@@ -2,6 +2,7 @@ import type { ApiKeyRecord, ApiKeyMetadata } from "../../types/api-key-types";
22import type { AuditLog , AuditLogQuery , AuditLogStats , AuditAction } from "../../types/audit-log-types" ;
33import type { Storage } from "../../types/storage-types" ;
44import { generateKey } from "../../core/generate" ;
5+ import { logger } from "../../utils/logger" ;
56import type {
67 AdapterFactoryConfig ,
78 AdapterFactoryOptions ,
@@ -12,23 +13,19 @@ import type {
1213} from "./types" ;
1314
1415export * from "./types" ;
15-
16- /** Default query limit for paginated results */
17- export const DEFAULT_QUERY_LIMIT = 100 ;
16+ export { DEFAULT_QUERY_LIMIT , calculateLogStats } from "../utils" ;
1817
1918/**
2019 * Creates a storage adapter with automatic transformations and field mapping
2120 */
2221export const createAdapterFactory = (
23- options : AdapterFactoryOptions
22+ options : AdapterFactoryOptions
2423) : Storage => {
2524 const config : AdapterFactoryConfig = {
2625 supportsDates : true ,
2726 supportsBooleans : true ,
2827 usePlural : false ,
2928 disableIdGeneration : false ,
30- disableTransformInput : false ,
31- disableTransformOutput : false ,
3229 debugLogs : false ,
3330 ...options . config ,
3431 } ;
@@ -40,19 +37,17 @@ export const createAdapterFactory = (
4037 ...options . schema ,
4138 } ;
4239
43- // Debug logging helper
4440 const debugLog = ( ...args : unknown [ ] ) => {
4541 if ( ! config . debugLogs ) return ;
4642
4743 if ( typeof config . debugLogs === "boolean" ) {
48- console . log ( `[${ config . adapterName } ]` , ...args ) ;
44+ logger . info ( `[${ config . adapterName } ]` , ...args ) ;
4945 return ;
5046 }
5147
52- // Check if the specific method is enabled
5348 const method = typeof args [ 0 ] === "string" ? args [ 0 ] : null ;
5449 if ( method && config . debugLogs [ method as keyof typeof config . debugLogs ] ) {
55- console . log ( `[${ config . adapterName } ]` , ...args ) ;
50+ logger . info ( `[${ config . adapterName } ]` , ...args ) ;
5651 }
5752 } ;
5853
@@ -283,11 +278,6 @@ export const createAdapterFactory = (
283278 record . id = config . customIdGenerator ? config . customIdGenerator ( ) : generateKey ( ) ;
284279 }
285280
286- if ( ! config . disableTransformInput ) {
287- const transformed = transformApiKeyInput ( record ) ;
288- debugLog ( "save" , "Transformed:" , transformed ) ;
289- }
290-
291281 await baseAdapter . save ( record ) ;
292282 debugLog ( "save" , "Saved successfully" ) ;
293283 } ,
0 commit comments