@gzl10/nexus-sdk 0.1.9 → 0.1.10

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.
Files changed (2) hide show
  1. package/dist/index.d.ts +22 -7
  2. package/package.json +1 -1
package/dist/index.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import { Knex } from 'knex';
2
+ export { Knex } from 'knex';
2
3
  import { Request, RequestHandler, Router } from 'express';
3
4
  export { CookieOptions, NextFunction, Request, RequestHandler, Response, Router } from 'express';
4
5
  import { Logger } from 'pino';
@@ -11,6 +12,9 @@ import { Logger } from 'pino';
11
12
  * depending on the full @gzl10/nexus-backend package.
12
13
  */
13
14
 
15
+ type KnexCreateTableBuilder = Knex.CreateTableBuilder;
16
+ type KnexAlterTableBuilder = Knex.AlterTableBuilder;
17
+ type KnexTransaction = Knex.Transaction;
14
18
  /**
15
19
  * Request autenticado con usuario y abilities CASL
16
20
  * El backend especializa TUser y TAbility con tipos concretos
@@ -168,16 +172,27 @@ interface MigrationHelpers {
168
172
  addAuditFieldsIfMissing: (db: Knex, tableName: string) => Promise<void>;
169
173
  addColumnIfMissing: (db: Knex, tableName: string, columnName: string, columnBuilder: (table: Knex.AlterTableBuilder) => void) => Promise<boolean>;
170
174
  }
175
+ /**
176
+ * Schema de validación genérico (compatible con Zod sin depender de él)
177
+ * Cualquier objeto con método parse() es válido
178
+ */
179
+ interface ValidationSchema {
180
+ parse: (data: unknown) => unknown;
181
+ }
182
+ /**
183
+ * Opciones para el middleware de validación
184
+ */
185
+ interface ValidateSchemas {
186
+ body?: ValidationSchema;
187
+ query?: ValidationSchema;
188
+ params?: ValidationSchema;
189
+ }
171
190
  /**
172
191
  * Middlewares disponibles en el contexto
173
192
  */
174
193
  interface ModuleMiddlewares {
175
- validate: (schemas: {
176
- body?: unknown;
177
- query?: unknown;
178
- params?: unknown;
179
- }) => RequestHandler;
180
- [key: string]: RequestHandler | ((...args: unknown[]) => RequestHandler) | undefined;
194
+ validate: (schemas: ValidateSchemas) => RequestHandler;
195
+ [key: string]: RequestHandler | ((...args: any[]) => RequestHandler) | undefined;
181
196
  }
182
197
  /**
183
198
  * Contexto inyectado a los módulos
@@ -278,4 +293,4 @@ interface PluginManifest {
278
293
  modules: ModuleManifest[];
279
294
  }
280
295
 
281
- export type { AbilityLike, AuthRequest, BaseUser, CoreServices, FieldValidation, ForbiddenErrorConstructor, ForbiddenErrorInstance, FormField, FormFieldType, ListType, MigrationHelpers, ModuleAbilities, ModuleContext, ModuleEntity, ModuleManifest, ModuleMiddlewares, ModuleRequirements, PaginatedResult, PaginationParams, PluginAuthRequest, PluginCategory, PluginManifest, UsersResolver };
296
+ export type { AbilityLike, AuthRequest, BaseUser, CoreServices, FieldValidation, ForbiddenErrorConstructor, ForbiddenErrorInstance, FormField, FormFieldType, KnexAlterTableBuilder, KnexCreateTableBuilder, KnexTransaction, ListType, MigrationHelpers, ModuleAbilities, ModuleContext, ModuleEntity, ModuleManifest, ModuleMiddlewares, ModuleRequirements, PaginatedResult, PaginationParams, PluginAuthRequest, PluginCategory, PluginManifest, UsersResolver, ValidateSchemas, ValidationSchema };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gzl10/nexus-sdk",
3
- "version": "0.1.9",
3
+ "version": "0.1.10",
4
4
  "description": "SDK types for creating Nexus plugins and modules",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",