@solid-nestjs/common 0.2.2 → 0.2.4
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/enums/standard-actions.enum.d.ts +2 -1
- package/dist/enums/standard-actions.enum.d.ts.map +1 -1
- package/dist/enums/standard-actions.enum.js +1 -0
- package/dist/enums/standard-actions.enum.js.map +1 -1
- package/dist/interfaces/services/crud-service.interface.d.ts +86 -36
- package/dist/interfaces/services/crud-service.interface.d.ts.map +1 -1
- package/dist/interfaces/services/crud-service.interface.js +5 -0
- package/dist/interfaces/services/crud-service.interface.js.map +1 -1
- package/dist/interfaces/services/data-service.interface.d.ts +3 -3
- package/dist/interfaces/services/data-service.interface.d.ts.map +1 -1
- package/dist/interfaces/structures/crud-service-structure.interface.d.ts +53 -0
- package/dist/interfaces/structures/crud-service-structure.interface.d.ts.map +1 -0
- package/dist/interfaces/structures/crud-service-structure.interface.js +3 -0
- package/dist/interfaces/structures/crud-service-structure.interface.js.map +1 -0
- package/dist/interfaces/structures/data-service-structure.interface.d.ts +44 -0
- package/dist/interfaces/structures/data-service-structure.interface.d.ts.map +1 -0
- package/dist/interfaces/structures/data-service-structure.interface.js +3 -0
- package/dist/interfaces/structures/data-service-structure.interface.js.map +1 -0
- package/dist/interfaces/structures/entity-provider-structure.interface.d.ts +12 -2
- package/dist/interfaces/structures/entity-provider-structure.interface.d.ts.map +1 -1
- package/dist/interfaces/structures/entity-provider-structure.interface.js +8 -0
- package/dist/interfaces/structures/entity-provider-structure.interface.js.map +1 -1
- package/dist/interfaces/structures/index.d.ts +3 -0
- package/dist/interfaces/structures/index.d.ts.map +1 -1
- package/dist/interfaces/structures/index.js +1 -0
- package/dist/interfaces/structures/index.js.map +1 -1
- package/dist/interfaces/structures/service-plugins.interface.d.ts +223 -0
- package/dist/interfaces/structures/service-plugins.interface.d.ts.map +1 -0
- package/dist/interfaces/structures/service-plugins.interface.js +3 -0
- package/dist/interfaces/structures/service-plugins.interface.js.map +1 -0
- package/dist/types/index.d.ts +2 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js +2 -0
- package/dist/types/index.js.map +1 -1
- package/dist/types/prettify.type.d.ts +4 -0
- package/dist/types/prettify.type.d.ts.map +1 -0
- package/dist/types/prettify.type.js +3 -0
- package/dist/types/prettify.type.js.map +1 -0
- package/dist/types/union-to-intersection.type.d.ts +2 -0
- package/dist/types/union-to-intersection.type.d.ts.map +1 -0
- package/dist/types/union-to-intersection.type.js +3 -0
- package/dist/types/union-to-intersection.type.js.map +1 -0
- package/dist/utils/http-status.utils.d.ts.map +1 -1
- package/dist/utils/http-status.utils.js +5 -1
- package/dist/utils/http-status.utils.js.map +1 -1
- package/package.json +9 -3
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"standard-actions.enum.d.ts","sourceRoot":"","sources":["../../src/enums/standard-actions.enum.ts"],"names":[],"mappings":"AAAA,oBAAY,eAAe;IACzB,MAAM,WAAW;IACjB,MAAM,WAAW;IACjB,MAAM,WAAW;
|
1
|
+
{"version":3,"file":"standard-actions.enum.d.ts","sourceRoot":"","sources":["../../src/enums/standard-actions.enum.ts"],"names":[],"mappings":"AAAA,oBAAY,eAAe;IACzB,MAAM,WAAW;IACjB,MAAM,WAAW;IACjB,MAAM,WAAW;IACjB,OAAO,YAAY;CACpB"}
|
@@ -6,5 +6,6 @@ var StandardActions;
|
|
6
6
|
StandardActions["Create"] = "Create";
|
7
7
|
StandardActions["Update"] = "Update";
|
8
8
|
StandardActions["Remove"] = "Remove";
|
9
|
+
StandardActions["Recover"] = "Recover";
|
9
10
|
})(StandardActions || (exports.StandardActions = StandardActions = {}));
|
10
11
|
//# sourceMappingURL=standard-actions.enum.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"standard-actions.enum.js","sourceRoot":"","sources":["../../src/enums/standard-actions.enum.ts"],"names":[],"mappings":";;;AAAA,IAAY,
|
1
|
+
{"version":3,"file":"standard-actions.enum.js","sourceRoot":"","sources":["../../src/enums/standard-actions.enum.ts"],"names":[],"mappings":";;;AAAA,IAAY,eAKX;AALD,WAAY,eAAe;IACzB,oCAAiB,CAAA;IACjB,oCAAiB,CAAA;IACjB,oCAAiB,CAAA;IACjB,sCAAmB,CAAA;AACrB,CAAC,EALW,eAAe,+BAAf,eAAe,QAK1B"}
|
@@ -1,48 +1,84 @@
|
|
1
1
|
import { DeepPartial } from '../../types';
|
2
|
-
import { Context, IdTypeFrom, Entity } from '../misc';
|
2
|
+
import { Context, IdTypeFrom, Entity, FindArgs } from '../misc';
|
3
3
|
import { DataService } from './data-service.interface';
|
4
4
|
/**
|
5
|
-
* Interface
|
5
|
+
* Interface for Create, Update, and Delete operations without soft deletion support.
|
6
6
|
*
|
7
|
-
* @typeParam IdType - The type of the entity's identifier.
|
8
|
-
* @typeParam EntityType - The type of the entity managed by the service
|
9
|
-
* @typeParam CreateInputType - The type
|
10
|
-
* @typeParam UpdateInputType - The type
|
11
|
-
* @typeParam ContextType - The type
|
12
|
-
*
|
13
|
-
* @remarks
|
14
|
-
* This interface abstracts the basic CUD operations for entities, allowing implementations to define
|
15
|
-
* how entities are created, updated, and removed (both soft and hard deletes).
|
16
|
-
*
|
17
|
-
* @method create - Creates a new entity using the provided input and context.
|
18
|
-
* @param context - The operation context.
|
19
|
-
* @param createInput - The data required to create the entity.
|
20
|
-
* @returns A promise resolving to the created entity.
|
21
|
-
*
|
22
|
-
* @method update - Updates an existing entity identified by `id` with the provided input and context.
|
23
|
-
* @param context - The operation context.
|
24
|
-
* @param id - The identifier of the entity to update.
|
25
|
-
* @param updateInput - The data to update the entity with.
|
26
|
-
* @returns A promise resolving to the updated entity.
|
27
|
-
*
|
28
|
-
* @method remove - Performs a soft delete of the entity identified by `id` in the given context.
|
29
|
-
* @param context - The operation context.
|
30
|
-
* @param id - The identifier of the entity to remove.
|
31
|
-
* @returns A promise resolving to the removed entity.
|
32
|
-
*
|
33
|
-
* @method hardRemove - Permanently deletes the entity identified by `id` in the given context.
|
34
|
-
* @param context - The operation context.
|
35
|
-
* @param id - The identifier of the entity to hard remove.
|
36
|
-
* @returns A promise resolving to the hard-removed entity.
|
7
|
+
* @typeParam IdType - The type of the entity's identifier, derived from the entity type.
|
8
|
+
* @typeParam EntityType - The type of the entity managed by the service, extending `Entity<unknown>`.
|
9
|
+
* @typeParam CreateInputType - The type used for creating new entities, typically a partial of `EntityType`.
|
10
|
+
* @typeParam UpdateInputType - The type used for updating entities, typically a partial of `EntityType`.
|
11
|
+
* @typeParam ContextType - The context type for the service, defaults to `Context`.
|
37
12
|
*/
|
38
|
-
export interface CudService<IdType extends IdTypeFrom<EntityType>, EntityType extends Entity<unknown>, CreateInputType extends DeepPartial<EntityType>, UpdateInputType extends DeepPartial<EntityType>, ContextType extends Context = Context> {
|
13
|
+
export interface CudService<IdType extends IdTypeFrom<EntityType>, EntityType extends Entity<unknown>, CreateInputType extends DeepPartial<EntityType>, UpdateInputType extends DeepPartial<EntityType>, FindArgsType extends FindArgs<EntityType> = FindArgs<EntityType>, ContextType extends Context = Context> {
|
14
|
+
/**
|
15
|
+
* Creates a new entity.
|
16
|
+
*
|
17
|
+
* @param context - The execution context for the operation.
|
18
|
+
* @param createInput - The data for creating the new entity.
|
19
|
+
* @returns A promise that resolves to the created entity.
|
20
|
+
*/
|
39
21
|
create(context: ContextType, createInput: CreateInputType): Promise<EntityType>;
|
22
|
+
/**
|
23
|
+
* Updates an existing entity.
|
24
|
+
*
|
25
|
+
* @param context - The execution context for the operation.
|
26
|
+
* @param id - The identifier of the entity to update.
|
27
|
+
* @param updateInput - The data for updating the entity.
|
28
|
+
* @returns A promise that resolves to the updated entity.
|
29
|
+
*/
|
40
30
|
update(context: ContextType, id: IdType, updateInput: UpdateInputType): Promise<EntityType>;
|
31
|
+
/**
|
32
|
+
* Removes an entity. The removal behavior depends on the implementation
|
33
|
+
* (could be soft or hard delete).
|
34
|
+
*
|
35
|
+
* @param context - The execution context for the operation.
|
36
|
+
* @param id - The identifier of the entity to remove.
|
37
|
+
* @returns A promise that resolves to the removed entity.
|
38
|
+
*/
|
41
39
|
remove(context: ContextType, id: IdType): Promise<EntityType>;
|
40
|
+
}
|
41
|
+
/**
|
42
|
+
* Interface for services that support soft deletion and recovery operations.
|
43
|
+
* Extends the basic CUD operations with soft deletion capabilities.
|
44
|
+
*
|
45
|
+
* @typeParam IdType - The type of the entity's identifier, derived from the entity type.
|
46
|
+
* @typeParam EntityType - The type of the entity managed by the service, extending `Entity<unknown>`.
|
47
|
+
* @typeParam CreateInputType - The type used for creating new entities, typically a partial of `EntityType`.
|
48
|
+
* @typeParam UpdateInputType - The type used for updating entities, typically a partial of `EntityType`.
|
49
|
+
* @typeParam ContextType - The context type for the service, defaults to `Context`.
|
50
|
+
*/
|
51
|
+
export interface SoftDeletableCudService<IdType extends IdTypeFrom<EntityType>, EntityType extends Entity<unknown>, CreateInputType extends DeepPartial<EntityType>, UpdateInputType extends DeepPartial<EntityType>, FindArgsType extends FindArgs<EntityType> = FindArgs<EntityType>, ContextType extends Context = Context> extends CudService<IdType, EntityType, CreateInputType, UpdateInputType, FindArgsType, ContextType> {
|
52
|
+
/**
|
53
|
+
* Soft removes an entity by marking it as deleted without permanently removing it.
|
54
|
+
* The entity can be recovered later using the recover method.
|
55
|
+
*
|
56
|
+
* @param context - The execution context for the operation.
|
57
|
+
* @param id - The identifier of the entity to soft remove.
|
58
|
+
* @returns A promise that resolves to the soft-removed entity.
|
59
|
+
*/
|
60
|
+
softRemove(context: ContextType, id: IdType): Promise<EntityType>;
|
61
|
+
/**
|
62
|
+
* Permanently removes an entity from the data store.
|
63
|
+
* This operation cannot be undone.
|
64
|
+
*
|
65
|
+
* @param context - The execution context for the operation.
|
66
|
+
* @param id - The identifier of the entity to permanently remove.
|
67
|
+
* @returns A promise that resolves to the permanently removed entity.
|
68
|
+
*/
|
42
69
|
hardRemove(context: ContextType, id: IdType): Promise<EntityType>;
|
70
|
+
/**
|
71
|
+
* Recovers a previously soft-removed entity, making it active again.
|
72
|
+
*
|
73
|
+
* @param context - The execution context for the operation.
|
74
|
+
* @param id - The identifier of the entity to recover.
|
75
|
+
* @returns A promise that resolves to the recovered entity.
|
76
|
+
*/
|
77
|
+
recover(context: ContextType, id: IdType): Promise<EntityType>;
|
43
78
|
}
|
44
79
|
/**
|
45
|
-
* Generic interface for a CRUD (Create, Read, Update, Delete) service.
|
80
|
+
* Generic interface for a full CRUD (Create, Read, Update, Delete) service.
|
81
|
+
* Combines read operations from DataService with write operations from CudService.
|
46
82
|
*
|
47
83
|
* @typeParam IdType - The type of the entity's identifier, derived from the entity type.
|
48
84
|
* @typeParam EntityType - The type of the entity managed by the service, extending `Entity<unknown>`.
|
@@ -52,8 +88,22 @@ export interface CudService<IdType extends IdTypeFrom<EntityType>, EntityType ex
|
|
52
88
|
*
|
53
89
|
* @remarks
|
54
90
|
* This interface extends both `DataService` and `CudService`, combining read and write operations
|
55
|
-
* for entities. It is intended to be implemented by services that provide
|
91
|
+
* for entities. It is intended to be implemented by services that provide basic CRUD functionality
|
92
|
+
* without soft deletion support.
|
93
|
+
*/
|
94
|
+
export interface CrudService<IdType extends IdTypeFrom<EntityType>, EntityType extends Entity<unknown>, CreateInputType extends DeepPartial<EntityType>, UpdateInputType extends DeepPartial<EntityType>, FindArgsType extends FindArgs<EntityType> = FindArgs<EntityType>, ContextType extends Context = Context> extends DataService<IdType, EntityType, FindArgsType, ContextType>, CudService<IdType, EntityType, CreateInputType, UpdateInputType, FindArgsType, ContextType> {
|
95
|
+
}
|
96
|
+
/**
|
97
|
+
* Full CRUD service interface with soft deletion and recovery capabilities.
|
98
|
+
* Combines read operations from DataService with soft deletion operations from SoftDeletableService.
|
99
|
+
*
|
100
|
+
* @typeParam IdType - The type of the entity's identifier, derived from the entity type.
|
101
|
+
* @typeParam EntityType - The type of the entity managed by the service, extending `Entity<unknown>`.
|
102
|
+
* @typeParam CreateInputType - The type used for creating new entities, typically a partial of `EntityType`.
|
103
|
+
* @typeParam UpdateInputType - The type used for updating entities, typically a partial of `EntityType`.
|
104
|
+
* @typeParam ContextType - The context type for the service, defaults to `Context`.
|
56
105
|
*/
|
57
|
-
export interface
|
106
|
+
export interface SoftDeletableCrudService<IdType extends IdTypeFrom<EntityType>, EntityType extends Entity<unknown>, CreateInputType extends DeepPartial<EntityType>, UpdateInputType extends DeepPartial<EntityType>, FindArgsType extends FindArgs<EntityType> = FindArgs<EntityType>, ContextType extends Context = Context> extends DataService<IdType, EntityType, FindArgsType, ContextType>, SoftDeletableCudService<IdType, EntityType, CreateInputType, UpdateInputType, FindArgsType, ContextType> {
|
58
107
|
}
|
108
|
+
export declare function isSoftDeletableCrudService<IdType extends IdTypeFrom<EntityType>, EntityType extends Entity<unknown>, CreateInputType extends DeepPartial<EntityType>, UpdateInputType extends DeepPartial<EntityType>, FindArgsType extends FindArgs<EntityType> = FindArgs<EntityType>, ContextType extends Context = Context>(service: CrudService<IdType, EntityType, CreateInputType, UpdateInputType, FindArgsType, ContextType>): service is SoftDeletableCrudService<IdType, EntityType, CreateInputType, UpdateInputType, FindArgsType, ContextType>;
|
59
109
|
//# sourceMappingURL=crud-service.interface.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"crud-service.interface.d.ts","sourceRoot":"","sources":["../../../src/interfaces/services/crud-service.interface.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;
|
1
|
+
{"version":3,"file":"crud-service.interface.d.ts","sourceRoot":"","sources":["../../../src/interfaces/services/crud-service.interface.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAChE,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAEvD;;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BAA0B,CACxC,MAAM,SAAS,UAAU,CAAC,UAAU,CAAC,EACrC,UAAU,SAAS,MAAM,CAAC,OAAO,CAAC,EAClC,eAAe,SAAS,WAAW,CAAC,UAAU,CAAC,EAC/C,eAAe,SAAS,WAAW,CAAC,UAAU,CAAC,EAC/C,YAAY,SAAS,QAAQ,CAAC,UAAU,CAAC,GAAG,QAAQ,CAAC,UAAU,CAAC,EAChE,WAAW,SAAS,OAAO,GAAG,OAAO,EAErC,OAAO,EAAE,WAAW,CAClB,MAAM,EACN,UAAU,EACV,eAAe,EACf,eAAe,EACf,YAAY,EACZ,WAAW,CACZ,GACA,OAAO,IAAI,wBAAwB,CACpC,MAAM,EACN,UAAU,EACV,eAAe,EACf,eAAe,EACf,YAAY,EACZ,WAAW,CACZ,CAEA"}
|
@@ -1,3 +1,8 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.isSoftDeletableCrudService = isSoftDeletableCrudService;
|
4
|
+
// Add this helper function before the CrudControllerFrom function
|
5
|
+
function isSoftDeletableCrudService(service) {
|
6
|
+
return service && typeof service.hardRemove === 'function';
|
7
|
+
}
|
3
8
|
//# sourceMappingURL=crud-service.interface.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"crud-service.interface.js","sourceRoot":"","sources":["../../../src/interfaces/services/crud-service.interface.ts"],"names":[],"mappings":""}
|
1
|
+
{"version":3,"file":"crud-service.interface.js","sourceRoot":"","sources":["../../../src/interfaces/services/crud-service.interface.ts"],"names":[],"mappings":";;AA6KA,gEAyBC;AA1BD,kEAAkE;AAClE,SAAgB,0BAA0B,CAQxC,OAOC;IASD,OAAO,OAAO,IAAI,OAAQ,OAAe,CAAC,UAAU,KAAK,UAAU,CAAC;AACtE,CAAC"}
|
@@ -20,12 +20,12 @@ import { Where } from '../../types/find-args.type';
|
|
20
20
|
* @method runInTransaction - Executes a function within a transactional context.
|
21
21
|
* @method audit - Records an audit log entry for a specified action.
|
22
22
|
*/
|
23
|
-
export interface DataService<IdType extends IdTypeFrom<EntityType>, EntityType extends Entity<unknown>, ContextType extends Context = Context> {
|
24
|
-
findAll<TBool extends BooleanType = false>(context: ContextType, args?:
|
23
|
+
export interface DataService<IdType extends IdTypeFrom<EntityType>, EntityType extends Entity<unknown>, FindArgsType extends FindArgs<EntityType> = FindArgs<EntityType>, ContextType extends Context = Context> {
|
24
|
+
findAll<TBool extends BooleanType = false>(context: ContextType, args?: FindArgsType, withPagination?: TBool): Promise<If<TBool, {
|
25
25
|
data: EntityType[];
|
26
26
|
pagination: PaginationResult;
|
27
27
|
}, EntityType[]>>;
|
28
|
-
pagination(context: ContextType, args?:
|
28
|
+
pagination(context: ContextType, args?: FindArgsType): Promise<PaginationResult>;
|
29
29
|
findOne<TBool extends BooleanType = false>(context: ContextType, id: IdType, orFail?: TBool): Promise<NotNullableIf<TBool, EntityType>>;
|
30
30
|
findOneBy<TBool extends BooleanType = false>(context: ContextType, where: Where<EntityType>, orFail?: TBool): Promise<NotNullableIf<TBool, EntityType>>;
|
31
31
|
runInTransaction<ReturnType>(context: ContextType, fn: (context: ContextType) => Promise<ReturnType>): Promise<ReturnType>;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"data-service.interface.d.ts","sourceRoot":"","sources":["../../../src/interfaces/services/data-service.interface.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,EAAE,EAAE,MAAM,aAAa,CAAC;AAC7D,OAAO,EACL,OAAO,EACP,UAAU,EACV,MAAM,EACN,QAAQ,EACR,gBAAgB,EACjB,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,KAAK,EAAE,MAAM,4BAA4B,CAAC;AAEnD;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,WAAW,WAAW,CAC1B,MAAM,SAAS,UAAU,CAAC,UAAU,CAAC,EACrC,UAAU,SAAS,MAAM,CAAC,OAAO,CAAC,EAClC,WAAW,SAAS,OAAO,GAAG,OAAO;IAErC,OAAO,CAAC,KAAK,SAAS,WAAW,GAAG,KAAK,EACvC,OAAO,EAAE,WAAW,EACpB,IAAI,CAAC,EAAE,
|
1
|
+
{"version":3,"file":"data-service.interface.d.ts","sourceRoot":"","sources":["../../../src/interfaces/services/data-service.interface.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,EAAE,EAAE,MAAM,aAAa,CAAC;AAC7D,OAAO,EACL,OAAO,EACP,UAAU,EACV,MAAM,EACN,QAAQ,EACR,gBAAgB,EACjB,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,KAAK,EAAE,MAAM,4BAA4B,CAAC;AAEnD;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,WAAW,WAAW,CAC1B,MAAM,SAAS,UAAU,CAAC,UAAU,CAAC,EACrC,UAAU,SAAS,MAAM,CAAC,OAAO,CAAC,EAClC,YAAY,SAAS,QAAQ,CAAC,UAAU,CAAC,GAAG,QAAQ,CAAC,UAAU,CAAC,EAChE,WAAW,SAAS,OAAO,GAAG,OAAO;IAErC,OAAO,CAAC,KAAK,SAAS,WAAW,GAAG,KAAK,EACvC,OAAO,EAAE,WAAW,EACpB,IAAI,CAAC,EAAE,YAAY,EACnB,cAAc,CAAC,EAAE,KAAK,GACrB,OAAO,CACR,EAAE,CACA,KAAK,EACL;QAAE,IAAI,EAAE,UAAU,EAAE,CAAC;QAAC,UAAU,EAAE,gBAAgB,CAAA;KAAE,EACpD,UAAU,EAAE,CACb,CACF,CAAC;IAEF,UAAU,CACR,OAAO,EAAE,WAAW,EACpB,IAAI,CAAC,EAAE,YAAY,GAClB,OAAO,CAAC,gBAAgB,CAAC,CAAC;IAE7B,OAAO,CAAC,KAAK,SAAS,WAAW,GAAG,KAAK,EACvC,OAAO,EAAE,WAAW,EACpB,EAAE,EAAE,MAAM,EACV,MAAM,CAAC,EAAE,KAAK,GACb,OAAO,CAAC,aAAa,CAAC,KAAK,EAAE,UAAU,CAAC,CAAC,CAAC;IAE7C,SAAS,CAAC,KAAK,SAAS,WAAW,GAAG,KAAK,EACzC,OAAO,EAAE,WAAW,EACpB,KAAK,EAAE,KAAK,CAAC,UAAU,CAAC,EACxB,MAAM,CAAC,EAAE,KAAK,GACb,OAAO,CAAC,aAAa,CAAC,KAAK,EAAE,UAAU,CAAC,CAAC,CAAC;IAE7C,gBAAgB,CAAC,UAAU,EACzB,OAAO,EAAE,WAAW,EACpB,EAAE,EAAE,CAAC,OAAO,EAAE,WAAW,KAAK,OAAO,CAAC,UAAU,CAAC,GAChD,OAAO,CAAC,UAAU,CAAC,CAAC;IAEvB,KAAK,CACH,OAAO,EAAE,WAAW,EACpB,MAAM,EAAE,MAAM,EACd,QAAQ,CAAC,EAAE,MAAM,EACjB,WAAW,CAAC,EAAE,MAAM,EACpB,UAAU,CAAC,EAAE,MAAM,GAClB,OAAO,CAAC,IAAI,CAAC,CAAC;CAClB"}
|
@@ -0,0 +1,53 @@
|
|
1
|
+
import { Constructable, DeepPartial } from '../../types';
|
2
|
+
import { Context, Entity, FindArgs, IdTypeFrom } from '../misc';
|
3
|
+
import { DataServiceFunctions, DataServiceStructure } from './data-service-structure.interface';
|
4
|
+
/**
|
5
|
+
* Configuration structure for individual CRUD service functions.
|
6
|
+
* Provides method decorators.
|
7
|
+
*
|
8
|
+
* @template EntityType - The entity type this function operates on
|
9
|
+
*/
|
10
|
+
export interface CrudServiceFunctionStructure<EntityType> {
|
11
|
+
/** Array of method decorators to apply to the function */
|
12
|
+
decorators?: (() => MethodDecorator)[];
|
13
|
+
}
|
14
|
+
/**
|
15
|
+
* Defines the available CRUD and bulk operation functions that can be configured for a service.
|
16
|
+
* Extends DataServiceFunctions with create, update, and delete operations.
|
17
|
+
*
|
18
|
+
* @template EntityType - The entity type this service operates on
|
19
|
+
*/
|
20
|
+
export interface CrudServiceFunctions<EntityType> extends DataServiceFunctions<EntityType> {
|
21
|
+
/** Configuration for the create operation */
|
22
|
+
create?: CrudServiceFunctionStructure<EntityType>;
|
23
|
+
/** Configuration for the update operation */
|
24
|
+
update?: CrudServiceFunctionStructure<EntityType>;
|
25
|
+
/** Configuration for the remove operation (soft delete by default) */
|
26
|
+
remove?: CrudServiceFunctionStructure<EntityType>;
|
27
|
+
/** Configuration for the soft remove operation (explicit soft delete) */
|
28
|
+
softRemove?: CrudServiceFunctionStructure<EntityType>;
|
29
|
+
/** Configuration for the hard remove operation (permanent delete) */
|
30
|
+
hardRemove?: CrudServiceFunctionStructure<EntityType>;
|
31
|
+
/** Configuration for the recover operation (restore soft-deleted entities) */
|
32
|
+
recover?: CrudServiceFunctionStructure<EntityType>;
|
33
|
+
}
|
34
|
+
/**
|
35
|
+
* Structure definition for configuring a CRUD service.
|
36
|
+
* Extends DataServiceStructure with additional input types and CRUD-specific function configurations.
|
37
|
+
*
|
38
|
+
* @template IdType - The type of the entity's identifier
|
39
|
+
* @template EntityType - The entity type this service operates on
|
40
|
+
* @template CreateInputType - The input type for create operations
|
41
|
+
* @template UpdateInputType - The input type for update operations
|
42
|
+
* @template FindArgsType - The type for find operation arguments
|
43
|
+
* @template ContextType - The context type for operations
|
44
|
+
*/
|
45
|
+
export interface CrudServiceStructure<IdType extends IdTypeFrom<EntityType>, EntityType extends Entity<unknown>, CreateInputType extends DeepPartial<EntityType>, UpdateInputType extends DeepPartial<EntityType>, FindArgsType extends FindArgs<EntityType> = FindArgs<EntityType>, ContextType extends Context = Context> extends DataServiceStructure<IdType, EntityType, FindArgsType, ContextType> {
|
46
|
+
/** Constructor for the create input type */
|
47
|
+
createInputType: Constructable<CreateInputType>;
|
48
|
+
/** Constructor for the update input type */
|
49
|
+
updateInputType: Constructable<UpdateInputType>;
|
50
|
+
/** Optional configuration for CRUD service functions */
|
51
|
+
functions?: CrudServiceFunctions<EntityType>;
|
52
|
+
}
|
53
|
+
//# sourceMappingURL=crud-service-structure.interface.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"crud-service-structure.interface.d.ts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C,EAChE,WAAW,SAAS,OAAO,GAAG,OAAO,CACrC,SAAQ,oBAAoB,CAAC,MAAM,EAAE,UAAU,EAAE,YAAY,EAAE,WAAW,CAAC;IAC3E,4CAA4C;IAC5C,eAAe,EAAE,aAAa,CAAC,eAAe,CAAC,CAAC;IAChD,4CAA4C;IAC5C,eAAe,EAAE,aAAa,CAAC,eAAe,CAAC,CAAC;IAChD,wDAAwD;IACxD,SAAS,CAAC,EAAE,oBAAoB,CAAC,UAAU,CAAC,CAAC;CAC9C"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"crud-service-structure.interface.js","sourceRoot":"","sources":["../../../src/interfaces/structures/crud-service-structure.interface.ts"],"names":[],"mappings":""}
|
@@ -0,0 +1,44 @@
|
|
1
|
+
import { Constructable } from '../../types';
|
2
|
+
import { Context, Entity, FindArgs, IdTypeFrom } from '../misc';
|
3
|
+
import { EntityProviderStructure } from './entity-provider-structure.interface';
|
4
|
+
/**
|
5
|
+
* Configuration structure for individual data service functions.
|
6
|
+
*
|
7
|
+
* @template EntityType - The entity type this function operates on
|
8
|
+
*/
|
9
|
+
export interface DataServiceFunctionStructure<EntityType> {
|
10
|
+
/** Array of method decorators to apply to the function */
|
11
|
+
decorators?: (() => MethodDecorator)[];
|
12
|
+
}
|
13
|
+
/**
|
14
|
+
* Defines the available data service functions that can be configured.
|
15
|
+
* Includes basic read operations like findAll, findOne, and pagination.
|
16
|
+
*
|
17
|
+
* @template EntityType - The entity type this service operates on
|
18
|
+
*/
|
19
|
+
export interface DataServiceFunctions<EntityType> {
|
20
|
+
/** Configuration for the findAll operation */
|
21
|
+
findAll?: DataServiceFunctionStructure<EntityType>;
|
22
|
+
/** Configuration for the findOne operation */
|
23
|
+
findOne?: DataServiceFunctionStructure<EntityType>;
|
24
|
+
/** Configuration for the pagination operation */
|
25
|
+
pagination?: DataServiceFunctionStructure<EntityType>;
|
26
|
+
}
|
27
|
+
/**
|
28
|
+
* Structure definition for configuring a data service.
|
29
|
+
* Extends EntityProviderStructure and QueryBuilderConfig with additional service configuration.
|
30
|
+
*
|
31
|
+
* @template IdType - The type of the entity's identifier
|
32
|
+
* @template EntityType - The entity type this service operates on
|
33
|
+
* @template FindArgsType - The type for find operation arguments
|
34
|
+
* @template ContextType - The context type for operations
|
35
|
+
*/
|
36
|
+
export interface DataServiceStructure<IdType extends IdTypeFrom<EntityType>, EntityType extends Entity<unknown>, FindArgsType extends FindArgs<EntityType> = FindArgs<EntityType>, ContextType extends Context = Context> extends EntityProviderStructure<IdType, EntityType> {
|
37
|
+
/** Optional constructor for the find arguments type */
|
38
|
+
findArgsType?: Constructable<FindArgsType>;
|
39
|
+
/** Optional constructor for the context type */
|
40
|
+
contextType?: Constructable<ContextType>;
|
41
|
+
/** Optional configuration for data service functions */
|
42
|
+
functions?: DataServiceFunctions<EntityType>;
|
43
|
+
}
|
44
|
+
//# sourceMappingURL=data-service-structure.interface.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"data-service-structure.interface.d.ts","sourceRoot":"","sources":["../../../src/interfaces/structures/data-service-structure.interface.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAChE,OAAO,EAAE,uBAAuB,EAAE,MAAM,uCAAuC,CAAC;AAEhF;;;;GAIG;AACH,MAAM,WAAW,4BAA4B,CAAC,UAAU;IACtD,0DAA0D;IAC1D,UAAU,CAAC,EAAE,CAAC,MAAM,eAAe,CAAC,EAAE,CAAC;CACxC;AAED;;;;;GAKG;AACH,MAAM,WAAW,oBAAoB,CAAC,UAAU;IAC9C,8CAA8C;IAC9C,OAAO,CAAC,EAAE,4BAA4B,CAAC,UAAU,CAAC,CAAC;IACnD,8CAA8C;IAC9C,OAAO,CAAC,EAAE,4BAA4B,CAAC,UAAU,CAAC,CAAC;IACnD,iDAAiD;IACjD,UAAU,CAAC,EAAE,4BAA4B,CAAC,UAAU,CAAC,CAAC;CACvD;AAED;;;;;;;;GAQG;AACH,MAAM,WAAW,oBAAoB,CACnC,MAAM,SAAS,UAAU,CAAC,UAAU,CAAC,EACrC,UAAU,SAAS,MAAM,CAAC,OAAO,CAAC,EAClC,YAAY,SAAS,QAAQ,CAAC,UAAU,CAAC,GAAG,QAAQ,CAAC,UAAU,CAAC,EAChE,WAAW,SAAS,OAAO,GAAG,OAAO,CACrC,SAAQ,uBAAuB,CAAC,MAAM,EAAE,UAAU,CAAC;IACnD,uDAAuD;IACvD,YAAY,CAAC,EAAE,aAAa,CAAC,YAAY,CAAC,CAAC;IAC3C,gDAAgD;IAChD,WAAW,CAAC,EAAE,aAAa,CAAC,WAAW,CAAC,CAAC;IACzC,wDAAwD;IACxD,SAAS,CAAC,EAAE,oBAAoB,CAAC,UAAU,CAAC,CAAC;CAC9C"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"data-service-structure.interface.js","sourceRoot":"","sources":["../../../src/interfaces/structures/data-service-structure.interface.ts"],"names":[],"mappings":""}
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import { PipeTransform, Type } from '@nestjs/common';
|
2
|
-
import { Constructable } from '../../types';
|
3
|
-
import { Entity, IdTypeFrom } from '../misc';
|
2
|
+
import { Constructable, DeepPartial } from '../../types';
|
3
|
+
import { Context, Entity, FindArgs, IdTypeFrom } from '../misc';
|
4
4
|
export interface IdStructure<IdType> {
|
5
5
|
type: Constructable<IdType>;
|
6
6
|
pipeTransforms?: Type<PipeTransform>[];
|
@@ -10,4 +10,14 @@ export interface EntityProviderStructure<IdType extends IdTypeFrom<EntityType>,
|
|
10
10
|
entityId?: IdStructure<IdType>;
|
11
11
|
}
|
12
12
|
export declare function fillEntityId<IdType extends IdTypeFrom<EntityType>, EntityType extends Entity<unknown>>(entityProvider: EntityProviderStructure<IdType, EntityType>): void;
|
13
|
+
export interface DataProviderStructure<IdType extends IdTypeFrom<EntityType>, EntityType extends Entity<unknown>, FindArgsType extends FindArgs<EntityType> = FindArgs<EntityType>, ContextType extends Context = Context> extends EntityProviderStructure<IdType, EntityType> {
|
14
|
+
findArgsType?: Constructable<FindArgsType>;
|
15
|
+
contextType?: Constructable<ContextType>;
|
16
|
+
}
|
17
|
+
export interface CrudProviderStructure<IdType extends IdTypeFrom<EntityType>, EntityType extends Entity<unknown>, CreateInputType extends DeepPartial<EntityType>, UpdateInputType extends DeepPartial<EntityType>, FindArgsType extends FindArgs<EntityType> = FindArgs<EntityType>, ContextType extends Context = Context> extends DataProviderStructure<IdType, EntityType, FindArgsType, ContextType> {
|
18
|
+
createInputType: Constructable<CreateInputType>;
|
19
|
+
updateInputType: Constructable<UpdateInputType>;
|
20
|
+
}
|
21
|
+
export declare function DataProviderStructure<IdType extends IdTypeFrom<EntityType>, EntityType extends Entity<unknown>, FindArgsType extends FindArgs<EntityType> = FindArgs<EntityType>, ContextType extends Context = Context>(input: DataProviderStructure<IdType, EntityType, FindArgsType, ContextType>): DataProviderStructure<IdType, EntityType, FindArgsType, ContextType>;
|
22
|
+
export declare function CrudProviderStructure<IdType extends IdTypeFrom<EntityType>, EntityType extends Entity<unknown>, CreateInputType extends DeepPartial<EntityType>, UpdateInputType extends DeepPartial<EntityType>, FindArgsType extends FindArgs<EntityType> = FindArgs<EntityType>, ContextType extends Context = Context>(input: CrudProviderStructure<IdType, EntityType, CreateInputType, UpdateInputType, FindArgsType, ContextType>): CrudProviderStructure<IdType, EntityType, CreateInputType, UpdateInputType, FindArgsType, ContextType>;
|
13
23
|
//# sourceMappingURL=entity-provider-structure.interface.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"entity-provider-structure.interface.d.ts","sourceRoot":"","sources":["../../../src/interfaces/structures/entity-provider-structure.interface.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAErD,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;
|
1
|
+
{"version":3,"file":"entity-provider-structure.interface.d.ts","sourceRoot":"","sources":["../../../src/interfaces/structures/entity-provider-structure.interface.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAErD,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AACzD,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAEhE,MAAM,WAAW,WAAW,CAAC,MAAM;IACjC,IAAI,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;IAC5B,cAAc,CAAC,EAAE,IAAI,CAAC,aAAa,CAAC,EAAE,CAAC;CACxC;AAED,MAAM,WAAW,uBAAuB,CACtC,MAAM,SAAS,UAAU,CAAC,UAAU,CAAC,EACrC,UAAU,SAAS,MAAM,CAAC,OAAO,CAAC;IAElC,UAAU,EAAE,aAAa,CAAC,UAAU,CAAC,CAAC;IACtC,QAAQ,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;CAChC;AAED,wBAAgB,YAAY,CAC1B,MAAM,SAAS,UAAU,CAAC,UAAU,CAAC,EACrC,UAAU,SAAS,MAAM,CAAC,OAAO,CAAC,EAClC,cAAc,EAAE,uBAAuB,CAAC,MAAM,EAAE,UAAU,CAAC,QAU5D;AAED,MAAM,WAAW,qBAAqB,CACpC,MAAM,SAAS,UAAU,CAAC,UAAU,CAAC,EACrC,UAAU,SAAS,MAAM,CAAC,OAAO,CAAC,EAClC,YAAY,SAAS,QAAQ,CAAC,UAAU,CAAC,GAAG,QAAQ,CAAC,UAAU,CAAC,EAChE,WAAW,SAAS,OAAO,GAAG,OAAO,CACrC,SAAQ,uBAAuB,CAAC,MAAM,EAAE,UAAU,CAAC;IACnD,YAAY,CAAC,EAAE,aAAa,CAAC,YAAY,CAAC,CAAC;IAC3C,WAAW,CAAC,EAAE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1B,MAAM,EACN,UAAU,EACV,eAAe,EACf,eAAe,EACf,YAAY,EACZ,WAAW,CACZ,GACA,qBAAqB,CACtB,MAAM,EACN,UAAU,EACV,eAAe,EACf,eAAe,EACf,YAAY,EACZ,WAAW,CACZ,CAEA"}
|
@@ -1,6 +1,8 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.fillEntityId = fillEntityId;
|
4
|
+
exports.DataProviderStructure = DataProviderStructure;
|
5
|
+
exports.CrudProviderStructure = CrudProviderStructure;
|
4
6
|
const helpers_1 = require("../../helpers");
|
5
7
|
function fillEntityId(entityProvider) {
|
6
8
|
if (entityProvider.entityId)
|
@@ -12,4 +14,10 @@ function fillEntityId(entityProvider) {
|
|
12
14
|
pipeTransforms: idPipeTransform ? [idPipeTransform] : [],
|
13
15
|
};
|
14
16
|
}
|
17
|
+
function DataProviderStructure(input) {
|
18
|
+
return input;
|
19
|
+
}
|
20
|
+
function CrudProviderStructure(input) {
|
21
|
+
return input;
|
22
|
+
}
|
15
23
|
//# sourceMappingURL=entity-provider-structure.interface.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"entity-provider-structure.interface.js","sourceRoot":"","sources":["../../../src/interfaces/structures/entity-provider-structure.interface.ts"],"names":[],"mappings":";;AAkBA,oCAaC;
|
1
|
+
{"version":3,"file":"entity-provider-structure.interface.js","sourceRoot":"","sources":["../../../src/interfaces/structures/entity-provider-structure.interface.ts"],"names":[],"mappings":";;AAkBA,oCAaC;AAwBD,sDASC;AAED,sDAyBC;AA1FD,2CAAyE;AAiBzE,SAAgB,YAAY,CAG1B,cAA2D;IAC3D,IAAI,cAAc,CAAC,QAAQ;QAAE,OAAO;IAEpC,MAAM,MAAM,GAAG,IAAA,yBAAe,EAAC,cAAc,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC;IAChE,MAAM,eAAe,GAAG,IAAA,iCAAuB,EAAC,MAAM,CAAC,CAAC;IAExD,cAAc,CAAC,QAAQ,GAAG;QACxB,IAAI,EAAE,MAAM;QACZ,cAAc,EAAE,eAAe,CAAC,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,EAAE;KACzD,CAAC;AACJ,CAAC;AAwBD,SAAgB,qBAAqB,CAMnC,KAA2E;IAE3E,OAAO,KAAK,CAAC;AACf,CAAC;AAED,SAAgB,qBAAqB,CAQnC,KAOC;IASD,OAAO,KAAK,CAAC;AACf,CAAC"}
|
@@ -1,2 +1,5 @@
|
|
1
|
+
export { DataServiceFunctionStructure as CommonDataServiceFunctionStructure, DataServiceFunctions as CommonDataServiceFunctions, DataServiceStructure as CommonDataServiceStructure, } from './data-service-structure.interface';
|
2
|
+
export { CrudServiceFunctionStructure as CommonCrudServiceFunctionStructure, CrudServiceFunctions as CommonCrudServiceFunctions, CrudServiceStructure as CommonCrudServiceStructure, } from './crud-service-structure.interface';
|
3
|
+
export * from './service-plugins.interface';
|
1
4
|
export * from './entity-provider-structure.interface';
|
2
5
|
//# sourceMappingURL=index.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/interfaces/structures/index.ts"],"names":[],"mappings":"AAAA,cAAc,uCAAuC,CAAC"}
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/interfaces/structures/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,4BAA4B,IAAI,kCAAkC,EAClE,oBAAoB,IAAI,0BAA0B,EAClD,oBAAoB,IAAI,0BAA0B,GACnD,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EACL,4BAA4B,IAAI,kCAAkC,EAClE,oBAAoB,IAAI,0BAA0B,EAClD,oBAAoB,IAAI,0BAA0B,GACnD,MAAM,oCAAoC,CAAC;AAE5C,cAAc,6BAA6B,CAAC;AAE5C,cAAc,uCAAuC,CAAC"}
|
@@ -14,5 +14,6 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
15
15
|
};
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
17
|
+
__exportStar(require("./service-plugins.interface"), exports);
|
17
18
|
__exportStar(require("./entity-provider-structure.interface"), exports);
|
18
19
|
//# sourceMappingURL=index.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/interfaces/structures/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/interfaces/structures/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAWA,8DAA4C;AAE5C,wEAAsD"}
|
@@ -0,0 +1,223 @@
|
|
1
|
+
import { Type } from '@nestjs/common';
|
2
|
+
import { Constructable, DeepPartial, UnionToIntersection } from '../../types';
|
3
|
+
import { Context, Entity, FindArgs, IdTypeFrom } from '../misc';
|
4
|
+
import { DataService, CrudService } from '../services';
|
5
|
+
import { CrudServiceStructure } from './crud-service-structure.interface';
|
6
|
+
import { DataServiceStructure } from './data-service-structure.interface';
|
7
|
+
/**
|
8
|
+
* Interface defining a plugin system for extending service functionality in the SOLID NestJS framework.
|
9
|
+
*
|
10
|
+
* Service plugins allow developers to enhance data and CRUD services with additional methods,
|
11
|
+
* configuration options, and custom behavior. Plugins can modify service structures during
|
12
|
+
* configuration and enhance service classes with new functionality.
|
13
|
+
*
|
14
|
+
* @template IdType - The type of the entity's identifier
|
15
|
+
* @template EntityType - The entity type this plugin operates on
|
16
|
+
* @template CreateInputType - The input type for create operations, defaults to DeepPartial<EntityType>
|
17
|
+
* @template UpdateInputType - The input type for update operations, defaults to DeepPartial<EntityType>
|
18
|
+
* @template FindArgsType - The type for find operation arguments, defaults to FindArgs<EntityType>
|
19
|
+
* @template ContextType - The context type for operations, defaults to Context
|
20
|
+
* @template TDataOptions - Record of additional options that can be added to data service structures
|
21
|
+
* @template TCrudOptions - Record of additional options that can be added to CRUD service structures
|
22
|
+
* @template TDataAddOns - Record of additional methods/properties added to data services
|
23
|
+
* @template TCrudAddOns - Record of additional methods/properties added to CRUD services
|
24
|
+
*
|
25
|
+
* @example
|
26
|
+
* ```typescript
|
27
|
+
* // Define a logging plugin
|
28
|
+
* const loggingPlugin: ServicePlugin<string, User> = {
|
29
|
+
* applyDataServiceStructure(structure) {
|
30
|
+
* // Modify structure configuration
|
31
|
+
* structure.enableLogging = true;
|
32
|
+
* },
|
33
|
+
*
|
34
|
+
* applyDataServiceClass(serviceClass, structure) {
|
35
|
+
* // Extend service class with logging methods
|
36
|
+
* class LoggingService extends serviceClass {
|
37
|
+
* log(message: string) {
|
38
|
+
* console.log(`[${structure.entityType.name}] ${message}`);
|
39
|
+
* }
|
40
|
+
* }
|
41
|
+
* return LoggingService;
|
42
|
+
* }
|
43
|
+
* };
|
44
|
+
* ```
|
45
|
+
*/
|
46
|
+
export interface ServicePlugin<IdType extends IdTypeFrom<EntityType>, EntityType extends Entity<unknown>, CreateInputType extends DeepPartial<EntityType> = DeepPartial<EntityType>, UpdateInputType extends DeepPartial<EntityType> = DeepPartial<EntityType>, FindArgsType extends FindArgs<EntityType> = FindArgs<EntityType>, ContextType extends Context = Context, TDataOptions extends Record<string, any> = {}, TCrudOptions extends Record<string, any> = {}, TDataAddOns extends Record<string, any> = {}, TCrudAddOns extends Record<string, any> = {}> {
|
47
|
+
/**
|
48
|
+
* Hook that allows modifying the data service structure during configuration.
|
49
|
+
* This method is called before the service class is created, allowing plugins
|
50
|
+
* to add configuration options, modify function settings, or add decorators.
|
51
|
+
*
|
52
|
+
* @param structure - The data service structure being configured, enhanced with plugin options
|
53
|
+
*
|
54
|
+
* @example
|
55
|
+
* ```typescript
|
56
|
+
* applyDataServiceStructure(structure) {
|
57
|
+
* // Add caching configuration
|
58
|
+
* structure.enableCache = true;
|
59
|
+
* structure.cacheTimeout = 300;
|
60
|
+
* }
|
61
|
+
* ```
|
62
|
+
*/
|
63
|
+
applyDataServiceStructure?(structure: DataServiceStructure<IdType, EntityType, FindArgsType, ContextType> & TDataOptions): void;
|
64
|
+
/**
|
65
|
+
* Hook that allows modifying the CRUD service structure during configuration.
|
66
|
+
* This method is called before the service class is created, allowing plugins
|
67
|
+
* to add configuration options, modify function settings, or add decorators.
|
68
|
+
*
|
69
|
+
* @param structure - The CRUD service structure being configured, enhanced with plugin options
|
70
|
+
*
|
71
|
+
* @example
|
72
|
+
* ```typescript
|
73
|
+
* applyCrudServiceStructure(structure) {
|
74
|
+
* // Add validation configuration
|
75
|
+
* structure.enableValidation = true;
|
76
|
+
* structure.validationRules = ['email', 'required'];
|
77
|
+
* }
|
78
|
+
* ```
|
79
|
+
*/
|
80
|
+
applyCrudServiceStructure?(structure: CrudServiceStructure<IdType, EntityType, CreateInputType, UpdateInputType, FindArgsType, ContextType> & TDataOptions & TCrudOptions): void;
|
81
|
+
/**
|
82
|
+
* Hook that allows modifying or extending the data service class.
|
83
|
+
* This method receives the constructed service class and can return an enhanced
|
84
|
+
* version with additional methods, properties, or behavior.
|
85
|
+
*
|
86
|
+
* @param serviceClass - The original data service class constructor
|
87
|
+
* @param structure - The data service structure with plugin options
|
88
|
+
* @returns Enhanced service class constructor with additional functionality
|
89
|
+
*
|
90
|
+
* @example
|
91
|
+
* ```typescript
|
92
|
+
* applyDataServiceClass(serviceClass, structure) {
|
93
|
+
* class EnhancedService extends serviceClass {
|
94
|
+
* async findWithCache(id: string) {
|
95
|
+
* // Add caching logic
|
96
|
+
* return this.findOne(context, id);
|
97
|
+
* }
|
98
|
+
* }
|
99
|
+
* return EnhancedService;
|
100
|
+
* }
|
101
|
+
* ```
|
102
|
+
*/
|
103
|
+
applyDataServiceClass?(serviceClass: Constructable<DataService<IdType, EntityType, FindArgsType, ContextType>>, structure: DataServiceStructure<IdType, EntityType, FindArgsType, ContextType> & TDataOptions): Type<DataService<IdType, EntityType, FindArgsType, ContextType> & TDataAddOns>;
|
104
|
+
/**
|
105
|
+
* Hook that allows modifying or extending the CRUD service class.
|
106
|
+
* This method receives the constructed service class and can return an enhanced
|
107
|
+
* version with additional methods, properties, or behavior.
|
108
|
+
*
|
109
|
+
* @param serviceClass - The original CRUD service class constructor
|
110
|
+
* @param structure - The CRUD service structure with plugin options
|
111
|
+
* @returns Enhanced service class constructor with additional functionality
|
112
|
+
*
|
113
|
+
* @example
|
114
|
+
* ```typescript
|
115
|
+
* applyCrudServiceClass(serviceClass, structure) {
|
116
|
+
* class AuditedService extends serviceClass {
|
117
|
+
* async create(context, input) {
|
118
|
+
* const result = await super.create(context, input);
|
119
|
+
* await this.auditLog('CREATE', result.id);
|
120
|
+
* return result;
|
121
|
+
* }
|
122
|
+
* }
|
123
|
+
* return AuditedService;
|
124
|
+
* }
|
125
|
+
* ```
|
126
|
+
*/
|
127
|
+
applyCrudServiceClass?(serviceClass: Constructable<CrudService<IdType, EntityType, CreateInputType, UpdateInputType, FindArgsType, ContextType>>, structure: CrudServiceStructure<IdType, EntityType, CreateInputType, UpdateInputType, FindArgsType, ContextType> & TDataOptions & TCrudOptions): Type<CrudService<IdType, EntityType, CreateInputType, UpdateInputType, FindArgsType, ContextType> & TDataAddOns & TCrudAddOns>;
|
128
|
+
}
|
129
|
+
/**
|
130
|
+
* Utility type that extracts and merges all data add-ons from an array of service plugins.
|
131
|
+
* This type is used to determine what additional methods and properties will be available
|
132
|
+
* on data services when using a specific set of plugins.
|
133
|
+
*
|
134
|
+
* @template ServicePluginArrayType - An array of service plugins
|
135
|
+
* @returns Union-to-intersection type of all TDataAddOns from the plugins
|
136
|
+
*
|
137
|
+
* @example
|
138
|
+
* ```typescript
|
139
|
+
* type MyPlugins = [LoggingPlugin, CachingPlugin];
|
140
|
+
* type DataAddOns = ExtractDataAddOnsFromServicePluginArray<MyPlugins>;
|
141
|
+
* // DataAddOns will contain methods from both logging and caching plugins
|
142
|
+
* ```
|
143
|
+
*/
|
144
|
+
export type ExtractDataAddOnsFromServicePluginArray<ServicePluginArrayType extends readonly ServicePlugin<any, any, any, any, any, any, any, any, any, any>[]> = UnionToIntersection<ServicePluginArrayType[number] extends ServicePlugin<any, any, any, any, any, any, any, any, infer TAddOns, any> ? TAddOns : never>;
|
145
|
+
/**
|
146
|
+
* Utility type that extracts and merges all CRUD add-ons from an array of service plugins.
|
147
|
+
* This type is used to determine what additional methods and properties will be available
|
148
|
+
* on CRUD services when using a specific set of plugins.
|
149
|
+
*
|
150
|
+
* @template ServicePluginArrayType - An array of service plugins
|
151
|
+
* @returns Union-to-intersection type of all TCrudAddOns from the plugins
|
152
|
+
*
|
153
|
+
* @example
|
154
|
+
* ```typescript
|
155
|
+
* type MyPlugins = [ValidationPlugin, AuditPlugin];
|
156
|
+
* type CrudAddOns = ExtractCrudAddOnsFromServicePluginArray<MyPlugins>;
|
157
|
+
* // CrudAddOns will contain methods from both validation and audit plugins
|
158
|
+
* ```
|
159
|
+
*/
|
160
|
+
export type ExtractCrudAddOnsFromServicePluginArray<ServicePluginArrayType extends readonly ServicePlugin<any, any, any, any, any, any, any, any, any, any>[]> = UnionToIntersection<ServicePluginArrayType[number] extends ServicePlugin<any, any, any, any, any, any, any, any, any, infer TAddOns> ? TAddOns : never>;
|
161
|
+
/**
|
162
|
+
* Utility type that extracts and merges both data and CRUD add-ons from an array of service plugins.
|
163
|
+
* This provides a complete view of all additional functionality that will be available
|
164
|
+
* on services when using a specific set of plugins.
|
165
|
+
*
|
166
|
+
* @template ServicePluginArrayType - An array of service plugins
|
167
|
+
* @returns Combined type of all data and CRUD add-ons from the plugins
|
168
|
+
*
|
169
|
+
* @example
|
170
|
+
* ```typescript
|
171
|
+
* type MyPlugins = [LoggingPlugin, ValidationPlugin, CachingPlugin];
|
172
|
+
* type AllAddOns = ExtractAddOnsFromServicePluginArray<MyPlugins>;
|
173
|
+
* // AllAddOns will contain methods from all plugins combined
|
174
|
+
* ```
|
175
|
+
*/
|
176
|
+
export type ExtractAddOnsFromServicePluginArray<ServicePluginArrayType extends readonly ServicePlugin<any, any, any, any, any, any, any, any, any, any>[]> = ExtractDataAddOnsFromServicePluginArray<ServicePluginArrayType> & ExtractCrudAddOnsFromServicePluginArray<ServicePluginArrayType>;
|
177
|
+
/**
|
178
|
+
* Utility type that extracts and merges all data options from an array of service plugins.
|
179
|
+
* These options become available in the data service structure configuration when using the plugins.
|
180
|
+
*
|
181
|
+
* @template ServicePluginArrayType - An array of service plugins
|
182
|
+
* @returns Union-to-intersection type of all TDataOptions from the plugins
|
183
|
+
*
|
184
|
+
* @example
|
185
|
+
* ```typescript
|
186
|
+
* type MyPlugins = [CachingPlugin, LoggingPlugin];
|
187
|
+
* type DataOptions = ExtractDataOptionsFromServicePluginArray<MyPlugins>;
|
188
|
+
* // DataOptions might include { cacheTimeout?: number; logLevel?: string; }
|
189
|
+
* ```
|
190
|
+
*/
|
191
|
+
export type ExtractDataOptionsFromServicePluginArray<ServicePluginArrayType extends readonly ServicePlugin<any, any, any, any, any, any, any, any, any, any>[]> = UnionToIntersection<ServicePluginArrayType[number] extends ServicePlugin<any, any, any, any, any, any, infer TOptions, any, any, any> ? TOptions : never>;
|
192
|
+
/**
|
193
|
+
* Utility type that extracts and merges all CRUD options from an array of service plugins.
|
194
|
+
* These options become available in the CRUD service structure configuration when using the plugins.
|
195
|
+
*
|
196
|
+
* @template ServicePluginArrayType - An array of service plugins
|
197
|
+
* @returns Union-to-intersection type of all TCrudOptions from the plugins
|
198
|
+
*
|
199
|
+
* @example
|
200
|
+
* ```typescript
|
201
|
+
* type MyPlugins = [ValidationPlugin, AuditPlugin];
|
202
|
+
* type CrudOptions = ExtractCrudOptionsFromServicePluginArray<MyPlugins>;
|
203
|
+
* // CrudOptions might include { enableValidation?: boolean; auditLevel?: string; }
|
204
|
+
* ```
|
205
|
+
*/
|
206
|
+
export type ExtractCrudOptionsFromServicePluginArray<ServicePluginArrayType extends readonly ServicePlugin<any, any, any, any, any, any, any, any, any, any>[]> = UnionToIntersection<ServicePluginArrayType[number] extends ServicePlugin<any, any, any, any, any, any, any, infer TOptions, any, any> ? TOptions : never>;
|
207
|
+
/**
|
208
|
+
* Utility type that extracts and merges both data and CRUD options from an array of service plugins.
|
209
|
+
* This provides a complete view of all configuration options that will be available
|
210
|
+
* when using a specific set of plugins.
|
211
|
+
*
|
212
|
+
* @template ServicePluginArrayType - An array of service plugins
|
213
|
+
* @returns Combined type of all data and CRUD options from the plugins
|
214
|
+
*
|
215
|
+
* @example
|
216
|
+
* ```typescript
|
217
|
+
* type MyPlugins = [CachingPlugin, ValidationPlugin, AuditPlugin];
|
218
|
+
* type AllOptions = ExtractOptionsFromServicePluginArray<MyPlugins>;
|
219
|
+
* // AllOptions will include all configuration options from all plugins
|
220
|
+
* ```
|
221
|
+
*/
|
222
|
+
export type ExtractOptionsFromServicePluginArray<ServicePluginArrayType extends readonly ServicePlugin<any, any, any, any, any, any, any, any, any, any>[]> = ExtractDataOptionsFromServicePluginArray<ServicePluginArrayType> & ExtractCrudOptionsFromServicePluginArray<ServicePluginArrayType>;
|
223
|
+
//# sourceMappingURL=service-plugins.interface.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"service-plugins.interface.d.ts","sourceRoot":"","sources":["../../../src/interfaces/structures/service-plugins.interface.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AACtC,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAC9E,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAChE,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AACvD,OAAO,EAAE,oBAAoB,EAAE,MAAM,oCAAoC,CAAC;AAC1E,OAAO,EAAE,oBAAoB,EAAE,MAAM,oCAAoC,CAAC;AAE1E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsC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CAAC;AAEF;;;;;;;;;;;;;;GAcG;AACH,MAAM,MAAM,oCAAoC,CAC9C,sBAAsB,SAAS,SAAS,aAAa,CACnD,GAAG,EACH,GAAG,EACH,GAAG,EACH,GAAG,EACH,GAAG,EACH,GAAG,EACH,GAAG,EACH,GAAG,EACH,GAAG,EACH,GAAG,CACJ,EAAE,IACD,wCAAwC,CAAC,sBAAsB,CAAC,GAClE,wCAAwC,CAAC,sBAAsB,CAAC,CAAC"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"service-plugins.interface.js","sourceRoot":"","sources":["../../../src/interfaces/structures/service-plugins.interface.ts"],"names":[],"mappings":""}
|
package/dist/types/index.d.ts
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,qBAAqB,CAAC;AACpC,cAAc,kBAAkB,CAAC"}
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,qBAAqB,CAAC;AACpC,cAAc,kBAAkB,CAAC;AACjC,cAAc,iBAAiB,CAAC;AAChC,cAAc,8BAA8B,CAAC"}
|
package/dist/types/index.js
CHANGED
@@ -18,4 +18,6 @@ __exportStar(require("./constructor.type"), exports);
|
|
18
18
|
__exportStar(require("./boolean.type"), exports);
|
19
19
|
__exportStar(require("./deep-partial.type"), exports);
|
20
20
|
__exportStar(require("./find-args.type"), exports);
|
21
|
+
__exportStar(require("./prettify.type"), exports);
|
22
|
+
__exportStar(require("./union-to-intersection.type"), exports);
|
21
23
|
//# sourceMappingURL=index.js.map
|
package/dist/types/index.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,qDAAmC;AACnC,iDAA+B;AAC/B,sDAAoC;AACpC,mDAAiC"}
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,qDAAmC;AACnC,iDAA+B;AAC/B,sDAAoC;AACpC,mDAAiC;AACjC,kDAAgC;AAChC,+DAA6C"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"prettify.type.d.ts","sourceRoot":"","sources":["../../src/types/prettify.type.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,QAAQ,CAAC,CAAC,IAAI;KAAG,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CAAE,GAAG,EAAE,CAAC"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"prettify.type.js","sourceRoot":"","sources":["../../src/types/prettify.type.ts"],"names":[],"mappings":""}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"union-to-intersection.type.d.ts","sourceRoot":"","sources":["../../src/types/union-to-intersection.type.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,mBAAmB,CAAC,CAAC,IAAI,CACnC,CAAC,SAAS,GAAG,GAAG,CAAC,CAAC,EAAE,CAAC,KAAK,IAAI,GAAG,KAAK,CACvC,SAAS,CAAC,CAAC,EAAE,MAAM,CAAC,KAAK,IAAI,GAC1B,CAAC,GACD,KAAK,CAAC"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"union-to-intersection.type.js","sourceRoot":"","sources":["../../src/types/union-to-intersection.type.ts"],"names":[],"mappings":""}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"http-status.utils.d.ts","sourceRoot":"","sources":["../../src/utils/http-status.utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;
|
1
|
+
{"version":3,"file":"http-status.utils.d.ts","sourceRoot":"","sources":["../../src/utils/http-status.utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAoB5C;;;;;;;;GAQG;AACH,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,UAAU,GAAG,MAAM,CAOnE"}
|
@@ -4,7 +4,11 @@ exports.getHttpStatusDescription = getHttpStatusDescription;
|
|
4
4
|
const common_1 = require("@nestjs/common");
|
5
5
|
const httpStatusDescriptions = new Map();
|
6
6
|
function formatStatusDescription(status) {
|
7
|
-
|
7
|
+
const statusName = common_1.HttpStatus[status];
|
8
|
+
if (!statusName) {
|
9
|
+
return 'Unknown Status';
|
10
|
+
}
|
11
|
+
return statusName
|
8
12
|
.toLowerCase()
|
9
13
|
.replace(/_/g, ' ')
|
10
14
|
.replace(/\b\w/g, l => l.toUpperCase());
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"http-status.utils.js","sourceRoot":"","sources":["../../src/utils/http-status.utils.ts"],"names":[],"mappings":";;
|
1
|
+
{"version":3,"file":"http-status.utils.js","sourceRoot":"","sources":["../../src/utils/http-status.utils.ts"],"names":[],"mappings":";;AA6BA,4DAOC;AApCD,2CAA4C;AAE5C,MAAM,sBAAsB,GAA4B,IAAI,GAAG,EAG5D,CAAC;AAEJ,SAAS,uBAAuB,CAAC,MAAkB;IACjD,MAAM,UAAU,GAAG,mBAAU,CAAC,MAAM,CAAC,CAAC;IAEtC,IAAI,CAAC,UAAU,EAAE,CAAC;QAChB,OAAO,gBAAgB,CAAC;IAC1B,CAAC;IAED,OAAO,UAAU;SACd,WAAW,EAAE;SACb,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC;SAClB,OAAO,CAAC,OAAO,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC,CAAC;AAC5C,CAAC;AAED;;;;;;;;GAQG;AACH,SAAgB,wBAAwB,CAAC,MAAkB;IACzD,IAAI,CAAC,sBAAsB,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC;QACxC,MAAM,WAAW,GAAG,uBAAuB,CAAC,MAAM,CAAC,CAAC;QACpD,sBAAsB,CAAC,GAAG,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;IAClD,CAAC;IAED,OAAO,sBAAsB,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,gBAAgB,CAAC;AAChE,CAAC"}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@solid-nestjs/common",
|
3
|
-
"version": "0.2.
|
3
|
+
"version": "0.2.4",
|
4
4
|
"description": "solid-nestjs common utilities",
|
5
5
|
"main": "dist/index.js",
|
6
6
|
"types": "dist/index.d.ts",
|
@@ -13,7 +13,10 @@
|
|
13
13
|
},
|
14
14
|
"scripts": {
|
15
15
|
"build": "tsc",
|
16
|
-
"build:watch": "tsc -w"
|
16
|
+
"build:watch": "tsc -w",
|
17
|
+
"test": "jest",
|
18
|
+
"test:watch": "jest --watch",
|
19
|
+
"test:coverage": "jest --coverage"
|
17
20
|
},
|
18
21
|
"keywords": [
|
19
22
|
"typescript",
|
@@ -32,9 +35,12 @@
|
|
32
35
|
"@nestjs/core": "^11.0.1"
|
33
36
|
},
|
34
37
|
"devDependencies": {
|
38
|
+
"@types/jest": "^29.5.14",
|
35
39
|
"@types/node": "^22.14.1",
|
40
|
+
"jest": "^29.7.0",
|
41
|
+
"ts-jest": "^29.3.4",
|
36
42
|
"tsconfig.json": "^1.0.11",
|
37
43
|
"typescript": "^5.8.3"
|
38
44
|
},
|
39
|
-
"gitHead": "
|
45
|
+
"gitHead": "3b189b3002ed221637db01df5dcf201d3d220636"
|
40
46
|
}
|