@gzl10/nexus-sdk 0.1.7 → 0.1.8
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/index.d.ts +50 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -19,6 +19,38 @@ interface AuthRequest<TUser = unknown, TAbility = unknown> extends Request {
|
|
|
19
19
|
user: TUser;
|
|
20
20
|
ability: TAbility;
|
|
21
21
|
}
|
|
22
|
+
/**
|
|
23
|
+
* Usuario base sin contraseña para uso en plugins
|
|
24
|
+
* Usado para tipar relaciones con usuarios (ej: author, created_by)
|
|
25
|
+
*/
|
|
26
|
+
interface BaseUser {
|
|
27
|
+
id: string;
|
|
28
|
+
name: string;
|
|
29
|
+
email: string;
|
|
30
|
+
role_id: string;
|
|
31
|
+
created_at: Date;
|
|
32
|
+
updated_at: Date;
|
|
33
|
+
created_by: string | null;
|
|
34
|
+
updated_by: string | null;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Parámetros de paginación para queries
|
|
38
|
+
*/
|
|
39
|
+
interface PaginationParams {
|
|
40
|
+
page: number;
|
|
41
|
+
limit: number;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Resultado paginado genérico
|
|
45
|
+
*/
|
|
46
|
+
interface PaginatedResult<T> {
|
|
47
|
+
items: T[];
|
|
48
|
+
total: number;
|
|
49
|
+
page: number;
|
|
50
|
+
limit: number;
|
|
51
|
+
totalPages: number;
|
|
52
|
+
hasNext: boolean;
|
|
53
|
+
}
|
|
22
54
|
/**
|
|
23
55
|
* Tipo de campo para formularios dinámicos
|
|
24
56
|
*/
|
|
@@ -76,6 +108,21 @@ interface ModuleRequirements {
|
|
|
76
108
|
env?: string[];
|
|
77
109
|
modules?: string[];
|
|
78
110
|
}
|
|
111
|
+
/**
|
|
112
|
+
* Resolver de usuarios para plugins
|
|
113
|
+
* Permite acceder a usuarios sin conocer la implementación interna
|
|
114
|
+
*/
|
|
115
|
+
interface UsersResolver {
|
|
116
|
+
findById: (id: string) => Promise<BaseUser | null>;
|
|
117
|
+
findByIds: (ids: string[]) => Promise<BaseUser[]>;
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Servicios core inyectados por el backend
|
|
121
|
+
* Los plugins acceden a estos servicios via ctx.services
|
|
122
|
+
*/
|
|
123
|
+
interface CoreServices {
|
|
124
|
+
users?: UsersResolver;
|
|
125
|
+
}
|
|
79
126
|
/**
|
|
80
127
|
* Helpers para migraciones de base de datos
|
|
81
128
|
*/
|
|
@@ -130,6 +177,8 @@ interface ModuleContext {
|
|
|
130
177
|
data?: Record<string, unknown>;
|
|
131
178
|
}) => Promise<void>;
|
|
132
179
|
};
|
|
180
|
+
/** Servicios de módulos core (users, etc.) */
|
|
181
|
+
services: CoreServices & Record<string, unknown>;
|
|
133
182
|
}
|
|
134
183
|
/**
|
|
135
184
|
* Manifest de un módulo Nexus
|
|
@@ -192,4 +241,4 @@ interface PluginManifest {
|
|
|
192
241
|
modules: ModuleManifest[];
|
|
193
242
|
}
|
|
194
243
|
|
|
195
|
-
export type { AuthRequest, FieldValidation, FormField, FormFieldType, ListType, MigrationHelpers, ModuleContext, ModuleEntity, ModuleManifest, ModuleMiddlewares, ModuleRequirements, PluginCategory, PluginManifest };
|
|
244
|
+
export type { AuthRequest, BaseUser, CoreServices, FieldValidation, FormField, FormFieldType, ListType, MigrationHelpers, ModuleContext, ModuleEntity, ModuleManifest, ModuleMiddlewares, ModuleRequirements, PaginatedResult, PaginationParams, PluginCategory, PluginManifest, UsersResolver };
|