@pakento/cms-sdk 4.0.4 → 4.0.6

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.mts CHANGED
@@ -223,24 +223,15 @@ interface CustomGraphQLResponse<T> {
223
223
 
224
224
  declare class PakentoCMSAPI {
225
225
  private client;
226
- private redis?;
226
+ private cache;
227
227
  private defaultTTL;
228
228
  private baseURL;
229
229
  private apiKey;
230
230
  constructor(config?: {
231
231
  cacheTTL?: number;
232
232
  });
233
- /**
234
- * Obtiene datos desde cache si existen; de lo contrario llama a fetcher() y guarda.
235
- */
236
- private safeJsonParse;
237
- private serializeForCache;
238
- private getCachedOrFetch;
239
- /**
240
- * Construye una llave única para el cache a partir del nombre de la
241
- * consulta y los parámetros.
242
- */
243
- private buildCacheKey;
233
+ private handleApiError;
234
+ private fetchGraphQL;
244
235
  getItems(params?: GetItemsParams): Promise<ItemsApiResponse>;
245
236
  private fetchItemsFromAPI;
246
237
  getCategories(params?: GetCategoriesParams): Promise<CategoriesApiResponse>;
@@ -252,6 +243,30 @@ declare class PakentoCMSAPI {
252
243
  createEcommerceOrder(params: CreateEcommerceOrderParams): Promise<CreateEcommerceOrderResponse>;
253
244
  executeCustomQuery<T>(params: CustomGraphQLParams<T>): Promise<CustomGraphQLResponse<T>>;
254
245
  sendContactUsEmail(params: SendContactUsEmailParams): Promise<SendContactUsEmailResponse>;
246
+ /**
247
+ * Verifica si existe cache para una función y parámetros específicos
248
+ */
249
+ hasCache(functionName: string, params?: Record<string, unknown>): Promise<boolean>;
250
+ /**
251
+ * Obtiene la key de cache para una función y parámetros específicos
252
+ */
253
+ getCacheKey(functionName: string, params?: Record<string, unknown>): string;
254
+ /**
255
+ * Limpia el cache para una función y parámetros específicos
256
+ */
257
+ clearCache(functionName: string, params?: Record<string, unknown>): Promise<boolean>;
258
+ /**
259
+ * Limpia todo el cache relacionado con este API Key
260
+ */
261
+ clearAllCache(): Promise<boolean>;
262
+ /**
263
+ * Obtiene información del cache (útil para debugging)
264
+ */
265
+ getCacheInfo(functionName: string, params?: Record<string, unknown>): Promise<{
266
+ exists: boolean;
267
+ key: string;
268
+ ttl?: number;
269
+ }>;
255
270
  }
256
271
  declare const pakentoCMSAPI: PakentoCMSAPI;
257
272
 
package/dist/index.d.ts CHANGED
@@ -223,24 +223,15 @@ interface CustomGraphQLResponse<T> {
223
223
 
224
224
  declare class PakentoCMSAPI {
225
225
  private client;
226
- private redis?;
226
+ private cache;
227
227
  private defaultTTL;
228
228
  private baseURL;
229
229
  private apiKey;
230
230
  constructor(config?: {
231
231
  cacheTTL?: number;
232
232
  });
233
- /**
234
- * Obtiene datos desde cache si existen; de lo contrario llama a fetcher() y guarda.
235
- */
236
- private safeJsonParse;
237
- private serializeForCache;
238
- private getCachedOrFetch;
239
- /**
240
- * Construye una llave única para el cache a partir del nombre de la
241
- * consulta y los parámetros.
242
- */
243
- private buildCacheKey;
233
+ private handleApiError;
234
+ private fetchGraphQL;
244
235
  getItems(params?: GetItemsParams): Promise<ItemsApiResponse>;
245
236
  private fetchItemsFromAPI;
246
237
  getCategories(params?: GetCategoriesParams): Promise<CategoriesApiResponse>;
@@ -252,6 +243,30 @@ declare class PakentoCMSAPI {
252
243
  createEcommerceOrder(params: CreateEcommerceOrderParams): Promise<CreateEcommerceOrderResponse>;
253
244
  executeCustomQuery<T>(params: CustomGraphQLParams<T>): Promise<CustomGraphQLResponse<T>>;
254
245
  sendContactUsEmail(params: SendContactUsEmailParams): Promise<SendContactUsEmailResponse>;
246
+ /**
247
+ * Verifica si existe cache para una función y parámetros específicos
248
+ */
249
+ hasCache(functionName: string, params?: Record<string, unknown>): Promise<boolean>;
250
+ /**
251
+ * Obtiene la key de cache para una función y parámetros específicos
252
+ */
253
+ getCacheKey(functionName: string, params?: Record<string, unknown>): string;
254
+ /**
255
+ * Limpia el cache para una función y parámetros específicos
256
+ */
257
+ clearCache(functionName: string, params?: Record<string, unknown>): Promise<boolean>;
258
+ /**
259
+ * Limpia todo el cache relacionado con este API Key
260
+ */
261
+ clearAllCache(): Promise<boolean>;
262
+ /**
263
+ * Obtiene información del cache (útil para debugging)
264
+ */
265
+ getCacheInfo(functionName: string, params?: Record<string, unknown>): Promise<{
266
+ exists: boolean;
267
+ key: string;
268
+ ttl?: number;
269
+ }>;
255
270
  }
256
271
  declare const pakentoCMSAPI: PakentoCMSAPI;
257
272