@gzl10/nexus-sdk 0.9.0 → 0.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli/index.js +1 -1
- package/dist/index.d.ts +60 -2
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -150,6 +150,6 @@ New file: ${path}`));
|
|
|
150
150
|
}
|
|
151
151
|
|
|
152
152
|
// src/cli/index.ts
|
|
153
|
-
var program = new Command2().name("nexus-sdk").description("Nexus SDK CLI - Code generation from EntityDefinitions").version("0.
|
|
153
|
+
var program = new Command2().name("nexus-sdk").description("Nexus SDK CLI - Code generation from EntityDefinitions").version("0.10.0");
|
|
154
154
|
program.addCommand(createGenerateCommand());
|
|
155
155
|
program.parse();
|
package/dist/index.d.ts
CHANGED
|
@@ -839,6 +839,64 @@ interface ActionEntityService<T = unknown> {
|
|
|
839
839
|
execute(data: Partial<T>): Promise<unknown>;
|
|
840
840
|
readonly definition: EntityDefinition;
|
|
841
841
|
}
|
|
842
|
+
/**
|
|
843
|
+
* Hooks para personalizar comportamiento de servicios de entidad
|
|
844
|
+
* Permite a plugins añadir lógica sin necesitar herencia
|
|
845
|
+
*/
|
|
846
|
+
interface EntityServiceHooks<T = unknown> {
|
|
847
|
+
/**
|
|
848
|
+
* Ejecutado antes de crear un registro
|
|
849
|
+
* @param data Datos a insertar
|
|
850
|
+
* @returns Datos modificados
|
|
851
|
+
*/
|
|
852
|
+
beforeCreate?: (data: Partial<T>) => Promise<Partial<T>> | Partial<T>;
|
|
853
|
+
/**
|
|
854
|
+
* Ejecutado después de crear un registro
|
|
855
|
+
* @param record Registro creado
|
|
856
|
+
*/
|
|
857
|
+
afterCreate?: (record: T) => Promise<void> | void;
|
|
858
|
+
/**
|
|
859
|
+
* Ejecutado antes de actualizar un registro
|
|
860
|
+
* @param id ID del registro
|
|
861
|
+
* @param data Datos a actualizar
|
|
862
|
+
* @returns Datos modificados
|
|
863
|
+
*/
|
|
864
|
+
beforeUpdate?: (id: string, data: Partial<T>) => Promise<Partial<T>> | Partial<T>;
|
|
865
|
+
/**
|
|
866
|
+
* Ejecutado después de actualizar un registro
|
|
867
|
+
* @param record Registro actualizado
|
|
868
|
+
*/
|
|
869
|
+
afterUpdate?: (record: T) => Promise<void> | void;
|
|
870
|
+
/**
|
|
871
|
+
* Ejecutado antes de eliminar un registro
|
|
872
|
+
* @param id ID del registro
|
|
873
|
+
*/
|
|
874
|
+
beforeDelete?: (id: string) => Promise<void> | void;
|
|
875
|
+
/**
|
|
876
|
+
* Ejecutado después de eliminar un registro
|
|
877
|
+
* @param id ID eliminado
|
|
878
|
+
*/
|
|
879
|
+
afterDelete?: (id: string) => Promise<void> | void;
|
|
880
|
+
/**
|
|
881
|
+
* Ejecutado después de obtener un registro por ID
|
|
882
|
+
* @param record Registro obtenido (o null)
|
|
883
|
+
* @returns Registro modificado
|
|
884
|
+
*/
|
|
885
|
+
afterFindById?: (record: T | null) => Promise<T | null> | T | null;
|
|
886
|
+
/**
|
|
887
|
+
* Ejecutado después de obtener lista paginada
|
|
888
|
+
* @param result Resultado paginado
|
|
889
|
+
* @returns Resultado modificado
|
|
890
|
+
*/
|
|
891
|
+
afterFindAll?: (result: PaginatedResult<T>) => Promise<PaginatedResult<T>> | PaginatedResult<T>;
|
|
892
|
+
}
|
|
893
|
+
/**
|
|
894
|
+
* Opciones para createEntityService
|
|
895
|
+
*/
|
|
896
|
+
interface CreateEntityServiceOptions<T = unknown> {
|
|
897
|
+
/** Hooks para personalizar comportamiento */
|
|
898
|
+
hooks?: EntityServiceHooks<T>;
|
|
899
|
+
}
|
|
842
900
|
/**
|
|
843
901
|
* Handler de entidad para Express
|
|
844
902
|
*/
|
|
@@ -881,7 +939,7 @@ interface ModuleContext {
|
|
|
881
939
|
/** Servicios de módulos (inyectados por backend) */
|
|
882
940
|
services: CoreServices;
|
|
883
941
|
/** Factory para crear servicios de entidades (detecta tipo automáticamente) */
|
|
884
|
-
createEntityService<T = unknown>(definition: EntityDefinition): BaseEntityService<T>;
|
|
942
|
+
createEntityService<T = unknown>(definition: EntityDefinition, options?: CreateEntityServiceOptions<T>): BaseEntityService<T>;
|
|
885
943
|
/** Factory para crear controller de entidad con CASL y validación */
|
|
886
944
|
createEntityController(service: BaseEntityService, definition: EntityDefinition): EntityController;
|
|
887
945
|
/** Factory para crear router de entidad con rutas CRUD */
|
|
@@ -948,4 +1006,4 @@ interface PluginManifest {
|
|
|
948
1006
|
modules: ModuleManifest[];
|
|
949
1007
|
}
|
|
950
1008
|
|
|
951
|
-
export { type AbilityLike, type ActionEntityDefinition, type ActionEntityService, type AuthRequest, type BaseEntityService, type BaseMailService, type BaseRolesService, type BaseUser, type BaseUsersService, type CaslAction, type CollectionEntityDefinition, type CollectionEntityService, type ComputedEntityDefinition, type ComputedEntityService, type ConfigEntityDefinition, type ConfigEntityService, type ContextHelpers, type CoreServices, type DbType, type EntityCaslConfig, type EntityController, type EntityDefinition, type EntityHandler, type EntityIndex, type EntityQuery, type EntityType, type EventEmitterLike, type EventEntityDefinition, type EventEntityService, type ExternalEntityDefinition, type ExternalEntityService, type FieldCaslAccess, type FieldDbConfig, type FieldDefinition, type FieldMeta, type FieldOptions, type FieldRelation, type FieldStorageConfig, type FieldValidationConfig, type ForbiddenErrorConstructor, type ForbiddenErrorInstance, GENERATED_DIR, type InputType, type KnexAlterTableBuilder, type KnexCreateTableBuilder, type KnexTransaction, type LoggerReporter, type ModuleAbilities, type ModuleContext, type ModuleManifest, type ModuleMiddlewares, type ModuleRequirements, type NonPersistentEntityDefinition, type OwnershipCondition, type PaginatedResult, type PaginationParams, type PersistentEntityDefinition, type PluginAuthRequest, type PluginCategory, type PluginManifest, type ReferenceEntityDefinition, type ReferenceEntityService, type RolePermission, type SendMailOptions, type SendMailResult, type SingleEntityDefinition, type SingleEntityService, type TempEntityDefinition, type TempEntityService, type ValidateSchemas, type ValidationSchema, type ViewEntityDefinition, type ViewEntityService, type VirtualEntityDefinition, type VirtualEntityService, generateModel, generateModelsFile, generateReadOnlyModel, getEntityName, getEntitySubject, hasTable, isPersistentEntity, isSingletonEntity };
|
|
1009
|
+
export { type AbilityLike, type ActionEntityDefinition, type ActionEntityService, type AuthRequest, type BaseEntityService, type BaseMailService, type BaseRolesService, type BaseUser, type BaseUsersService, type CaslAction, type CollectionEntityDefinition, type CollectionEntityService, type ComputedEntityDefinition, type ComputedEntityService, type ConfigEntityDefinition, type ConfigEntityService, type ContextHelpers, type CoreServices, type CreateEntityServiceOptions, type DbType, type EntityCaslConfig, type EntityController, type EntityDefinition, type EntityHandler, type EntityIndex, type EntityQuery, type EntityServiceHooks, type EntityType, type EventEmitterLike, type EventEntityDefinition, type EventEntityService, type ExternalEntityDefinition, type ExternalEntityService, type FieldCaslAccess, type FieldDbConfig, type FieldDefinition, type FieldMeta, type FieldOptions, type FieldRelation, type FieldStorageConfig, type FieldValidationConfig, type ForbiddenErrorConstructor, type ForbiddenErrorInstance, GENERATED_DIR, type InputType, type KnexAlterTableBuilder, type KnexCreateTableBuilder, type KnexTransaction, type LoggerReporter, type ModuleAbilities, type ModuleContext, type ModuleManifest, type ModuleMiddlewares, type ModuleRequirements, type NonPersistentEntityDefinition, type OwnershipCondition, type PaginatedResult, type PaginationParams, type PersistentEntityDefinition, type PluginAuthRequest, type PluginCategory, type PluginManifest, type ReferenceEntityDefinition, type ReferenceEntityService, type RolePermission, type SendMailOptions, type SendMailResult, type SingleEntityDefinition, type SingleEntityService, type TempEntityDefinition, type TempEntityService, type ValidateSchemas, type ValidationSchema, type ViewEntityDefinition, type ViewEntityService, type VirtualEntityDefinition, type VirtualEntityService, generateModel, generateModelsFile, generateReadOnlyModel, getEntityName, getEntitySubject, hasTable, isPersistentEntity, isSingletonEntity };
|