@elsikora/nestjs-crud-automator 1.2.0 → 1.2.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/class/api/base-service.class.d.ts +5 -5
- package/dist/class/api/base-service.class.js +19 -10
- package/dist/class/api/base-service.class.js.map +1 -1
- package/dist/class/api/index.d.ts +0 -1
- package/dist/class/api/index.js +0 -1
- package/dist/class/api/index.js.map +1 -1
- package/dist/constant/decorator/api/controller.constant.d.ts +1 -1
- package/dist/constant/decorator/api/controller.constant.js +2 -2
- package/dist/constant/decorator/api/controller.constant.js.map +1 -1
- package/dist/constant/decorator/api/function.constant.d.ts +1 -1
- package/dist/constant/decorator/api/function.constant.js +2 -2
- package/dist/constant/decorator/api/function.constant.js.map +1 -1
- package/dist/constant/decorator/api/property-describe.constant.d.ts +1 -1
- package/dist/constant/decorator/api/property-describe.constant.js +2 -2
- package/dist/constant/decorator/api/property-describe.constant.js.map +1 -1
- package/dist/constant/factory/dto/get-list-query.constant.d.ts +1 -2
- package/dist/constant/factory/dto/get-list-query.constant.js +2 -2
- package/dist/constant/factory/dto/get-list-query.constant.js.map +1 -1
- package/dist/constant/interface/api/filter.constant.d.ts +1 -1
- package/dist/constant/interface/api/filter.constant.js +2 -2
- package/dist/constant/interface/api/filter.constant.js.map +1 -1
- package/dist/constant/interface/api/index.d.ts +1 -0
- package/dist/constant/interface/api/index.js +1 -0
- package/dist/constant/interface/api/index.js.map +1 -1
- package/dist/constant/interface/api/property/string.constant.d.ts +1 -1
- package/dist/constant/interface/api/property/string.constant.js +2 -2
- package/dist/constant/interface/api/property/string.constant.js.map +1 -1
- package/dist/constant/interface/api/property/wallet.constant.d.ts +1 -1
- package/dist/constant/interface/api/property/wallet.constant.js +2 -2
- package/dist/constant/interface/api/property/wallet.constant.js.map +1 -1
- package/dist/decorator/api/function/create/executor-properties.type.d.ts +8 -0
- package/dist/{type/decorator/api/property/describe-properties.type.js → decorator/api/function/create/executor-properties.type.js} +1 -1
- package/dist/decorator/api/function/create/executor-properties.type.js.map +1 -0
- package/dist/decorator/api/function/create/index.d.ts +1 -0
- package/dist/decorator/api/function/create/index.js +18 -0
- package/dist/decorator/api/function/create/index.js.map +1 -0
- package/dist/decorator/api/function/create.decorator.d.ts +2 -4
- package/dist/decorator/api/function/create.decorator.js +16 -14
- package/dist/decorator/api/function/create.decorator.js.map +1 -1
- package/dist/decorator/api/function/decorator.d.ts +4 -3
- package/dist/decorator/api/function/decorator.js +17 -14
- package/dist/decorator/api/function/decorator.js.map +1 -1
- package/dist/decorator/api/function/delete.decorator.d.ts +3 -3
- package/dist/decorator/api/function/delete.decorator.js +2 -2
- package/dist/decorator/api/function/delete.decorator.js.map +1 -1
- package/dist/decorator/api/function/get-list.decorator.d.ts +3 -3
- package/dist/decorator/api/function/get-list.decorator.js +4 -4
- package/dist/decorator/api/function/get-list.decorator.js.map +1 -1
- package/dist/decorator/api/function/get.decorator.d.ts +3 -3
- package/dist/decorator/api/function/get.decorator.js +3 -4
- package/dist/decorator/api/function/get.decorator.js.map +1 -1
- package/dist/decorator/api/function/index.d.ts +1 -0
- package/dist/decorator/api/function/index.js +1 -0
- package/dist/decorator/api/function/index.js.map +1 -1
- package/dist/decorator/api/function/update.decorator.d.ts +3 -3
- package/dist/decorator/api/function/update.decorator.js +6 -11
- package/dist/decorator/api/function/update.decorator.js.map +1 -1
- package/dist/decorator/api/property/describe.decorator.js +1 -1
- package/dist/decorator/api/property/describe.decorator.js.map +1 -1
- package/dist/decorator/api/property/string.decorator.js +4 -4
- package/dist/decorator/api/property/string.decorator.js.map +1 -1
- package/dist/decorator/api/property/wallet.decorator.js +3 -3
- package/dist/decorator/api/property/wallet.decorator.js.map +1 -1
- package/dist/decorator/api/route/decorator.js.map +1 -1
- package/dist/decorator/api/service.decorator.d.ts +4 -4
- package/dist/decorator/api/service.decorator.js +7 -32
- package/dist/decorator/api/service.decorator.js.map +1 -1
- package/dist/enum/decorator/api/dto-type.enum.d.ts +3 -3
- package/dist/enum/decorator/api/dto-type.enum.js +2 -2
- package/dist/enum/decorator/api/dto-type.enum.js.map +1 -1
- package/dist/factory/api/controller.factory.d.ts +1 -1
- package/dist/factory/api/controller.factory.js +15 -15
- package/dist/factory/api/controller.factory.js.map +1 -1
- package/dist/interface/decorator/api/controller-properties.interface.d.ts +1 -1
- package/dist/interface/decorator/api/controller-properties.interface.js.map +1 -1
- package/dist/interface/decorator/api/function/create-properties.interface.d.ts +4 -0
- package/dist/interface/decorator/api/function/create-properties.interface.js +3 -0
- package/dist/interface/decorator/api/function/create-properties.interface.js.map +1 -0
- package/dist/interface/decorator/api/property/base-properties.interface.d.ts +1 -1
- package/dist/interface/decorator/api/property/base-properties.interface.js.map +1 -1
- package/dist/interface/utility/get-entity-columns-properties.interface.d.ts +5 -0
- package/dist/interface/utility/get-entity-columns-properties.interface.js +3 -0
- package/dist/interface/utility/get-entity-columns-properties.interface.js.map +1 -0
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/dist/type/decorator/api/property/describe/array/index.d.ts +2 -0
- package/dist/type/decorator/api/property/describe/array/index.js +19 -0
- package/dist/type/decorator/api/property/describe/array/index.js.map +1 -0
- package/dist/type/decorator/api/property/describe/array/optional-properties.type.d.ts +3 -0
- package/dist/type/decorator/api/property/describe/array/optional-properties.type.js +3 -0
- package/dist/type/decorator/api/property/describe/array/optional-properties.type.js.map +1 -0
- package/dist/type/decorator/api/property/describe/array/required-properties.type.d.ts +6 -0
- package/dist/type/decorator/api/property/describe/array/required-properties.type.js +3 -0
- package/dist/type/decorator/api/property/describe/array/required-properties.type.js.map +1 -0
- package/dist/type/decorator/api/property/describe/base-properties.type.d.ts +7 -0
- package/dist/type/decorator/api/property/describe/base-properties.type.js +3 -0
- package/dist/type/decorator/api/property/describe/base-properties.type.js.map +1 -0
- package/dist/type/decorator/api/property/describe/boolean-properties.type.d.ts +7 -0
- package/dist/type/decorator/api/property/describe/boolean-properties.type.js +3 -0
- package/dist/type/decorator/api/property/describe/boolean-properties.type.js.map +1 -0
- package/dist/type/decorator/api/property/describe/date-properties.type.d.ts +7 -0
- package/dist/type/decorator/api/property/describe/date-properties.type.js +3 -0
- package/dist/type/decorator/api/property/describe/date-properties.type.js.map +1 -0
- package/dist/type/decorator/api/property/describe/dto/body-properties.type.d.ts +5 -0
- package/dist/type/decorator/api/property/describe/dto/body-properties.type.js +3 -0
- package/dist/type/decorator/api/property/describe/dto/body-properties.type.js.map +1 -0
- package/dist/type/decorator/api/property/describe/dto/index.d.ts +5 -0
- package/dist/type/decorator/api/property/describe/dto/index.js +22 -0
- package/dist/type/decorator/api/property/describe/dto/index.js.map +1 -0
- package/dist/type/decorator/api/property/describe/dto/properties.type.d.ts +6 -0
- package/dist/type/decorator/api/property/describe/dto/properties.type.js +3 -0
- package/dist/type/decorator/api/property/describe/dto/properties.type.js.map +1 -0
- package/dist/type/decorator/api/property/describe/dto/query/get-list-properties.type.d.ts +3 -0
- package/dist/type/decorator/api/property/describe/dto/query/get-list-properties.type.js +3 -0
- package/dist/type/decorator/api/property/describe/dto/query/get-list-properties.type.js.map +1 -0
- package/dist/type/decorator/api/property/describe/dto/query/index.d.ts +2 -0
- package/dist/type/decorator/api/property/describe/dto/query/index.js +19 -0
- package/dist/type/decorator/api/property/describe/dto/query/index.js.map +1 -0
- package/dist/type/decorator/api/property/describe/dto/query/properties.type.d.ts +6 -0
- package/dist/type/decorator/api/property/describe/dto/query/properties.type.js +3 -0
- package/dist/type/decorator/api/property/describe/dto/query/properties.type.js.map +1 -0
- package/dist/type/decorator/api/property/describe/dto/request-properties.type.d.ts +5 -0
- package/dist/type/decorator/api/property/describe/dto/request-properties.type.js +3 -0
- package/dist/type/decorator/api/property/describe/dto/request-properties.type.js.map +1 -0
- package/dist/type/decorator/api/property/describe/dto/response-properties.type.d.ts +5 -0
- package/dist/type/decorator/api/property/describe/dto/response-properties.type.js +3 -0
- package/dist/type/decorator/api/property/describe/dto/response-properties.type.js.map +1 -0
- package/dist/type/decorator/api/property/describe/example-properties.type.d.ts +7 -0
- package/dist/type/decorator/api/property/describe/example-properties.type.js +3 -0
- package/dist/type/decorator/api/property/describe/example-properties.type.js.map +1 -0
- package/dist/type/decorator/api/property/describe/index.d.ts +12 -0
- package/dist/type/decorator/api/property/describe/index.js +29 -0
- package/dist/type/decorator/api/property/describe/index.js.map +1 -0
- package/dist/type/decorator/api/property/describe/number-properties.type.d.ts +13 -0
- package/dist/type/decorator/api/property/describe/number-properties.type.js +3 -0
- package/dist/type/decorator/api/property/describe/number-properties.type.js.map +1 -0
- package/dist/type/decorator/api/property/describe/object-properties.type.d.ts +8 -0
- package/dist/type/decorator/api/property/describe/object-properties.type.js +3 -0
- package/dist/type/decorator/api/property/describe/object-properties.type.js.map +1 -0
- package/dist/type/decorator/api/property/describe/properties/base-dto-properties.type.d.ts +2 -0
- package/dist/type/decorator/api/property/describe/properties/base-dto-properties.type.js +3 -0
- package/dist/type/decorator/api/property/describe/properties/base-dto-properties.type.js.map +1 -0
- package/dist/type/decorator/api/property/describe/properties/base-properties.type.d.ts +10 -0
- package/dist/type/decorator/api/property/describe/properties/base-properties.type.js +3 -0
- package/dist/type/decorator/api/property/describe/properties/base-properties.type.js.map +1 -0
- package/dist/type/decorator/api/property/describe/properties/index.d.ts +2 -0
- package/dist/type/decorator/api/property/describe/properties/index.js +19 -0
- package/dist/type/decorator/api/property/describe/properties/index.js.map +1 -0
- package/dist/type/decorator/api/property/describe/properties.type.d.ts +7 -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/describe/string-properties.type.d.ts +13 -0
- package/dist/type/decorator/api/property/describe/string-properties.type.js +3 -0
- package/dist/type/decorator/api/property/describe/string-properties.type.js.map +1 -0
- package/dist/type/decorator/api/property/describe/uuid-properties.type.d.ts +7 -0
- package/dist/type/decorator/api/property/describe/uuid-properties.type.js +3 -0
- package/dist/type/decorator/api/property/describe/uuid-properties.type.js.map +1 -0
- package/dist/type/decorator/api/property/index.d.ts +1 -1
- package/dist/type/decorator/api/property/index.js +1 -1
- package/dist/type/decorator/api/property/index.js.map +1 -1
- package/dist/utility/api/controller/get-method-name.utility.d.ts +1 -1
- package/dist/utility/api/controller/get-method-name.utility.js +1 -1
- package/dist/utility/api/controller/get-method-name.utility.js.map +1 -1
- package/dist/utility/api/controller/write-method.utility.d.ts +1 -1
- package/dist/utility/api/controller/write-method.utility.js.map +1 -1
- package/dist/utility/api/filter-order-by-from-entity.utility.d.ts +4 -2
- package/dist/utility/api/filter-order-by-from-entity.utility.js +17 -13
- package/dist/utility/api/filter-order-by-from-entity.utility.js.map +1 -1
- package/dist/utility/dto/generate.utility.d.ts +1 -1
- package/dist/utility/dto/generate.utility.js +96 -90
- package/dist/utility/dto/generate.utility.js.map +1 -1
- package/dist/utility/get-entity-columns.utility.d.ts +3 -2
- package/dist/utility/get-entity-columns.utility.js +4 -3
- package/dist/utility/get-entity-columns.utility.js.map +1 -1
- package/package.json +1 -1
- package/dist/class/api/base-controller.class.d.ts +0 -4
- package/dist/class/api/base-controller.class.js +0 -10
- package/dist/class/api/base-controller.class.js.map +0 -1
- package/dist/type/decorator/api/property/describe-properties.type.d.ts +0 -64
- package/dist/type/decorator/api/property/describe-properties.type.js.map +0 -1
|
@@ -2,9 +2,9 @@ import type { IApiGetListResponseResult } from "../../interface";
|
|
|
2
2
|
import type { TApiFunctionCreateProperties, TApiFunctionGetListProperties, TApiFunctionGetProperties, TApiFunctionUpdateProperties } from "../../type";
|
|
3
3
|
import type { FindOptionsRelations } from "typeorm";
|
|
4
4
|
export declare class BaseApiService<E> {
|
|
5
|
-
create(
|
|
6
|
-
delete(
|
|
7
|
-
get(
|
|
8
|
-
getList(
|
|
9
|
-
update(
|
|
5
|
+
create(properties: TApiFunctionCreateProperties<E>): Promise<E>;
|
|
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>;
|
|
10
10
|
}
|
|
@@ -2,20 +2,29 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.BaseApiService = void 0;
|
|
4
4
|
class BaseApiService {
|
|
5
|
-
create(
|
|
6
|
-
|
|
5
|
+
create(properties) {
|
|
6
|
+
void properties;
|
|
7
|
+
return Promise.resolve({});
|
|
7
8
|
}
|
|
8
|
-
delete(
|
|
9
|
-
|
|
9
|
+
delete(id) {
|
|
10
|
+
void id;
|
|
11
|
+
return Promise.resolve();
|
|
10
12
|
}
|
|
11
|
-
get(
|
|
12
|
-
|
|
13
|
+
get(id, properties, relations) {
|
|
14
|
+
void id;
|
|
15
|
+
void properties;
|
|
16
|
+
void relations;
|
|
17
|
+
return Promise.resolve({});
|
|
13
18
|
}
|
|
14
|
-
getList(
|
|
15
|
-
|
|
19
|
+
getList(properties, relations) {
|
|
20
|
+
void properties;
|
|
21
|
+
void relations;
|
|
22
|
+
return Promise.resolve({ items: [], total: 0 });
|
|
16
23
|
}
|
|
17
|
-
update(
|
|
18
|
-
|
|
24
|
+
update(id, properties) {
|
|
25
|
+
void id;
|
|
26
|
+
void properties;
|
|
27
|
+
return Promise.resolve({});
|
|
19
28
|
}
|
|
20
29
|
}
|
|
21
30
|
exports.BaseApiService = BaseApiService;
|
|
@@ -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":";;;AAIA,MAAa,cAAc;IAC1B,MAAM,CAAC,UAA2C;QACjD,KAAK,UAAU,CAAC;QAEhB,OAAO,OAAO,CAAC,OAAO,CAAC,EAAO,CAAC,CAAC;IACjC,CAAC;IAED,MAAM,CAAC,EAAU;QAChB,KAAK,EAAE,CAAC;QAER,OAAO,OAAO,CAAC,OAAO,EAAE,CAAC;IAC1B,CAAC;IAED,GAAG,CAAC,EAAU,EAAE,UAAyC,EAAE,SAAmC;QAC7F,KAAK,EAAE,CAAC;QACR,KAAK,UAAU,CAAC;QAChB,KAAK,SAAS,CAAC;QAEf,OAAO,OAAO,CAAC,OAAO,CAAC,EAAO,CAAC,CAAC;IACjC,CAAC;IAED,OAAO,CAAC,UAA4C,EAAE,SAAmC;QACxF,KAAK,UAAU,CAAC;QAChB,KAAK,SAAS,CAAC;QAEf,OAAO,OAAO,CAAC,OAAO,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,KAAK,EAAE,CAAC,EAA6C,CAAC,CAAC;IAC5F,CAAC;IAED,MAAM,CAAC,EAAU,EAAE,UAA2C;QAC7D,KAAK,EAAE,CAAC;QACR,KAAK,UAAU,CAAC;QAEhB,OAAO,OAAO,CAAC,OAAO,CAAC,EAAO,CAAC,CAAC;IACjC,CAAC;CACD;AAlCD,wCAkCC","sourcesContent":["import type { IApiGetListResponseResult } from \"../../interface\";\nimport type { TApiFunctionCreateProperties, TApiFunctionGetListProperties, TApiFunctionGetProperties, TApiFunctionUpdateProperties } from \"../../type\";\nimport type { FindOptionsRelations } from \"typeorm\";\n\nexport class BaseApiService<E> {\n\tcreate(properties: TApiFunctionCreateProperties<E>): Promise<E> {\n\t\tvoid properties;\n\n\t\treturn Promise.resolve({} as E);\n\t}\n\n\tdelete(id: string): Promise<void> {\n\t\tvoid id;\n\n\t\treturn Promise.resolve();\n\t}\n\n\tget(id: string, properties?: TApiFunctionGetProperties<E>, relations?: FindOptionsRelations<E>): Promise<E> {\n\t\tvoid id;\n\t\tvoid properties;\n\t\tvoid relations;\n\n\t\treturn Promise.resolve({} as E);\n\t}\n\n\tgetList(properties: TApiFunctionGetListProperties<E>, relations?: FindOptionsRelations<E>): Promise<IApiGetListResponseResult<E>> {\n\t\tvoid properties;\n\t\tvoid relations;\n\n\t\treturn Promise.resolve({ items: [], total: 0 } as unknown as IApiGetListResponseResult<E>);\n\t}\n\n\tupdate(id: string, properties: TApiFunctionUpdateProperties<E>): Promise<E> {\n\t\tvoid id;\n\t\tvoid properties;\n\n\t\treturn Promise.resolve({} as E);\n\t}\n}\n"]}
|
package/dist/class/api/index.js
CHANGED
|
@@ -15,5 +15,4 @@ 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);
|
|
19
18
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"/","sources":["class/api/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,uDAAqC
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"/","sources":["class/api/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,uDAAqC","sourcesContent":["export * from \"./base-service.class\";\n"]}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.CONTROLLER_API_DECORATOR_CONSTANT = void 0;
|
|
4
4
|
const RESERVED_METHOD_PREFIX = "apiController";
|
|
5
|
-
exports.
|
|
5
|
+
exports.CONTROLLER_API_DECORATOR_CONSTANT = {
|
|
6
6
|
RESERVED_METHOD_PREFIX,
|
|
7
7
|
};
|
|
8
8
|
//# sourceMappingURL=controller.constant.js.map
|
|
@@ -1 +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
|
|
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 CONTROLLER_API_DECORATOR_CONSTANT: {\n\treadonly RESERVED_METHOD_PREFIX: string;\n} = {\n\tRESERVED_METHOD_PREFIX,\n} as const;\n"]}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.FUNCTION_API_DECORATOR_CONSTANT = void 0;
|
|
4
4
|
const enum_1 = require("../../../enum");
|
|
5
5
|
const DEFAULT_FILTER_ORDER_BY_DIRECTION = enum_1.EFilterOrderDirection.ASC;
|
|
6
|
-
exports.
|
|
6
|
+
exports.FUNCTION_API_DECORATOR_CONSTANT = {
|
|
7
7
|
DEFAULT_FILTER_ORDER_BY_DIRECTION,
|
|
8
8
|
};
|
|
9
9
|
//# sourceMappingURL=function.constant.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"function.constant.js","sourceRoot":"/","sources":["constant/decorator/api/function.constant.ts"],"names":[],"mappings":";;;AAAA,wCAAsD;AAEtD,MAAM,iCAAiC,GAA0B,4BAAqB,CAAC,GAAG,CAAC;AAE9E,QAAA,+BAA+B,GAExC;IACH,iCAAiC;CACxB,CAAC","sourcesContent":["import { EFilterOrderDirection } from \"../../../enum\";\n\nconst DEFAULT_FILTER_ORDER_BY_DIRECTION: EFilterOrderDirection = EFilterOrderDirection.ASC;\n\nexport const
|
|
1
|
+
{"version":3,"file":"function.constant.js","sourceRoot":"/","sources":["constant/decorator/api/function.constant.ts"],"names":[],"mappings":";;;AAAA,wCAAsD;AAEtD,MAAM,iCAAiC,GAA0B,4BAAqB,CAAC,GAAG,CAAC;AAE9E,QAAA,+BAA+B,GAExC;IACH,iCAAiC;CACxB,CAAC","sourcesContent":["import { EFilterOrderDirection } from \"../../../enum\";\n\nconst DEFAULT_FILTER_ORDER_BY_DIRECTION: EFilterOrderDirection = EFilterOrderDirection.ASC;\n\nexport const FUNCTION_API_DECORATOR_CONSTANT: {\n\treadonly DEFAULT_FILTER_ORDER_BY_DIRECTION: EFilterOrderDirection;\n} = {\n\tDEFAULT_FILTER_ORDER_BY_DIRECTION,\n} as const;\n"]}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.PROPERTY_DESCRIBE_DECORATOR_API_CONSTANT = void 0;
|
|
4
4
|
const METADATA_PROPERTY_NAME = "API_PROPERTY_DESCRIBE";
|
|
5
|
-
exports.
|
|
5
|
+
exports.PROPERTY_DESCRIBE_DECORATOR_API_CONSTANT = {
|
|
6
6
|
METADATA_PROPERTY_NAME,
|
|
7
7
|
};
|
|
8
8
|
//# sourceMappingURL=property-describe.constant.js.map
|
|
@@ -1 +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
|
|
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 PROPERTY_DESCRIBE_DECORATOR_API_CONSTANT: {\n\treadonly METADATA_PROPERTY_NAME: string;\n} = {\n\tMETADATA_PROPERTY_NAME,\n} as const;\n"]}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
declare const
|
|
1
|
+
export declare const GET_LIST_QUERY_DTO_FACTORY_CONSTANT: {
|
|
2
2
|
readonly MAXIMUM_LIST_LENGTH: number;
|
|
3
3
|
readonly MAXIMUM_LIST_PAGES_COUNT: number;
|
|
4
4
|
readonly MINIMUM_LIST_LENGTH: number;
|
|
5
5
|
readonly MINIMUM_LIST_PAGES_COUNT: number;
|
|
6
6
|
};
|
|
7
|
-
export default GET_LIST_QUERY_DTO_FACTOR_CONSTANT;
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GET_LIST_QUERY_DTO_FACTORY_CONSTANT = void 0;
|
|
3
4
|
const MINIMUM_LIST_LENGTH = 1;
|
|
4
5
|
const MAXIMUM_LIST_LENGTH = 100;
|
|
5
6
|
const MINIMUM_LIST_PAGES_COUNT = 1;
|
|
6
7
|
const MAXIMUM_LIST_PAGES_COUNT = 100;
|
|
7
|
-
|
|
8
|
+
exports.GET_LIST_QUERY_DTO_FACTORY_CONSTANT = {
|
|
8
9
|
MAXIMUM_LIST_LENGTH,
|
|
9
10
|
MAXIMUM_LIST_PAGES_COUNT,
|
|
10
11
|
MINIMUM_LIST_LENGTH,
|
|
11
12
|
MINIMUM_LIST_PAGES_COUNT,
|
|
12
13
|
};
|
|
13
|
-
exports.default = GET_LIST_QUERY_DTO_FACTOR_CONSTANT;
|
|
14
14
|
//# sourceMappingURL=get-list-query.constant.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-list-query.constant.js","sourceRoot":"/","sources":["constant/factory/dto/get-list-query.constant.ts"],"names":[],"mappings":"
|
|
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;AAEhC,QAAA,mCAAmC,GAK5C;IACH,mBAAmB;IACnB,wBAAwB;IACxB,mBAAmB;IACnB,wBAAwB;CACf,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\nexport const GET_LIST_QUERY_DTO_FACTORY_CONSTANT: {\n\treadonly MAXIMUM_LIST_LENGTH: number;\n\treadonly MAXIMUM_LIST_PAGES_COUNT: number;\n\treadonly MINIMUM_LIST_LENGTH: number;\n\treadonly MINIMUM_LIST_PAGES_COUNT: number;\n} = {\n\tMAXIMUM_LIST_LENGTH,\n\tMAXIMUM_LIST_PAGES_COUNT,\n\tMINIMUM_LIST_LENGTH,\n\tMINIMUM_LIST_PAGES_COUNT,\n} as const;\n"]}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.FILTER_API_INTERFACE_CONSTANT = void 0;
|
|
4
4
|
const ALLOWED_ENTITY_TO_FILTER_COLUMNS = ["string", "text", "varchar", "char", "number", "int", "integer", "tinyint", "smallint", "mediumint", "bigint", "float", "double", "decimal", "date", "datetime", "timestamp"];
|
|
5
|
-
exports.
|
|
5
|
+
exports.FILTER_API_INTERFACE_CONSTANT = {
|
|
6
6
|
ALLOWED_ENTITY_TO_FILTER_COLUMNS,
|
|
7
7
|
};
|
|
8
8
|
//# sourceMappingURL=filter.constant.js.map
|
|
@@ -1 +1 @@
|
|
|
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
|
|
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 FILTER_API_INTERFACE_CONSTANT: {\n\treadonly ALLOWED_ENTITY_TO_FILTER_COLUMNS: Array<string>;\n} = {\n\tALLOWED_ENTITY_TO_FILTER_COLUMNS,\n} as const;\n"]}
|
|
@@ -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("./property"), exports);
|
|
18
|
+
__exportStar(require("./filter.constant"), exports);
|
|
18
19
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"/","sources":["constant/interface/api/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,6CAA2B","sourcesContent":["export * from \"./property\";\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"/","sources":["constant/interface/api/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,6CAA2B;AAC3B,oDAAkC","sourcesContent":["export * from \"./property\";\nexport * from \"./filter.constant\";\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { IsIpVersion } from "class-validator/types/decorator/string/IsIP";
|
|
2
|
-
export declare const
|
|
2
|
+
export declare const STRING_PROPERTY_API_INTERFACE_CONSTANT: {
|
|
3
3
|
readonly IP_VERSION: IsIpVersion;
|
|
4
4
|
readonly REGEX_FLAGS_INDEX: number;
|
|
5
5
|
readonly REGEX_PATTERN_INDEX: number;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.STRING_PROPERTY_API_INTERFACE_CONSTANT = void 0;
|
|
4
4
|
const REGEX_PATTERN_INDEX = 1;
|
|
5
5
|
const REGEX_FLAGS_INDEX = 2;
|
|
6
6
|
const IP_VERSION = 4;
|
|
7
|
-
exports.
|
|
7
|
+
exports.STRING_PROPERTY_API_INTERFACE_CONSTANT = {
|
|
8
8
|
IP_VERSION,
|
|
9
9
|
REGEX_FLAGS_INDEX,
|
|
10
10
|
REGEX_PATTERN_INDEX,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"string.constant.js","sourceRoot":"/","sources":["constant/interface/api/property/string.constant.ts"],"names":[],"mappings":";;;AAEA,MAAM,mBAAmB,GAAW,CAAC,CAAC;AACtC,MAAM,iBAAiB,GAAW,CAAC,CAAC;AACpC,MAAM,UAAU,GAAgB,CAAC,CAAC;AAErB,QAAA,sCAAsC,GAI/C;IACH,UAAU;IACV,iBAAiB;IACjB,mBAAmB;CACV,CAAC","sourcesContent":["import type { IsIpVersion } from \"class-validator/types/decorator/string/IsIP\";\n\nconst REGEX_PATTERN_INDEX: number = 1;\nconst REGEX_FLAGS_INDEX: number = 2;\nconst IP_VERSION: IsIpVersion = 4;\n\nexport const
|
|
1
|
+
{"version":3,"file":"string.constant.js","sourceRoot":"/","sources":["constant/interface/api/property/string.constant.ts"],"names":[],"mappings":";;;AAEA,MAAM,mBAAmB,GAAW,CAAC,CAAC;AACtC,MAAM,iBAAiB,GAAW,CAAC,CAAC;AACpC,MAAM,UAAU,GAAgB,CAAC,CAAC;AAErB,QAAA,sCAAsC,GAI/C;IACH,UAAU;IACV,iBAAiB;IACjB,mBAAmB;CACV,CAAC","sourcesContent":["import type { IsIpVersion } from \"class-validator/types/decorator/string/IsIP\";\n\nconst REGEX_PATTERN_INDEX: number = 1;\nconst REGEX_FLAGS_INDEX: number = 2;\nconst IP_VERSION: IsIpVersion = 4;\n\nexport const STRING_PROPERTY_API_INTERFACE_CONSTANT: {\n\treadonly IP_VERSION: IsIpVersion;\n\treadonly REGEX_FLAGS_INDEX: number;\n\treadonly REGEX_PATTERN_INDEX: number;\n} = {\n\tIP_VERSION,\n\tREGEX_FLAGS_INDEX,\n\tREGEX_PATTERN_INDEX,\n} as const;\n"]}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.WALLET_PROPERTY_API_INTERFACE_CONSTANT = void 0;
|
|
4
4
|
const MINIMUM = 10_000_000_000;
|
|
5
5
|
const MAXIMUM = 999_999_999_999;
|
|
6
6
|
const EXAMPLE = 18_143_008_867;
|
|
7
|
-
exports.
|
|
7
|
+
exports.WALLET_PROPERTY_API_INTERFACE_CONSTANT = {
|
|
8
8
|
EXAMPLE,
|
|
9
9
|
MAXIMUM,
|
|
10
10
|
MINIMUM,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wallet.constant.js","sourceRoot":"/","sources":["constant/interface/api/property/wallet.constant.ts"],"names":[],"mappings":";;;AAAA,MAAM,OAAO,GAAW,cAAc,CAAC;AACvC,MAAM,OAAO,GAAW,eAAe,CAAC;AACxC,MAAM,OAAO,GAAW,cAAc,CAAC;AAE1B,QAAA,sCAAsC,GAI/C;IACH,OAAO;IACP,OAAO;IACP,OAAO;CACE,CAAC","sourcesContent":["const MINIMUM: number = 10_000_000_000;\nconst MAXIMUM: number = 999_999_999_999;\nconst EXAMPLE: number = 18_143_008_867;\n\nexport const
|
|
1
|
+
{"version":3,"file":"wallet.constant.js","sourceRoot":"/","sources":["constant/interface/api/property/wallet.constant.ts"],"names":[],"mappings":";;;AAAA,MAAM,OAAO,GAAW,cAAc,CAAC;AACvC,MAAM,OAAO,GAAW,eAAe,CAAC;AACxC,MAAM,OAAO,GAAW,cAAc,CAAC;AAE1B,QAAA,sCAAsC,GAI/C;IACH,OAAO;IACP,OAAO;IACP,OAAO;CACE,CAAC","sourcesContent":["const MINIMUM: number = 10_000_000_000;\nconst MAXIMUM: number = 999_999_999_999;\nconst EXAMPLE: number = 18_143_008_867;\n\nexport const WALLET_PROPERTY_API_INTERFACE_CONSTANT: {\n\treadonly EXAMPLE: number;\n\treadonly MAXIMUM: number;\n\treadonly MINIMUM: number;\n} = {\n\tEXAMPLE,\n\tMAXIMUM,\n\tMINIMUM,\n} as const;\n"]}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { IApiBaseEntity } from "../../../../interface";
|
|
2
|
+
import type { TApiFunctionCreateProperties } from "../../../../type";
|
|
3
|
+
import type { Repository } from "typeorm";
|
|
4
|
+
export interface IApiFunctionCreateExecutorProperties<E extends IApiBaseEntity> {
|
|
5
|
+
entity: IApiBaseEntity;
|
|
6
|
+
properties: TApiFunctionCreateProperties<E>;
|
|
7
|
+
repository: Repository<E>;
|
|
8
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"executor-properties.type.js","sourceRoot":"/","sources":["decorator/api/function/create/executor-properties.type.ts"],"names":[],"mappings":"","sourcesContent":["import type { IApiBaseEntity } from \"../../../../interface\";\n\nimport type { TApiFunctionCreateProperties } from \"../../../../type\";\nimport type { Repository } from \"typeorm\";\n\nexport interface IApiFunctionCreateExecutorProperties<E extends IApiBaseEntity> {\n\tentity: IApiBaseEntity;\n\tproperties: TApiFunctionCreateProperties<E>;\n\trepository: Repository<E>;\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./executor-properties.type";
|
|
@@ -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("./executor-properties.type"), exports);
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"/","sources":["decorator/api/function/create/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,6DAA2C","sourcesContent":["export * from \"./executor-properties.type\";\n"]}
|
|
@@ -1,4 +1,2 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
export declare function ApiFunctionCreate
|
|
3
|
-
model: new () => E;
|
|
4
|
-
}): (_target: any, _propertyKey: string, descriptor: PropertyDescriptor) => PropertyDescriptor;
|
|
1
|
+
import type { IApiFunctionCreateProperties } from "../../../interface/decorator/api/function/create-properties.interface";
|
|
2
|
+
export declare function ApiFunctionCreate(properties: IApiFunctionCreateProperties): (target: unknown, propertyKey: string, descriptor: PropertyDescriptor) => PropertyDescriptor;
|
|
@@ -4,39 +4,41 @@ exports.ApiFunctionCreate = ApiFunctionCreate;
|
|
|
4
4
|
const common_1 = require("@nestjs/common");
|
|
5
5
|
const enum_1 = require("../../../enum");
|
|
6
6
|
const utility_1 = require("../../../utility");
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
async function executor(options) {
|
|
8
|
+
const { entity, properties, repository } = options;
|
|
9
9
|
try {
|
|
10
|
-
const allColumns = (0,
|
|
11
|
-
const autoGeneratedColumns = (0,
|
|
12
|
-
const filteredProperties =
|
|
10
|
+
const allColumns = (0, utility_1.GetEntityColumns)({ entity });
|
|
11
|
+
const autoGeneratedColumns = (0, utility_1.GetEntityColumns)({ entity, shouldTakeGeneratedOnly: true });
|
|
12
|
+
const filteredProperties = {};
|
|
13
|
+
for (const key of Object.keys(properties)) {
|
|
13
14
|
if (allColumns.includes(key) && !autoGeneratedColumns.includes(key)) {
|
|
14
|
-
|
|
15
|
+
filteredProperties[key] = properties[key];
|
|
15
16
|
}
|
|
16
|
-
|
|
17
|
-
}, {});
|
|
17
|
+
}
|
|
18
18
|
const newEntity = repository.create(filteredProperties);
|
|
19
19
|
return await repository.save(newEntity);
|
|
20
20
|
}
|
|
21
21
|
catch (error) {
|
|
22
|
-
console.log(error);
|
|
23
22
|
if (error instanceof common_1.HttpException) {
|
|
24
23
|
throw error;
|
|
25
24
|
}
|
|
26
25
|
throw new common_1.InternalServerErrorException((0, utility_1.ErrorString)({
|
|
27
|
-
entity:
|
|
26
|
+
entity: entity,
|
|
28
27
|
type: enum_1.EErrorStringAction.CREATING_ERROR,
|
|
29
28
|
}));
|
|
30
29
|
}
|
|
31
30
|
}
|
|
32
|
-
function ApiFunctionCreate(
|
|
33
|
-
|
|
31
|
+
function ApiFunctionCreate(properties) {
|
|
32
|
+
const { entity } = properties;
|
|
33
|
+
return function (target, propertyKey, descriptor) {
|
|
34
|
+
void target;
|
|
35
|
+
void propertyKey;
|
|
34
36
|
descriptor.value = async function (properties) {
|
|
35
37
|
const repository = this.repository;
|
|
36
38
|
if (!repository) {
|
|
37
|
-
throw
|
|
39
|
+
throw (0, utility_1.ErrorException)("Repository is not available in this context");
|
|
38
40
|
}
|
|
39
|
-
return executor(
|
|
41
|
+
return executor({ entity, properties, repository });
|
|
40
42
|
};
|
|
41
43
|
return descriptor;
|
|
42
44
|
};
|
|
@@ -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":";;AA6CA,8CAwBC;AArED,2CAA6E;AAE7E,wCAAmD;AAEnD,8CAAiF;AASjF,KAAK,UAAU,QAAQ,CAA2B,OAAgD;IACjG,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,UAAU,EAAE,GAA4C,OAAO,CAAC;IAE5F,IAAI,CAAC;QACJ,MAAM,UAAU,GAAmB,IAAA,0BAAgB,EAAC,EAAE,MAAM,EAAE,CAAC,CAAC;QAChE,MAAM,oBAAoB,GAAmB,IAAA,0BAAgB,EAAC,EAAE,MAAM,EAAE,uBAAuB,EAAE,IAAI,EAAE,CAAC,CAAC;QAEzG,MAAM,kBAAkB,GAAmB,EAAoB,CAAC;QAEhE,KAAK,MAAM,GAAG,IAAI,MAAM,CAAC,IAAI,CAAC,UAAU,CAAiD,EAAE,CAAC;YAC3F,IAAI,UAAU,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,oBAAoB,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;gBACpE,kBAA+C,CAAC,GAAG,CAAC,GAAG,UAAU,CAAC,GAAG,CAAC,CAAC;YACzE,CAAC;QACF,CAAC;QAED,MAAM,SAAS,GAAM,UAAU,CAAC,MAAM,CAAC,kBAAkB,CAAC,CAAC;QAE3D,OAAO,MAAM,UAAU,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IACzC,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QAChB,IAAI,KAAK,YAAY,sBAAa,EAAE,CAAC;YACpC,MAAM,KAAK,CAAC;QACb,CAAC;QAED,MAAM,IAAI,qCAA4B,CACrC,IAAA,qBAAW,EAAC;YACX,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,yBAAkB,CAAC,cAAc;SACvC,CAAC,CACF,CAAC;IACH,CAAC;AACF,CAAC;AAED,SAAgB,iBAAiB,CAAC,UAAwC;IACzE,MAAM,EAAE,MAAM,EAAE,GAAiC,UAAU,CAAC;IAE5D,OAAO,UAAU,MAAe,EAAE,WAAmB,EAAE,UAA8B;QACpF,KAAK,MAAM,CAAC;QACZ,KAAK,WAAW,CAAC;QAEjB,UAAU,CAAC,KAAK,GAAG,KAAK,WAIvB,UAAuD;YAEvD,MAAM,UAAU,GAA8B,IAAI,CAAC,UAAU,CAAC;YAE9D,IAAI,CAAC,UAAU,EAAE,CAAC;gBACjB,MAAM,IAAA,wBAAc,EAAC,6CAA6C,CAAC,CAAC;YACrE,CAAC;YAED,OAAO,QAAQ,CAAC,EAAE,MAAM,EAAE,UAAU,EAAE,UAAU,EAAE,CAAC,CAAC;QACrD,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 { ErrorException, ErrorString, GetEntityColumns } from \"../../../utility\";\n\nimport type { IApiFunctionCreateExecutorProperties } from \"./create\";\nimport type { IApiBaseEntity } from \"../../../interface\";\nimport type { IApiFunctionCreateProperties } from \"../../../interface/decorator/api/function/create-properties.interface\";\nimport type { TApiFunctionCreateProperties } from \"../../../type\";\n\nimport type { DeepPartial, Repository } from \"typeorm\";\n\nasync function executor<E extends IApiBaseEntity>(options: IApiFunctionCreateExecutorProperties<E>): Promise<E> {\n\tconst { entity, properties, repository }: IApiFunctionCreateExecutorProperties<E> = options;\n\n\ttry {\n\t\tconst allColumns: Array<keyof E> = GetEntityColumns({ entity });\n\t\tconst autoGeneratedColumns: Array<keyof E> = GetEntityColumns({ entity, shouldTakeGeneratedOnly: true });\n\n\t\tconst filteredProperties: DeepPartial<E> = {} as DeepPartial<E>;\n\n\t\tfor (const key of Object.keys(properties) as Array<keyof TApiFunctionCreateProperties<E>>) {\n\t\t\tif (allColumns.includes(key) && !autoGeneratedColumns.includes(key)) {\n\t\t\t\t(filteredProperties as Record<keyof E, unknown>)[key] = properties[key];\n\t\t\t}\n\t\t}\n\n\t\tconst newEntity: E = repository.create(filteredProperties);\n\n\t\treturn await repository.save(newEntity);\n\t} catch (error) {\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: entity,\n\t\t\t\ttype: EErrorStringAction.CREATING_ERROR,\n\t\t\t}),\n\t\t);\n\t}\n}\n\nexport function ApiFunctionCreate(properties: IApiFunctionCreateProperties) {\n\tconst { entity }: IApiFunctionCreateProperties = properties;\n\n\treturn function (target: unknown, propertyKey: string, descriptor: PropertyDescriptor): PropertyDescriptor {\n\t\tvoid target;\n\t\tvoid propertyKey;\n\n\t\tdescriptor.value = async function (\n\t\t\tthis: {\n\t\t\t\trepository: Repository<typeof entity>;\n\t\t\t},\n\t\t\tproperties: TApiFunctionCreateProperties<typeof entity>,\n\t\t): Promise<IApiBaseEntity> {\n\t\t\tconst repository: Repository<typeof entity> = this.repository;\n\n\t\t\tif (!repository) {\n\t\t\t\tthrow ErrorException(\"Repository is not available in this context\");\n\t\t\t}\n\n\t\t\treturn executor({ entity, properties, repository });\n\t\t};\n\n\t\treturn descriptor;\n\t};\n}\n"]}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { EApiFunctionType } from "../../../enum";
|
|
2
|
-
import type {
|
|
3
|
-
|
|
2
|
+
import type { IApiBaseEntity } from "../../../interface";
|
|
3
|
+
import type { FindOptionsRelations } from "typeorm";
|
|
4
|
+
export declare function ApiFunction<E extends IApiBaseEntity, R>(options: {
|
|
4
5
|
model: new () => E;
|
|
5
6
|
relations?: FindOptionsRelations<E>;
|
|
6
7
|
type: EApiFunctionType;
|
|
7
|
-
}): (_target:
|
|
8
|
+
}): (_target: unknown, propertyKey: string, descriptor: PropertyDescriptor) => PropertyDescriptor;
|
|
@@ -2,42 +2,45 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ApiFunction = ApiFunction;
|
|
4
4
|
const enum_1 = require("../../../enum");
|
|
5
|
+
const utility_1 = require("../../../utility");
|
|
5
6
|
const create_decorator_1 = require("./create.decorator");
|
|
6
7
|
const delete_decorator_1 = require("./delete.decorator");
|
|
7
8
|
const get_list_decorator_1 = require("./get-list.decorator");
|
|
8
9
|
const get_decorator_1 = require("./get.decorator");
|
|
9
10
|
const update_decorator_1 = require("./update.decorator");
|
|
10
11
|
function ApiFunction(options) {
|
|
11
|
-
return function (_target,
|
|
12
|
+
return function (_target, propertyKey, descriptor) {
|
|
12
13
|
const originalMethod = descriptor.value;
|
|
13
14
|
descriptor.value = function (...arguments_) {
|
|
15
|
+
let decoratorFunction;
|
|
14
16
|
switch (options.type) {
|
|
15
17
|
case enum_1.EApiFunctionType.GET_LIST: {
|
|
16
|
-
|
|
18
|
+
decoratorFunction = (0, get_list_decorator_1.ApiFunctionGetList)({ model: options.model });
|
|
19
|
+
break;
|
|
17
20
|
}
|
|
18
21
|
case enum_1.EApiFunctionType.GET: {
|
|
19
|
-
|
|
22
|
+
decoratorFunction = (0, get_decorator_1.ApiFunctionGet)({ model: options.model });
|
|
23
|
+
break;
|
|
20
24
|
}
|
|
21
25
|
case enum_1.EApiFunctionType.CREATE: {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
}).value.apply(this, arguments_);
|
|
26
|
+
decoratorFunction = (0, create_decorator_1.ApiFunctionCreate)({ entity: options.model });
|
|
27
|
+
break;
|
|
25
28
|
}
|
|
26
29
|
case enum_1.EApiFunctionType.UPDATE: {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
}).value.apply(this, arguments_);
|
|
30
|
+
decoratorFunction = (0, update_decorator_1.ApiFunctionUpdate)({ model: options.model });
|
|
31
|
+
break;
|
|
30
32
|
}
|
|
31
33
|
case enum_1.EApiFunctionType.DELETE: {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
}).value.apply(this, arguments_);
|
|
34
|
+
decoratorFunction = (0, delete_decorator_1.ApiFunctionDelete)({ model: options.model });
|
|
35
|
+
break;
|
|
35
36
|
}
|
|
36
37
|
default: {
|
|
37
|
-
throw
|
|
38
|
+
throw (0, utility_1.ErrorException)("Unsupported function");
|
|
38
39
|
}
|
|
39
40
|
}
|
|
40
|
-
|
|
41
|
+
const modifiedDescriptor = decoratorFunction(this, propertyKey, { value: originalMethod });
|
|
42
|
+
const modifiedMethod = modifiedDescriptor.value;
|
|
43
|
+
return modifiedMethod.apply(this, arguments_);
|
|
41
44
|
};
|
|
42
45
|
return descriptor;
|
|
43
46
|
};
|
|
@@ -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":";;AAeA,kCAqDC;AApED,wCAAiD;AAEjD,8CAAkD;AAElD,yDAAuD;AACvD,yDAAuD;AACvD,6DAA0D;AAC1D,mDAAiD;AACjD,yDAAuD;AAOvD,SAAgB,WAAW,CAA8B,OAA4F;IAEpJ,OAAO,UAAU,OAAgB,EAAE,WAAmB,EAAE,UAA8B;QACrF,MAAM,cAAc,GAAY,UAAU,CAAC,KAAK,CAAC;QAGjD,UAAU,CAAC,KAAK,GAAG,UAA+C,GAAG,UAAsB;YAC1F,IAAI,iBAAqC,CAAC;YAE1C,QAAQ,OAAO,CAAC,IAAI,EAAE,CAAC;gBACtB,KAAK,uBAAgB,CAAC,QAAQ,CAAC,CAAC,CAAC;oBAChC,iBAAiB,GAAG,IAAA,uCAAkB,EAAC,EAAE,KAAK,EAAE,OAAO,CAAC,KAAK,EAAE,CAAC,CAAC;oBAEjE,MAAM;gBACP,CAAC;gBAED,KAAK,uBAAgB,CAAC,GAAG,CAAC,CAAC,CAAC;oBAC3B,iBAAiB,GAAG,IAAA,8BAAc,EAAC,EAAE,KAAK,EAAE,OAAO,CAAC,KAAK,EAAE,CAAC,CAAC;oBAE7D,MAAM;gBACP,CAAC;gBAED,KAAK,uBAAgB,CAAC,MAAM,CAAC,CAAC,CAAC;oBAC9B,iBAAiB,GAAG,IAAA,oCAAiB,EAAC,EAAE,MAAM,EAAE,OAAO,CAAC,KAAK,EAAE,CAAC,CAAC;oBAEjE,MAAM;gBACP,CAAC;gBAED,KAAK,uBAAgB,CAAC,MAAM,CAAC,CAAC,CAAC;oBAC9B,iBAAiB,GAAG,IAAA,oCAAiB,EAAC,EAAE,KAAK,EAAE,OAAO,CAAC,KAAK,EAAE,CAAC,CAAC;oBAEhE,MAAM;gBACP,CAAC;gBAED,KAAK,uBAAgB,CAAC,MAAM,CAAC,CAAC,CAAC;oBAC9B,iBAAiB,GAAG,IAAA,oCAAiB,EAAC,EAAE,KAAK,EAAE,OAAO,CAAC,KAAK,EAAE,CAAC,CAAC;oBAEhE,MAAM;gBACP,CAAC;gBAED,OAAO,CAAC,CAAC,CAAC;oBACT,MAAM,IAAA,wBAAc,EAAC,sBAAsB,CAAC,CAAC;gBAC9C,CAAC;YACF,CAAC;YAED,MAAM,kBAAkB,GAAuB,iBAAiB,CAAC,IAAI,EAAE,WAAW,EAAE,EAAE,KAAK,EAAE,cAAc,EAAE,CAAC,CAAC;YAC/G,MAAM,cAAc,GAAsC,kBAAkB,CAAC,KAA0C,CAAC;YAExH,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 { ErrorException } from \"../../../utility\";\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 { IApiBaseEntity } from \"../../../interface\";\nimport type { FindOptionsRelations, Repository } from \"typeorm\";\n\ntype TDecoratorFunction = (target: any, propertyKey: string, descriptor: PropertyDescriptor) => PropertyDescriptor;\n\nexport function ApiFunction<E extends IApiBaseEntity, R>(options: { model: new () => E; relations?: FindOptionsRelations<E>; type: EApiFunctionType }) {\n\t// eslint-disable-next-line @typescript-eslint/naming-convention\n\treturn function (_target: unknown, propertyKey: string, descriptor: PropertyDescriptor): PropertyDescriptor {\n\t\tconst originalMethod: unknown = descriptor.value;\n\n\t\t// eslint-disable-next-line @typescript-eslint/naming-convention\n\t\tdescriptor.value = function (this: { repository: Repository<E> }, ...arguments_: Array<any>): any {\n\t\t\tlet decoratorFunction: TDecoratorFunction;\n\n\t\t\tswitch (options.type) {\n\t\t\t\tcase EApiFunctionType.GET_LIST: {\n\t\t\t\t\tdecoratorFunction = ApiFunctionGetList({ model: options.model });\n\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\tcase EApiFunctionType.GET: {\n\t\t\t\t\tdecoratorFunction = ApiFunctionGet({ model: options.model });\n\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\tcase EApiFunctionType.CREATE: {\n\t\t\t\t\tdecoratorFunction = ApiFunctionCreate({ entity: options.model });\n\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\tcase EApiFunctionType.UPDATE: {\n\t\t\t\t\tdecoratorFunction = ApiFunctionUpdate({ model: options.model });\n\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\tcase EApiFunctionType.DELETE: {\n\t\t\t\t\tdecoratorFunction = ApiFunctionDelete({ model: options.model });\n\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\tdefault: {\n\t\t\t\t\tthrow ErrorException(\"Unsupported function\");\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst modifiedDescriptor: PropertyDescriptor = decoratorFunction(this, propertyKey, { value: originalMethod });\n\t\t\tconst modifiedMethod: (...arguments__: Array<any>) => R = modifiedDescriptor.value as (...arguments__: Array<any>) => R;\n\n\t\t\treturn modifiedMethod.apply(this, arguments_);\n\t\t};\n\n\t\treturn descriptor;\n\t};\n}\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
export declare function ApiFunctionDelete<E extends
|
|
1
|
+
import type { IApiBaseEntity } from "../../../interface";
|
|
2
|
+
export declare function ApiFunctionDelete<E extends IApiBaseEntity>(options: {
|
|
3
3
|
model: new () => E;
|
|
4
|
-
}): (_target:
|
|
4
|
+
}): (_target: unknown, _propertyKey: string, descriptor: PropertyDescriptor) => PropertyDescriptor;
|
|
@@ -28,7 +28,7 @@ function ApiFunctionDelete(options) {
|
|
|
28
28
|
descriptor.value = async function (id) {
|
|
29
29
|
const repository = this.repository;
|
|
30
30
|
if (!repository) {
|
|
31
|
-
throw
|
|
31
|
+
throw (0, utility_1.ErrorException)("Repository is not available in this context");
|
|
32
32
|
}
|
|
33
33
|
if (!getFunction) {
|
|
34
34
|
const getDescriptor = {
|
|
@@ -41,7 +41,7 @@ function ApiFunctionDelete(options) {
|
|
|
41
41
|
getFunction = getDescriptor.value.bind(this);
|
|
42
42
|
}
|
|
43
43
|
else {
|
|
44
|
-
throw
|
|
44
|
+
throw (0, utility_1.ErrorException)("Get function is not properly decorated");
|
|
45
45
|
}
|
|
46
46
|
}
|
|
47
47
|
return executor(repository, options.model, id, getFunction);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"delete.decorator.js","sourceRoot":"/","sources":["decorator/api/function/delete.decorator.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"delete.decorator.js","sourceRoot":"/","sources":["decorator/api/function/delete.decorator.ts"],"names":[],"mappings":";;AAkCA,8CAsCC;AAxED,2CAA6E;AAE7E,wCAAmD;AAEnD,8CAA+D;AAE/D,mDAAiD;AAOjD,KAAK,UAAU,QAAQ,CAA2B,UAAyB,EAAE,UAAuB,EAAE,EAAmB,EAAE,WAAkF;IAC5M,IAAI,CAAC;QACJ,MAAM,MAAM,GAAM,MAAM,WAAW,CAAC,EAAE,CAAC,QAAQ,EAAE,CAAC,CAAC;QAEnD,MAAM,UAAU,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IACjC,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,CAA2B,OAA+B;IAE1F,OAAO,UAAU,OAAgB,EAAE,YAAoB,EAAE,UAA8B;QACtF,MAAM,YAAY,GAA+F,IAAA,8BAAc,EAAC,EAAE,KAAK,EAAE,OAAO,CAAC,KAAK,EAAE,CAAC,CAAC;QAC1J,IAAI,WAAkF,CAAC;QAEvF,UAAU,CAAC,KAAK,GAAG,KAAK,WAIvB,EAAmB;YAEnB,MAAM,UAAU,GAAkB,IAAI,CAAC,UAAU,CAAC;YAElD,IAAI,CAAC,UAAU,EAAE,CAAC;gBACjB,MAAM,IAAA,wBAAc,EAAC,6CAA6C,CAAC,CAAC;YACrE,CAAC;YAED,IAAI,CAAC,WAAW,EAAE,CAAC;gBAClB,MAAM,aAAa,GAAmG;oBACrH,KAAK,EAAE;wBACN,OAAO,OAAO,CAAC,MAAM,CAAC,IAAI,KAAK,CAAC,iBAAiB,CAAC,CAAC,CAAC;oBACrD,CAAC;iBACD,CAAC;gBACF,YAAY,CAAC,IAAI,EAAE,KAAK,EAAE,aAAa,CAAC,CAAC;gBAEzC,IAAI,aAAa,CAAC,KAAK,EAAE,CAAC;oBACzB,WAAW,GAAG,aAAa,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;gBAC9C,CAAC;qBAAM,CAAC;oBACP,MAAM,IAAA,wBAAc,EAAC,wCAAwC,CAAC,CAAC;gBAChE,CAAC;YACF,CAAC;YAED,OAAO,QAAQ,CAAI,UAAU,EAAE,OAAO,CAAC,KAAK,EAAE,EAAE,EAAE,WAAW,CAAC,CAAC;QAChE,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 { ErrorException, ErrorString } from \"../../../utility\";\n\nimport { ApiFunctionGet } from \"./get.decorator\";\n\nimport type { IApiBaseEntity } from \"../../../interface\";\n\nimport type { TApiFunctionGetProperties } from \"../../../type\";\nimport type { Repository } from \"typeorm\";\n\nasync function executor<E extends IApiBaseEntity>(repository: Repository<E>, entityType: new () => E, id: number | string, getFunction: (id: string, properties?: TApiFunctionGetProperties<E>) => Promise<E>): Promise<void> {\n\ttry {\n\t\tconst entity: E = await getFunction(id.toString());\n\n\t\tawait repository.remove(entity);\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.DELETING_ERROR,\n\t\t\t}),\n\t\t);\n\t}\n}\n\nexport function ApiFunctionDelete<E extends IApiBaseEntity>(options: { model: new () => E }) {\n\t// eslint-disable-next-line @typescript-eslint/naming-convention\n\treturn function (_target: unknown, _propertyKey: string, descriptor: PropertyDescriptor): PropertyDescriptor {\n\t\tconst getDecorator: (_target: any, _propertyKey: string, descriptor: PropertyDescriptor) => PropertyDescriptor = ApiFunctionGet({ model: options.model });\n\t\tlet getFunction: (id: string, properties?: TApiFunctionGetProperties<E>) => Promise<E>;\n\n\t\tdescriptor.value = async function (\n\t\t\tthis: {\n\t\t\t\trepository: Repository<E>;\n\t\t\t},\n\t\t\tid: number | string,\n\t\t): Promise<void> {\n\t\t\tconst repository: Repository<E> = this.repository;\n\n\t\t\tif (!repository) {\n\t\t\t\tthrow ErrorException(\"Repository is not available in this context\");\n\t\t\t}\n\n\t\t\tif (!getFunction) {\n\t\t\t\tconst getDescriptor: TypedPropertyDescriptor<(id: string, properties?: TApiFunctionGetProperties<E>) => Promise<E>> = {\n\t\t\t\t\tvalue: function () {\n\t\t\t\t\t\treturn Promise.reject(new Error(\"Not implemented\"));\n\t\t\t\t\t},\n\t\t\t\t};\n\t\t\t\tgetDecorator(this, \"get\", getDescriptor);\n\n\t\t\t\tif (getDescriptor.value) {\n\t\t\t\t\tgetFunction = getDescriptor.value.bind(this);\n\t\t\t\t} else {\n\t\t\t\t\tthrow ErrorException(\"Get function is not properly decorated\");\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn executor<E>(repository, options.model, id, getFunction);\n\t\t};\n\n\t\treturn descriptor;\n\t};\n}\n"]}
|