@elsikora/nestjs-crud-automator 1.10.1-dev.1 → 1.10.1-dev.2
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/cjs/class/api/subscriber/executor.class.js.map +1 -1
- package/dist/cjs/decorator/api/controller.decorator.d.ts +3 -5
- package/dist/cjs/decorator/api/controller.decorator.js.map +1 -1
- package/dist/cjs/factory/api/controller.factory.js +36 -36
- package/dist/cjs/interface/class/api/subscriber/function.interface.d.ts +0 -1
- package/dist/cjs/type/decorator/api/controller/constructor.type.d.ts +2 -2
- package/dist/cjs/type/decorator/api/property/describe/enum-properties.type.d.ts +1 -1
- package/dist/cjs/type/factory/api/controller/target-methods.type.d.ts +1 -1
- package/dist/cjs/utility/is-error-of-type.utility.js.map +1 -1
- package/dist/esm/class/api/subscriber/executor.class.js.map +1 -1
- package/dist/esm/decorator/api/controller.decorator.d.ts +3 -5
- package/dist/esm/decorator/api/controller.decorator.js.map +1 -1
- package/dist/esm/factory/api/controller.factory.js +36 -36
- package/dist/esm/interface/class/api/subscriber/function.interface.d.ts +0 -1
- package/dist/esm/type/decorator/api/controller/constructor.type.d.ts +2 -2
- package/dist/esm/type/decorator/api/property/describe/enum-properties.type.d.ts +1 -1
- package/dist/esm/type/factory/api/controller/target-methods.type.d.ts +1 -1
- package/dist/esm/utility/is-error-of-type.utility.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"executor.class.js","sources":["../../../../../../src/class/api/subscriber/executor.class.ts"],"sourcesContent":[null],"names":["LoggerUtility","SERVICE_API_DECORATOR_CONSTANT","apiSubscriberRegistry","CapitalizeString","CONTROLLER_API_DECORATOR_CONSTANT"],"mappings":";;;;;;;;AAeA,MAAM,gBAAgB,GAAkBA,4BAAa,CAAC,SAAS,CAAC,uBAAuB,CAAC;MAE3E,qBAAqB,CAAA;AAC1B,IAAA,aAAa,0BAA0B,CAA4C,WAA2D,EAAE,MAAS,EAAE,YAA8B,EAAE,MAA4B,EAAE,OAAmE,EAAE,KAAa,EAAA;AACjT,QAAA,IAAI,CAAC,OAAO,CAAC,WAAW,CAACC,+CAA8B,CAAC,uBAAuB,EAAE,WAAW,CAAC,EAAE;YAC9F,OAAO,OAAO,CAAC,MAAiB;;AAGjC,QAAA,MAAM,WAAW,GAAkDC,oCAAqB,CAAC,sBAAsB,CAAC,MAAM,CAAC,WAAW,CAAC,IAAI,CAAC;AACxI,QAAA,IAAI,MAAM,GAAwB,OAAO,CAAC,MAAM;AAEhD,QAAA,KAAK,MAAM,UAAU,IAAI,WAAW,EAAE;YACrC,MAAM,QAAQ,GAAW,CAAA,EAAA,EAAK,MAAM,CAAA,EAAGC,yCAAgB,CAAC,YAAY,CAAC,CAAA,CAAE;AACvE,YAAA,MAAM,IAAI,GAAY,UAAU,CAAC,
|
|
1
|
+
{"version":3,"file":"executor.class.js","sources":["../../../../../../src/class/api/subscriber/executor.class.ts"],"sourcesContent":[null],"names":["LoggerUtility","SERVICE_API_DECORATOR_CONSTANT","apiSubscriberRegistry","CapitalizeString","CONTROLLER_API_DECORATOR_CONSTANT"],"mappings":";;;;;;;;AAeA,MAAM,gBAAgB,GAAkBA,4BAAa,CAAC,SAAS,CAAC,uBAAuB,CAAC;MAE3E,qBAAqB,CAAA;AAC1B,IAAA,aAAa,0BAA0B,CAA4C,WAA2D,EAAE,MAAS,EAAE,YAA8B,EAAE,MAA4B,EAAE,OAAmE,EAAE,KAAa,EAAA;AACjT,QAAA,IAAI,CAAC,OAAO,CAAC,WAAW,CAACC,+CAA8B,CAAC,uBAAuB,EAAE,WAAW,CAAC,EAAE;YAC9F,OAAO,OAAO,CAAC,MAAiB;;AAGjC,QAAA,MAAM,WAAW,GAAkDC,oCAAqB,CAAC,sBAAsB,CAAC,MAAM,CAAC,WAAW,CAAC,IAAI,CAAC;AACxI,QAAA,IAAI,MAAM,GAAwB,OAAO,CAAC,MAAM;AAEhD,QAAA,KAAK,MAAM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,YAAA,IAAI,OAAO,IAAI,KAAK,UAAU,EAAE;AAC/B,gBAAA,gBAAgB,CAAC,OAAO,CAAC,wBAAwB,QAAQ,CAAA,MAAA,EAAS,UAAU,CAAC,WAAW,CAAC,IAAI,CAAA,YAAA,EAAe,MAAM,CAAC,WAAW,CAAC,IAAI,CAAA,CAAE,CAAC;gBACtI,MAAM,UAAU,IAAyB,MAAM,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,EAAE,GAAG,OAAO,EAAE,MAAM,EAAE,EAAE,KAAK,CAAC,CAAwB;AAE3H,gBAAA,IAAI,UAAU,KAAK,SAAS,EAAE;oBAC7B,MAAM,GAAG,UAAU;;;;AAKtB,QAAA,OAAO,MAAM;;AAEd;;;;"}
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import type { IApiBaseEntity } from '../../interface/
|
|
2
|
-
import type {
|
|
3
|
-
|
|
4
|
-
import type { TApiControllerTargetMethod } from '../../type/factory/api/controller/index';
|
|
5
|
-
export declare const ApiController: <E extends IApiBaseEntity>(options: IApiControllerProperties<E>) => (target: TApiControllerTargetMethod<E>) => TApiControllerConstructor;
|
|
1
|
+
import type { IApiBaseEntity, IApiControllerProperties } from '../../interface/index';
|
|
2
|
+
import type { TApiControllerConstructor } from '../../type/index';
|
|
3
|
+
export declare const ApiController: <E extends IApiBaseEntity>(options: IApiControllerProperties<E>) => <T extends TApiControllerConstructor>(target: T) => T;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"controller.decorator.js","sources":["../../../../../src/decorator/api/controller.decorator.ts"],"sourcesContent":[null],"names":["ApiControllerFactory"],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"controller.decorator.js","sources":["../../../../../src/decorator/api/controller.decorator.ts"],"sourcesContent":[null],"names":["ApiControllerFactory"],"mappings":";;;;AAKO,MAAM,aAAa,GACzB,CAA2B,OAAoC,KAC/D,CAAsC,MAAS,KAAO;IACrD,MAAM,OAAO,GAA4B,IAAIA,uCAAoB,CAAI,MAAM,EAAE,OAAO,CAAC;IACrF,OAAO,CAAC,IAAI,EAAE;;AAGd,IAAA,MAAM,mBAAmB,GAA2D,cAAc,MAAM,CAAA;;AAEvG,QAAA,WAAA,CAAY,GAAG,UAAe,EAAA;;AAE7B,YAAA,KAAK,CAAC,GAAG,UAAU,CAAC;;KAErB;AACD,IAAA,MAAM,CAAC,cAAc,CAAC,mBAAmB,EAAE,MAAM,EAAE,EAAE,KAAK,EAAE,MAAM,CAAC,IAAI,EAAE,CAAC;AAE1E,IAAA,OAAO,mBAAwB;AAChC;;;;"}
|
|
@@ -95,8 +95,8 @@ class ApiControllerFactory {
|
|
|
95
95
|
this.targetPrototype[methodName] = Object.defineProperty(async function (body, headers, ip, authenticationRequest) {
|
|
96
96
|
const entityInstance = new properties.entity();
|
|
97
97
|
const beforeExecutionContext = {
|
|
98
|
-
|
|
99
|
-
|
|
98
|
+
DATA: { entityMetadata, method, methodName, properties },
|
|
99
|
+
ENTITY: entityInstance,
|
|
100
100
|
result: { authenticationRequest, body, headers, ip },
|
|
101
101
|
ROUTE_TYPE: routeType_enum.EApiRouteType.CREATE,
|
|
102
102
|
};
|
|
@@ -125,8 +125,8 @@ class ApiControllerFactory {
|
|
|
125
125
|
const response = await this.service.get(requestProperties);
|
|
126
126
|
transformData_utility.ApiControllerTransformData(properties.routes[method]?.response?.transformers, properties, { response }, { authenticationRequest, headers, ip });
|
|
127
127
|
const afterExecutionContext = {
|
|
128
|
-
|
|
129
|
-
|
|
128
|
+
DATA: { ...beforeExecutionContext.DATA, authenticationRequest, body, headers, ip },
|
|
129
|
+
ENTITY: response,
|
|
130
130
|
result: response,
|
|
131
131
|
ROUTE_TYPE: routeType_enum.EApiRouteType.CREATE,
|
|
132
132
|
};
|
|
@@ -140,8 +140,8 @@ class ApiControllerFactory {
|
|
|
140
140
|
}
|
|
141
141
|
catch (error) {
|
|
142
142
|
const errorExecutionContext = {
|
|
143
|
-
|
|
144
|
-
|
|
143
|
+
DATA: { ...beforeExecutionContext.DATA, authenticationRequest, body, headers, ip },
|
|
144
|
+
ENTITY: entityInstance,
|
|
145
145
|
ROUTE_TYPE: routeType_enum.EApiRouteType.CREATE,
|
|
146
146
|
};
|
|
147
147
|
await executor_class.ApiSubscriberExecutor.executeRouteSubscribers(this.constructor, entityInstance, routeType_enum.EApiRouteType.CREATE, onType_enum.EApiSubscriberOnType.AFTER_ERROR, errorExecutionContext, error);
|
|
@@ -153,8 +153,8 @@ class ApiControllerFactory {
|
|
|
153
153
|
this.targetPrototype[methodName] = Object.defineProperty(async function (parameters, headers, ip, authenticationRequest) {
|
|
154
154
|
const entityInstance = new properties.entity();
|
|
155
155
|
const beforeExecutionContext = {
|
|
156
|
-
|
|
157
|
-
|
|
156
|
+
DATA: { entityMetadata, method, methodName, properties },
|
|
157
|
+
ENTITY: entityInstance,
|
|
158
158
|
result: { authenticationRequest, headers, ip, parameters },
|
|
159
159
|
ROUTE_TYPE: routeType_enum.EApiRouteType.DELETE,
|
|
160
160
|
};
|
|
@@ -179,8 +179,8 @@ class ApiControllerFactory {
|
|
|
179
179
|
};
|
|
180
180
|
await this.service.delete(requestCriteria);
|
|
181
181
|
const afterExecutionContext = {
|
|
182
|
-
|
|
183
|
-
|
|
182
|
+
DATA: { ...beforeExecutionContext.DATA, authenticationRequest, headers, ip, parameters },
|
|
183
|
+
ENTITY: entityInstance,
|
|
184
184
|
result: parameters,
|
|
185
185
|
ROUTE_TYPE: routeType_enum.EApiRouteType.DELETE,
|
|
186
186
|
};
|
|
@@ -188,8 +188,8 @@ class ApiControllerFactory {
|
|
|
188
188
|
}
|
|
189
189
|
catch (error) {
|
|
190
190
|
const errorExecutionContext = {
|
|
191
|
-
|
|
192
|
-
|
|
191
|
+
DATA: { ...beforeExecutionContext.DATA, authenticationRequest, headers, ip, parameters },
|
|
192
|
+
ENTITY: entityInstance,
|
|
193
193
|
ROUTE_TYPE: routeType_enum.EApiRouteType.DELETE,
|
|
194
194
|
};
|
|
195
195
|
await executor_class.ApiSubscriberExecutor.executeRouteSubscribers(this.constructor, entityInstance, routeType_enum.EApiRouteType.DELETE, onType_enum.EApiSubscriberOnType.AFTER_ERROR, errorExecutionContext, error);
|
|
@@ -201,8 +201,8 @@ class ApiControllerFactory {
|
|
|
201
201
|
this.targetPrototype[methodName] = Object.defineProperty(async function (parameters, headers, ip, authenticationRequest) {
|
|
202
202
|
const entityInstance = new properties.entity();
|
|
203
203
|
const beforeExecutionContext = {
|
|
204
|
-
|
|
205
|
-
|
|
204
|
+
DATA: { entityMetadata, method, methodName, properties },
|
|
205
|
+
ENTITY: entityInstance,
|
|
206
206
|
result: { authenticationRequest, headers, ip, parameters },
|
|
207
207
|
ROUTE_TYPE: routeType_enum.EApiRouteType.GET,
|
|
208
208
|
};
|
|
@@ -229,8 +229,8 @@ class ApiControllerFactory {
|
|
|
229
229
|
const response = await this.service.get(requestProperties);
|
|
230
230
|
transformData_utility.ApiControllerTransformData(properties.routes[method]?.response?.transformers, properties, { response }, { authenticationRequest, headers, ip });
|
|
231
231
|
const afterExecutionContext = {
|
|
232
|
-
|
|
233
|
-
|
|
232
|
+
DATA: { ...beforeExecutionContext.DATA, authenticationRequest, headers, ip, parameters },
|
|
233
|
+
ENTITY: response,
|
|
234
234
|
result: response,
|
|
235
235
|
ROUTE_TYPE: routeType_enum.EApiRouteType.GET,
|
|
236
236
|
};
|
|
@@ -244,8 +244,8 @@ class ApiControllerFactory {
|
|
|
244
244
|
}
|
|
245
245
|
catch (error) {
|
|
246
246
|
const errorExecutionContext = {
|
|
247
|
-
|
|
248
|
-
|
|
247
|
+
DATA: { ...beforeExecutionContext.DATA, authenticationRequest, headers, ip, parameters },
|
|
248
|
+
ENTITY: entityInstance,
|
|
249
249
|
ROUTE_TYPE: routeType_enum.EApiRouteType.GET,
|
|
250
250
|
};
|
|
251
251
|
await executor_class.ApiSubscriberExecutor.executeRouteSubscribers(this.constructor, entityInstance, routeType_enum.EApiRouteType.GET, onType_enum.EApiSubscriberOnType.AFTER_ERROR, errorExecutionContext, error);
|
|
@@ -257,8 +257,8 @@ class ApiControllerFactory {
|
|
|
257
257
|
this.targetPrototype[methodName] = Object.defineProperty(async function (query, headers, ip, authenticationRequest) {
|
|
258
258
|
const entityInstance = new properties.entity();
|
|
259
259
|
const beforeExecutionContext = {
|
|
260
|
-
|
|
261
|
-
|
|
260
|
+
DATA: { entityMetadata, method, methodName, properties },
|
|
261
|
+
ENTITY: entityInstance,
|
|
262
262
|
result: { authenticationRequest, headers, ip, query },
|
|
263
263
|
ROUTE_TYPE: routeType_enum.EApiRouteType.GET_LIST,
|
|
264
264
|
};
|
|
@@ -287,8 +287,8 @@ class ApiControllerFactory {
|
|
|
287
287
|
const response = await this.service.getList(requestProperties);
|
|
288
288
|
transformData_utility.ApiControllerTransformData(properties.routes[method]?.request?.transformers, properties, { response }, { authenticationRequest, headers, ip });
|
|
289
289
|
const afterExecutionContext = {
|
|
290
|
-
|
|
291
|
-
|
|
290
|
+
DATA: { ...beforeExecutionContext.DATA, authenticationRequest, headers, ip, query },
|
|
291
|
+
ENTITY: entityInstance,
|
|
292
292
|
result: response,
|
|
293
293
|
ROUTE_TYPE: routeType_enum.EApiRouteType.GET_LIST,
|
|
294
294
|
};
|
|
@@ -302,8 +302,8 @@ class ApiControllerFactory {
|
|
|
302
302
|
}
|
|
303
303
|
catch (error) {
|
|
304
304
|
const errorExecutionContext = {
|
|
305
|
-
|
|
306
|
-
|
|
305
|
+
DATA: { ...beforeExecutionContext.DATA, authenticationRequest, headers, ip, query },
|
|
306
|
+
ENTITY: entityInstance,
|
|
307
307
|
ROUTE_TYPE: routeType_enum.EApiRouteType.GET_LIST,
|
|
308
308
|
};
|
|
309
309
|
await executor_class.ApiSubscriberExecutor.executeRouteSubscribers(this.constructor, entityInstance, routeType_enum.EApiRouteType.GET_LIST, onType_enum.EApiSubscriberOnType.AFTER_ERROR, errorExecutionContext, error);
|
|
@@ -315,8 +315,8 @@ class ApiControllerFactory {
|
|
|
315
315
|
this.targetPrototype[methodName] = Object.defineProperty(async function (parameters, body, headers, ip, authenticationRequest) {
|
|
316
316
|
const entityInstance = new properties.entity();
|
|
317
317
|
const beforeExecutionContext = {
|
|
318
|
-
|
|
319
|
-
|
|
318
|
+
DATA: { entityMetadata, method, methodName, properties },
|
|
319
|
+
ENTITY: entityInstance,
|
|
320
320
|
result: { authenticationRequest, body, headers, ip, parameters },
|
|
321
321
|
ROUTE_TYPE: routeType_enum.EApiRouteType.PARTIAL_UPDATE,
|
|
322
322
|
};
|
|
@@ -343,8 +343,8 @@ class ApiControllerFactory {
|
|
|
343
343
|
const response = await this.service.update(requestCriteria, body);
|
|
344
344
|
transformData_utility.ApiControllerTransformData(properties.routes[method]?.response?.transformers, properties, { response }, { authenticationRequest, headers, ip });
|
|
345
345
|
const afterExecutionContext = {
|
|
346
|
-
|
|
347
|
-
|
|
346
|
+
DATA: { ...beforeExecutionContext.DATA, authenticationRequest, body, headers, ip, parameters },
|
|
347
|
+
ENTITY: response,
|
|
348
348
|
result: response,
|
|
349
349
|
ROUTE_TYPE: routeType_enum.EApiRouteType.PARTIAL_UPDATE,
|
|
350
350
|
};
|
|
@@ -358,8 +358,8 @@ class ApiControllerFactory {
|
|
|
358
358
|
}
|
|
359
359
|
catch (error) {
|
|
360
360
|
const errorExecutionContext = {
|
|
361
|
-
|
|
362
|
-
|
|
361
|
+
DATA: { ...beforeExecutionContext.DATA, authenticationRequest, body, headers, ip, parameters },
|
|
362
|
+
ENTITY: entityInstance,
|
|
363
363
|
ROUTE_TYPE: routeType_enum.EApiRouteType.PARTIAL_UPDATE,
|
|
364
364
|
};
|
|
365
365
|
await executor_class.ApiSubscriberExecutor.executeRouteSubscribers(this.constructor, entityInstance, routeType_enum.EApiRouteType.PARTIAL_UPDATE, onType_enum.EApiSubscriberOnType.AFTER_ERROR, errorExecutionContext, error);
|
|
@@ -371,8 +371,8 @@ class ApiControllerFactory {
|
|
|
371
371
|
this.targetPrototype[methodName] = Object.defineProperty(async function (parameters, body, headers, ip, authenticationRequest) {
|
|
372
372
|
const entityInstance = new properties.entity();
|
|
373
373
|
const beforeExecutionContext = {
|
|
374
|
-
|
|
375
|
-
|
|
374
|
+
DATA: { entityMetadata, method, methodName, properties },
|
|
375
|
+
ENTITY: entityInstance,
|
|
376
376
|
result: { authenticationRequest, body, headers, ip, parameters },
|
|
377
377
|
ROUTE_TYPE: routeType_enum.EApiRouteType.UPDATE,
|
|
378
378
|
};
|
|
@@ -399,8 +399,8 @@ class ApiControllerFactory {
|
|
|
399
399
|
const response = await this.service.update(requestCriteria, body);
|
|
400
400
|
transformData_utility.ApiControllerTransformData(properties.routes[method]?.response?.transformers, properties, { response }, { authenticationRequest, headers, ip });
|
|
401
401
|
const afterExecutionContext = {
|
|
402
|
-
|
|
403
|
-
|
|
402
|
+
DATA: { ...beforeExecutionContext.DATA, authenticationRequest, body, headers, ip, parameters },
|
|
403
|
+
ENTITY: response,
|
|
404
404
|
result: response,
|
|
405
405
|
ROUTE_TYPE: routeType_enum.EApiRouteType.UPDATE,
|
|
406
406
|
};
|
|
@@ -414,8 +414,8 @@ class ApiControllerFactory {
|
|
|
414
414
|
}
|
|
415
415
|
catch (error) {
|
|
416
416
|
const errorExecutionContext = {
|
|
417
|
-
|
|
418
|
-
|
|
417
|
+
DATA: { ...beforeExecutionContext.DATA, authenticationRequest, body, headers, ip, parameters },
|
|
418
|
+
ENTITY: entityInstance,
|
|
419
419
|
ROUTE_TYPE: routeType_enum.EApiRouteType.UPDATE,
|
|
420
420
|
};
|
|
421
421
|
await executor_class.ApiSubscriberExecutor.executeRouteSubscribers(this.constructor, entityInstance, routeType_enum.EApiRouteType.UPDATE, onType_enum.EApiSubscriberOnType.AFTER_ERROR, errorExecutionContext, error);
|
|
@@ -3,7 +3,6 @@ import type { IApiSubscriberFunctionExecutionContext } from './function-executio
|
|
|
3
3
|
import type { IApiSubscriber } from './interface';
|
|
4
4
|
import type { TApiFunctionCreateProperties } from '../../../../type/decorator/api/function/index';
|
|
5
5
|
export interface IApiSubscriberFunction<E extends IApiBaseEntity> extends IApiSubscriber {
|
|
6
|
-
[key: string]: unknown;
|
|
7
6
|
onAfterCreate?(context: IApiSubscriberFunctionExecutionContext<E, E>): Promise<E | undefined>;
|
|
8
7
|
onAfterDelete?(context: IApiSubscriberFunctionExecutionContext<E, E>): Promise<E | undefined>;
|
|
9
8
|
onAfterErrorCreate?(context: IApiSubscriberFunctionExecutionContext<E, never>, error: Error): Promise<void>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { ApiServiceBase } from '../../../../class/api/index';
|
|
2
|
-
export type TApiControllerConstructor = new (...arguments_: Array<
|
|
3
|
-
service: ApiServiceBase<
|
|
2
|
+
export type TApiControllerConstructor = new (...arguments_: Array<any>) => {
|
|
3
|
+
service: ApiServiceBase<any>;
|
|
4
4
|
};
|
|
@@ -3,7 +3,7 @@ import type { TApiPropertyDescribeArrayOptionalProperties, TApiPropertyDescribeA
|
|
|
3
3
|
import type { TApiPropertyDescribeBaseProperties } from './base-properties.type';
|
|
4
4
|
export type TApiPropertyDescribeEnumProperties = {
|
|
5
5
|
description: string;
|
|
6
|
-
enum: Record<string,
|
|
6
|
+
enum: Record<string, number | string>;
|
|
7
7
|
enumName: string;
|
|
8
8
|
type: EApiPropertyDescribeType.ENUM;
|
|
9
9
|
} & (TApiPropertyDescribeArrayOptionalProperties | TApiPropertyDescribeArrayRequiredProperties) & TApiPropertyDescribeBaseProperties;
|
|
@@ -2,7 +2,7 @@ import type { ApiServiceBase } from '../../../../class/api/index';
|
|
|
2
2
|
import type { EApiRouteType } from '../../../../enum/decorator/api/index';
|
|
3
3
|
import type { TApiControllerMethodMap } from './method-map.type';
|
|
4
4
|
import type { TApiControllerMethodName } from './method-name.type';
|
|
5
|
-
export type TApiControllerTargetMethod<E> = new (...arguments_: Array<
|
|
5
|
+
export type TApiControllerTargetMethod<E> = new (...arguments_: Array<any>) => {
|
|
6
6
|
[K in EApiRouteType as TApiControllerMethodName<K>]: TApiControllerMethodMap<E>[K];
|
|
7
7
|
} & {
|
|
8
8
|
service: ApiServiceBase<E>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"is-error-of-type.utility.js","sources":["../../../../src/utility/is-error-of-type.utility.ts"],"sourcesContent":[null],"names":["EException","BadRequestException","ConflictException","ForbiddenException","GatewayTimeoutException","GoneException","HttpVersionNotSupportedException","ImATeapotException","InternalServerErrorException","MethodNotAllowedException","NotAcceptableException","NotFoundException","NotImplementedException","PayloadTooLargeException","PreconditionFailedException","RequestTimeoutException","ServiceUnavailableException","ThrottlerException","UnauthorizedException","UnprocessableEntityException","UnsupportedMediaTypeException"],"mappings":";;;;;;AAAA;AA8BA,MAAM,YAAY,GAAwD;AACzE,IAAA,CAACA,yBAAU,CAAC,WAAW,GAAGC,0BAAmB;AAC7C,IAAA,CAACD,yBAAU,CAAC,QAAQ,GAAGE,wBAAiB;AACxC,IAAA,CAACF,yBAAU,CAAC,kBAAkB,GAAG,SAAS;AAC1C,IAAA,CAACA,yBAAU,CAAC,SAAS,GAAGG,yBAAkB;AAC1C,IAAA,CAACH,yBAAU,CAAC,eAAe,GAAGI,8BAAuB;AACrD,IAAA,CAACJ,yBAAU,CAAC,IAAI,GAAGK,oBAAa;AAChC,IAAA,CAACL,yBAAU,CAAC,0BAA0B,GAAGM,uCAAgC;AACzE,IAAA,CAACN,yBAAU,CAAC,WAAW,GAAGO,yBAAkB;AAC5C,IAAA,CAACP,yBAAU,CAAC,qBAAqB,GAAGQ,mCAA4B;AAChE,IAAA,CAACR,yBAAU,CAAC,eAAe,GAAG,SAAS;AACvC,IAAA,CAACA,yBAAU,CAAC,kBAAkB,GAAGS,gCAAyB;AAC1D,IAAA,CAACT,yBAAU,CAAC,+BAA+B,GAAG,SAAS;AACvD,IAAA,CAACA,yBAAU,CAAC,cAAc,GAAGU,6BAAsB;AACnD,IAAA,CAACV,yBAAU,CAAC,YAAY,GAAG,SAAS;AACpC,IAAA,CAACA,yBAAU,CAAC,SAAS,GAAGW,wBAAiB;AACzC,IAAA,CAACX,yBAAU,CAAC,eAAe,GAAGY,8BAAuB;AACrD,IAAA,CAACZ,yBAAU,CAAC,iBAAiB,GAAGa,+BAAwB;AACxD,IAAA,CAACb,yBAAU,CAAC,gBAAgB,GAAG,SAAS;AACxC,IAAA,CAACA,yBAAU,CAAC,mBAAmB,GAAGc,kCAA2B;AAC7D,IAAA,CAACd,yBAAU,CAAC,+BAA+B,GAAG,SAAS;AACvD,IAAA,CAACA,yBAAU,CAAC,eAAe,GAAGe,8BAAuB;AACrD,IAAA,CAACf,yBAAU,CAAC,oBAAoB,GAAG,SAAS;AAC5C,IAAA,CAACA,yBAAU,CAAC,mBAAmB,GAAGgB,kCAA2B;AAC7D,IAAA,CAAChB,yBAAU,CAAC,iBAAiB,GAAGiB,4BAAkB;AAClD,IAAA,CAACjB,yBAAU,CAAC,YAAY,GAAGkB,4BAAqB;AAChD,IAAA,CAAClB,yBAAU,CAAC,oBAAoB,GAAGmB,mCAA4B;AAC/D,IAAA,CAACnB,yBAAU,CAAC,sBAAsB,GAAGoB,oCAA6B;AAClE,IAAA,CAACpB,yBAAU,CAAC,gBAAgB,GAAG,SAAS;CACxC;AAED;;;;;AAKG;AACG,SAAU,aAAa,CAAC,KAAc,EAAE,IAAgB,EAAA;AAC7D,IAAA,MAAM,cAAc,
|
|
1
|
+
{"version":3,"file":"is-error-of-type.utility.js","sources":["../../../../src/utility/is-error-of-type.utility.ts"],"sourcesContent":[null],"names":["EException","BadRequestException","ConflictException","ForbiddenException","GatewayTimeoutException","GoneException","HttpVersionNotSupportedException","ImATeapotException","InternalServerErrorException","MethodNotAllowedException","NotAcceptableException","NotFoundException","NotImplementedException","PayloadTooLargeException","PreconditionFailedException","RequestTimeoutException","ServiceUnavailableException","ThrottlerException","UnauthorizedException","UnprocessableEntityException","UnsupportedMediaTypeException"],"mappings":";;;;;;AAAA;AA8BA,MAAM,YAAY,GAAwD;AACzE,IAAA,CAACA,yBAAU,CAAC,WAAW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AAiB,GAAGiB,4BAAkB;AAClD,IAAA,CAACjB,yBAAU,CAAC,YAAY,GAAGkB,4BAAqB;AAChD,IAAA,CAAClB,yBAAU,CAAC,oBAAoB,GAAGmB,mCAA4B;AAC/D,IAAA,CAACnB,yBAAU,CAAC,sBAAsB,GAAGoB,oCAA6B;AAClE,IAAA,CAACpB,yBAAU,CAAC,gBAAgB,GAAG,SAAS;CACxC;AAED;;;;;AAKG;AACG,SAAU,aAAa,CAAC,KAAc,EAAE,IAAgB,EAAA;AAC7D,IAAA,MAAM,cAAc,GAA8B,YAAY,CAAC,IAAI,CAA8B;IAEjG,IAAI,CAAC,cAAc,EAAE;AACpB,QAAA,OAAO,KAAK;;IAGb,IAAI,CAAC,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE;AACxC,QAAA,OAAO,KAAK;;;AAIb,IAAA,IAAI,KAAK,YAAY,cAAc,EAAE;AACpC,QAAA,OAAO,IAAI;;IAGZ,MAAM,WAAW,GAAsB,KAA0B;AAEjE,IAAA,OAAO,CAAC,EAAE,WAAW,CAAC,IAAI,IAAI,WAAW,CAAC,IAAI,KAAK,cAAc,CAAC,IAAI,CAAC;AACxE;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"executor.class.js","sources":["../../../../../../src/class/api/subscriber/executor.class.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;;;AAeA,MAAM,gBAAgB,GAAkB,aAAa,CAAC,SAAS,CAAC,uBAAuB,CAAC;MAE3E,qBAAqB,CAAA;AAC1B,IAAA,aAAa,0BAA0B,CAA4C,WAA2D,EAAE,MAAS,EAAE,YAA8B,EAAE,MAA4B,EAAE,OAAmE,EAAE,KAAa,EAAA;AACjT,QAAA,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,8BAA8B,CAAC,uBAAuB,EAAE,WAAW,CAAC,EAAE;YAC9F,OAAO,OAAO,CAAC,MAAiB;;AAGjC,QAAA,MAAM,WAAW,GAAkD,qBAAqB,CA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AwB;AAE3H,gBAAA,IAAI,UAAU,KAAK,SAAS,EAAE;oBAC7B,MAAM,GAAG,UAAU;;;;AAKtB,QAAA,OAAO,MAAM;;AAEd;;;;"}
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import type { IApiBaseEntity } from '../../interface/
|
|
2
|
-
import type {
|
|
3
|
-
|
|
4
|
-
import type { TApiControllerTargetMethod } from '../../type/factory/api/controller/index';
|
|
5
|
-
export declare const ApiController: <E extends IApiBaseEntity>(options: IApiControllerProperties<E>) => (target: TApiControllerTargetMethod<E>) => TApiControllerConstructor;
|
|
1
|
+
import type { IApiBaseEntity, IApiControllerProperties } from '../../interface/index';
|
|
2
|
+
import type { TApiControllerConstructor } from '../../type/index';
|
|
3
|
+
export declare const ApiController: <E extends IApiBaseEntity>(options: IApiControllerProperties<E>) => <T extends TApiControllerConstructor>(target: T) => T;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"controller.decorator.js","sources":["../../../../../src/decorator/api/controller.decorator.ts"],"sourcesContent":[null],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"controller.decorator.js","sources":["../../../../../src/decorator/api/controller.decorator.ts"],"sourcesContent":[null],"names":[],"mappings":";;AAKO,MAAM,aAAa,GACzB,CAA2B,OAAoC,KAC/D,CAAsC,MAAS,KAAO;IACrD,MAAM,OAAO,GAA4B,IAAI,oBAAoB,CAAI,MAAM,EAAE,OAAO,CAAC;IACrF,OAAO,CAAC,IAAI,EAAE;;AAGd,IAAA,MAAM,mBAAmB,GAA2D,cAAc,MAAM,CAAA;;AAEvG,QAAA,WAAA,CAAY,GAAG,UAAe,EAAA;;AAE7B,YAAA,KAAK,CAAC,GAAG,UAAU,CAAC;;KAErB;AACD,IAAA,MAAM,CAAC,cAAc,CAAC,mBAAmB,EAAE,MAAM,EAAE,EAAE,KAAK,EAAE,MAAM,CAAC,IAAI,EAAE,CAAC;AAE1E,IAAA,OAAO,mBAAwB;AAChC;;;;"}
|
|
@@ -93,8 +93,8 @@ class ApiControllerFactory {
|
|
|
93
93
|
this.targetPrototype[methodName] = Object.defineProperty(async function (body, headers, ip, authenticationRequest) {
|
|
94
94
|
const entityInstance = new properties.entity();
|
|
95
95
|
const beforeExecutionContext = {
|
|
96
|
-
|
|
97
|
-
|
|
96
|
+
DATA: { entityMetadata, method, methodName, properties },
|
|
97
|
+
ENTITY: entityInstance,
|
|
98
98
|
result: { authenticationRequest, body, headers, ip },
|
|
99
99
|
ROUTE_TYPE: EApiRouteType.CREATE,
|
|
100
100
|
};
|
|
@@ -123,8 +123,8 @@ class ApiControllerFactory {
|
|
|
123
123
|
const response = await this.service.get(requestProperties);
|
|
124
124
|
ApiControllerTransformData(properties.routes[method]?.response?.transformers, properties, { response }, { authenticationRequest, headers, ip });
|
|
125
125
|
const afterExecutionContext = {
|
|
126
|
-
|
|
127
|
-
|
|
126
|
+
DATA: { ...beforeExecutionContext.DATA, authenticationRequest, body, headers, ip },
|
|
127
|
+
ENTITY: response,
|
|
128
128
|
result: response,
|
|
129
129
|
ROUTE_TYPE: EApiRouteType.CREATE,
|
|
130
130
|
};
|
|
@@ -138,8 +138,8 @@ class ApiControllerFactory {
|
|
|
138
138
|
}
|
|
139
139
|
catch (error) {
|
|
140
140
|
const errorExecutionContext = {
|
|
141
|
-
|
|
142
|
-
|
|
141
|
+
DATA: { ...beforeExecutionContext.DATA, authenticationRequest, body, headers, ip },
|
|
142
|
+
ENTITY: entityInstance,
|
|
143
143
|
ROUTE_TYPE: EApiRouteType.CREATE,
|
|
144
144
|
};
|
|
145
145
|
await ApiSubscriberExecutor.executeRouteSubscribers(this.constructor, entityInstance, EApiRouteType.CREATE, EApiSubscriberOnType.AFTER_ERROR, errorExecutionContext, error);
|
|
@@ -151,8 +151,8 @@ class ApiControllerFactory {
|
|
|
151
151
|
this.targetPrototype[methodName] = Object.defineProperty(async function (parameters, headers, ip, authenticationRequest) {
|
|
152
152
|
const entityInstance = new properties.entity();
|
|
153
153
|
const beforeExecutionContext = {
|
|
154
|
-
|
|
155
|
-
|
|
154
|
+
DATA: { entityMetadata, method, methodName, properties },
|
|
155
|
+
ENTITY: entityInstance,
|
|
156
156
|
result: { authenticationRequest, headers, ip, parameters },
|
|
157
157
|
ROUTE_TYPE: EApiRouteType.DELETE,
|
|
158
158
|
};
|
|
@@ -177,8 +177,8 @@ class ApiControllerFactory {
|
|
|
177
177
|
};
|
|
178
178
|
await this.service.delete(requestCriteria);
|
|
179
179
|
const afterExecutionContext = {
|
|
180
|
-
|
|
181
|
-
|
|
180
|
+
DATA: { ...beforeExecutionContext.DATA, authenticationRequest, headers, ip, parameters },
|
|
181
|
+
ENTITY: entityInstance,
|
|
182
182
|
result: parameters,
|
|
183
183
|
ROUTE_TYPE: EApiRouteType.DELETE,
|
|
184
184
|
};
|
|
@@ -186,8 +186,8 @@ class ApiControllerFactory {
|
|
|
186
186
|
}
|
|
187
187
|
catch (error) {
|
|
188
188
|
const errorExecutionContext = {
|
|
189
|
-
|
|
190
|
-
|
|
189
|
+
DATA: { ...beforeExecutionContext.DATA, authenticationRequest, headers, ip, parameters },
|
|
190
|
+
ENTITY: entityInstance,
|
|
191
191
|
ROUTE_TYPE: EApiRouteType.DELETE,
|
|
192
192
|
};
|
|
193
193
|
await ApiSubscriberExecutor.executeRouteSubscribers(this.constructor, entityInstance, EApiRouteType.DELETE, EApiSubscriberOnType.AFTER_ERROR, errorExecutionContext, error);
|
|
@@ -199,8 +199,8 @@ class ApiControllerFactory {
|
|
|
199
199
|
this.targetPrototype[methodName] = Object.defineProperty(async function (parameters, headers, ip, authenticationRequest) {
|
|
200
200
|
const entityInstance = new properties.entity();
|
|
201
201
|
const beforeExecutionContext = {
|
|
202
|
-
|
|
203
|
-
|
|
202
|
+
DATA: { entityMetadata, method, methodName, properties },
|
|
203
|
+
ENTITY: entityInstance,
|
|
204
204
|
result: { authenticationRequest, headers, ip, parameters },
|
|
205
205
|
ROUTE_TYPE: EApiRouteType.GET,
|
|
206
206
|
};
|
|
@@ -227,8 +227,8 @@ class ApiControllerFactory {
|
|
|
227
227
|
const response = await this.service.get(requestProperties);
|
|
228
228
|
ApiControllerTransformData(properties.routes[method]?.response?.transformers, properties, { response }, { authenticationRequest, headers, ip });
|
|
229
229
|
const afterExecutionContext = {
|
|
230
|
-
|
|
231
|
-
|
|
230
|
+
DATA: { ...beforeExecutionContext.DATA, authenticationRequest, headers, ip, parameters },
|
|
231
|
+
ENTITY: response,
|
|
232
232
|
result: response,
|
|
233
233
|
ROUTE_TYPE: EApiRouteType.GET,
|
|
234
234
|
};
|
|
@@ -242,8 +242,8 @@ class ApiControllerFactory {
|
|
|
242
242
|
}
|
|
243
243
|
catch (error) {
|
|
244
244
|
const errorExecutionContext = {
|
|
245
|
-
|
|
246
|
-
|
|
245
|
+
DATA: { ...beforeExecutionContext.DATA, authenticationRequest, headers, ip, parameters },
|
|
246
|
+
ENTITY: entityInstance,
|
|
247
247
|
ROUTE_TYPE: EApiRouteType.GET,
|
|
248
248
|
};
|
|
249
249
|
await ApiSubscriberExecutor.executeRouteSubscribers(this.constructor, entityInstance, EApiRouteType.GET, EApiSubscriberOnType.AFTER_ERROR, errorExecutionContext, error);
|
|
@@ -255,8 +255,8 @@ class ApiControllerFactory {
|
|
|
255
255
|
this.targetPrototype[methodName] = Object.defineProperty(async function (query, headers, ip, authenticationRequest) {
|
|
256
256
|
const entityInstance = new properties.entity();
|
|
257
257
|
const beforeExecutionContext = {
|
|
258
|
-
|
|
259
|
-
|
|
258
|
+
DATA: { entityMetadata, method, methodName, properties },
|
|
259
|
+
ENTITY: entityInstance,
|
|
260
260
|
result: { authenticationRequest, headers, ip, query },
|
|
261
261
|
ROUTE_TYPE: EApiRouteType.GET_LIST,
|
|
262
262
|
};
|
|
@@ -285,8 +285,8 @@ class ApiControllerFactory {
|
|
|
285
285
|
const response = await this.service.getList(requestProperties);
|
|
286
286
|
ApiControllerTransformData(properties.routes[method]?.request?.transformers, properties, { response }, { authenticationRequest, headers, ip });
|
|
287
287
|
const afterExecutionContext = {
|
|
288
|
-
|
|
289
|
-
|
|
288
|
+
DATA: { ...beforeExecutionContext.DATA, authenticationRequest, headers, ip, query },
|
|
289
|
+
ENTITY: entityInstance,
|
|
290
290
|
result: response,
|
|
291
291
|
ROUTE_TYPE: EApiRouteType.GET_LIST,
|
|
292
292
|
};
|
|
@@ -300,8 +300,8 @@ class ApiControllerFactory {
|
|
|
300
300
|
}
|
|
301
301
|
catch (error) {
|
|
302
302
|
const errorExecutionContext = {
|
|
303
|
-
|
|
304
|
-
|
|
303
|
+
DATA: { ...beforeExecutionContext.DATA, authenticationRequest, headers, ip, query },
|
|
304
|
+
ENTITY: entityInstance,
|
|
305
305
|
ROUTE_TYPE: EApiRouteType.GET_LIST,
|
|
306
306
|
};
|
|
307
307
|
await ApiSubscriberExecutor.executeRouteSubscribers(this.constructor, entityInstance, EApiRouteType.GET_LIST, EApiSubscriberOnType.AFTER_ERROR, errorExecutionContext, error);
|
|
@@ -313,8 +313,8 @@ class ApiControllerFactory {
|
|
|
313
313
|
this.targetPrototype[methodName] = Object.defineProperty(async function (parameters, body, headers, ip, authenticationRequest) {
|
|
314
314
|
const entityInstance = new properties.entity();
|
|
315
315
|
const beforeExecutionContext = {
|
|
316
|
-
|
|
317
|
-
|
|
316
|
+
DATA: { entityMetadata, method, methodName, properties },
|
|
317
|
+
ENTITY: entityInstance,
|
|
318
318
|
result: { authenticationRequest, body, headers, ip, parameters },
|
|
319
319
|
ROUTE_TYPE: EApiRouteType.PARTIAL_UPDATE,
|
|
320
320
|
};
|
|
@@ -341,8 +341,8 @@ class ApiControllerFactory {
|
|
|
341
341
|
const response = await this.service.update(requestCriteria, body);
|
|
342
342
|
ApiControllerTransformData(properties.routes[method]?.response?.transformers, properties, { response }, { authenticationRequest, headers, ip });
|
|
343
343
|
const afterExecutionContext = {
|
|
344
|
-
|
|
345
|
-
|
|
344
|
+
DATA: { ...beforeExecutionContext.DATA, authenticationRequest, body, headers, ip, parameters },
|
|
345
|
+
ENTITY: response,
|
|
346
346
|
result: response,
|
|
347
347
|
ROUTE_TYPE: EApiRouteType.PARTIAL_UPDATE,
|
|
348
348
|
};
|
|
@@ -356,8 +356,8 @@ class ApiControllerFactory {
|
|
|
356
356
|
}
|
|
357
357
|
catch (error) {
|
|
358
358
|
const errorExecutionContext = {
|
|
359
|
-
|
|
360
|
-
|
|
359
|
+
DATA: { ...beforeExecutionContext.DATA, authenticationRequest, body, headers, ip, parameters },
|
|
360
|
+
ENTITY: entityInstance,
|
|
361
361
|
ROUTE_TYPE: EApiRouteType.PARTIAL_UPDATE,
|
|
362
362
|
};
|
|
363
363
|
await ApiSubscriberExecutor.executeRouteSubscribers(this.constructor, entityInstance, EApiRouteType.PARTIAL_UPDATE, EApiSubscriberOnType.AFTER_ERROR, errorExecutionContext, error);
|
|
@@ -369,8 +369,8 @@ class ApiControllerFactory {
|
|
|
369
369
|
this.targetPrototype[methodName] = Object.defineProperty(async function (parameters, body, headers, ip, authenticationRequest) {
|
|
370
370
|
const entityInstance = new properties.entity();
|
|
371
371
|
const beforeExecutionContext = {
|
|
372
|
-
|
|
373
|
-
|
|
372
|
+
DATA: { entityMetadata, method, methodName, properties },
|
|
373
|
+
ENTITY: entityInstance,
|
|
374
374
|
result: { authenticationRequest, body, headers, ip, parameters },
|
|
375
375
|
ROUTE_TYPE: EApiRouteType.UPDATE,
|
|
376
376
|
};
|
|
@@ -397,8 +397,8 @@ class ApiControllerFactory {
|
|
|
397
397
|
const response = await this.service.update(requestCriteria, body);
|
|
398
398
|
ApiControllerTransformData(properties.routes[method]?.response?.transformers, properties, { response }, { authenticationRequest, headers, ip });
|
|
399
399
|
const afterExecutionContext = {
|
|
400
|
-
|
|
401
|
-
|
|
400
|
+
DATA: { ...beforeExecutionContext.DATA, authenticationRequest, body, headers, ip, parameters },
|
|
401
|
+
ENTITY: response,
|
|
402
402
|
result: response,
|
|
403
403
|
ROUTE_TYPE: EApiRouteType.UPDATE,
|
|
404
404
|
};
|
|
@@ -412,8 +412,8 @@ class ApiControllerFactory {
|
|
|
412
412
|
}
|
|
413
413
|
catch (error) {
|
|
414
414
|
const errorExecutionContext = {
|
|
415
|
-
|
|
416
|
-
|
|
415
|
+
DATA: { ...beforeExecutionContext.DATA, authenticationRequest, body, headers, ip, parameters },
|
|
416
|
+
ENTITY: entityInstance,
|
|
417
417
|
ROUTE_TYPE: EApiRouteType.UPDATE,
|
|
418
418
|
};
|
|
419
419
|
await ApiSubscriberExecutor.executeRouteSubscribers(this.constructor, entityInstance, EApiRouteType.UPDATE, EApiSubscriberOnType.AFTER_ERROR, errorExecutionContext, error);
|
|
@@ -3,7 +3,6 @@ import type { IApiSubscriberFunctionExecutionContext } from './function-executio
|
|
|
3
3
|
import type { IApiSubscriber } from './interface';
|
|
4
4
|
import type { TApiFunctionCreateProperties } from '../../../../type/decorator/api/function/index';
|
|
5
5
|
export interface IApiSubscriberFunction<E extends IApiBaseEntity> extends IApiSubscriber {
|
|
6
|
-
[key: string]: unknown;
|
|
7
6
|
onAfterCreate?(context: IApiSubscriberFunctionExecutionContext<E, E>): Promise<E | undefined>;
|
|
8
7
|
onAfterDelete?(context: IApiSubscriberFunctionExecutionContext<E, E>): Promise<E | undefined>;
|
|
9
8
|
onAfterErrorCreate?(context: IApiSubscriberFunctionExecutionContext<E, never>, error: Error): Promise<void>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { ApiServiceBase } from '../../../../class/api/index';
|
|
2
|
-
export type TApiControllerConstructor = new (...arguments_: Array<
|
|
3
|
-
service: ApiServiceBase<
|
|
2
|
+
export type TApiControllerConstructor = new (...arguments_: Array<any>) => {
|
|
3
|
+
service: ApiServiceBase<any>;
|
|
4
4
|
};
|
|
@@ -3,7 +3,7 @@ import type { TApiPropertyDescribeArrayOptionalProperties, TApiPropertyDescribeA
|
|
|
3
3
|
import type { TApiPropertyDescribeBaseProperties } from './base-properties.type';
|
|
4
4
|
export type TApiPropertyDescribeEnumProperties = {
|
|
5
5
|
description: string;
|
|
6
|
-
enum: Record<string,
|
|
6
|
+
enum: Record<string, number | string>;
|
|
7
7
|
enumName: string;
|
|
8
8
|
type: EApiPropertyDescribeType.ENUM;
|
|
9
9
|
} & (TApiPropertyDescribeArrayOptionalProperties | TApiPropertyDescribeArrayRequiredProperties) & TApiPropertyDescribeBaseProperties;
|
|
@@ -2,7 +2,7 @@ import type { ApiServiceBase } from '../../../../class/api/index';
|
|
|
2
2
|
import type { EApiRouteType } from '../../../../enum/decorator/api/index';
|
|
3
3
|
import type { TApiControllerMethodMap } from './method-map.type';
|
|
4
4
|
import type { TApiControllerMethodName } from './method-name.type';
|
|
5
|
-
export type TApiControllerTargetMethod<E> = new (...arguments_: Array<
|
|
5
|
+
export type TApiControllerTargetMethod<E> = new (...arguments_: Array<any>) => {
|
|
6
6
|
[K in EApiRouteType as TApiControllerMethodName<K>]: TApiControllerMethodMap<E>[K];
|
|
7
7
|
} & {
|
|
8
8
|
service: ApiServiceBase<E>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"is-error-of-type.utility.js","sources":["../../../../src/utility/is-error-of-type.utility.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;AAAA;AA8BA,MAAM,YAAY,GAAwD;AACzE,IAAA,CAAC,UAAU,CAAC,WAAW,GAAG,mBAAmB;AAC7C,IAAA,CAAC,UAAU,CAAC,QAAQ,GAAG,iBAAiB;AACxC,IAAA,CAAC,UAAU,CAAC,kBAAkB,GAAG,SAAS;AAC1C,IAAA,CAAC,UAAU,CAAC,SAAS,GAAG,kBAAkB;AAC1C,IAAA,CAAC,UAAU,CAAC,eAAe,GAAG,uBAAuB;AACrD,IAAA,CAAC,UAAU,CAAC,IAAI,GAAG,aAAa;AAChC,IAAA,CAAC,UAAU,CAAC,0BAA0B,GAAG,gCAAgC;AACzE,IAAA,CAAC,UAAU,CAAC,WAAW,GAAG,kBAAkB;AAC5C,IAAA,CAAC,UAAU,CAAC,qBAAqB,GAAG,4BAA4B;AAChE,IAAA,CAAC,UAAU,CAAC,eAAe,GAAG,SAAS;AACvC,IAAA,CAAC,UAAU,CAAC,kBAAkB,GAAG,yBAAyB;AAC1D,IAAA,CAAC,UAAU,CAAC,+BAA+B,GAAG,SAAS;AACvD,IAAA,CAAC,UAAU,CAAC,cAAc,GAAG,sBAAsB;AACnD,IAAA,CAAC,UAAU,CAAC,YAAY,GAAG,SAAS;AACpC,IAAA,CAAC,UAAU,CAAC,SAAS,GAAG,iBAAiB;AACzC,IAAA,CAAC,UAAU,CAAC,eAAe,GAAG,uBAAuB;AACrD,IAAA,CAAC,UAAU,CAAC,iBAAiB,GAAG,wBAAwB;AACxD,IAAA,CAAC,UAAU,CAAC,gBAAgB,GAAG,SAAS;AACxC,IAAA,CAAC,UAAU,CAAC,mBAAmB,GAAG,2BAA2B;AAC7D,IAAA,CAAC,UAAU,CAAC,+BAA+B,GAAG,SAAS;AACvD,IAAA,CAAC,UAAU,CAAC,eAAe,GAAG,uBAAuB;AACrD,IAAA,CAAC,UAAU,CAAC,oBAAoB,GAAG,SAAS;AAC5C,IAAA,CAAC,UAAU,CAAC,mBAAmB,GAAG,2BAA2B;AAC7D,IAAA,CAAC,UAAU,CAAC,iBAAiB,GAAG,kBAAkB;AAClD,IAAA,CAAC,UAAU,CAAC,YAAY,GAAG,qBAAqB;AAChD,IAAA,CAAC,UAAU,CAAC,oBAAoB,GAAG,4BAA4B;AAC/D,IAAA,CAAC,UAAU,CAAC,sBAAsB,GAAG,6BAA6B;AAClE,IAAA,CAAC,UAAU,CAAC,gBAAgB,GAAG,SAAS;CACxC;AAED;;;;;AAKG;AACG,SAAU,aAAa,CAAC,KAAc,EAAE,IAAgB,EAAA;AAC7D,IAAA,MAAM,cAAc,
|
|
1
|
+
{"version":3,"file":"is-error-of-type.utility.js","sources":["../../../../src/utility/is-error-of-type.utility.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;AAAA;AA8BA,MAAM,YAAY,GAAwD;AACzE,IAAA,CAAC,UAAU,CAAC,WAAW,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