@elsikora/nestjs-crud-automator 1.11.0 → 1.11.1-dev.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/README.md +293 -300
- package/dist/cjs/class/api/subscriber/executor.class.d.ts +6 -2
- package/dist/cjs/class/api/subscriber/executor.class.js +32 -4
- package/dist/cjs/class/api/subscriber/executor.class.js.map +1 -1
- package/dist/cjs/decorator/api/function/create.decorator.js +9 -4
- package/dist/cjs/decorator/api/function/create.decorator.js.map +1 -1
- package/dist/cjs/decorator/api/function/delete.decorator.js +9 -4
- package/dist/cjs/decorator/api/function/delete.decorator.js.map +1 -1
- package/dist/cjs/decorator/api/function/get-list.decorator.js +9 -4
- package/dist/cjs/decorator/api/function/get-list.decorator.js.map +1 -1
- package/dist/cjs/decorator/api/function/get-many.decorator.js +9 -4
- package/dist/cjs/decorator/api/function/get-many.decorator.js.map +1 -1
- package/dist/cjs/decorator/api/function/get.decorator.js +9 -4
- package/dist/cjs/decorator/api/function/get.decorator.js.map +1 -1
- package/dist/cjs/decorator/api/function/update.decorator.js +9 -4
- package/dist/cjs/decorator/api/function/update.decorator.js.map +1 -1
- package/dist/cjs/factory/api/controller.factory.js +42 -17
- package/dist/cjs/factory/api/controller.factory.js.map +1 -1
- package/dist/cjs/interface/class/api/subscriber/error-execution-context.interface.d.ts +15 -0
- package/dist/cjs/interface/class/api/subscriber/execution-context.interface.d.ts +5 -1
- package/dist/cjs/interface/class/api/subscriber/function-error-execution-context.interface.d.ts +10 -0
- package/dist/cjs/interface/class/api/subscriber/function-execution-context.interface.d.ts +4 -0
- package/dist/cjs/interface/class/api/subscriber/function.interface.d.ts +13 -12
- package/dist/cjs/interface/class/api/subscriber/index.d.ts +3 -0
- package/dist/cjs/interface/class/api/subscriber/route-error-execution-context.interface.d.ts +10 -0
- package/dist/cjs/interface/class/api/subscriber/route-execution-context.interface.d.ts +4 -0
- package/dist/cjs/interface/class/api/subscriber/route.interface.d.ts +13 -12
- package/dist/esm/class/api/subscriber/executor.class.d.ts +6 -2
- package/dist/esm/class/api/subscriber/executor.class.js +32 -4
- package/dist/esm/class/api/subscriber/executor.class.js.map +1 -1
- package/dist/esm/decorator/api/function/create.decorator.js +9 -4
- package/dist/esm/decorator/api/function/create.decorator.js.map +1 -1
- package/dist/esm/decorator/api/function/delete.decorator.js +9 -4
- package/dist/esm/decorator/api/function/delete.decorator.js.map +1 -1
- package/dist/esm/decorator/api/function/get-list.decorator.js +9 -4
- package/dist/esm/decorator/api/function/get-list.decorator.js.map +1 -1
- package/dist/esm/decorator/api/function/get-many.decorator.js +9 -4
- package/dist/esm/decorator/api/function/get-many.decorator.js.map +1 -1
- package/dist/esm/decorator/api/function/get.decorator.js +9 -4
- package/dist/esm/decorator/api/function/get.decorator.js.map +1 -1
- package/dist/esm/decorator/api/function/update.decorator.js +9 -4
- package/dist/esm/decorator/api/function/update.decorator.js.map +1 -1
- package/dist/esm/factory/api/controller.factory.js +42 -17
- package/dist/esm/factory/api/controller.factory.js.map +1 -1
- package/dist/esm/interface/class/api/subscriber/error-execution-context.interface.d.ts +15 -0
- package/dist/esm/interface/class/api/subscriber/execution-context.interface.d.ts +5 -1
- package/dist/esm/interface/class/api/subscriber/function-error-execution-context.interface.d.ts +10 -0
- package/dist/esm/interface/class/api/subscriber/function-execution-context.interface.d.ts +4 -0
- package/dist/esm/interface/class/api/subscriber/function.interface.d.ts +13 -12
- package/dist/esm/interface/class/api/subscriber/index.d.ts +3 -0
- package/dist/esm/interface/class/api/subscriber/route-error-execution-context.interface.d.ts +10 -0
- package/dist/esm/interface/class/api/subscriber/route-execution-context.interface.d.ts +4 -0
- package/dist/esm/interface/class/api/subscriber/route.interface.d.ts +13 -12
- package/package.json +1 -1
|
@@ -1,28 +1,29 @@
|
|
|
1
1
|
import type { IApiBaseEntity } from '../../../api-base-entity.interface';
|
|
2
|
+
import type { IApiSubscriberFunctionErrorExecutionContext } from './function-error-execution-context.interface';
|
|
2
3
|
import type { IApiSubscriberFunctionExecutionContext } from './function-execution-context.interface';
|
|
3
4
|
import type { IApiSubscriber } from './interface';
|
|
4
5
|
import type { TApiFunctionCreateProperties } from '../../../../type/decorator/api/function/index';
|
|
5
6
|
export interface IApiSubscriberFunction<E extends IApiBaseEntity> extends IApiSubscriber {
|
|
6
7
|
onAfterCreate?(context: IApiSubscriberFunctionExecutionContext<E, E>): Promise<E | undefined>;
|
|
7
8
|
onAfterDelete?(context: IApiSubscriberFunctionExecutionContext<E, E>): Promise<E | undefined>;
|
|
8
|
-
onAfterErrorCreate?(context:
|
|
9
|
-
onAfterErrorDelete?(context:
|
|
10
|
-
onAfterErrorGet?(context:
|
|
11
|
-
onAfterErrorGetList?(context:
|
|
12
|
-
onAfterErrorGetMany?(context:
|
|
13
|
-
onAfterErrorUpdate?(context:
|
|
9
|
+
onAfterErrorCreate?(context: IApiSubscriberFunctionErrorExecutionContext<E>, error: Error): Promise<void>;
|
|
10
|
+
onAfterErrorDelete?(context: IApiSubscriberFunctionErrorExecutionContext<E>, error: Error): Promise<void>;
|
|
11
|
+
onAfterErrorGet?(context: IApiSubscriberFunctionErrorExecutionContext<E>, error: Error): Promise<void>;
|
|
12
|
+
onAfterErrorGetList?(context: IApiSubscriberFunctionErrorExecutionContext<E>, error: Error): Promise<void>;
|
|
13
|
+
onAfterErrorGetMany?(context: IApiSubscriberFunctionErrorExecutionContext<E>, error: Error): Promise<void>;
|
|
14
|
+
onAfterErrorUpdate?(context: IApiSubscriberFunctionErrorExecutionContext<E>, error: Error): Promise<void>;
|
|
14
15
|
onAfterGet?(context: IApiSubscriberFunctionExecutionContext<E, E>): Promise<E | undefined>;
|
|
15
16
|
onAfterGetList?(context: IApiSubscriberFunctionExecutionContext<E, Array<E>>): Promise<Array<E> | undefined>;
|
|
16
17
|
onAfterGetMany?(context: IApiSubscriberFunctionExecutionContext<E, Array<E>>): Promise<Array<E> | undefined>;
|
|
17
18
|
onAfterUpdate?(context: IApiSubscriberFunctionExecutionContext<E, E>): Promise<E | undefined>;
|
|
18
19
|
onBeforeCreate?(context: IApiSubscriberFunctionExecutionContext<E, TApiFunctionCreateProperties<E>>): Promise<TApiFunctionCreateProperties<E> | undefined>;
|
|
19
20
|
onBeforeDelete?(context: IApiSubscriberFunctionExecutionContext<E, E>): Promise<E | undefined>;
|
|
20
|
-
onBeforeErrorCreate?(context:
|
|
21
|
-
onBeforeErrorDelete?(context:
|
|
22
|
-
onBeforeErrorGet?(context:
|
|
23
|
-
onBeforeErrorGetList?(context:
|
|
24
|
-
onBeforeErrorGetMany?(context:
|
|
25
|
-
onBeforeErrorUpdate?(context:
|
|
21
|
+
onBeforeErrorCreate?(context: IApiSubscriberFunctionErrorExecutionContext<E>, error: Error): Promise<void>;
|
|
22
|
+
onBeforeErrorDelete?(context: IApiSubscriberFunctionErrorExecutionContext<E>, error: Error): Promise<void>;
|
|
23
|
+
onBeforeErrorGet?(context: IApiSubscriberFunctionErrorExecutionContext<E>, error: Error): Promise<void>;
|
|
24
|
+
onBeforeErrorGetList?(context: IApiSubscriberFunctionErrorExecutionContext<E>, error: Error): Promise<void>;
|
|
25
|
+
onBeforeErrorGetMany?(context: IApiSubscriberFunctionErrorExecutionContext<E>, error: Error): Promise<void>;
|
|
26
|
+
onBeforeErrorUpdate?(context: IApiSubscriberFunctionErrorExecutionContext<E>, error: Error): Promise<void>;
|
|
26
27
|
onBeforeGet?(context: IApiSubscriberFunctionExecutionContext<E, E>): Promise<E | undefined>;
|
|
27
28
|
onBeforeGetList?(context: IApiSubscriberFunctionExecutionContext<E, E>): Promise<E | undefined>;
|
|
28
29
|
onBeforeGetMany?(context: IApiSubscriberFunctionExecutionContext<E, E>): Promise<E | undefined>;
|
|
@@ -1,6 +1,9 @@
|
|
|
1
|
+
export type * from './error-execution-context.interface';
|
|
1
2
|
export type * from './execution-context.interface';
|
|
3
|
+
export type * from './function-error-execution-context.interface';
|
|
2
4
|
export type * from './function-execution-context.interface';
|
|
3
5
|
export type * from './function.interface';
|
|
4
6
|
export type * from './interface';
|
|
7
|
+
export type * from './route-error-execution-context.interface';
|
|
5
8
|
export type * from './route-execution-context.interface';
|
|
6
9
|
export type * from './route.interface';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { EApiRouteType } from '../../../../enum/decorator/api/route-type.enum';
|
|
2
|
+
import type { IApiBaseEntity } from '../../../api-base-entity.interface';
|
|
3
|
+
import type { IApiSubscriberErrorExecutionContext } from './error-execution-context.interface';
|
|
4
|
+
/**
|
|
5
|
+
* Error execution context for route subscriber callbacks.
|
|
6
|
+
* Contains route type information but no result field.
|
|
7
|
+
*/
|
|
8
|
+
export interface IApiSubscriberRouteErrorExecutionContext<E extends IApiBaseEntity, Input = unknown> extends IApiSubscriberErrorExecutionContext<E, Input> {
|
|
9
|
+
readonly ROUTE_TYPE: EApiRouteType;
|
|
10
|
+
}
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import type { EApiRouteType } from '../../../../enum/decorator/api/route-type.enum';
|
|
2
2
|
import type { IApiBaseEntity } from '../../../api-base-entity.interface';
|
|
3
3
|
import type { IApiSubscriberExecutionContext } from './execution-context.interface';
|
|
4
|
+
/**
|
|
5
|
+
* Execution context for route subscriber callbacks.
|
|
6
|
+
* Extends base execution context with route type information.
|
|
7
|
+
*/
|
|
4
8
|
export interface IApiSubscriberRouteExecutionContext<E extends IApiBaseEntity, Result = unknown, Input = unknown> extends IApiSubscriberExecutionContext<E, Result, Input> {
|
|
5
9
|
readonly ROUTE_TYPE: EApiRouteType;
|
|
6
10
|
}
|
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
import type { IApiBaseEntity } from '../../../api-base-entity.interface';
|
|
2
2
|
import type { IApiSubscriber } from './interface';
|
|
3
|
+
import type { IApiSubscriberRouteErrorExecutionContext } from './route-error-execution-context.interface';
|
|
3
4
|
import type { IApiSubscriberRouteExecutionContext } from './route-execution-context.interface';
|
|
4
5
|
import type { DeepPartial } from "typeorm";
|
|
5
6
|
export interface IApiSubscriberRoute<E extends IApiBaseEntity> extends IApiSubscriber {
|
|
6
7
|
onAfterCreate?(context: IApiSubscriberRouteExecutionContext<E, E>): Promise<E | undefined>;
|
|
7
8
|
onAfterDelete?(context: IApiSubscriberRouteExecutionContext<E, E>): Promise<E | undefined>;
|
|
8
|
-
onAfterErrorCreate?(context:
|
|
9
|
-
onAfterErrorDelete?(context:
|
|
10
|
-
onAfterErrorGet?(context:
|
|
11
|
-
onAfterErrorGetList?(context:
|
|
12
|
-
onAfterErrorGetMany?(context:
|
|
13
|
-
onAfterErrorUpdate?(context:
|
|
9
|
+
onAfterErrorCreate?(context: IApiSubscriberRouteErrorExecutionContext<E>, error: Error): Promise<void>;
|
|
10
|
+
onAfterErrorDelete?(context: IApiSubscriberRouteErrorExecutionContext<E>, error: Error): Promise<void>;
|
|
11
|
+
onAfterErrorGet?(context: IApiSubscriberRouteErrorExecutionContext<E>, error: Error): Promise<void>;
|
|
12
|
+
onAfterErrorGetList?(context: IApiSubscriberRouteErrorExecutionContext<E>, error: Error): Promise<void>;
|
|
13
|
+
onAfterErrorGetMany?(context: IApiSubscriberRouteErrorExecutionContext<E>, error: Error): Promise<void>;
|
|
14
|
+
onAfterErrorUpdate?(context: IApiSubscriberRouteErrorExecutionContext<E>, error: Error): Promise<void>;
|
|
14
15
|
onAfterGet?(context: IApiSubscriberRouteExecutionContext<E, E>): Promise<E | undefined>;
|
|
15
16
|
onAfterGetList?(context: IApiSubscriberRouteExecutionContext<E, Array<E>>): Promise<Array<E> | undefined>;
|
|
16
17
|
onAfterGetMany?(context: IApiSubscriberRouteExecutionContext<E, Array<E>>): Promise<Array<E> | undefined>;
|
|
@@ -21,12 +22,12 @@ export interface IApiSubscriberRoute<E extends IApiBaseEntity> extends IApiSubsc
|
|
|
21
22
|
body: DeepPartial<E>;
|
|
22
23
|
} | undefined>;
|
|
23
24
|
onBeforeDelete?(context: IApiSubscriberRouteExecutionContext<E, E>): Promise<E | undefined>;
|
|
24
|
-
onBeforeErrorCreate?(context:
|
|
25
|
-
onBeforeErrorDelete?(context:
|
|
26
|
-
onBeforeErrorGet?(context:
|
|
27
|
-
onBeforeErrorGetList?(context:
|
|
28
|
-
onBeforeErrorGetMany?(context:
|
|
29
|
-
onBeforeErrorUpdate?(context:
|
|
25
|
+
onBeforeErrorCreate?(context: IApiSubscriberRouteErrorExecutionContext<E>, error: Error): Promise<void>;
|
|
26
|
+
onBeforeErrorDelete?(context: IApiSubscriberRouteErrorExecutionContext<E>, error: Error): Promise<void>;
|
|
27
|
+
onBeforeErrorGet?(context: IApiSubscriberRouteErrorExecutionContext<E>, error: Error): Promise<void>;
|
|
28
|
+
onBeforeErrorGetList?(context: IApiSubscriberRouteErrorExecutionContext<E>, error: Error): Promise<void>;
|
|
29
|
+
onBeforeErrorGetMany?(context: IApiSubscriberRouteErrorExecutionContext<E>, error: Error): Promise<void>;
|
|
30
|
+
onBeforeErrorUpdate?(context: IApiSubscriberRouteErrorExecutionContext<E>, error: Error): Promise<void>;
|
|
30
31
|
onBeforeGet?(context: IApiSubscriberRouteExecutionContext<E, E>): Promise<E | undefined>;
|
|
31
32
|
onBeforeGetList?(context: IApiSubscriberRouteExecutionContext<E, E>): Promise<E | undefined>;
|
|
32
33
|
onBeforeGetMany?(context: IApiSubscriberRouteExecutionContext<E, E>): Promise<E | undefined>;
|