@pakento/cms-sdk 4.3.11 → 4.3.13

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/README.md CHANGED
@@ -197,4 +197,4 @@ MIT
197
197
 
198
198
  ## EJECUCION DE PREUBAS:
199
199
 
200
- npx ts-node -P tsconfig.examples.json examples/testItems.
200
+ npx ts-node -P tsconfig.examples.json examples/testItems.ts
package/dist/index.d.mts CHANGED
@@ -6,8 +6,8 @@ declare class CacheService {
6
6
  private defaultTTL;
7
7
  constructor(apiKey: string);
8
8
  private generateParamsHash;
9
- buildCacheKey(params?: Record<string, unknown>): string;
10
- cacheWrap<T>(key: string, fetcher: () => Promise<T>, filters?: Record<string, unknown>): Promise<T>;
9
+ buildCacheKey(functionName: string, params?: Record<string, unknown>): string;
10
+ cacheWrap<T>(key: string, fetcher: () => Promise<T>, functionName: string, filters?: Record<string, unknown>): Promise<T>;
11
11
  clearAllCache(): Promise<boolean>;
12
12
  }
13
13
 
@@ -42,6 +42,35 @@ interface ItemImage {
42
42
  url: string;
43
43
  thumbnail_url: string;
44
44
  }
45
+ interface AttributeValue {
46
+ id: string;
47
+ value: string;
48
+ }
49
+ interface MasterAttribute {
50
+ id: string;
51
+ name: string;
52
+ values: AttributeValue[];
53
+ }
54
+ interface VariationAttributeValue {
55
+ attribute_id: string;
56
+ attribute_name: string;
57
+ value: string;
58
+ value_id: string;
59
+ }
60
+ interface Variation {
61
+ id: string;
62
+ name: string;
63
+ description: string;
64
+ cover_image_url: string;
65
+ cover_image_thumbnail_url: string;
66
+ price: number;
67
+ old_price: number;
68
+ price_notes: string;
69
+ price_text: string;
70
+ currency_prefix: string;
71
+ attribute_values: VariationAttributeValue[];
72
+ images: ItemImage[];
73
+ }
45
74
  interface Item {
46
75
  id: string;
47
76
  name: string;
@@ -60,6 +89,10 @@ interface Item {
60
89
  cover_image_thumbnail_url: string;
61
90
  url_safe_name: string;
62
91
  images: ItemImage[];
92
+ item_super_category_id: number;
93
+ item_super_category_name: string;
94
+ master_attributes: MasterAttribute[];
95
+ variations: Variation[];
63
96
  }
64
97
  interface ItemsWhere {
65
98
  item_category_id?: WhereClause;
@@ -83,30 +116,41 @@ interface ItemEcommerceRaw {
83
116
  featured: boolean;
84
117
  description: string;
85
118
  url_safe_name: string;
119
+ item_super_category_id: string;
120
+ item_super_category_name: string;
121
+ item_category_id: string;
122
+ item_category_name: string;
123
+ cover_image_url: string;
124
+ cover_image_thumbnail_url: string;
125
+ price: number;
126
+ old_price: number;
127
+ price_notes: string;
128
+ price_text: string;
129
+ currency_prefix: string;
130
+ brand_id: string;
131
+ brand_name: string;
132
+ master_attributes: MasterAttribute[];
133
+ variations: {
134
+ id: string;
135
+ name: string;
136
+ description: string;
137
+ cover_image_url: string;
138
+ cover_image_thumbnail_url: string;
139
+ price: number;
140
+ old_price: number;
141
+ price_notes: string;
142
+ price_text: string;
143
+ currency_prefix: string;
144
+ attribute_values: VariationAttributeValue[];
145
+ images: {
146
+ url: string;
147
+ thumbnail_url: string;
148
+ }[];
149
+ }[];
86
150
  images: {
87
151
  url: string;
88
- thumbnailURL: string;
152
+ thumbnail_url: string;
89
153
  }[];
90
- coverImage: {
91
- url: string;
92
- thumbnailURL: string;
93
- } | null;
94
- item_prices: {
95
- docs: {
96
- amount: number;
97
- old_price: number;
98
- price_text: string;
99
- price_notes: string;
100
- }[];
101
- };
102
- brand: {
103
- id: string;
104
- name: string;
105
- } | null;
106
- item_category: {
107
- id: string;
108
- name: string;
109
- } | null;
110
154
  }
111
155
  interface ItemsRawResponse {
112
156
  totalDocs: number;
@@ -336,4 +380,4 @@ declare class CustomApi extends ApiClient {
336
380
  }
337
381
  declare const customApi: CustomApi;
338
382
 
339
- export { ApiClient, type ApiResponse, type Brand, type BrandEcommerceRaw, type BrandsRawResponse, CacheService, type CategoriesRawResponse, type CategoriesWhere, type Category, type CategoryEcommerceRaw, type CreateEcommerceOrderItem, type CreateEcommerceOrderParams, type CreateEcommerceOrderResponse, type CustomGraphQLParams, type CustomGraphQLResponse, type Entity, type EntityEcommerceRaw, type EntityRawResponse, type GetBrandsParams, type GetCategoriesParams, type GetEntityParams, type GetItemsParams, type Item, type ItemEcommerceRaw, type ItemImage, type ItemsRawResponse, type ItemsWhere, type SendContactUsEmailParams, type SendContactUsEmailResponse, type WhereClause, brandsApi, categoriesApi, contactApi, customApi, entityApi, itemsApi, ordersApi };
383
+ export { ApiClient, type ApiResponse, type AttributeValue, type Brand, type BrandEcommerceRaw, type BrandsRawResponse, CacheService, type CategoriesRawResponse, type CategoriesWhere, type Category, type CategoryEcommerceRaw, type CreateEcommerceOrderItem, type CreateEcommerceOrderParams, type CreateEcommerceOrderResponse, type CustomGraphQLParams, type CustomGraphQLResponse, type Entity, type EntityEcommerceRaw, type EntityRawResponse, type GetBrandsParams, type GetCategoriesParams, type GetEntityParams, type GetItemsParams, type Item, type ItemEcommerceRaw, type ItemImage, type ItemsRawResponse, type ItemsWhere, type MasterAttribute, type SendContactUsEmailParams, type SendContactUsEmailResponse, type Variation, type VariationAttributeValue, type WhereClause, brandsApi, categoriesApi, contactApi, customApi, entityApi, itemsApi, ordersApi };
package/dist/index.d.ts CHANGED
@@ -6,8 +6,8 @@ declare class CacheService {
6
6
  private defaultTTL;
7
7
  constructor(apiKey: string);
8
8
  private generateParamsHash;
9
- buildCacheKey(params?: Record<string, unknown>): string;
10
- cacheWrap<T>(key: string, fetcher: () => Promise<T>, filters?: Record<string, unknown>): Promise<T>;
9
+ buildCacheKey(functionName: string, params?: Record<string, unknown>): string;
10
+ cacheWrap<T>(key: string, fetcher: () => Promise<T>, functionName: string, filters?: Record<string, unknown>): Promise<T>;
11
11
  clearAllCache(): Promise<boolean>;
12
12
  }
13
13
 
@@ -42,6 +42,35 @@ interface ItemImage {
42
42
  url: string;
43
43
  thumbnail_url: string;
44
44
  }
45
+ interface AttributeValue {
46
+ id: string;
47
+ value: string;
48
+ }
49
+ interface MasterAttribute {
50
+ id: string;
51
+ name: string;
52
+ values: AttributeValue[];
53
+ }
54
+ interface VariationAttributeValue {
55
+ attribute_id: string;
56
+ attribute_name: string;
57
+ value: string;
58
+ value_id: string;
59
+ }
60
+ interface Variation {
61
+ id: string;
62
+ name: string;
63
+ description: string;
64
+ cover_image_url: string;
65
+ cover_image_thumbnail_url: string;
66
+ price: number;
67
+ old_price: number;
68
+ price_notes: string;
69
+ price_text: string;
70
+ currency_prefix: string;
71
+ attribute_values: VariationAttributeValue[];
72
+ images: ItemImage[];
73
+ }
45
74
  interface Item {
46
75
  id: string;
47
76
  name: string;
@@ -60,6 +89,10 @@ interface Item {
60
89
  cover_image_thumbnail_url: string;
61
90
  url_safe_name: string;
62
91
  images: ItemImage[];
92
+ item_super_category_id: number;
93
+ item_super_category_name: string;
94
+ master_attributes: MasterAttribute[];
95
+ variations: Variation[];
63
96
  }
64
97
  interface ItemsWhere {
65
98
  item_category_id?: WhereClause;
@@ -83,30 +116,41 @@ interface ItemEcommerceRaw {
83
116
  featured: boolean;
84
117
  description: string;
85
118
  url_safe_name: string;
119
+ item_super_category_id: string;
120
+ item_super_category_name: string;
121
+ item_category_id: string;
122
+ item_category_name: string;
123
+ cover_image_url: string;
124
+ cover_image_thumbnail_url: string;
125
+ price: number;
126
+ old_price: number;
127
+ price_notes: string;
128
+ price_text: string;
129
+ currency_prefix: string;
130
+ brand_id: string;
131
+ brand_name: string;
132
+ master_attributes: MasterAttribute[];
133
+ variations: {
134
+ id: string;
135
+ name: string;
136
+ description: string;
137
+ cover_image_url: string;
138
+ cover_image_thumbnail_url: string;
139
+ price: number;
140
+ old_price: number;
141
+ price_notes: string;
142
+ price_text: string;
143
+ currency_prefix: string;
144
+ attribute_values: VariationAttributeValue[];
145
+ images: {
146
+ url: string;
147
+ thumbnail_url: string;
148
+ }[];
149
+ }[];
86
150
  images: {
87
151
  url: string;
88
- thumbnailURL: string;
152
+ thumbnail_url: string;
89
153
  }[];
90
- coverImage: {
91
- url: string;
92
- thumbnailURL: string;
93
- } | null;
94
- item_prices: {
95
- docs: {
96
- amount: number;
97
- old_price: number;
98
- price_text: string;
99
- price_notes: string;
100
- }[];
101
- };
102
- brand: {
103
- id: string;
104
- name: string;
105
- } | null;
106
- item_category: {
107
- id: string;
108
- name: string;
109
- } | null;
110
154
  }
111
155
  interface ItemsRawResponse {
112
156
  totalDocs: number;
@@ -336,4 +380,4 @@ declare class CustomApi extends ApiClient {
336
380
  }
337
381
  declare const customApi: CustomApi;
338
382
 
339
- export { ApiClient, type ApiResponse, type Brand, type BrandEcommerceRaw, type BrandsRawResponse, CacheService, type CategoriesRawResponse, type CategoriesWhere, type Category, type CategoryEcommerceRaw, type CreateEcommerceOrderItem, type CreateEcommerceOrderParams, type CreateEcommerceOrderResponse, type CustomGraphQLParams, type CustomGraphQLResponse, type Entity, type EntityEcommerceRaw, type EntityRawResponse, type GetBrandsParams, type GetCategoriesParams, type GetEntityParams, type GetItemsParams, type Item, type ItemEcommerceRaw, type ItemImage, type ItemsRawResponse, type ItemsWhere, type SendContactUsEmailParams, type SendContactUsEmailResponse, type WhereClause, brandsApi, categoriesApi, contactApi, customApi, entityApi, itemsApi, ordersApi };
383
+ export { ApiClient, type ApiResponse, type AttributeValue, type Brand, type BrandEcommerceRaw, type BrandsRawResponse, CacheService, type CategoriesRawResponse, type CategoriesWhere, type Category, type CategoryEcommerceRaw, type CreateEcommerceOrderItem, type CreateEcommerceOrderParams, type CreateEcommerceOrderResponse, type CustomGraphQLParams, type CustomGraphQLResponse, type Entity, type EntityEcommerceRaw, type EntityRawResponse, type GetBrandsParams, type GetCategoriesParams, type GetEntityParams, type GetItemsParams, type Item, type ItemEcommerceRaw, type ItemImage, type ItemsRawResponse, type ItemsWhere, type MasterAttribute, type SendContactUsEmailParams, type SendContactUsEmailResponse, type Variation, type VariationAttributeValue, type WhereClause, brandsApi, categoriesApi, contactApi, customApi, entityApi, itemsApi, ordersApi };
package/dist/index.js CHANGED
@@ -64,11 +64,11 @@ var CacheService = class {
64
64
  const paramsString = JSON.stringify(params);
65
65
  return btoa(paramsString);
66
66
  }
67
- buildCacheKey(params = {}) {
68
- const paramsHash = this.generateParamsHash(params);
67
+ buildCacheKey(functionName, params = {}) {
68
+ const paramsHash = this.generateParamsHash({ ...params, functionName });
69
69
  return `pakento:${this.apiKeyHash}:${paramsHash}`;
70
70
  }
71
- async cacheWrap(key, fetcher, filters) {
71
+ async cacheWrap(key, fetcher, functionName, filters) {
72
72
  if (!this.redis) {
73
73
  return fetcher();
74
74
  }
@@ -90,6 +90,7 @@ var CacheService = class {
90
90
  const result = await fetcher();
91
91
  try {
92
92
  const cacheData = {
93
+ _function: functionName,
93
94
  _filters: filters || {},
94
95
  _cachedAt: (/* @__PURE__ */ new Date()).toISOString(),
95
96
  ...result
@@ -181,32 +182,49 @@ var ApiClient = class {
181
182
 
182
183
  // src/api/items/parsers.ts
183
184
  function parseRawItemToItem(rawItem) {
184
- const firstPrice = rawItem.item_prices.docs[0];
185
185
  const images = rawItem.images.map((img) => ({
186
186
  url: img.url,
187
- thumbnail_url: img.thumbnailURL
187
+ thumbnail_url: img.thumbnail_url
188
+ }));
189
+ const variations = rawItem.variations.map((v) => ({
190
+ id: v.id,
191
+ name: v.name,
192
+ description: v.description,
193
+ cover_image_url: v.cover_image_url,
194
+ cover_image_thumbnail_url: v.cover_image_thumbnail_url,
195
+ price: v.price,
196
+ old_price: v.old_price,
197
+ price_notes: v.price_notes,
198
+ price_text: v.price_text,
199
+ currency_prefix: v.currency_prefix,
200
+ attribute_values: v.attribute_values,
201
+ images: v.images.map((img) => ({
202
+ url: img.url,
203
+ thumbnail_url: img.thumbnail_url
204
+ }))
188
205
  }));
189
- const coverImageUrl = rawItem.coverImage?.url || rawItem.images[0]?.url || "";
190
- const coverImageThumbnailUrl = rawItem.coverImage?.thumbnailURL || rawItem.images[0]?.thumbnailURL || "";
191
206
  return {
192
207
  id: rawItem.id,
193
208
  name: rawItem.name,
194
209
  featured: rawItem.featured,
195
210
  url_safe_name: rawItem.url_safe_name,
196
- currency_prefix: "$",
197
- // Default currency prefix, could be made configurable
211
+ currency_prefix: rawItem.currency_prefix,
198
212
  description: rawItem.description,
199
- old_price: firstPrice?.old_price || 0,
200
- item_category_name: rawItem.item_category?.name || "",
201
- item_category_id: parseInt(rawItem.item_category?.id || "0"),
202
- price_text: firstPrice?.price_text || "",
203
- price_notes: firstPrice?.price_notes || "",
204
- price: firstPrice?.amount || 0,
205
- brand_id: parseInt(rawItem.brand?.id || "0"),
206
- brand_name: rawItem.brand?.name || "",
207
- cover_image_url: coverImageUrl,
208
- cover_image_thumbnail_url: coverImageThumbnailUrl,
209
- images
213
+ old_price: rawItem.old_price,
214
+ item_category_name: rawItem.item_category_name,
215
+ item_category_id: parseInt(rawItem.item_category_id || "0", 10),
216
+ item_super_category_name: rawItem.item_super_category_name,
217
+ item_super_category_id: parseInt(rawItem.item_super_category_id || "0", 10),
218
+ price_text: rawItem.price_text,
219
+ price_notes: rawItem.price_notes,
220
+ price: rawItem.price,
221
+ brand_id: parseInt(rawItem.brand_id || "0", 10),
222
+ brand_name: rawItem.brand_name,
223
+ cover_image_url: rawItem.cover_image_url,
224
+ cover_image_thumbnail_url: rawItem.cover_image_thumbnail_url,
225
+ images,
226
+ master_attributes: rawItem.master_attributes,
227
+ variations
210
228
  };
211
229
  }
212
230
  function parseRawItemsToItems(rawItems) {
@@ -250,11 +268,11 @@ var ItemsApi = class extends ApiClient {
250
268
  errorMessage
251
269
  };
252
270
  }
253
- console.log("ARMANDO CACHE KEY CON:", validatedParams.data);
254
- const cacheKey = this.cache.buildCacheKey(validatedParams.data);
271
+ const cacheKey = this.cache.buildCacheKey("getItems", validatedParams.data);
255
272
  return this.cache.cacheWrap(
256
273
  cacheKey,
257
274
  () => this.fetchItemsFromAPI(validatedParams.data),
275
+ "getItems",
258
276
  validatedParams.data
259
277
  );
260
278
  }
@@ -272,62 +290,97 @@ var ItemsApi = class extends ApiClient {
272
290
  }
273
291
  const query = `
274
292
  query GetEcommerceItems(
275
- $where: EcommerceItemsWhere
276
- $onlyOffers: Boolean
277
- $limit: Int
278
- $page: Int
279
- $search: String
280
- $sort: String
281
- $minPrice: Float
282
- $maxPrice: Float
293
+ $where: EcommerceItemsWhere
294
+ $onlyOffers: Boolean
295
+ $limit: Int
296
+ $page: Int
297
+ $search: String
298
+ $sort: String
299
+ $minPrice: Float
300
+ $maxPrice: Float
301
+ ) {
302
+ GetEcommerceItems(
303
+ where: $where
304
+ onlyOffers: $onlyOffers
305
+ limit: $limit
306
+ page: $page
307
+ search: $search
308
+ sort: $sort
309
+ minPrice: $minPrice
310
+ maxPrice: $maxPrice
283
311
  ) {
284
- GetEcommerceItems(
285
- where: $where
286
- onlyOffers: $onlyOffers
287
- limit: $limit
288
- page: $page
289
- search: $search
290
- sort: $sort
291
- minPrice: $minPrice
292
- maxPrice: $maxPrice
293
- ) {
294
- totalDocs
295
- totalPages
296
- prevPage
297
- nextPage
298
- docs {
312
+ totalDocs
313
+ totalPages
314
+ prevPage
315
+ nextPage
316
+ docs {
317
+ id
318
+ name
319
+ featured
320
+ description
321
+ url_safe_name
322
+
323
+ item_super_category_id
324
+ item_super_category_name
325
+
326
+ item_category_id
327
+ item_category_name
328
+
329
+ cover_image_url
330
+ cover_image_thumbnail_url
331
+
332
+ price
333
+ old_price
334
+ price_notes
335
+ price_text
336
+ currency_prefix
337
+
338
+ brand_id
339
+ brand_name
340
+
341
+ master_attributes {
342
+ id
343
+ name
344
+ values {
345
+ id
346
+ value
347
+ }
348
+ }
349
+
350
+ variations {
299
351
  id
300
352
  name
301
- featured
302
353
  description
303
- url_safe_name
304
- images {
305
- url
306
- thumbnailURL
354
+
355
+ cover_image_url
356
+ cover_image_thumbnail_url
357
+
358
+ price
359
+ old_price
360
+ price_notes
361
+ price_text
362
+ currency_prefix
363
+
364
+ attribute_values {
365
+ attribute_id
366
+ attribute_name
367
+ value
368
+ value_id
307
369
  }
308
- coverImage {
370
+
371
+ images {
309
372
  url
310
- thumbnailURL
311
- }
312
- item_prices {
313
- docs {
314
- amount
315
- old_price
316
- price_text
317
- price_notes
318
- }
319
- }
320
- brand {
321
- id
322
- name
323
- }
324
- item_category {
325
- id
326
- name
373
+ thumbnail_url
327
374
  }
328
375
  }
376
+
377
+ images {
378
+ url
379
+ thumbnail_url
380
+ }
329
381
  }
330
382
  }
383
+ }
331
384
  `;
332
385
  const whereConditions = {};
333
386
  if (params.where?.item_category_id?.equals) {
@@ -414,10 +467,14 @@ var CategoriesApi = class extends ApiClient {
414
467
  );
415
468
  return { data: [], error: true, errorMessage };
416
469
  }
417
- const cacheKey = this.cache.buildCacheKey(validatedParams.data);
470
+ const cacheKey = this.cache.buildCacheKey(
471
+ "getCategories",
472
+ validatedParams.data
473
+ );
418
474
  return this.cache.cacheWrap(
419
475
  cacheKey,
420
476
  () => this.fetchCategoriesFromAPI(validatedParams.data),
477
+ "getCategories",
421
478
  validatedParams.data
422
479
  );
423
480
  }
@@ -509,10 +566,14 @@ var BrandsApi = class extends ApiClient {
509
566
  errorMessage
510
567
  };
511
568
  }
512
- const cacheKey = this.cache.buildCacheKey(validatedParams.data);
569
+ const cacheKey = this.cache.buildCacheKey(
570
+ "getBrands",
571
+ validatedParams.data
572
+ );
513
573
  return this.cache.cacheWrap(
514
574
  cacheKey,
515
575
  () => this.fetchBrandsFromAPI(validatedParams.data),
576
+ "getBrands",
516
577
  validatedParams.data
517
578
  );
518
579
  }
@@ -623,10 +684,11 @@ function parseRawEntityToEntity(rawEntity) {
623
684
  // src/api/entity/api.ts
624
685
  var EntityApi = class extends ApiClient {
625
686
  async getEntity(params = {}) {
626
- const cacheKey = this.cache.buildCacheKey(params);
687
+ const cacheKey = this.cache.buildCacheKey("getEntity", params);
627
688
  return this.cache.cacheWrap(
628
689
  cacheKey,
629
690
  () => this.fetchEntityFromAPI(params),
691
+ "getEntity",
630
692
  params
631
693
  );
632
694
  }
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts","../src/api/core/apiClient.ts","../src/api/core/cache.ts","../src/api/items/parsers.ts","../src/api/items/validators.ts","../src/api/items/api.ts","../src/api/categories/validators.ts","../src/api/categories/parsers.ts","../src/api/categories/api.ts","../src/api/brands/validators.ts","../src/api/brands/parsers.ts","../src/api/brands/api.ts","../src/api/entity/parsers.ts","../src/api/entity/api.ts","../src/api/orders/validators.ts","../src/api/orders/api.ts","../src/api/contact/validators.ts","../src/api/contact/api.ts","../src/api/custom/api.ts"],"sourcesContent":["// Core\nexport { ApiClient } from \"./api/core/apiClient\";\n\n// Cache\nexport { CacheService } from \"./api/core/cache\";\n\n// Items\nexport { itemsApi } from \"./api/items\";\n\n// Categories\nexport { categoriesApi } from \"./api/categories\";\n\n// Brands\nexport { brandsApi } from \"./api/brands\";\n\n// Entity\nexport { entityApi } from \"./api/entity\";\n\n// Orders\nexport { ordersApi } from \"./api/orders\";\n\n// Contact\nexport { contactApi } from \"./api/contact\";\n\n// Custom\nexport { customApi } from \"./api/custom\";\n\n// Types (re-export if needed)\nexport * from \"./api/items/types\";\nexport * from \"./api/categories/types\";\nexport * from \"./api/brands/types\";\nexport * from \"./api/entity/types\";\nexport * from \"./api/orders/types\";\nexport * from \"./api/contact/types\";\nexport * from \"./api/custom/types\";\nexport * from \"./api/core/types\";\n","import axios, { AxiosInstance, AxiosError } from \"axios\";\nimport { z } from \"zod\";\nimport { CacheService } from \"./cache\";\n\nexport class ApiClient {\n protected client: AxiosInstance;\n protected cache: CacheService;\n protected baseURL: string;\n protected apiKey: string;\n\n constructor() {\n this.baseURL = process.env.PAKENTO_CMS_BASE_URL || \"\";\n this.apiKey = process.env.PAKENTO_API_KEY || \"\";\n this.cache = new CacheService(this.apiKey);\n\n this.client = axios.create({\n baseURL: this.baseURL,\n headers: {\n \"Content-Type\": \"application/json\",\n Authorization: `users API-Key ${this.apiKey}`,\n },\n });\n\n this.client.interceptors.request.use(\n (config) => {\n const fullUrl = `${config.baseURL}${config.url}`;\n console.log(`🌐 API Call: ${config.method?.toUpperCase()} ${fullUrl}`);\n return config;\n },\n (error) => Promise.reject(error)\n );\n }\n\n protected handleApiError(error: unknown, context: string): string {\n if (error instanceof AxiosError) {\n const status = error.response?.status;\n const responseMessage = error.response?.data?.message;\n if (status === 401) return \"API Key inválida o expirada\";\n if (status === 404) return `${context} no encontrado`;\n if (status && status >= 500) return \"Error del servidor CMS\";\n return (\n responseMessage || `Error de conexión en ${context}: ${error.message}`\n );\n } else if (error instanceof z.ZodError) {\n return `Validación fallida: ${error.issues\n .map((e) => e.message)\n .join(\", \")}`;\n } else if (error instanceof Error) {\n return error.message;\n }\n return \"Error desconocido\";\n }\n\n protected async fetchGraphQL<T>(\n query: string,\n variables: any,\n extractData: (responseData: any) => T\n ): Promise<{ data: T | null; error: boolean; errorMessage: string | null }> {\n try {\n const response = await this.client.post(\"/api/graphql\", {\n query,\n variables,\n });\n if (response.data.errors) {\n const errorMessage = `GraphQL Error: ${response.data.errors[0].message}`;\n return { data: null, error: true, errorMessage };\n }\n const data = extractData(response.data.data);\n return { data, error: false, errorMessage: null };\n } catch (error) {\n const errorMessage = this.handleApiError(error, \"GraphQL query\");\n return { data: null, error: true, errorMessage };\n }\n }\n}\n","import { Redis } from \"@upstash/redis\";\n\nexport class CacheService {\n private redis?: Redis;\n private apiKeyHash: string;\n private defaultTTL: number = 172800; // 48 hours\n\n constructor(apiKey: string) {\n this.apiKeyHash = apiKey.substring(0, 8);\n\n if (\n process.env.UPSTASH_REDIS_REST_URL &&\n process.env.UPSTASH_REDIS_REST_TOKEN\n ) {\n this.redis = new Redis({\n url: process.env.UPSTASH_REDIS_REST_URL,\n token: process.env.UPSTASH_REDIS_REST_TOKEN,\n });\n }\n }\n\n private generateParamsHash(params: Record<string, unknown>): string {\n const paramsString = JSON.stringify(params);\n return btoa(paramsString);\n }\n\n public buildCacheKey(params: Record<string, unknown> = {}): string {\n const paramsHash = this.generateParamsHash(params);\n return `pakento:${this.apiKeyHash}:${paramsHash}`;\n }\n\n public async cacheWrap<T>(\n key: string,\n fetcher: () => Promise<T>,\n filters?: Record<string, unknown>\n ): Promise<T> {\n if (!this.redis) {\n return fetcher();\n }\n\n let cached: string | null = null;\n try {\n cached = await this.redis.get(key);\n\n if (typeof cached === \"object\" && cached !== null) {\n console.log(\"[Cache] ✅ Reading from cache:\", key);\n return cached as T;\n }\n\n if (cached) {\n console.log(\"[Cache] ✅ Reading from cache:\", key);\n return JSON.parse(cached as string) as T;\n }\n } catch (err) {\n console.warn(\"[Cache] ❌ Error reading from cache:\", err);\n console.log(`[Cache] ❌ Key: ${key}, type: ${typeof cached}`);\n }\n\n const result = await fetcher();\n\n try {\n // Crear objeto de caché con datos y filtros para visualización\n const cacheData = {\n _filters: filters || {},\n _cachedAt: new Date().toISOString(),\n ...result,\n };\n\n console.log(\"[Cache] ✅ Writing to cache:\", key);\n await this.redis.set(key, JSON.stringify(cacheData), {\n ex: this.defaultTTL,\n });\n } catch (err) {\n console.warn(\"[Cache] ❌ Error writing to cache:\", err);\n }\n\n return result;\n }\n\n public async clearAllCache(): Promise<boolean> {\n if (!this.redis) {\n console.warn(\"[Cache] ❌ Redis no configurado\");\n return false;\n }\n\n try {\n const pattern = `pakento:${this.apiKeyHash}:*`;\n const keys = await this.redis.keys(pattern);\n\n if (keys.length > 0) {\n await this.redis.del(...keys);\n console.log(\"[Cache] ✅ Cache limpiado\");\n }\n\n return true;\n } catch (err) {\n console.warn(\"[Cache] ❌ Error limpiando todo el cache\", err);\n return false;\n }\n }\n}\n","import { Item, ItemEcommerceRaw } from \"./types\";\n\n/**\n * Parses a raw GraphQL response item to the normalized Item type\n * @param rawItem - The raw item from GraphQL response\n * @returns Normalized Item object\n */\nexport function parseRawItemToItem(rawItem: ItemEcommerceRaw): Item {\n const firstPrice = rawItem.item_prices.docs[0];\n\n const images = rawItem.images.map((img) => ({\n url: img.url,\n thumbnail_url: img.thumbnailURL,\n }));\n\n const coverImageUrl = rawItem.coverImage?.url || rawItem.images[0]?.url || \"\";\n const coverImageThumbnailUrl =\n rawItem.coverImage?.thumbnailURL || rawItem.images[0]?.thumbnailURL || \"\";\n\n return {\n id: rawItem.id,\n name: rawItem.name,\n featured: rawItem.featured,\n url_safe_name: rawItem.url_safe_name,\n currency_prefix: \"$\", // Default currency prefix, could be made configurable\n description: rawItem.description,\n old_price: firstPrice?.old_price || 0,\n item_category_name: rawItem.item_category?.name || \"\",\n item_category_id: parseInt(rawItem.item_category?.id || \"0\"),\n price_text: firstPrice?.price_text || \"\",\n price_notes: firstPrice?.price_notes || \"\",\n price: firstPrice?.amount || 0,\n brand_id: parseInt(rawItem.brand?.id || \"0\"),\n brand_name: rawItem.brand?.name || \"\",\n cover_image_url: coverImageUrl,\n cover_image_thumbnail_url: coverImageThumbnailUrl,\n images: images,\n };\n}\n\n/**\n * Parses an array of raw GraphQL response items to normalized Item types\n * @param rawItems - Array of raw items from GraphQL response\n * @returns Array of normalized Item objects\n */\nexport function parseRawItemsToItems(rawItems: ItemEcommerceRaw[]): Item[] {\n return rawItems.map(parseRawItemToItem);\n}\n","import { z } from \"zod\";\n\nexport const itemsParamsSchema = z.object({\n where: z\n .object({\n item_category_id: z.object({ equals: z.string().optional() }).optional(),\n item_super_category_id: z\n .object({ equals: z.string().optional() })\n .optional(),\n brand_id: z.object({ equals: z.string().optional() }).optional(),\n id: z.object({ equals: z.string().optional() }).optional(),\n })\n .optional(),\n onlyOffers: z.boolean().optional(),\n limit: z.coerce.number().optional(),\n page: z.coerce.number().optional(),\n search: z.string().optional(),\n sort: z.string().optional(),\n minPrice: z.coerce.number().optional(),\n maxPrice: z.coerce.number().optional(),\n});\n","import { ApiClient } from \"../core/apiClient\";\nimport { itemsParamsSchema } from \"./validators\";\nimport { parseRawItemsToItems } from \"./parsers\";\nimport { GetItemsParams, ItemsRawResponse, ItemsWhere, Item } from \"./types\";\nimport { ApiResponse } from \"../core/types\";\n\nclass ItemsApi extends ApiClient {\n async getItems(params: GetItemsParams = {}): Promise<ApiResponse<Item[]>> {\n const validatedParams = itemsParamsSchema.safeParse(params);\n if (!validatedParams.success) {\n const errorMessage = this.handleApiError(\n validatedParams.error,\n \"getItems validation\"\n );\n return {\n data: [],\n totalDocs: 0,\n totalPages: 0,\n prevPage: null,\n nextPage: null,\n error: true,\n errorMessage,\n };\n }\n\n console.log(\"ARMANDO CACHE KEY CON:\", validatedParams.data);\n const cacheKey = this.cache.buildCacheKey(validatedParams.data);\n return this.cache.cacheWrap(\n cacheKey,\n () => this.fetchItemsFromAPI(validatedParams.data),\n validatedParams.data\n );\n }\n\n private async fetchItemsFromAPI(\n params: GetItemsParams\n ): Promise<ApiResponse<Item[]>> {\n if (!this.baseURL || !this.apiKey) {\n return {\n data: [],\n totalDocs: 0,\n totalPages: 0,\n prevPage: null,\n nextPage: null,\n error: true,\n errorMessage:\n \"SDK no configurado: PAKENTO_CMS_BASE_URL o PAKENTO_API_KEY faltantes.\",\n };\n }\n\n const query = `\n query GetEcommerceItems(\n $where: EcommerceItemsWhere\n $onlyOffers: Boolean\n $limit: Int\n $page: Int\n $search: String\n $sort: String\n $minPrice: Float\n $maxPrice: Float\n ) {\n GetEcommerceItems(\n where: $where\n onlyOffers: $onlyOffers\n limit: $limit\n page: $page\n search: $search\n sort: $sort\n minPrice: $minPrice\n maxPrice: $maxPrice\n ) {\n totalDocs\n totalPages\n prevPage\n nextPage\n docs {\n id\n name\n featured\n description\n url_safe_name\n images {\n url\n thumbnailURL\n }\n coverImage {\n url\n thumbnailURL\n }\n item_prices {\n docs {\n amount\n old_price\n price_text\n price_notes\n }\n }\n brand {\n id\n name\n }\n item_category {\n id\n name\n }\n }\n }\n }\n `;\n\n const whereConditions: ItemsWhere = {};\n if (params.where?.item_category_id?.equals) {\n whereConditions.item_category_id = {\n equals: params.where.item_category_id.equals,\n };\n }\n if (params.where?.item_super_category_id?.equals) {\n whereConditions.item_super_category_id = {\n equals: params.where.item_super_category_id.equals,\n };\n }\n if (params.where?.brand_id?.equals) {\n whereConditions.brand_id = { equals: params.where.brand_id.equals };\n }\n if (params.where?.id?.equals) {\n whereConditions.id = { equals: params.where.id.equals };\n }\n\n const variables = {\n ...params,\n where:\n Object.keys(whereConditions).length > 0 ? whereConditions : undefined,\n };\n\n const { data, error, errorMessage } =\n await this.fetchGraphQL<ItemsRawResponse>(\n query,\n variables,\n (responseData) => responseData.GetEcommerceItems\n );\n\n if (error) {\n return {\n data: [],\n totalDocs: 0,\n totalPages: 0,\n prevPage: null,\n nextPage: null,\n error: true,\n errorMessage,\n };\n }\n\n return {\n data: parseRawItemsToItems(data!.docs),\n totalDocs: data!.totalDocs,\n totalPages: data!.totalPages,\n prevPage: data!.prevPage,\n nextPage: data!.nextPage,\n error: false,\n errorMessage: null,\n };\n }\n}\n\nexport const itemsApi = new ItemsApi();\n","import { z } from \"zod\";\n\nexport const categoriesParamsSchema = z.object({\n where: z\n .object({\n item_super_category_id: z\n .object({ equals: z.string().optional() })\n .optional(),\n brand_id: z.object({ equals: z.string().optional() }).optional(),\n })\n .optional(),\n limit: z.coerce.number().optional(),\n page: z.coerce.number().optional(),\n sort: z.string().optional(),\n});\n","import { Category, CategoryEcommerceRaw } from \"./types\";\n\n/**\n * Parses a raw GraphQL response category to the normalized Category type\n * @param rawCategory - The raw category from GraphQL response\n * @returns Normalized Category object\n */\nexport function parseRawCategoryToCategory(\n rawCategory: CategoryEcommerceRaw\n): Category {\n return {\n id: rawCategory.id,\n name: rawCategory.name,\n image_url: rawCategory.image_url,\n };\n}\n\n/**\n * Parses an array of raw GraphQL response categories to normalized Category types\n * @param rawCategories - Array of raw categories from GraphQL response\n * @returns Array of normalized Category objects\n */\nexport function parseRawCategoriesToCategories(\n rawCategories: CategoryEcommerceRaw[]\n): Category[] {\n return rawCategories.map(parseRawCategoryToCategory);\n}\n","import { ApiClient } from \"../core/apiClient\";\nimport { categoriesParamsSchema } from \"./validators\";\nimport { parseRawCategoriesToCategories } from \"./parsers\";\nimport { GetCategoriesParams, CategoriesRawResponse, Category } from \"./types\";\nimport { ApiResponse } from \"../core/types\";\n\nclass CategoriesApi extends ApiClient {\n async getCategories(\n params: GetCategoriesParams = {}\n ): Promise<ApiResponse<Category[]>> {\n const validatedParams = categoriesParamsSchema.safeParse(params);\n if (!validatedParams.success) {\n const errorMessage = this.handleApiError(\n validatedParams.error,\n \"getCategories validation\"\n );\n return { data: [], error: true, errorMessage };\n }\n\n const cacheKey = this.cache.buildCacheKey(validatedParams.data);\n return this.cache.cacheWrap(\n cacheKey,\n () => this.fetchCategoriesFromAPI(validatedParams.data),\n validatedParams.data\n );\n }\n\n private async fetchCategoriesFromAPI(\n params: GetCategoriesParams\n ): Promise<ApiResponse<Category[]>> {\n if (!this.baseURL || !this.apiKey) {\n return {\n data: [],\n error: true,\n errorMessage:\n \"SDK no configurado: PAKENTO_CMS_BASE_URL o PAKENTO_API_KEY faltantes.\",\n };\n }\n\n const query = `\n query GetEcommerceCategories(\n $where: EcommerceCategoriesWhere\n $limit: Int\n $page: Int\n $sort: String\n ) {\n GetEcommerceCategories(\n where: $where\n limit: $limit\n page: $page\n sort: $sort\n ) {\n docs {\n id\n name\n image_url\n }\n }\n }\n `;\n\n const { data, error, errorMessage } =\n await this.fetchGraphQL<CategoriesRawResponse>(\n query,\n params,\n (responseData) => responseData.GetEcommerceCategories\n );\n\n if (error) {\n return { data: [], error: true, errorMessage };\n }\n\n return {\n data: parseRawCategoriesToCategories(data!.docs),\n error: false,\n errorMessage: null,\n };\n }\n}\n\nexport const categoriesApi = new CategoriesApi();\n","import { z } from \"zod\";\n\nexport const brandsParamsSchema = z.object({\n limit: z.coerce.number().optional(),\n page: z.coerce.number().optional(),\n sort: z.string().optional(),\n});\n","import { Brand, BrandEcommerceRaw } from \"./types\";\n\n/**\n * Parses a raw GraphQL response brand to the normalized Brand type\n * @param rawBrand - The raw brand from GraphQL response\n * @returns Normalized Brand object\n */\nexport function parseRawBrandToBrand(rawBrand: BrandEcommerceRaw): Brand {\n return {\n id: rawBrand.id,\n name: rawBrand.name,\n description: rawBrand.description,\n items_count: rawBrand.items_count,\n image_url: rawBrand.image_url,\n image_thumbnail_url: rawBrand.image_thumbnail_url,\n };\n}\n\n/**\n * Parses an array of raw GraphQL response brands to normalized Brand types\n * @param rawBrands - Array of raw brands from GraphQL response\n * @returns Array of normalized Brand objects\n */\nexport function parseRawBrandsToBrands(\n rawBrands: BrandEcommerceRaw[]\n): Brand[] {\n return rawBrands.map(parseRawBrandToBrand);\n}\n","import { ApiClient } from \"../core/apiClient\";\nimport { brandsParamsSchema } from \"./validators\";\nimport { parseRawBrandsToBrands } from \"./parsers\";\nimport { GetBrandsParams, BrandsRawResponse, Brand } from \"./types\";\nimport { ApiResponse } from \"../core/types\";\n\nclass BrandsApi extends ApiClient {\n async getBrands(params: GetBrandsParams = {}): Promise<ApiResponse<Brand[]>> {\n const validatedParams = brandsParamsSchema.safeParse(params);\n if (!validatedParams.success) {\n const errorMessage = this.handleApiError(\n validatedParams.error,\n \"getBrands validation\"\n );\n return {\n data: [],\n totalDocs: 0,\n totalPages: 0,\n prevPage: null,\n nextPage: null,\n error: true,\n errorMessage,\n };\n }\n\n const cacheKey = this.cache.buildCacheKey(validatedParams.data);\n return this.cache.cacheWrap(\n cacheKey,\n () => this.fetchBrandsFromAPI(validatedParams.data),\n validatedParams.data\n );\n }\n\n private async fetchBrandsFromAPI(\n params: GetBrandsParams\n ): Promise<ApiResponse<Brand[]>> {\n if (!this.baseURL || !this.apiKey) {\n return {\n data: [],\n totalDocs: 0,\n totalPages: 0,\n prevPage: null,\n nextPage: null,\n error: true,\n errorMessage:\n \"SDK no configurado: PAKENTO_CMS_BASE_URL o PAKENTO_API_KEY faltantes.\",\n };\n }\n\n const query = `\n query GetEcommerceBrands(\n $limit: Int\n $page: Int\n $sort: String\n ) {\n GetEcommerceBrands(\n limit: $limit\n page: $page\n sort: $sort\n ) {\n totalDocs\n totalPages\n prevPage\n nextPage\n docs {\n id\n name\n description\n items_count\n image_url\n image_thumbnail_url\n }\n }\n }\n `;\n\n const { data, error, errorMessage } =\n await this.fetchGraphQL<BrandsRawResponse>(\n query,\n params,\n (responseData) => responseData.GetEcommerceBrands\n );\n\n if (error) {\n return {\n data: [],\n totalDocs: 0,\n totalPages: 0,\n prevPage: null,\n nextPage: null,\n error: true,\n errorMessage,\n };\n }\n\n return {\n data: parseRawBrandsToBrands(data!.docs),\n totalDocs: data!.totalDocs,\n totalPages: data!.totalPages,\n prevPage: data!.prevPage,\n nextPage: data!.nextPage,\n error: false,\n errorMessage: null,\n };\n }\n}\n\nexport const brandsApi = new BrandsApi();\n","import { Entity, EntityEcommerceRaw } from \"./types\";\n\n/**\n * Parses a raw GraphQL response entity to the normalized Entity type\n * @param rawEntity - The raw entity from GraphQL response\n * @returns Normalized Entity object\n */\nexport function parseRawEntityToEntity(rawEntity: EntityEcommerceRaw): Entity {\n return {\n id: rawEntity.id,\n tin: rawEntity.tin,\n name: rawEntity.name,\n web: rawEntity.web,\n address: rawEntity.address,\n country: rawEntity.country,\n city: rawEntity.city,\n currency_id: rawEntity.currency_id,\n currency_name: rawEntity.currency_name,\n currency_prefix: rawEntity.currency_prefix,\n currency_suffix: rawEntity.currency_suffix,\n logo_url: rawEntity.logo_url,\n logo_alt: rawEntity.logo_alt,\n logo_thumbnail_url: rawEntity.logo_thumbnail_url,\n logo_sizes_thumbnail_filename: rawEntity.logo_sizes_thumbnail_filename,\n logo_filename: rawEntity.logo_filename,\n logo_width: rawEntity.logo_width,\n logo_height: rawEntity.logo_height,\n logo_2_url: rawEntity.logo_2_url,\n logo_2_alt: rawEntity.logo_2_alt,\n logo_2_thumbnail_url: rawEntity.logo_2_thumbnail_url,\n logo_2_sizes_thumbnail_filename: rawEntity.logo_2_sizes_thumbnail_filename,\n logo_2_filename: rawEntity.logo_2_filename,\n logo_2_width: rawEntity.logo_2_width,\n logo_2_height: rawEntity.logo_2_height,\n featured_image_url: rawEntity.featured_image_url,\n featured_image_thumbnail_url: rawEntity.featured_image_thumbnail_url,\n featured_image_sizes_thumbnail_filename:\n rawEntity.featured_image_sizes_thumbnail_filename,\n featured_image_filename: rawEntity.featured_image_filename,\n featured_image_width: rawEntity.featured_image_width,\n featured_image_height: rawEntity.featured_image_height,\n };\n}\n","import { ApiClient } from \"../core/apiClient\";\nimport { parseRawEntityToEntity } from \"./parsers\";\nimport { GetEntityParams, EntityRawResponse, Entity } from \"./types\";\nimport { ApiResponse } from \"../core/types\";\n\nclass EntityApi extends ApiClient {\n async getEntity(params: GetEntityParams = {}): Promise<ApiResponse<Entity>> {\n const cacheKey = this.cache.buildCacheKey(params);\n return this.cache.cacheWrap(\n cacheKey,\n () => this.fetchEntityFromAPI(params),\n params\n );\n }\n\n private async fetchEntityFromAPI(\n params: GetEntityParams\n ): Promise<ApiResponse<Entity>> {\n if (!this.baseURL || !this.apiKey) {\n return {\n data: null,\n error: true,\n errorMessage:\n \"SDK no configurado: PAKENTO_CMS_BASE_URL o PAKENTO_API_KEY faltantes.\",\n };\n }\n\n const query = `\n query GetEntity {\n GetEntity {\n id\n tin\n name\n web\n address\n country\n city\n currency_id\n currency_name\n currency_prefix\n currency_suffix\n logo_url\n logo_alt\n logo_thumbnail_url\n logo_sizes_thumbnail_filename\n logo_filename\n logo_width\n logo_height\n logo_2_url\n logo_2_alt\n logo_2_thumbnail_url\n logo_2_sizes_thumbnail_filename\n logo_2_filename\n logo_2_width\n logo_2_height\n featured_image_url\n featured_image_thumbnail_url\n featured_image_sizes_thumbnail_filename\n featured_image_filename\n featured_image_width\n featured_image_height\n }\n }\n `;\n\n const { data, error, errorMessage } =\n await this.fetchGraphQL<EntityRawResponse>(\n query,\n params,\n (responseData) => responseData\n );\n\n if (error) {\n return { data: null, error: true, errorMessage };\n }\n\n return {\n data: parseRawEntityToEntity(data!.GetEntity),\n error: false,\n errorMessage: null,\n };\n }\n}\n\nexport const entityApi = new EntityApi();\n","import { z } from \"zod\";\n\nexport const orderSchema = z.object({\n name: z.string().min(1),\n email: z.string().email(),\n phone: z.string().optional(),\n notes: z.string().optional(),\n tin: z.string().optional(),\n items: z\n .array(\n z.object({ id: z.number().positive(), quantity: z.number().positive() })\n )\n .min(1),\n delivery_address: z.string().optional(),\n delivery_instructions: z.string().optional(),\n payment_method: z.enum([\"cash\", \"transfer\"]).optional(),\n});\n","import { ApiClient } from \"../core/apiClient\";\nimport { orderSchema } from \"./validators\";\nimport {\n CreateEcommerceOrderParams,\n CreateEcommerceOrderResponse,\n} from \"./types\";\n\nclass OrdersApi extends ApiClient {\n async createEcommerceOrder(\n params: CreateEcommerceOrderParams\n ): Promise<CreateEcommerceOrderResponse> {\n if (!this.baseURL || !this.apiKey) {\n return {\n message: \"SDK no configurado\",\n error: true,\n errorMessage: \"SDK no configurado\",\n };\n }\n\n const validated = orderSchema.safeParse(params);\n if (!validated.success) {\n const errorMessage = this.handleApiError(\n validated.error,\n \"createEcommerceOrder validation\"\n );\n return { message: errorMessage, error: true, errorMessage };\n }\n\n try {\n const response = await this.client.post(\n \"/api/orders/create-ecommerce-order\",\n validated.data\n );\n\n if (response.status === 200) {\n return {\n message: response.data.message || \"Orden creada exitosamente\",\n order_id: response.data.order_id,\n error: false,\n errorMessage: null,\n };\n } else {\n const errorMessage = response.data.message || \"Error al crear la orden\";\n return { message: errorMessage, error: true, errorMessage };\n }\n } catch (error) {\n const errorMessage = this.handleApiError(error, \"createEcommerceOrder\");\n return { message: errorMessage, error: true, errorMessage };\n }\n }\n}\n\nexport const ordersApi = new OrdersApi();\n","import { z } from \"zod\";\n\nexport const contactUsSchema = z.object({\n name: z.string().min(1),\n email: z.string().email(),\n phone: z.string().optional(),\n subject: z.string().optional(),\n notes: z.string().min(1),\n});\n","import { ApiClient } from \"../core/apiClient\";\nimport { contactUsSchema } from \"./validators\";\nimport { SendContactUsEmailParams, SendContactUsEmailResponse } from \"./types\";\n\nclass ContactApi extends ApiClient {\n async sendContactUsEmail(\n params: SendContactUsEmailParams\n ): Promise<SendContactUsEmailResponse> {\n if (!this.baseURL || !this.apiKey) {\n return {\n message: \"SDK no configurado\",\n error: true,\n errorMessage: \"SDK no configurado\",\n };\n }\n\n const validated = contactUsSchema.safeParse(params);\n if (!validated.success) {\n const errorMessage = this.handleApiError(\n validated.error,\n \"sendContactUsEmail validation\"\n );\n return { message: errorMessage, error: true, errorMessage };\n }\n\n try {\n const response = await this.client.post(\n \"/api/entities/send-contact-us-email\",\n validated.data\n );\n\n if (response.status === 200) {\n return {\n message: response.data.message || \"Mensaje enviado exitosamente\",\n error: false,\n errorMessage: null,\n };\n } else {\n const errorMessage =\n response.data.message || \"Error al enviar el mensaje\";\n return { message: errorMessage, error: true, errorMessage };\n }\n } catch (error) {\n const errorMessage = this.handleApiError(error, \"sendContactUsEmail\");\n return { message: errorMessage, error: true, errorMessage };\n }\n }\n}\n\nexport const contactApi = new ContactApi();\n","import { ApiClient } from \"../core/apiClient\";\nimport { CustomGraphQLParams, CustomGraphQLResponse } from \"./types\";\n\nclass CustomApi extends ApiClient {\n async executeCustomQuery<T>(\n params: CustomGraphQLParams\n ): Promise<CustomGraphQLResponse<T>> {\n if (!this.baseURL || !this.apiKey) {\n return {\n data: null as T,\n error: true,\n errorMessage:\n \"SDK no configurado: PAKENTO_CMS_BASE_URL o PAKENTO_API_KEY faltantes.\",\n };\n }\n\n if (\n !params.query ||\n typeof params.query !== \"string\" ||\n params.query.trim() === \"\"\n ) {\n return {\n data: null as T,\n error: true,\n errorMessage: \"Se requiere un query GraphQL válido.\",\n };\n }\n\n try {\n const response = await this.client.post(\"/api/graphql\", {\n query: params.query,\n variables: params.variables || {},\n });\n\n if (response.data.errors && response.data.errors.length > 0) {\n return {\n data: response.data.data || (null as T),\n errors: response.data.errors,\n error: true,\n errorMessage: `GraphQL Errors: ${response.data.errors\n .map((err: { message: string }) => err.message)\n .join(\", \")}`,\n };\n }\n\n return {\n data: response.data.data,\n error: false,\n errorMessage: null,\n };\n } catch (error) {\n const errorMessage = this.handleApiError(error, \"Custom GraphQL\");\n return { data: null as T, error: true, errorMessage };\n }\n }\n}\n\nexport const customApi = new CustomApi();\n"],"mappings":";;;;;;;;;;;;;;;;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B,UAAU;AAAA,EAChC,MAAM,mBACJ,QACmC;AACnC,QAAI,CAAC,KAAK,WAAW,CAAC,KAAK,QAAQ;AACjC,aAAO;AAAA,QACL,MAAM;AAAA,QACN,OAAO;AAAA,QACP,cACE;AAAA,MACJ;AAAA,IACF;AAEA,QACE,CAAC,OAAO,SACR,OAAO,OAAO,UAAU,YACxB,OAAO,MAAM,KAAK,MAAM,IACxB;AACA,aAAO;AAAA,QACL,MAAM;AAAA,QACN,OAAO;AAAA,QACP,cAAc;AAAA,MAChB;AAAA,IACF;AAEA,QAAI;AACF,YAAM,WAAW,MAAM,KAAK,OAAO,KAAK,gBAAgB;AAAA,QACtD,OAAO,OAAO;AAAA,QACd,WAAW,OAAO,aAAa,CAAC;AAAA,MAClC,CAAC;AAED,UAAI,SAAS,KAAK,UAAU,SAAS,KAAK,OAAO,SAAS,GAAG;AAC3D,eAAO;AAAA,UACL,MAAM,SAAS,KAAK,QAAS;AAAA,UAC7B,QAAQ,SAAS,KAAK;AAAA,UACtB,OAAO;AAAA,UACP,cAAc,mBAAmB,SAAS,KAAK,OAC5C,IAAI,CAAC,QAA6B,IAAI,OAAO,EAC7C,KAAK,IAAI,CAAC;AAAA,QACf;AAAA,MACF;AAEA,aAAO;AAAA,QACL,MAAM,SAAS,KAAK;AAAA,QACpB,OAAO;AAAA,QACP,cAAc;AAAA,MAChB;AAAA,IACF,SAAS,OAAO;AACd,YAAM,eAAe,KAAK,eAAe,OAAO,gBAAgB;AAChE,aAAO,EAAE,MAAM,MAAW,OAAO,MAAM,aAAa;AAAA,IACtD;AAAA,EACF;AACF;AAEO,IAAM,YAAY,IAAI,UAAU;","names":["axios","import_zod","import_zod","import_zod","import_zod","import_zod"]}
1
+ {"version":3,"sources":["../src/index.ts","../src/api/core/apiClient.ts","../src/api/core/cache.ts","../src/api/items/parsers.ts","../src/api/items/validators.ts","../src/api/items/api.ts","../src/api/categories/validators.ts","../src/api/categories/parsers.ts","../src/api/categories/api.ts","../src/api/brands/validators.ts","../src/api/brands/parsers.ts","../src/api/brands/api.ts","../src/api/entity/parsers.ts","../src/api/entity/api.ts","../src/api/orders/validators.ts","../src/api/orders/api.ts","../src/api/contact/validators.ts","../src/api/contact/api.ts","../src/api/custom/api.ts"],"sourcesContent":["// Core\nexport { ApiClient } from \"./api/core/apiClient\";\n\n// Cache\nexport { CacheService } from \"./api/core/cache\";\n\n// Items\nexport { itemsApi } from \"./api/items\";\n\n// Categories\nexport { categoriesApi } from \"./api/categories\";\n\n// Brands\nexport { brandsApi } from \"./api/brands\";\n\n// Entity\nexport { entityApi } from \"./api/entity\";\n\n// Orders\nexport { ordersApi } from \"./api/orders\";\n\n// Contact\nexport { contactApi } from \"./api/contact\";\n\n// Custom\nexport { customApi } from \"./api/custom\";\n\n// Types (re-export if needed)\nexport * from \"./api/items/types\";\nexport * from \"./api/categories/types\";\nexport * from \"./api/brands/types\";\nexport * from \"./api/entity/types\";\nexport * from \"./api/orders/types\";\nexport * from \"./api/contact/types\";\nexport * from \"./api/custom/types\";\nexport * from \"./api/core/types\";\n","import axios, { AxiosInstance, AxiosError } from \"axios\";\nimport { z } from \"zod\";\nimport { CacheService } from \"./cache\";\n\nexport class ApiClient {\n protected client: AxiosInstance;\n protected cache: CacheService;\n protected baseURL: string;\n protected apiKey: string;\n\n constructor() {\n this.baseURL = process.env.PAKENTO_CMS_BASE_URL || \"\";\n this.apiKey = process.env.PAKENTO_API_KEY || \"\";\n this.cache = new CacheService(this.apiKey);\n\n this.client = axios.create({\n baseURL: this.baseURL,\n headers: {\n \"Content-Type\": \"application/json\",\n Authorization: `users API-Key ${this.apiKey}`,\n },\n });\n\n this.client.interceptors.request.use(\n (config) => {\n const fullUrl = `${config.baseURL}${config.url}`;\n console.log(`🌐 API Call: ${config.method?.toUpperCase()} ${fullUrl}`);\n return config;\n },\n (error) => Promise.reject(error)\n );\n }\n\n protected handleApiError(error: unknown, context: string): string {\n if (error instanceof AxiosError) {\n const status = error.response?.status;\n const responseMessage = error.response?.data?.message;\n if (status === 401) return \"API Key inválida o expirada\";\n if (status === 404) return `${context} no encontrado`;\n if (status && status >= 500) return \"Error del servidor CMS\";\n return (\n responseMessage || `Error de conexión en ${context}: ${error.message}`\n );\n } else if (error instanceof z.ZodError) {\n return `Validación fallida: ${error.issues\n .map((e) => e.message)\n .join(\", \")}`;\n } else if (error instanceof Error) {\n return error.message;\n }\n return \"Error desconocido\";\n }\n\n protected async fetchGraphQL<T>(\n query: string,\n variables: any,\n extractData: (responseData: any) => T\n ): Promise<{ data: T | null; error: boolean; errorMessage: string | null }> {\n try {\n const response = await this.client.post(\"/api/graphql\", {\n query,\n variables,\n });\n if (response.data.errors) {\n const errorMessage = `GraphQL Error: ${response.data.errors[0].message}`;\n return { data: null, error: true, errorMessage };\n }\n const data = extractData(response.data.data);\n return { data, error: false, errorMessage: null };\n } catch (error) {\n const errorMessage = this.handleApiError(error, \"GraphQL query\");\n return { data: null, error: true, errorMessage };\n }\n }\n}\n","import { Redis } from \"@upstash/redis\";\n\nexport class CacheService {\n private redis?: Redis;\n private apiKeyHash: string;\n private defaultTTL: number = 172800; // 48 hours\n\n constructor(apiKey: string) {\n this.apiKeyHash = apiKey.substring(0, 8);\n\n if (\n process.env.UPSTASH_REDIS_REST_URL &&\n process.env.UPSTASH_REDIS_REST_TOKEN\n ) {\n this.redis = new Redis({\n url: process.env.UPSTASH_REDIS_REST_URL,\n token: process.env.UPSTASH_REDIS_REST_TOKEN,\n });\n }\n }\n\n private generateParamsHash(params: Record<string, unknown>): string {\n const paramsString = JSON.stringify(params);\n return btoa(paramsString);\n }\n\n public buildCacheKey(\n functionName: string,\n params: Record<string, unknown> = {}\n ): string {\n const paramsHash = this.generateParamsHash({ ...params, functionName });\n return `pakento:${this.apiKeyHash}:${paramsHash}`;\n }\n\n public async cacheWrap<T>(\n key: string,\n fetcher: () => Promise<T>,\n functionName: string,\n filters?: Record<string, unknown>\n ): Promise<T> {\n if (!this.redis) {\n return fetcher();\n }\n\n let cached: string | null = null;\n try {\n cached = await this.redis.get(key);\n\n if (typeof cached === \"object\" && cached !== null) {\n console.log(\"[Cache] ✅ Reading from cache:\", key);\n return cached as T;\n }\n\n if (cached) {\n console.log(\"[Cache] ✅ Reading from cache:\", key);\n return JSON.parse(cached as string) as T;\n }\n } catch (err) {\n console.warn(\"[Cache] ❌ Error reading from cache:\", err);\n console.log(`[Cache] ❌ Key: ${key}, type: ${typeof cached}`);\n }\n\n const result = await fetcher();\n\n try {\n // Crear objeto de caché con datos y filtros para visualización\n const cacheData = {\n _function: functionName,\n _filters: filters || {},\n _cachedAt: new Date().toISOString(),\n ...result,\n };\n\n console.log(\"[Cache] ✅ Writing to cache:\", key);\n await this.redis.set(key, JSON.stringify(cacheData), {\n ex: this.defaultTTL,\n });\n } catch (err) {\n console.warn(\"[Cache] ❌ Error writing to cache:\", err);\n }\n\n return result;\n }\n\n public async clearAllCache(): Promise<boolean> {\n if (!this.redis) {\n console.warn(\"[Cache] ❌ Redis no configurado\");\n return false;\n }\n\n try {\n const pattern = `pakento:${this.apiKeyHash}:*`;\n const keys = await this.redis.keys(pattern);\n\n if (keys.length > 0) {\n await this.redis.del(...keys);\n console.log(\"[Cache] ✅ Cache limpiado\");\n }\n\n return true;\n } catch (err) {\n console.warn(\"[Cache] ❌ Error limpiando todo el cache\", err);\n return false;\n }\n }\n}\n","import { Item, ItemEcommerceRaw } from \"./types\";\n\n/**\n * Parses a raw GraphQL response item to the normalized Item type\n * @param rawItem - The raw item from GraphQL response\n * @returns Normalized Item object\n */\nexport function parseRawItemToItem(rawItem: ItemEcommerceRaw): Item {\n const images = rawItem.images.map((img) => ({\n url: img.url,\n thumbnail_url: img.thumbnail_url,\n }));\n\n const variations = rawItem.variations.map((v) => ({\n id: v.id,\n name: v.name,\n description: v.description,\n cover_image_url: v.cover_image_url,\n cover_image_thumbnail_url: v.cover_image_thumbnail_url,\n price: v.price,\n old_price: v.old_price,\n price_notes: v.price_notes,\n price_text: v.price_text,\n currency_prefix: v.currency_prefix,\n attribute_values: v.attribute_values,\n images: v.images.map((img) => ({\n url: img.url,\n thumbnail_url: img.thumbnail_url,\n })),\n }));\n\n return {\n id: rawItem.id,\n name: rawItem.name,\n featured: rawItem.featured,\n url_safe_name: rawItem.url_safe_name,\n currency_prefix: rawItem.currency_prefix,\n description: rawItem.description,\n old_price: rawItem.old_price,\n item_category_name: rawItem.item_category_name,\n item_category_id: parseInt(rawItem.item_category_id || \"0\", 10),\n item_super_category_name: rawItem.item_super_category_name,\n item_super_category_id: parseInt(rawItem.item_super_category_id || \"0\", 10),\n price_text: rawItem.price_text,\n price_notes: rawItem.price_notes,\n price: rawItem.price,\n brand_id: parseInt(rawItem.brand_id || \"0\", 10),\n brand_name: rawItem.brand_name,\n cover_image_url: rawItem.cover_image_url,\n cover_image_thumbnail_url: rawItem.cover_image_thumbnail_url,\n images,\n master_attributes: rawItem.master_attributes,\n variations,\n };\n}\n\n/**\n * Parses an array of raw GraphQL response items to normalized Item types\n * @param rawItems - Array of raw items from GraphQL response\n * @returns Array of normalized Item objects\n */\nexport function parseRawItemsToItems(rawItems: ItemEcommerceRaw[]): Item[] {\n return rawItems.map(parseRawItemToItem);\n}\n","import { z } from \"zod\";\n\nexport const itemsParamsSchema = z.object({\n where: z\n .object({\n item_category_id: z.object({ equals: z.string().optional() }).optional(),\n item_super_category_id: z\n .object({ equals: z.string().optional() })\n .optional(),\n brand_id: z.object({ equals: z.string().optional() }).optional(),\n id: z.object({ equals: z.string().optional() }).optional(),\n })\n .optional(),\n onlyOffers: z.boolean().optional(),\n limit: z.coerce.number().optional(),\n page: z.coerce.number().optional(),\n search: z.string().optional(),\n sort: z.string().optional(),\n minPrice: z.coerce.number().optional(),\n maxPrice: z.coerce.number().optional(),\n});\n","import { ApiClient } from \"../core/apiClient\";\nimport { itemsParamsSchema } from \"./validators\";\nimport { parseRawItemsToItems } from \"./parsers\";\nimport { GetItemsParams, ItemsRawResponse, ItemsWhere, Item } from \"./types\";\nimport { ApiResponse } from \"../core/types\";\n\nclass ItemsApi extends ApiClient {\n async getItems(params: GetItemsParams = {}): Promise<ApiResponse<Item[]>> {\n const validatedParams = itemsParamsSchema.safeParse(params);\n if (!validatedParams.success) {\n const errorMessage = this.handleApiError(\n validatedParams.error,\n \"getItems validation\"\n );\n return {\n data: [],\n totalDocs: 0,\n totalPages: 0,\n prevPage: null,\n nextPage: null,\n error: true,\n errorMessage,\n };\n }\n\n const cacheKey = this.cache.buildCacheKey(\"getItems\", validatedParams.data);\n return this.cache.cacheWrap(\n cacheKey,\n () => this.fetchItemsFromAPI(validatedParams.data),\n \"getItems\",\n validatedParams.data\n );\n }\n\n private async fetchItemsFromAPI(\n params: GetItemsParams\n ): Promise<ApiResponse<Item[]>> {\n if (!this.baseURL || !this.apiKey) {\n return {\n data: [],\n totalDocs: 0,\n totalPages: 0,\n prevPage: null,\n nextPage: null,\n error: true,\n errorMessage:\n \"SDK no configurado: PAKENTO_CMS_BASE_URL o PAKENTO_API_KEY faltantes.\",\n };\n }\n\n const query = `\n query GetEcommerceItems(\n $where: EcommerceItemsWhere\n $onlyOffers: Boolean\n $limit: Int\n $page: Int\n $search: String\n $sort: String\n $minPrice: Float\n $maxPrice: Float\n ) {\n GetEcommerceItems(\n where: $where\n onlyOffers: $onlyOffers\n limit: $limit\n page: $page\n search: $search\n sort: $sort\n minPrice: $minPrice\n maxPrice: $maxPrice\n ) {\n totalDocs\n totalPages\n prevPage\n nextPage\n docs {\n id\n name\n featured\n description\n url_safe_name\n\n item_super_category_id\n item_super_category_name\n\n item_category_id\n item_category_name\n\n cover_image_url\n cover_image_thumbnail_url\n\n price\n old_price\n price_notes\n price_text\n currency_prefix\n\n brand_id\n brand_name\n\n master_attributes {\n id\n name\n values {\n id\n value\n }\n }\n\n variations {\n id\n name\n description\n\n cover_image_url\n cover_image_thumbnail_url\n\n price\n old_price\n price_notes\n price_text\n currency_prefix\n\n attribute_values {\n attribute_id\n attribute_name\n value\n value_id\n }\n\n images {\n url\n thumbnail_url\n }\n }\n\n images {\n url\n thumbnail_url\n }\n }\n }\n }\n `;\n\n const whereConditions: ItemsWhere = {};\n if (params.where?.item_category_id?.equals) {\n whereConditions.item_category_id = {\n equals: params.where.item_category_id.equals,\n };\n }\n if (params.where?.item_super_category_id?.equals) {\n whereConditions.item_super_category_id = {\n equals: params.where.item_super_category_id.equals,\n };\n }\n if (params.where?.brand_id?.equals) {\n whereConditions.brand_id = { equals: params.where.brand_id.equals };\n }\n if (params.where?.id?.equals) {\n whereConditions.id = { equals: params.where.id.equals };\n }\n\n const variables = {\n ...params,\n where:\n Object.keys(whereConditions).length > 0 ? whereConditions : undefined,\n };\n\n const { data, error, errorMessage } =\n await this.fetchGraphQL<ItemsRawResponse>(\n query,\n variables,\n (responseData) => responseData.GetEcommerceItems\n );\n\n if (error) {\n return {\n data: [],\n totalDocs: 0,\n totalPages: 0,\n prevPage: null,\n nextPage: null,\n error: true,\n errorMessage,\n };\n }\n\n return {\n data: parseRawItemsToItems(data!.docs),\n totalDocs: data!.totalDocs,\n totalPages: data!.totalPages,\n prevPage: data!.prevPage,\n nextPage: data!.nextPage,\n error: false,\n errorMessage: null,\n };\n }\n}\n\nexport const itemsApi = new ItemsApi();\n","import { z } from \"zod\";\n\nexport const categoriesParamsSchema = z.object({\n where: z\n .object({\n item_super_category_id: z\n .object({ equals: z.string().optional() })\n .optional(),\n brand_id: z.object({ equals: z.string().optional() }).optional(),\n })\n .optional(),\n limit: z.coerce.number().optional(),\n page: z.coerce.number().optional(),\n sort: z.string().optional(),\n});\n","import { Category, CategoryEcommerceRaw } from \"./types\";\n\n/**\n * Parses a raw GraphQL response category to the normalized Category type\n * @param rawCategory - The raw category from GraphQL response\n * @returns Normalized Category object\n */\nexport function parseRawCategoryToCategory(\n rawCategory: CategoryEcommerceRaw\n): Category {\n return {\n id: rawCategory.id,\n name: rawCategory.name,\n image_url: rawCategory.image_url,\n };\n}\n\n/**\n * Parses an array of raw GraphQL response categories to normalized Category types\n * @param rawCategories - Array of raw categories from GraphQL response\n * @returns Array of normalized Category objects\n */\nexport function parseRawCategoriesToCategories(\n rawCategories: CategoryEcommerceRaw[]\n): Category[] {\n return rawCategories.map(parseRawCategoryToCategory);\n}\n","import { ApiClient } from \"../core/apiClient\";\nimport { categoriesParamsSchema } from \"./validators\";\nimport { parseRawCategoriesToCategories } from \"./parsers\";\nimport { GetCategoriesParams, CategoriesRawResponse, Category } from \"./types\";\nimport { ApiResponse } from \"../core/types\";\n\nclass CategoriesApi extends ApiClient {\n async getCategories(\n params: GetCategoriesParams = {}\n ): Promise<ApiResponse<Category[]>> {\n const validatedParams = categoriesParamsSchema.safeParse(params);\n if (!validatedParams.success) {\n const errorMessage = this.handleApiError(\n validatedParams.error,\n \"getCategories validation\"\n );\n return { data: [], error: true, errorMessage };\n }\n\n const cacheKey = this.cache.buildCacheKey(\n \"getCategories\",\n validatedParams.data\n );\n return this.cache.cacheWrap(\n cacheKey,\n () => this.fetchCategoriesFromAPI(validatedParams.data),\n \"getCategories\",\n validatedParams.data\n );\n }\n\n private async fetchCategoriesFromAPI(\n params: GetCategoriesParams\n ): Promise<ApiResponse<Category[]>> {\n if (!this.baseURL || !this.apiKey) {\n return {\n data: [],\n error: true,\n errorMessage:\n \"SDK no configurado: PAKENTO_CMS_BASE_URL o PAKENTO_API_KEY faltantes.\",\n };\n }\n\n const query = `\n query GetEcommerceCategories(\n $where: EcommerceCategoriesWhere\n $limit: Int\n $page: Int\n $sort: String\n ) {\n GetEcommerceCategories(\n where: $where\n limit: $limit\n page: $page\n sort: $sort\n ) {\n docs {\n id\n name\n image_url\n }\n }\n }\n `;\n\n const { data, error, errorMessage } =\n await this.fetchGraphQL<CategoriesRawResponse>(\n query,\n params,\n (responseData) => responseData.GetEcommerceCategories\n );\n\n if (error) {\n return { data: [], error: true, errorMessage };\n }\n\n return {\n data: parseRawCategoriesToCategories(data!.docs),\n error: false,\n errorMessage: null,\n };\n }\n}\n\nexport const categoriesApi = new CategoriesApi();\n","import { z } from \"zod\";\n\nexport const brandsParamsSchema = z.object({\n limit: z.coerce.number().optional(),\n page: z.coerce.number().optional(),\n sort: z.string().optional(),\n});\n","import { Brand, BrandEcommerceRaw } from \"./types\";\n\n/**\n * Parses a raw GraphQL response brand to the normalized Brand type\n * @param rawBrand - The raw brand from GraphQL response\n * @returns Normalized Brand object\n */\nexport function parseRawBrandToBrand(rawBrand: BrandEcommerceRaw): Brand {\n return {\n id: rawBrand.id,\n name: rawBrand.name,\n description: rawBrand.description,\n items_count: rawBrand.items_count,\n image_url: rawBrand.image_url,\n image_thumbnail_url: rawBrand.image_thumbnail_url,\n };\n}\n\n/**\n * Parses an array of raw GraphQL response brands to normalized Brand types\n * @param rawBrands - Array of raw brands from GraphQL response\n * @returns Array of normalized Brand objects\n */\nexport function parseRawBrandsToBrands(\n rawBrands: BrandEcommerceRaw[]\n): Brand[] {\n return rawBrands.map(parseRawBrandToBrand);\n}\n","import { ApiClient } from \"../core/apiClient\";\nimport { brandsParamsSchema } from \"./validators\";\nimport { parseRawBrandsToBrands } from \"./parsers\";\nimport { GetBrandsParams, BrandsRawResponse, Brand } from \"./types\";\nimport { ApiResponse } from \"../core/types\";\n\nclass BrandsApi extends ApiClient {\n async getBrands(params: GetBrandsParams = {}): Promise<ApiResponse<Brand[]>> {\n const validatedParams = brandsParamsSchema.safeParse(params);\n if (!validatedParams.success) {\n const errorMessage = this.handleApiError(\n validatedParams.error,\n \"getBrands validation\"\n );\n return {\n data: [],\n totalDocs: 0,\n totalPages: 0,\n prevPage: null,\n nextPage: null,\n error: true,\n errorMessage,\n };\n }\n\n const cacheKey = this.cache.buildCacheKey(\n \"getBrands\",\n validatedParams.data\n );\n return this.cache.cacheWrap(\n cacheKey,\n () => this.fetchBrandsFromAPI(validatedParams.data),\n \"getBrands\",\n validatedParams.data\n );\n }\n\n private async fetchBrandsFromAPI(\n params: GetBrandsParams\n ): Promise<ApiResponse<Brand[]>> {\n if (!this.baseURL || !this.apiKey) {\n return {\n data: [],\n totalDocs: 0,\n totalPages: 0,\n prevPage: null,\n nextPage: null,\n error: true,\n errorMessage:\n \"SDK no configurado: PAKENTO_CMS_BASE_URL o PAKENTO_API_KEY faltantes.\",\n };\n }\n\n const query = `\n query GetEcommerceBrands(\n $limit: Int\n $page: Int\n $sort: String\n ) {\n GetEcommerceBrands(\n limit: $limit\n page: $page\n sort: $sort\n ) {\n totalDocs\n totalPages\n prevPage\n nextPage\n docs {\n id\n name\n description\n items_count\n image_url\n image_thumbnail_url\n }\n }\n }\n `;\n\n const { data, error, errorMessage } =\n await this.fetchGraphQL<BrandsRawResponse>(\n query,\n params,\n (responseData) => responseData.GetEcommerceBrands\n );\n\n if (error) {\n return {\n data: [],\n totalDocs: 0,\n totalPages: 0,\n prevPage: null,\n nextPage: null,\n error: true,\n errorMessage,\n };\n }\n\n return {\n data: parseRawBrandsToBrands(data!.docs),\n totalDocs: data!.totalDocs,\n totalPages: data!.totalPages,\n prevPage: data!.prevPage,\n nextPage: data!.nextPage,\n error: false,\n errorMessage: null,\n };\n }\n}\n\nexport const brandsApi = new BrandsApi();\n","import { Entity, EntityEcommerceRaw } from \"./types\";\n\n/**\n * Parses a raw GraphQL response entity to the normalized Entity type\n * @param rawEntity - The raw entity from GraphQL response\n * @returns Normalized Entity object\n */\nexport function parseRawEntityToEntity(rawEntity: EntityEcommerceRaw): Entity {\n return {\n id: rawEntity.id,\n tin: rawEntity.tin,\n name: rawEntity.name,\n web: rawEntity.web,\n address: rawEntity.address,\n country: rawEntity.country,\n city: rawEntity.city,\n currency_id: rawEntity.currency_id,\n currency_name: rawEntity.currency_name,\n currency_prefix: rawEntity.currency_prefix,\n currency_suffix: rawEntity.currency_suffix,\n logo_url: rawEntity.logo_url,\n logo_alt: rawEntity.logo_alt,\n logo_thumbnail_url: rawEntity.logo_thumbnail_url,\n logo_sizes_thumbnail_filename: rawEntity.logo_sizes_thumbnail_filename,\n logo_filename: rawEntity.logo_filename,\n logo_width: rawEntity.logo_width,\n logo_height: rawEntity.logo_height,\n logo_2_url: rawEntity.logo_2_url,\n logo_2_alt: rawEntity.logo_2_alt,\n logo_2_thumbnail_url: rawEntity.logo_2_thumbnail_url,\n logo_2_sizes_thumbnail_filename: rawEntity.logo_2_sizes_thumbnail_filename,\n logo_2_filename: rawEntity.logo_2_filename,\n logo_2_width: rawEntity.logo_2_width,\n logo_2_height: rawEntity.logo_2_height,\n featured_image_url: rawEntity.featured_image_url,\n featured_image_thumbnail_url: rawEntity.featured_image_thumbnail_url,\n featured_image_sizes_thumbnail_filename:\n rawEntity.featured_image_sizes_thumbnail_filename,\n featured_image_filename: rawEntity.featured_image_filename,\n featured_image_width: rawEntity.featured_image_width,\n featured_image_height: rawEntity.featured_image_height,\n };\n}\n","import { ApiClient } from \"../core/apiClient\";\nimport { parseRawEntityToEntity } from \"./parsers\";\nimport { GetEntityParams, EntityRawResponse, Entity } from \"./types\";\nimport { ApiResponse } from \"../core/types\";\n\nclass EntityApi extends ApiClient {\n async getEntity(params: GetEntityParams = {}): Promise<ApiResponse<Entity>> {\n const cacheKey = this.cache.buildCacheKey(\"getEntity\", params);\n return this.cache.cacheWrap(\n cacheKey,\n () => this.fetchEntityFromAPI(params),\n \"getEntity\",\n params\n );\n }\n\n private async fetchEntityFromAPI(\n params: GetEntityParams\n ): Promise<ApiResponse<Entity>> {\n if (!this.baseURL || !this.apiKey) {\n return {\n data: null,\n error: true,\n errorMessage:\n \"SDK no configurado: PAKENTO_CMS_BASE_URL o PAKENTO_API_KEY faltantes.\",\n };\n }\n\n const query = `\n query GetEntity {\n GetEntity {\n id\n tin\n name\n web\n address\n country\n city\n currency_id\n currency_name\n currency_prefix\n currency_suffix\n logo_url\n logo_alt\n logo_thumbnail_url\n logo_sizes_thumbnail_filename\n logo_filename\n logo_width\n logo_height\n logo_2_url\n logo_2_alt\n logo_2_thumbnail_url\n logo_2_sizes_thumbnail_filename\n logo_2_filename\n logo_2_width\n logo_2_height\n featured_image_url\n featured_image_thumbnail_url\n featured_image_sizes_thumbnail_filename\n featured_image_filename\n featured_image_width\n featured_image_height\n }\n }\n `;\n\n const { data, error, errorMessage } =\n await this.fetchGraphQL<EntityRawResponse>(\n query,\n params,\n (responseData) => responseData\n );\n\n if (error) {\n return { data: null, error: true, errorMessage };\n }\n\n return {\n data: parseRawEntityToEntity(data!.GetEntity),\n error: false,\n errorMessage: null,\n };\n }\n}\n\nexport const entityApi = new EntityApi();\n","import { z } from \"zod\";\n\nexport const orderSchema = z.object({\n name: z.string().min(1),\n email: z.string().email(),\n phone: z.string().optional(),\n notes: z.string().optional(),\n tin: z.string().optional(),\n items: z\n .array(\n z.object({ id: z.number().positive(), quantity: z.number().positive() })\n )\n .min(1),\n delivery_address: z.string().optional(),\n delivery_instructions: z.string().optional(),\n payment_method: z.enum([\"cash\", \"transfer\"]).optional(),\n});\n","import { ApiClient } from \"../core/apiClient\";\nimport { orderSchema } from \"./validators\";\nimport {\n CreateEcommerceOrderParams,\n CreateEcommerceOrderResponse,\n} from \"./types\";\n\nclass OrdersApi extends ApiClient {\n async createEcommerceOrder(\n params: CreateEcommerceOrderParams\n ): Promise<CreateEcommerceOrderResponse> {\n if (!this.baseURL || !this.apiKey) {\n return {\n message: \"SDK no configurado\",\n error: true,\n errorMessage: \"SDK no configurado\",\n };\n }\n\n const validated = orderSchema.safeParse(params);\n if (!validated.success) {\n const errorMessage = this.handleApiError(\n validated.error,\n \"createEcommerceOrder validation\"\n );\n return { message: errorMessage, error: true, errorMessage };\n }\n\n try {\n const response = await this.client.post(\n \"/api/orders/create-ecommerce-order\",\n validated.data\n );\n\n if (response.status === 200) {\n return {\n message: response.data.message || \"Orden creada exitosamente\",\n order_id: response.data.order_id,\n error: false,\n errorMessage: null,\n };\n } else {\n const errorMessage = response.data.message || \"Error al crear la orden\";\n return { message: errorMessage, error: true, errorMessage };\n }\n } catch (error) {\n const errorMessage = this.handleApiError(error, \"createEcommerceOrder\");\n return { message: errorMessage, error: true, errorMessage };\n }\n }\n}\n\nexport const ordersApi = new OrdersApi();\n","import { z } from \"zod\";\n\nexport const contactUsSchema = z.object({\n name: z.string().min(1),\n email: z.string().email(),\n phone: z.string().optional(),\n subject: z.string().optional(),\n notes: z.string().min(1),\n});\n","import { ApiClient } from \"../core/apiClient\";\nimport { contactUsSchema } from \"./validators\";\nimport { SendContactUsEmailParams, SendContactUsEmailResponse } from \"./types\";\n\nclass ContactApi extends ApiClient {\n async sendContactUsEmail(\n params: SendContactUsEmailParams\n ): Promise<SendContactUsEmailResponse> {\n if (!this.baseURL || !this.apiKey) {\n return {\n message: \"SDK no configurado\",\n error: true,\n errorMessage: \"SDK no configurado\",\n };\n }\n\n const validated = contactUsSchema.safeParse(params);\n if (!validated.success) {\n const errorMessage = this.handleApiError(\n validated.error,\n \"sendContactUsEmail validation\"\n );\n return { message: errorMessage, error: true, errorMessage };\n }\n\n try {\n const response = await this.client.post(\n \"/api/entities/send-contact-us-email\",\n validated.data\n );\n\n if (response.status === 200) {\n return {\n message: response.data.message || \"Mensaje enviado exitosamente\",\n error: false,\n errorMessage: null,\n };\n } else {\n const errorMessage =\n response.data.message || \"Error al enviar el mensaje\";\n return { message: errorMessage, error: true, errorMessage };\n }\n } catch (error) {\n const errorMessage = this.handleApiError(error, \"sendContactUsEmail\");\n return { message: errorMessage, error: true, errorMessage };\n }\n }\n}\n\nexport const contactApi = new ContactApi();\n","import { ApiClient } from \"../core/apiClient\";\nimport { CustomGraphQLParams, CustomGraphQLResponse } from \"./types\";\n\nclass CustomApi extends ApiClient {\n async executeCustomQuery<T>(\n params: CustomGraphQLParams\n ): Promise<CustomGraphQLResponse<T>> {\n if (!this.baseURL || !this.apiKey) {\n return {\n data: null as T,\n error: true,\n errorMessage:\n \"SDK no configurado: PAKENTO_CMS_BASE_URL o PAKENTO_API_KEY faltantes.\",\n };\n }\n\n if (\n !params.query ||\n typeof params.query !== \"string\" ||\n params.query.trim() === \"\"\n ) {\n return {\n data: null as T,\n error: true,\n errorMessage: \"Se requiere un query GraphQL válido.\",\n };\n }\n\n try {\n const response = await this.client.post(\"/api/graphql\", {\n query: params.query,\n variables: params.variables || {},\n });\n\n if (response.data.errors && response.data.errors.length > 0) {\n return {\n data: response.data.data || (null as T),\n errors: response.data.errors,\n error: true,\n errorMessage: `GraphQL Errors: ${response.data.errors\n .map((err: { message: string }) => err.message)\n .join(\", \")}`,\n };\n }\n\n return {\n data: response.data.data,\n error: false,\n errorMessage: null,\n };\n } catch (error) {\n const errorMessage = this.handleApiError(error, \"Custom GraphQL\");\n return { data: null as T, error: true, errorMessage };\n }\n }\n}\n\nexport const customApi = new CustomApi();\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,mBAAiD;AACjD,iBAAkB;;;ACDlB,mBAAsB;AAEf,IAAM,eAAN,MAAmB;AAAA;AAAA,EAKxB,YAAY,QAAgB;AAF5B,SAAQ,aAAqB;AAG3B,SAAK,aAAa,OAAO,UAAU,GAAG,CAAC;AAEvC,QACE,QAAQ,IAAI,0BACZ,QAAQ,IAAI,0BACZ;AACA,WAAK,QAAQ,IAAI,mBAAM;AAAA,QACrB,KAAK,QAAQ,IAAI;AAAA,QACjB,OAAO,QAAQ,IAAI;AAAA,MACrB,CAAC;AAAA,IACH;AAAA,EACF;AAAA,EAEQ,mBAAmB,QAAyC;AAClE,UAAM,eAAe,KAAK,UAAU,MAAM;AAC1C,WAAO,KAAK,YAAY;AAAA,EAC1B;AAAA,EAEO,cACL,cACA,SAAkC,CAAC,GAC3B;AACR,UAAM,aAAa,KAAK,mBAAmB,EAAE,GAAG,QAAQ,aAAa,CAAC;AACtE,WAAO,WAAW,KAAK,UAAU,IAAI,UAAU;AAAA,EACjD;AAAA,EAEA,MAAa,UACX,KACA,SACA,cACA,SACY;AACZ,QAAI,CAAC,KAAK,OAAO;AACf,aAAO,QAAQ;AAAA,IACjB;AAEA,QAAI,SAAwB;AAC5B,QAAI;AACF,eAAS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AAO,SACR,OAAO,OAAO,UAAU,YACxB,OAAO,MAAM,KAAK,MAAM,IACxB;AACA,aAAO;AAAA,QACL,MAAM;AAAA,QACN,OAAO;AAAA,QACP,cAAc;AAAA,MAChB;AAAA,IACF;AAEA,QAAI;AACF,YAAM,WAAW,MAAM,KAAK,OAAO,KAAK,gBAAgB;AAAA,QACtD,OAAO,OAAO;AAAA,QACd,WAAW,OAAO,aAAa,CAAC;AAAA,MAClC,CAAC;AAED,UAAI,SAAS,KAAK,UAAU,SAAS,KAAK,OAAO,SAAS,GAAG;AAC3D,eAAO;AAAA,UACL,MAAM,SAAS,KAAK,QAAS;AAAA,UAC7B,QAAQ,SAAS,KAAK;AAAA,UACtB,OAAO;AAAA,UACP,cAAc,mBAAmB,SAAS,KAAK,OAC5C,IAAI,CAAC,QAA6B,IAAI,OAAO,EAC7C,KAAK,IAAI,CAAC;AAAA,QACf;AAAA,MACF;AAEA,aAAO;AAAA,QACL,MAAM,SAAS,KAAK;AAAA,QACpB,OAAO;AAAA,QACP,cAAc;AAAA,MAChB;AAAA,IACF,SAAS,OAAO;AACd,YAAM,eAAe,KAAK,eAAe,OAAO,gBAAgB;AAChE,aAAO,EAAE,MAAM,MAAW,OAAO,MAAM,aAAa;AAAA,IACtD;AAAA,EACF;AACF;AAEO,IAAM,YAAY,IAAI,UAAU;","names":["axios","import_zod","import_zod","import_zod","import_zod","import_zod"]}
package/dist/index.mjs CHANGED
@@ -20,11 +20,11 @@ var CacheService = class {
20
20
  const paramsString = JSON.stringify(params);
21
21
  return btoa(paramsString);
22
22
  }
23
- buildCacheKey(params = {}) {
24
- const paramsHash = this.generateParamsHash(params);
23
+ buildCacheKey(functionName, params = {}) {
24
+ const paramsHash = this.generateParamsHash({ ...params, functionName });
25
25
  return `pakento:${this.apiKeyHash}:${paramsHash}`;
26
26
  }
27
- async cacheWrap(key, fetcher, filters) {
27
+ async cacheWrap(key, fetcher, functionName, filters) {
28
28
  if (!this.redis) {
29
29
  return fetcher();
30
30
  }
@@ -46,6 +46,7 @@ var CacheService = class {
46
46
  const result = await fetcher();
47
47
  try {
48
48
  const cacheData = {
49
+ _function: functionName,
49
50
  _filters: filters || {},
50
51
  _cachedAt: (/* @__PURE__ */ new Date()).toISOString(),
51
52
  ...result
@@ -137,32 +138,49 @@ var ApiClient = class {
137
138
 
138
139
  // src/api/items/parsers.ts
139
140
  function parseRawItemToItem(rawItem) {
140
- const firstPrice = rawItem.item_prices.docs[0];
141
141
  const images = rawItem.images.map((img) => ({
142
142
  url: img.url,
143
- thumbnail_url: img.thumbnailURL
143
+ thumbnail_url: img.thumbnail_url
144
+ }));
145
+ const variations = rawItem.variations.map((v) => ({
146
+ id: v.id,
147
+ name: v.name,
148
+ description: v.description,
149
+ cover_image_url: v.cover_image_url,
150
+ cover_image_thumbnail_url: v.cover_image_thumbnail_url,
151
+ price: v.price,
152
+ old_price: v.old_price,
153
+ price_notes: v.price_notes,
154
+ price_text: v.price_text,
155
+ currency_prefix: v.currency_prefix,
156
+ attribute_values: v.attribute_values,
157
+ images: v.images.map((img) => ({
158
+ url: img.url,
159
+ thumbnail_url: img.thumbnail_url
160
+ }))
144
161
  }));
145
- const coverImageUrl = rawItem.coverImage?.url || rawItem.images[0]?.url || "";
146
- const coverImageThumbnailUrl = rawItem.coverImage?.thumbnailURL || rawItem.images[0]?.thumbnailURL || "";
147
162
  return {
148
163
  id: rawItem.id,
149
164
  name: rawItem.name,
150
165
  featured: rawItem.featured,
151
166
  url_safe_name: rawItem.url_safe_name,
152
- currency_prefix: "$",
153
- // Default currency prefix, could be made configurable
167
+ currency_prefix: rawItem.currency_prefix,
154
168
  description: rawItem.description,
155
- old_price: firstPrice?.old_price || 0,
156
- item_category_name: rawItem.item_category?.name || "",
157
- item_category_id: parseInt(rawItem.item_category?.id || "0"),
158
- price_text: firstPrice?.price_text || "",
159
- price_notes: firstPrice?.price_notes || "",
160
- price: firstPrice?.amount || 0,
161
- brand_id: parseInt(rawItem.brand?.id || "0"),
162
- brand_name: rawItem.brand?.name || "",
163
- cover_image_url: coverImageUrl,
164
- cover_image_thumbnail_url: coverImageThumbnailUrl,
165
- images
169
+ old_price: rawItem.old_price,
170
+ item_category_name: rawItem.item_category_name,
171
+ item_category_id: parseInt(rawItem.item_category_id || "0", 10),
172
+ item_super_category_name: rawItem.item_super_category_name,
173
+ item_super_category_id: parseInt(rawItem.item_super_category_id || "0", 10),
174
+ price_text: rawItem.price_text,
175
+ price_notes: rawItem.price_notes,
176
+ price: rawItem.price,
177
+ brand_id: parseInt(rawItem.brand_id || "0", 10),
178
+ brand_name: rawItem.brand_name,
179
+ cover_image_url: rawItem.cover_image_url,
180
+ cover_image_thumbnail_url: rawItem.cover_image_thumbnail_url,
181
+ images,
182
+ master_attributes: rawItem.master_attributes,
183
+ variations
166
184
  };
167
185
  }
168
186
  function parseRawItemsToItems(rawItems) {
@@ -206,11 +224,11 @@ var ItemsApi = class extends ApiClient {
206
224
  errorMessage
207
225
  };
208
226
  }
209
- console.log("ARMANDO CACHE KEY CON:", validatedParams.data);
210
- const cacheKey = this.cache.buildCacheKey(validatedParams.data);
227
+ const cacheKey = this.cache.buildCacheKey("getItems", validatedParams.data);
211
228
  return this.cache.cacheWrap(
212
229
  cacheKey,
213
230
  () => this.fetchItemsFromAPI(validatedParams.data),
231
+ "getItems",
214
232
  validatedParams.data
215
233
  );
216
234
  }
@@ -228,62 +246,97 @@ var ItemsApi = class extends ApiClient {
228
246
  }
229
247
  const query = `
230
248
  query GetEcommerceItems(
231
- $where: EcommerceItemsWhere
232
- $onlyOffers: Boolean
233
- $limit: Int
234
- $page: Int
235
- $search: String
236
- $sort: String
237
- $minPrice: Float
238
- $maxPrice: Float
249
+ $where: EcommerceItemsWhere
250
+ $onlyOffers: Boolean
251
+ $limit: Int
252
+ $page: Int
253
+ $search: String
254
+ $sort: String
255
+ $minPrice: Float
256
+ $maxPrice: Float
257
+ ) {
258
+ GetEcommerceItems(
259
+ where: $where
260
+ onlyOffers: $onlyOffers
261
+ limit: $limit
262
+ page: $page
263
+ search: $search
264
+ sort: $sort
265
+ minPrice: $minPrice
266
+ maxPrice: $maxPrice
239
267
  ) {
240
- GetEcommerceItems(
241
- where: $where
242
- onlyOffers: $onlyOffers
243
- limit: $limit
244
- page: $page
245
- search: $search
246
- sort: $sort
247
- minPrice: $minPrice
248
- maxPrice: $maxPrice
249
- ) {
250
- totalDocs
251
- totalPages
252
- prevPage
253
- nextPage
254
- docs {
268
+ totalDocs
269
+ totalPages
270
+ prevPage
271
+ nextPage
272
+ docs {
273
+ id
274
+ name
275
+ featured
276
+ description
277
+ url_safe_name
278
+
279
+ item_super_category_id
280
+ item_super_category_name
281
+
282
+ item_category_id
283
+ item_category_name
284
+
285
+ cover_image_url
286
+ cover_image_thumbnail_url
287
+
288
+ price
289
+ old_price
290
+ price_notes
291
+ price_text
292
+ currency_prefix
293
+
294
+ brand_id
295
+ brand_name
296
+
297
+ master_attributes {
298
+ id
299
+ name
300
+ values {
301
+ id
302
+ value
303
+ }
304
+ }
305
+
306
+ variations {
255
307
  id
256
308
  name
257
- featured
258
309
  description
259
- url_safe_name
260
- images {
261
- url
262
- thumbnailURL
310
+
311
+ cover_image_url
312
+ cover_image_thumbnail_url
313
+
314
+ price
315
+ old_price
316
+ price_notes
317
+ price_text
318
+ currency_prefix
319
+
320
+ attribute_values {
321
+ attribute_id
322
+ attribute_name
323
+ value
324
+ value_id
263
325
  }
264
- coverImage {
326
+
327
+ images {
265
328
  url
266
- thumbnailURL
267
- }
268
- item_prices {
269
- docs {
270
- amount
271
- old_price
272
- price_text
273
- price_notes
274
- }
275
- }
276
- brand {
277
- id
278
- name
279
- }
280
- item_category {
281
- id
282
- name
329
+ thumbnail_url
283
330
  }
284
331
  }
332
+
333
+ images {
334
+ url
335
+ thumbnail_url
336
+ }
285
337
  }
286
338
  }
339
+ }
287
340
  `;
288
341
  const whereConditions = {};
289
342
  if (params.where?.item_category_id?.equals) {
@@ -370,10 +423,14 @@ var CategoriesApi = class extends ApiClient {
370
423
  );
371
424
  return { data: [], error: true, errorMessage };
372
425
  }
373
- const cacheKey = this.cache.buildCacheKey(validatedParams.data);
426
+ const cacheKey = this.cache.buildCacheKey(
427
+ "getCategories",
428
+ validatedParams.data
429
+ );
374
430
  return this.cache.cacheWrap(
375
431
  cacheKey,
376
432
  () => this.fetchCategoriesFromAPI(validatedParams.data),
433
+ "getCategories",
377
434
  validatedParams.data
378
435
  );
379
436
  }
@@ -465,10 +522,14 @@ var BrandsApi = class extends ApiClient {
465
522
  errorMessage
466
523
  };
467
524
  }
468
- const cacheKey = this.cache.buildCacheKey(validatedParams.data);
525
+ const cacheKey = this.cache.buildCacheKey(
526
+ "getBrands",
527
+ validatedParams.data
528
+ );
469
529
  return this.cache.cacheWrap(
470
530
  cacheKey,
471
531
  () => this.fetchBrandsFromAPI(validatedParams.data),
532
+ "getBrands",
472
533
  validatedParams.data
473
534
  );
474
535
  }
@@ -579,10 +640,11 @@ function parseRawEntityToEntity(rawEntity) {
579
640
  // src/api/entity/api.ts
580
641
  var EntityApi = class extends ApiClient {
581
642
  async getEntity(params = {}) {
582
- const cacheKey = this.cache.buildCacheKey(params);
643
+ const cacheKey = this.cache.buildCacheKey("getEntity", params);
583
644
  return this.cache.cacheWrap(
584
645
  cacheKey,
585
646
  () => this.fetchEntityFromAPI(params),
647
+ "getEntity",
586
648
  params
587
649
  );
588
650
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/api/core/apiClient.ts","../src/api/core/cache.ts","../src/api/items/parsers.ts","../src/api/items/validators.ts","../src/api/items/api.ts","../src/api/categories/validators.ts","../src/api/categories/parsers.ts","../src/api/categories/api.ts","../src/api/brands/validators.ts","../src/api/brands/parsers.ts","../src/api/brands/api.ts","../src/api/entity/parsers.ts","../src/api/entity/api.ts","../src/api/orders/validators.ts","../src/api/orders/api.ts","../src/api/contact/validators.ts","../src/api/contact/api.ts","../src/api/custom/api.ts"],"sourcesContent":["import axios, { AxiosInstance, AxiosError } from \"axios\";\nimport { z } from \"zod\";\nimport { CacheService } from \"./cache\";\n\nexport class ApiClient {\n protected client: AxiosInstance;\n protected cache: CacheService;\n protected baseURL: string;\n protected apiKey: string;\n\n constructor() {\n this.baseURL = process.env.PAKENTO_CMS_BASE_URL || \"\";\n this.apiKey = process.env.PAKENTO_API_KEY || \"\";\n this.cache = new CacheService(this.apiKey);\n\n this.client = axios.create({\n baseURL: this.baseURL,\n headers: {\n \"Content-Type\": \"application/json\",\n Authorization: `users API-Key ${this.apiKey}`,\n },\n });\n\n this.client.interceptors.request.use(\n (config) => {\n const fullUrl = `${config.baseURL}${config.url}`;\n console.log(`🌐 API Call: ${config.method?.toUpperCase()} ${fullUrl}`);\n return config;\n },\n (error) => Promise.reject(error)\n );\n }\n\n protected handleApiError(error: unknown, context: string): string {\n if (error instanceof AxiosError) {\n const status = error.response?.status;\n const responseMessage = error.response?.data?.message;\n if (status === 401) return \"API Key inválida o expirada\";\n if (status === 404) return `${context} no encontrado`;\n if (status && status >= 500) return \"Error del servidor CMS\";\n return (\n responseMessage || `Error de conexión en ${context}: ${error.message}`\n );\n } else if (error instanceof z.ZodError) {\n return `Validación fallida: ${error.issues\n .map((e) => e.message)\n .join(\", \")}`;\n } else if (error instanceof Error) {\n return error.message;\n }\n return \"Error desconocido\";\n }\n\n protected async fetchGraphQL<T>(\n query: string,\n variables: any,\n extractData: (responseData: any) => T\n ): Promise<{ data: T | null; error: boolean; errorMessage: string | null }> {\n try {\n const response = await this.client.post(\"/api/graphql\", {\n query,\n variables,\n });\n if (response.data.errors) {\n const errorMessage = `GraphQL Error: ${response.data.errors[0].message}`;\n return { data: null, error: true, errorMessage };\n }\n const data = extractData(response.data.data);\n return { data, error: false, errorMessage: null };\n } catch (error) {\n const errorMessage = this.handleApiError(error, \"GraphQL query\");\n return { data: null, error: true, errorMessage };\n }\n }\n}\n","import { Redis } from \"@upstash/redis\";\n\nexport class CacheService {\n private redis?: Redis;\n private apiKeyHash: string;\n private defaultTTL: number = 172800; // 48 hours\n\n constructor(apiKey: string) {\n this.apiKeyHash = apiKey.substring(0, 8);\n\n if (\n process.env.UPSTASH_REDIS_REST_URL &&\n process.env.UPSTASH_REDIS_REST_TOKEN\n ) {\n this.redis = new Redis({\n url: process.env.UPSTASH_REDIS_REST_URL,\n token: process.env.UPSTASH_REDIS_REST_TOKEN,\n });\n }\n }\n\n private generateParamsHash(params: Record<string, unknown>): string {\n const paramsString = JSON.stringify(params);\n return btoa(paramsString);\n }\n\n public buildCacheKey(params: Record<string, unknown> = {}): string {\n const paramsHash = this.generateParamsHash(params);\n return `pakento:${this.apiKeyHash}:${paramsHash}`;\n }\n\n public async cacheWrap<T>(\n key: string,\n fetcher: () => Promise<T>,\n filters?: Record<string, unknown>\n ): Promise<T> {\n if (!this.redis) {\n return fetcher();\n }\n\n let cached: string | null = null;\n try {\n cached = await this.redis.get(key);\n\n if (typeof cached === \"object\" && cached !== null) {\n console.log(\"[Cache] ✅ Reading from cache:\", key);\n return cached as T;\n }\n\n if (cached) {\n console.log(\"[Cache] ✅ Reading from cache:\", key);\n return JSON.parse(cached as string) as T;\n }\n } catch (err) {\n console.warn(\"[Cache] ❌ Error reading from cache:\", err);\n console.log(`[Cache] ❌ Key: ${key}, type: ${typeof cached}`);\n }\n\n const result = await fetcher();\n\n try {\n // Crear objeto de caché con datos y filtros para visualización\n const cacheData = {\n _filters: filters || {},\n _cachedAt: new Date().toISOString(),\n ...result,\n };\n\n console.log(\"[Cache] ✅ Writing to cache:\", key);\n await this.redis.set(key, JSON.stringify(cacheData), {\n ex: this.defaultTTL,\n });\n } catch (err) {\n console.warn(\"[Cache] ❌ Error writing to cache:\", err);\n }\n\n return result;\n }\n\n public async clearAllCache(): Promise<boolean> {\n if (!this.redis) {\n console.warn(\"[Cache] ❌ Redis no configurado\");\n return false;\n }\n\n try {\n const pattern = `pakento:${this.apiKeyHash}:*`;\n const keys = await this.redis.keys(pattern);\n\n if (keys.length > 0) {\n await this.redis.del(...keys);\n console.log(\"[Cache] ✅ Cache limpiado\");\n }\n\n return true;\n } catch (err) {\n console.warn(\"[Cache] ❌ Error limpiando todo el cache\", err);\n return false;\n }\n }\n}\n","import { Item, ItemEcommerceRaw } from \"./types\";\n\n/**\n * Parses a raw GraphQL response item to the normalized Item type\n * @param rawItem - The raw item from GraphQL response\n * @returns Normalized Item object\n */\nexport function parseRawItemToItem(rawItem: ItemEcommerceRaw): Item {\n const firstPrice = rawItem.item_prices.docs[0];\n\n const images = rawItem.images.map((img) => ({\n url: img.url,\n thumbnail_url: img.thumbnailURL,\n }));\n\n const coverImageUrl = rawItem.coverImage?.url || rawItem.images[0]?.url || \"\";\n const coverImageThumbnailUrl =\n rawItem.coverImage?.thumbnailURL || rawItem.images[0]?.thumbnailURL || \"\";\n\n return {\n id: rawItem.id,\n name: rawItem.name,\n featured: rawItem.featured,\n url_safe_name: rawItem.url_safe_name,\n currency_prefix: \"$\", // Default currency prefix, could be made configurable\n description: rawItem.description,\n old_price: firstPrice?.old_price || 0,\n item_category_name: rawItem.item_category?.name || \"\",\n item_category_id: parseInt(rawItem.item_category?.id || \"0\"),\n price_text: firstPrice?.price_text || \"\",\n price_notes: firstPrice?.price_notes || \"\",\n price: firstPrice?.amount || 0,\n brand_id: parseInt(rawItem.brand?.id || \"0\"),\n brand_name: rawItem.brand?.name || \"\",\n cover_image_url: coverImageUrl,\n cover_image_thumbnail_url: coverImageThumbnailUrl,\n images: images,\n };\n}\n\n/**\n * Parses an array of raw GraphQL response items to normalized Item types\n * @param rawItems - Array of raw items from GraphQL response\n * @returns Array of normalized Item objects\n */\nexport function parseRawItemsToItems(rawItems: ItemEcommerceRaw[]): Item[] {\n return rawItems.map(parseRawItemToItem);\n}\n","import { z } from \"zod\";\n\nexport const itemsParamsSchema = z.object({\n where: z\n .object({\n item_category_id: z.object({ equals: z.string().optional() }).optional(),\n item_super_category_id: z\n .object({ equals: z.string().optional() })\n .optional(),\n brand_id: z.object({ equals: z.string().optional() }).optional(),\n id: z.object({ equals: z.string().optional() }).optional(),\n })\n .optional(),\n onlyOffers: z.boolean().optional(),\n limit: z.coerce.number().optional(),\n page: z.coerce.number().optional(),\n search: z.string().optional(),\n sort: z.string().optional(),\n minPrice: z.coerce.number().optional(),\n maxPrice: z.coerce.number().optional(),\n});\n","import { ApiClient } from \"../core/apiClient\";\nimport { itemsParamsSchema } from \"./validators\";\nimport { parseRawItemsToItems } from \"./parsers\";\nimport { GetItemsParams, ItemsRawResponse, ItemsWhere, Item } from \"./types\";\nimport { ApiResponse } from \"../core/types\";\n\nclass ItemsApi extends ApiClient {\n async getItems(params: GetItemsParams = {}): Promise<ApiResponse<Item[]>> {\n const validatedParams = itemsParamsSchema.safeParse(params);\n if (!validatedParams.success) {\n const errorMessage = this.handleApiError(\n validatedParams.error,\n \"getItems validation\"\n );\n return {\n data: [],\n totalDocs: 0,\n totalPages: 0,\n prevPage: null,\n nextPage: null,\n error: true,\n errorMessage,\n };\n }\n\n console.log(\"ARMANDO CACHE KEY CON:\", validatedParams.data);\n const cacheKey = this.cache.buildCacheKey(validatedParams.data);\n return this.cache.cacheWrap(\n cacheKey,\n () => this.fetchItemsFromAPI(validatedParams.data),\n validatedParams.data\n );\n }\n\n private async fetchItemsFromAPI(\n params: GetItemsParams\n ): Promise<ApiResponse<Item[]>> {\n if (!this.baseURL || !this.apiKey) {\n return {\n data: [],\n totalDocs: 0,\n totalPages: 0,\n prevPage: null,\n nextPage: null,\n error: true,\n errorMessage:\n \"SDK no configurado: PAKENTO_CMS_BASE_URL o PAKENTO_API_KEY faltantes.\",\n };\n }\n\n const query = `\n query GetEcommerceItems(\n $where: EcommerceItemsWhere\n $onlyOffers: Boolean\n $limit: Int\n $page: Int\n $search: String\n $sort: String\n $minPrice: Float\n $maxPrice: Float\n ) {\n GetEcommerceItems(\n where: $where\n onlyOffers: $onlyOffers\n limit: $limit\n page: $page\n search: $search\n sort: $sort\n minPrice: $minPrice\n maxPrice: $maxPrice\n ) {\n totalDocs\n totalPages\n prevPage\n nextPage\n docs {\n id\n name\n featured\n description\n url_safe_name\n images {\n url\n thumbnailURL\n }\n coverImage {\n url\n thumbnailURL\n }\n item_prices {\n docs {\n amount\n old_price\n price_text\n price_notes\n }\n }\n brand {\n id\n name\n }\n item_category {\n id\n name\n }\n }\n }\n }\n `;\n\n const whereConditions: ItemsWhere = {};\n if (params.where?.item_category_id?.equals) {\n whereConditions.item_category_id = {\n equals: params.where.item_category_id.equals,\n };\n }\n if (params.where?.item_super_category_id?.equals) {\n whereConditions.item_super_category_id = {\n equals: params.where.item_super_category_id.equals,\n };\n }\n if (params.where?.brand_id?.equals) {\n whereConditions.brand_id = { equals: params.where.brand_id.equals };\n }\n if (params.where?.id?.equals) {\n whereConditions.id = { equals: params.where.id.equals };\n }\n\n const variables = {\n ...params,\n where:\n Object.keys(whereConditions).length > 0 ? whereConditions : undefined,\n };\n\n const { data, error, errorMessage } =\n await this.fetchGraphQL<ItemsRawResponse>(\n query,\n variables,\n (responseData) => responseData.GetEcommerceItems\n );\n\n if (error) {\n return {\n data: [],\n totalDocs: 0,\n totalPages: 0,\n prevPage: null,\n nextPage: null,\n error: true,\n errorMessage,\n };\n }\n\n return {\n data: parseRawItemsToItems(data!.docs),\n totalDocs: data!.totalDocs,\n totalPages: data!.totalPages,\n prevPage: data!.prevPage,\n nextPage: data!.nextPage,\n error: false,\n errorMessage: null,\n };\n }\n}\n\nexport const itemsApi = new ItemsApi();\n","import { z } from \"zod\";\n\nexport const categoriesParamsSchema = z.object({\n where: z\n .object({\n item_super_category_id: z\n .object({ equals: z.string().optional() })\n .optional(),\n brand_id: z.object({ equals: z.string().optional() }).optional(),\n })\n .optional(),\n limit: z.coerce.number().optional(),\n page: z.coerce.number().optional(),\n sort: z.string().optional(),\n});\n","import { Category, CategoryEcommerceRaw } from \"./types\";\n\n/**\n * Parses a raw GraphQL response category to the normalized Category type\n * @param rawCategory - The raw category from GraphQL response\n * @returns Normalized Category object\n */\nexport function parseRawCategoryToCategory(\n rawCategory: CategoryEcommerceRaw\n): Category {\n return {\n id: rawCategory.id,\n name: rawCategory.name,\n image_url: rawCategory.image_url,\n };\n}\n\n/**\n * Parses an array of raw GraphQL response categories to normalized Category types\n * @param rawCategories - Array of raw categories from GraphQL response\n * @returns Array of normalized Category objects\n */\nexport function parseRawCategoriesToCategories(\n rawCategories: CategoryEcommerceRaw[]\n): Category[] {\n return rawCategories.map(parseRawCategoryToCategory);\n}\n","import { ApiClient } from \"../core/apiClient\";\nimport { categoriesParamsSchema } from \"./validators\";\nimport { parseRawCategoriesToCategories } from \"./parsers\";\nimport { GetCategoriesParams, CategoriesRawResponse, Category } from \"./types\";\nimport { ApiResponse } from \"../core/types\";\n\nclass CategoriesApi extends ApiClient {\n async getCategories(\n params: GetCategoriesParams = {}\n ): Promise<ApiResponse<Category[]>> {\n const validatedParams = categoriesParamsSchema.safeParse(params);\n if (!validatedParams.success) {\n const errorMessage = this.handleApiError(\n validatedParams.error,\n \"getCategories validation\"\n );\n return { data: [], error: true, errorMessage };\n }\n\n const cacheKey = this.cache.buildCacheKey(validatedParams.data);\n return this.cache.cacheWrap(\n cacheKey,\n () => this.fetchCategoriesFromAPI(validatedParams.data),\n validatedParams.data\n );\n }\n\n private async fetchCategoriesFromAPI(\n params: GetCategoriesParams\n ): Promise<ApiResponse<Category[]>> {\n if (!this.baseURL || !this.apiKey) {\n return {\n data: [],\n error: true,\n errorMessage:\n \"SDK no configurado: PAKENTO_CMS_BASE_URL o PAKENTO_API_KEY faltantes.\",\n };\n }\n\n const query = `\n query GetEcommerceCategories(\n $where: EcommerceCategoriesWhere\n $limit: Int\n $page: Int\n $sort: String\n ) {\n GetEcommerceCategories(\n where: $where\n limit: $limit\n page: $page\n sort: $sort\n ) {\n docs {\n id\n name\n image_url\n }\n }\n }\n `;\n\n const { data, error, errorMessage } =\n await this.fetchGraphQL<CategoriesRawResponse>(\n query,\n params,\n (responseData) => responseData.GetEcommerceCategories\n );\n\n if (error) {\n return { data: [], error: true, errorMessage };\n }\n\n return {\n data: parseRawCategoriesToCategories(data!.docs),\n error: false,\n errorMessage: null,\n };\n }\n}\n\nexport const categoriesApi = new CategoriesApi();\n","import { z } from \"zod\";\n\nexport const brandsParamsSchema = z.object({\n limit: z.coerce.number().optional(),\n page: z.coerce.number().optional(),\n sort: z.string().optional(),\n});\n","import { Brand, BrandEcommerceRaw } from \"./types\";\n\n/**\n * Parses a raw GraphQL response brand to the normalized Brand type\n * @param rawBrand - The raw brand from GraphQL response\n * @returns Normalized Brand object\n */\nexport function parseRawBrandToBrand(rawBrand: BrandEcommerceRaw): Brand {\n return {\n id: rawBrand.id,\n name: rawBrand.name,\n description: rawBrand.description,\n items_count: rawBrand.items_count,\n image_url: rawBrand.image_url,\n image_thumbnail_url: rawBrand.image_thumbnail_url,\n };\n}\n\n/**\n * Parses an array of raw GraphQL response brands to normalized Brand types\n * @param rawBrands - Array of raw brands from GraphQL response\n * @returns Array of normalized Brand objects\n */\nexport function parseRawBrandsToBrands(\n rawBrands: BrandEcommerceRaw[]\n): Brand[] {\n return rawBrands.map(parseRawBrandToBrand);\n}\n","import { ApiClient } from \"../core/apiClient\";\nimport { brandsParamsSchema } from \"./validators\";\nimport { parseRawBrandsToBrands } from \"./parsers\";\nimport { GetBrandsParams, BrandsRawResponse, Brand } from \"./types\";\nimport { ApiResponse } from \"../core/types\";\n\nclass BrandsApi extends ApiClient {\n async getBrands(params: GetBrandsParams = {}): Promise<ApiResponse<Brand[]>> {\n const validatedParams = brandsParamsSchema.safeParse(params);\n if (!validatedParams.success) {\n const errorMessage = this.handleApiError(\n validatedParams.error,\n \"getBrands validation\"\n );\n return {\n data: [],\n totalDocs: 0,\n totalPages: 0,\n prevPage: null,\n nextPage: null,\n error: true,\n errorMessage,\n };\n }\n\n const cacheKey = this.cache.buildCacheKey(validatedParams.data);\n return this.cache.cacheWrap(\n cacheKey,\n () => this.fetchBrandsFromAPI(validatedParams.data),\n validatedParams.data\n );\n }\n\n private async fetchBrandsFromAPI(\n params: GetBrandsParams\n ): Promise<ApiResponse<Brand[]>> {\n if (!this.baseURL || !this.apiKey) {\n return {\n data: [],\n totalDocs: 0,\n totalPages: 0,\n prevPage: null,\n nextPage: null,\n error: true,\n errorMessage:\n \"SDK no configurado: PAKENTO_CMS_BASE_URL o PAKENTO_API_KEY faltantes.\",\n };\n }\n\n const query = `\n query GetEcommerceBrands(\n $limit: Int\n $page: Int\n $sort: String\n ) {\n GetEcommerceBrands(\n limit: $limit\n page: $page\n sort: $sort\n ) {\n totalDocs\n totalPages\n prevPage\n nextPage\n docs {\n id\n name\n description\n items_count\n image_url\n image_thumbnail_url\n }\n }\n }\n `;\n\n const { data, error, errorMessage } =\n await this.fetchGraphQL<BrandsRawResponse>(\n query,\n params,\n (responseData) => responseData.GetEcommerceBrands\n );\n\n if (error) {\n return {\n data: [],\n totalDocs: 0,\n totalPages: 0,\n prevPage: null,\n nextPage: null,\n error: true,\n errorMessage,\n };\n }\n\n return {\n data: parseRawBrandsToBrands(data!.docs),\n totalDocs: data!.totalDocs,\n totalPages: data!.totalPages,\n prevPage: data!.prevPage,\n nextPage: data!.nextPage,\n error: false,\n errorMessage: null,\n };\n }\n}\n\nexport const brandsApi = new BrandsApi();\n","import { Entity, EntityEcommerceRaw } from \"./types\";\n\n/**\n * Parses a raw GraphQL response entity to the normalized Entity type\n * @param rawEntity - The raw entity from GraphQL response\n * @returns Normalized Entity object\n */\nexport function parseRawEntityToEntity(rawEntity: EntityEcommerceRaw): Entity {\n return {\n id: rawEntity.id,\n tin: rawEntity.tin,\n name: rawEntity.name,\n web: rawEntity.web,\n address: rawEntity.address,\n country: rawEntity.country,\n city: rawEntity.city,\n currency_id: rawEntity.currency_id,\n currency_name: rawEntity.currency_name,\n currency_prefix: rawEntity.currency_prefix,\n currency_suffix: rawEntity.currency_suffix,\n logo_url: rawEntity.logo_url,\n logo_alt: rawEntity.logo_alt,\n logo_thumbnail_url: rawEntity.logo_thumbnail_url,\n logo_sizes_thumbnail_filename: rawEntity.logo_sizes_thumbnail_filename,\n logo_filename: rawEntity.logo_filename,\n logo_width: rawEntity.logo_width,\n logo_height: rawEntity.logo_height,\n logo_2_url: rawEntity.logo_2_url,\n logo_2_alt: rawEntity.logo_2_alt,\n logo_2_thumbnail_url: rawEntity.logo_2_thumbnail_url,\n logo_2_sizes_thumbnail_filename: rawEntity.logo_2_sizes_thumbnail_filename,\n logo_2_filename: rawEntity.logo_2_filename,\n logo_2_width: rawEntity.logo_2_width,\n logo_2_height: rawEntity.logo_2_height,\n featured_image_url: rawEntity.featured_image_url,\n featured_image_thumbnail_url: rawEntity.featured_image_thumbnail_url,\n featured_image_sizes_thumbnail_filename:\n rawEntity.featured_image_sizes_thumbnail_filename,\n featured_image_filename: rawEntity.featured_image_filename,\n featured_image_width: rawEntity.featured_image_width,\n featured_image_height: rawEntity.featured_image_height,\n };\n}\n","import { ApiClient } from \"../core/apiClient\";\nimport { parseRawEntityToEntity } from \"./parsers\";\nimport { GetEntityParams, EntityRawResponse, Entity } from \"./types\";\nimport { ApiResponse } from \"../core/types\";\n\nclass EntityApi extends ApiClient {\n async getEntity(params: GetEntityParams = {}): Promise<ApiResponse<Entity>> {\n const cacheKey = this.cache.buildCacheKey(params);\n return this.cache.cacheWrap(\n cacheKey,\n () => this.fetchEntityFromAPI(params),\n params\n );\n }\n\n private async fetchEntityFromAPI(\n params: GetEntityParams\n ): Promise<ApiResponse<Entity>> {\n if (!this.baseURL || !this.apiKey) {\n return {\n data: null,\n error: true,\n errorMessage:\n \"SDK no configurado: PAKENTO_CMS_BASE_URL o PAKENTO_API_KEY faltantes.\",\n };\n }\n\n const query = `\n query GetEntity {\n GetEntity {\n id\n tin\n name\n web\n address\n country\n city\n currency_id\n currency_name\n currency_prefix\n currency_suffix\n logo_url\n logo_alt\n logo_thumbnail_url\n logo_sizes_thumbnail_filename\n logo_filename\n logo_width\n logo_height\n logo_2_url\n logo_2_alt\n logo_2_thumbnail_url\n logo_2_sizes_thumbnail_filename\n logo_2_filename\n logo_2_width\n logo_2_height\n featured_image_url\n featured_image_thumbnail_url\n featured_image_sizes_thumbnail_filename\n featured_image_filename\n featured_image_width\n featured_image_height\n }\n }\n `;\n\n const { data, error, errorMessage } =\n await this.fetchGraphQL<EntityRawResponse>(\n query,\n params,\n (responseData) => responseData\n );\n\n if (error) {\n return { data: null, error: true, errorMessage };\n }\n\n return {\n data: parseRawEntityToEntity(data!.GetEntity),\n error: false,\n errorMessage: null,\n };\n }\n}\n\nexport const entityApi = new EntityApi();\n","import { z } from \"zod\";\n\nexport const orderSchema = z.object({\n name: z.string().min(1),\n email: z.string().email(),\n phone: z.string().optional(),\n notes: z.string().optional(),\n tin: z.string().optional(),\n items: z\n .array(\n z.object({ id: z.number().positive(), quantity: z.number().positive() })\n )\n .min(1),\n delivery_address: z.string().optional(),\n delivery_instructions: z.string().optional(),\n payment_method: z.enum([\"cash\", \"transfer\"]).optional(),\n});\n","import { ApiClient } from \"../core/apiClient\";\nimport { orderSchema } from \"./validators\";\nimport {\n CreateEcommerceOrderParams,\n CreateEcommerceOrderResponse,\n} from \"./types\";\n\nclass OrdersApi extends ApiClient {\n async createEcommerceOrder(\n params: CreateEcommerceOrderParams\n ): Promise<CreateEcommerceOrderResponse> {\n if (!this.baseURL || !this.apiKey) {\n return {\n message: \"SDK no configurado\",\n error: true,\n errorMessage: \"SDK no configurado\",\n };\n }\n\n const validated = orderSchema.safeParse(params);\n if (!validated.success) {\n const errorMessage = this.handleApiError(\n validated.error,\n \"createEcommerceOrder validation\"\n );\n return { message: errorMessage, error: true, errorMessage };\n }\n\n try {\n const response = await this.client.post(\n \"/api/orders/create-ecommerce-order\",\n validated.data\n );\n\n if (response.status === 200) {\n return {\n message: response.data.message || \"Orden creada exitosamente\",\n order_id: response.data.order_id,\n error: false,\n errorMessage: null,\n };\n } else {\n const errorMessage = response.data.message || \"Error al crear la orden\";\n return { message: errorMessage, error: true, errorMessage };\n }\n } catch (error) {\n const errorMessage = this.handleApiError(error, \"createEcommerceOrder\");\n return { message: errorMessage, error: true, errorMessage };\n }\n }\n}\n\nexport const ordersApi = new OrdersApi();\n","import { z } from \"zod\";\n\nexport const contactUsSchema = z.object({\n name: z.string().min(1),\n email: z.string().email(),\n phone: z.string().optional(),\n subject: z.string().optional(),\n notes: z.string().min(1),\n});\n","import { ApiClient } from \"../core/apiClient\";\nimport { contactUsSchema } from \"./validators\";\nimport { SendContactUsEmailParams, SendContactUsEmailResponse } from \"./types\";\n\nclass ContactApi extends ApiClient {\n async sendContactUsEmail(\n params: SendContactUsEmailParams\n ): Promise<SendContactUsEmailResponse> {\n if (!this.baseURL || !this.apiKey) {\n return {\n message: \"SDK no configurado\",\n error: true,\n errorMessage: \"SDK no configurado\",\n };\n }\n\n const validated = contactUsSchema.safeParse(params);\n if (!validated.success) {\n const errorMessage = this.handleApiError(\n validated.error,\n \"sendContactUsEmail validation\"\n );\n return { message: errorMessage, error: true, errorMessage };\n }\n\n try {\n const response = await this.client.post(\n \"/api/entities/send-contact-us-email\",\n validated.data\n );\n\n if (response.status === 200) {\n return {\n message: response.data.message || \"Mensaje enviado exitosamente\",\n error: false,\n errorMessage: null,\n };\n } else {\n const errorMessage =\n response.data.message || \"Error al enviar el mensaje\";\n return { message: errorMessage, error: true, errorMessage };\n }\n } catch (error) {\n const errorMessage = this.handleApiError(error, \"sendContactUsEmail\");\n return { message: errorMessage, error: true, errorMessage };\n }\n }\n}\n\nexport const contactApi = new ContactApi();\n","import { ApiClient } from \"../core/apiClient\";\nimport { CustomGraphQLParams, CustomGraphQLResponse } from \"./types\";\n\nclass CustomApi extends ApiClient {\n async executeCustomQuery<T>(\n params: CustomGraphQLParams\n ): Promise<CustomGraphQLResponse<T>> {\n if (!this.baseURL || !this.apiKey) {\n return {\n data: null as T,\n error: true,\n errorMessage:\n \"SDK no configurado: PAKENTO_CMS_BASE_URL o PAKENTO_API_KEY faltantes.\",\n };\n }\n\n if (\n !params.query ||\n typeof params.query !== \"string\" ||\n params.query.trim() === \"\"\n ) {\n return {\n data: null as T,\n error: true,\n errorMessage: \"Se requiere un query GraphQL válido.\",\n };\n }\n\n try {\n const response = await this.client.post(\"/api/graphql\", {\n query: params.query,\n variables: params.variables || {},\n });\n\n if (response.data.errors && response.data.errors.length > 0) {\n return {\n data: response.data.data || (null as T),\n errors: response.data.errors,\n error: true,\n errorMessage: `GraphQL Errors: ${response.data.errors\n .map((err: { message: string }) => err.message)\n .join(\", \")}`,\n };\n }\n\n return {\n data: response.data.data,\n error: false,\n errorMessage: null,\n };\n } catch (error) {\n const errorMessage = this.handleApiError(error, \"Custom GraphQL\");\n return { data: null as T, error: true, errorMessage };\n }\n }\n}\n\nexport const customApi = new CustomApi();\n"],"mappings":";AAAA,OAAO,SAAwB,kBAAkB;AACjD,SAAS,SAAS;;;ACDlB,SAAS,aAAa;AAEf,IAAM,eAAN,MAAmB;AAAA;AAAA,EAKxB,YAAY,QAAgB;AAF5B,SAAQ,aAAqB;AAG3B,SAAK,aAAa,OAAO,UAAU,GAAG,CAAC;AAEvC,QACE,QAAQ,IAAI,0BACZ,QAAQ,IAAI,0BACZ;AACA,WAAK,QAAQ,IAAI,MAAM;AAAA,QACrB,KAAK,QAAQ,IAAI;AAAA,QACjB,OAAO,QAAQ,IAAI;AAAA,MACrB,CAAC;AAAA,IACH;AAAA,EACF;AAAA,EAEQ,mBAAmB,QAAyC;AAClE,UAAM,eAAe,KAAK,UAAU,MAAM;AAC1C,WAAO,KAAK,YAAY;AAAA,EAC1B;AAAA,EAEO,cAAc,SAAkC,CAAC,GAAW;AACjE,UAAM,aAAa,KAAK,mBAAmB,MAAM;AACjD,WAAO,WAAW,KAAK,UAAU,IAAI,UAAU;AAAA,EACjD;AAAA,EAEA,MAAa,UACX,KACA,SACA,SACY;AACZ,QAAI,CAAC,KAAK,OAAO;AACf,aAAO,QAAQ;AAAA,IACjB;AAEA,QAAI,SAAwB;AAC5B,QAAI;AACF,eAAS,MAAM,KAAK,MAAM,IAAI,GAAG;AAEjC,UAAI,OAAO,WAAW,YAAY,WAAW,MAAM;AACjD,gBAA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AAA,IACF,SAAS,OAAO;AACd,YAAM,eAAe,KAAK,eAAe,OAAO,gBAAgB;AAChE,aAAO,EAAE,MAAM,MAAW,OAAO,MAAM,aAAa;AAAA,IACtD;AAAA,EACF;AACF;AAEO,IAAM,YAAY,IAAI,UAAU;","names":["z","z","z","z","z"]}
1
+ {"version":3,"sources":["../src/api/core/apiClient.ts","../src/api/core/cache.ts","../src/api/items/parsers.ts","../src/api/items/validators.ts","../src/api/items/api.ts","../src/api/categories/validators.ts","../src/api/categories/parsers.ts","../src/api/categories/api.ts","../src/api/brands/validators.ts","../src/api/brands/parsers.ts","../src/api/brands/api.ts","../src/api/entity/parsers.ts","../src/api/entity/api.ts","../src/api/orders/validators.ts","../src/api/orders/api.ts","../src/api/contact/validators.ts","../src/api/contact/api.ts","../src/api/custom/api.ts"],"sourcesContent":["import axios, { AxiosInstance, AxiosError } from \"axios\";\nimport { z } from \"zod\";\nimport { CacheService } from \"./cache\";\n\nexport class ApiClient {\n protected client: AxiosInstance;\n protected cache: CacheService;\n protected baseURL: string;\n protected apiKey: string;\n\n constructor() {\n this.baseURL = process.env.PAKENTO_CMS_BASE_URL || \"\";\n this.apiKey = process.env.PAKENTO_API_KEY || \"\";\n this.cache = new CacheService(this.apiKey);\n\n this.client = axios.create({\n baseURL: this.baseURL,\n headers: {\n \"Content-Type\": \"application/json\",\n Authorization: `users API-Key ${this.apiKey}`,\n },\n });\n\n this.client.interceptors.request.use(\n (config) => {\n const fullUrl = `${config.baseURL}${config.url}`;\n console.log(`🌐 API Call: ${config.method?.toUpperCase()} ${fullUrl}`);\n return config;\n },\n (error) => Promise.reject(error)\n );\n }\n\n protected handleApiError(error: unknown, context: string): string {\n if (error instanceof AxiosError) {\n const status = error.response?.status;\n const responseMessage = error.response?.data?.message;\n if (status === 401) return \"API Key inválida o expirada\";\n if (status === 404) return `${context} no encontrado`;\n if (status && status >= 500) return \"Error del servidor CMS\";\n return (\n responseMessage || `Error de conexión en ${context}: ${error.message}`\n );\n } else if (error instanceof z.ZodError) {\n return `Validación fallida: ${error.issues\n .map((e) => e.message)\n .join(\", \")}`;\n } else if (error instanceof Error) {\n return error.message;\n }\n return \"Error desconocido\";\n }\n\n protected async fetchGraphQL<T>(\n query: string,\n variables: any,\n extractData: (responseData: any) => T\n ): Promise<{ data: T | null; error: boolean; errorMessage: string | null }> {\n try {\n const response = await this.client.post(\"/api/graphql\", {\n query,\n variables,\n });\n if (response.data.errors) {\n const errorMessage = `GraphQL Error: ${response.data.errors[0].message}`;\n return { data: null, error: true, errorMessage };\n }\n const data = extractData(response.data.data);\n return { data, error: false, errorMessage: null };\n } catch (error) {\n const errorMessage = this.handleApiError(error, \"GraphQL query\");\n return { data: null, error: true, errorMessage };\n }\n }\n}\n","import { Redis } from \"@upstash/redis\";\n\nexport class CacheService {\n private redis?: Redis;\n private apiKeyHash: string;\n private defaultTTL: number = 172800; // 48 hours\n\n constructor(apiKey: string) {\n this.apiKeyHash = apiKey.substring(0, 8);\n\n if (\n process.env.UPSTASH_REDIS_REST_URL &&\n process.env.UPSTASH_REDIS_REST_TOKEN\n ) {\n this.redis = new Redis({\n url: process.env.UPSTASH_REDIS_REST_URL,\n token: process.env.UPSTASH_REDIS_REST_TOKEN,\n });\n }\n }\n\n private generateParamsHash(params: Record<string, unknown>): string {\n const paramsString = JSON.stringify(params);\n return btoa(paramsString);\n }\n\n public buildCacheKey(\n functionName: string,\n params: Record<string, unknown> = {}\n ): string {\n const paramsHash = this.generateParamsHash({ ...params, functionName });\n return `pakento:${this.apiKeyHash}:${paramsHash}`;\n }\n\n public async cacheWrap<T>(\n key: string,\n fetcher: () => Promise<T>,\n functionName: string,\n filters?: Record<string, unknown>\n ): Promise<T> {\n if (!this.redis) {\n return fetcher();\n }\n\n let cached: string | null = null;\n try {\n cached = await this.redis.get(key);\n\n if (typeof cached === \"object\" && cached !== null) {\n console.log(\"[Cache] ✅ Reading from cache:\", key);\n return cached as T;\n }\n\n if (cached) {\n console.log(\"[Cache] ✅ Reading from cache:\", key);\n return JSON.parse(cached as string) as T;\n }\n } catch (err) {\n console.warn(\"[Cache] ❌ Error reading from cache:\", err);\n console.log(`[Cache] ❌ Key: ${key}, type: ${typeof cached}`);\n }\n\n const result = await fetcher();\n\n try {\n // Crear objeto de caché con datos y filtros para visualización\n const cacheData = {\n _function: functionName,\n _filters: filters || {},\n _cachedAt: new Date().toISOString(),\n ...result,\n };\n\n console.log(\"[Cache] ✅ Writing to cache:\", key);\n await this.redis.set(key, JSON.stringify(cacheData), {\n ex: this.defaultTTL,\n });\n } catch (err) {\n console.warn(\"[Cache] ❌ Error writing to cache:\", err);\n }\n\n return result;\n }\n\n public async clearAllCache(): Promise<boolean> {\n if (!this.redis) {\n console.warn(\"[Cache] ❌ Redis no configurado\");\n return false;\n }\n\n try {\n const pattern = `pakento:${this.apiKeyHash}:*`;\n const keys = await this.redis.keys(pattern);\n\n if (keys.length > 0) {\n await this.redis.del(...keys);\n console.log(\"[Cache] ✅ Cache limpiado\");\n }\n\n return true;\n } catch (err) {\n console.warn(\"[Cache] ❌ Error limpiando todo el cache\", err);\n return false;\n }\n }\n}\n","import { Item, ItemEcommerceRaw } from \"./types\";\n\n/**\n * Parses a raw GraphQL response item to the normalized Item type\n * @param rawItem - The raw item from GraphQL response\n * @returns Normalized Item object\n */\nexport function parseRawItemToItem(rawItem: ItemEcommerceRaw): Item {\n const images = rawItem.images.map((img) => ({\n url: img.url,\n thumbnail_url: img.thumbnail_url,\n }));\n\n const variations = rawItem.variations.map((v) => ({\n id: v.id,\n name: v.name,\n description: v.description,\n cover_image_url: v.cover_image_url,\n cover_image_thumbnail_url: v.cover_image_thumbnail_url,\n price: v.price,\n old_price: v.old_price,\n price_notes: v.price_notes,\n price_text: v.price_text,\n currency_prefix: v.currency_prefix,\n attribute_values: v.attribute_values,\n images: v.images.map((img) => ({\n url: img.url,\n thumbnail_url: img.thumbnail_url,\n })),\n }));\n\n return {\n id: rawItem.id,\n name: rawItem.name,\n featured: rawItem.featured,\n url_safe_name: rawItem.url_safe_name,\n currency_prefix: rawItem.currency_prefix,\n description: rawItem.description,\n old_price: rawItem.old_price,\n item_category_name: rawItem.item_category_name,\n item_category_id: parseInt(rawItem.item_category_id || \"0\", 10),\n item_super_category_name: rawItem.item_super_category_name,\n item_super_category_id: parseInt(rawItem.item_super_category_id || \"0\", 10),\n price_text: rawItem.price_text,\n price_notes: rawItem.price_notes,\n price: rawItem.price,\n brand_id: parseInt(rawItem.brand_id || \"0\", 10),\n brand_name: rawItem.brand_name,\n cover_image_url: rawItem.cover_image_url,\n cover_image_thumbnail_url: rawItem.cover_image_thumbnail_url,\n images,\n master_attributes: rawItem.master_attributes,\n variations,\n };\n}\n\n/**\n * Parses an array of raw GraphQL response items to normalized Item types\n * @param rawItems - Array of raw items from GraphQL response\n * @returns Array of normalized Item objects\n */\nexport function parseRawItemsToItems(rawItems: ItemEcommerceRaw[]): Item[] {\n return rawItems.map(parseRawItemToItem);\n}\n","import { z } from \"zod\";\n\nexport const itemsParamsSchema = z.object({\n where: z\n .object({\n item_category_id: z.object({ equals: z.string().optional() }).optional(),\n item_super_category_id: z\n .object({ equals: z.string().optional() })\n .optional(),\n brand_id: z.object({ equals: z.string().optional() }).optional(),\n id: z.object({ equals: z.string().optional() }).optional(),\n })\n .optional(),\n onlyOffers: z.boolean().optional(),\n limit: z.coerce.number().optional(),\n page: z.coerce.number().optional(),\n search: z.string().optional(),\n sort: z.string().optional(),\n minPrice: z.coerce.number().optional(),\n maxPrice: z.coerce.number().optional(),\n});\n","import { ApiClient } from \"../core/apiClient\";\nimport { itemsParamsSchema } from \"./validators\";\nimport { parseRawItemsToItems } from \"./parsers\";\nimport { GetItemsParams, ItemsRawResponse, ItemsWhere, Item } from \"./types\";\nimport { ApiResponse } from \"../core/types\";\n\nclass ItemsApi extends ApiClient {\n async getItems(params: GetItemsParams = {}): Promise<ApiResponse<Item[]>> {\n const validatedParams = itemsParamsSchema.safeParse(params);\n if (!validatedParams.success) {\n const errorMessage = this.handleApiError(\n validatedParams.error,\n \"getItems validation\"\n );\n return {\n data: [],\n totalDocs: 0,\n totalPages: 0,\n prevPage: null,\n nextPage: null,\n error: true,\n errorMessage,\n };\n }\n\n const cacheKey = this.cache.buildCacheKey(\"getItems\", validatedParams.data);\n return this.cache.cacheWrap(\n cacheKey,\n () => this.fetchItemsFromAPI(validatedParams.data),\n \"getItems\",\n validatedParams.data\n );\n }\n\n private async fetchItemsFromAPI(\n params: GetItemsParams\n ): Promise<ApiResponse<Item[]>> {\n if (!this.baseURL || !this.apiKey) {\n return {\n data: [],\n totalDocs: 0,\n totalPages: 0,\n prevPage: null,\n nextPage: null,\n error: true,\n errorMessage:\n \"SDK no configurado: PAKENTO_CMS_BASE_URL o PAKENTO_API_KEY faltantes.\",\n };\n }\n\n const query = `\n query GetEcommerceItems(\n $where: EcommerceItemsWhere\n $onlyOffers: Boolean\n $limit: Int\n $page: Int\n $search: String\n $sort: String\n $minPrice: Float\n $maxPrice: Float\n ) {\n GetEcommerceItems(\n where: $where\n onlyOffers: $onlyOffers\n limit: $limit\n page: $page\n search: $search\n sort: $sort\n minPrice: $minPrice\n maxPrice: $maxPrice\n ) {\n totalDocs\n totalPages\n prevPage\n nextPage\n docs {\n id\n name\n featured\n description\n url_safe_name\n\n item_super_category_id\n item_super_category_name\n\n item_category_id\n item_category_name\n\n cover_image_url\n cover_image_thumbnail_url\n\n price\n old_price\n price_notes\n price_text\n currency_prefix\n\n brand_id\n brand_name\n\n master_attributes {\n id\n name\n values {\n id\n value\n }\n }\n\n variations {\n id\n name\n description\n\n cover_image_url\n cover_image_thumbnail_url\n\n price\n old_price\n price_notes\n price_text\n currency_prefix\n\n attribute_values {\n attribute_id\n attribute_name\n value\n value_id\n }\n\n images {\n url\n thumbnail_url\n }\n }\n\n images {\n url\n thumbnail_url\n }\n }\n }\n }\n `;\n\n const whereConditions: ItemsWhere = {};\n if (params.where?.item_category_id?.equals) {\n whereConditions.item_category_id = {\n equals: params.where.item_category_id.equals,\n };\n }\n if (params.where?.item_super_category_id?.equals) {\n whereConditions.item_super_category_id = {\n equals: params.where.item_super_category_id.equals,\n };\n }\n if (params.where?.brand_id?.equals) {\n whereConditions.brand_id = { equals: params.where.brand_id.equals };\n }\n if (params.where?.id?.equals) {\n whereConditions.id = { equals: params.where.id.equals };\n }\n\n const variables = {\n ...params,\n where:\n Object.keys(whereConditions).length > 0 ? whereConditions : undefined,\n };\n\n const { data, error, errorMessage } =\n await this.fetchGraphQL<ItemsRawResponse>(\n query,\n variables,\n (responseData) => responseData.GetEcommerceItems\n );\n\n if (error) {\n return {\n data: [],\n totalDocs: 0,\n totalPages: 0,\n prevPage: null,\n nextPage: null,\n error: true,\n errorMessage,\n };\n }\n\n return {\n data: parseRawItemsToItems(data!.docs),\n totalDocs: data!.totalDocs,\n totalPages: data!.totalPages,\n prevPage: data!.prevPage,\n nextPage: data!.nextPage,\n error: false,\n errorMessage: null,\n };\n }\n}\n\nexport const itemsApi = new ItemsApi();\n","import { z } from \"zod\";\n\nexport const categoriesParamsSchema = z.object({\n where: z\n .object({\n item_super_category_id: z\n .object({ equals: z.string().optional() })\n .optional(),\n brand_id: z.object({ equals: z.string().optional() }).optional(),\n })\n .optional(),\n limit: z.coerce.number().optional(),\n page: z.coerce.number().optional(),\n sort: z.string().optional(),\n});\n","import { Category, CategoryEcommerceRaw } from \"./types\";\n\n/**\n * Parses a raw GraphQL response category to the normalized Category type\n * @param rawCategory - The raw category from GraphQL response\n * @returns Normalized Category object\n */\nexport function parseRawCategoryToCategory(\n rawCategory: CategoryEcommerceRaw\n): Category {\n return {\n id: rawCategory.id,\n name: rawCategory.name,\n image_url: rawCategory.image_url,\n };\n}\n\n/**\n * Parses an array of raw GraphQL response categories to normalized Category types\n * @param rawCategories - Array of raw categories from GraphQL response\n * @returns Array of normalized Category objects\n */\nexport function parseRawCategoriesToCategories(\n rawCategories: CategoryEcommerceRaw[]\n): Category[] {\n return rawCategories.map(parseRawCategoryToCategory);\n}\n","import { ApiClient } from \"../core/apiClient\";\nimport { categoriesParamsSchema } from \"./validators\";\nimport { parseRawCategoriesToCategories } from \"./parsers\";\nimport { GetCategoriesParams, CategoriesRawResponse, Category } from \"./types\";\nimport { ApiResponse } from \"../core/types\";\n\nclass CategoriesApi extends ApiClient {\n async getCategories(\n params: GetCategoriesParams = {}\n ): Promise<ApiResponse<Category[]>> {\n const validatedParams = categoriesParamsSchema.safeParse(params);\n if (!validatedParams.success) {\n const errorMessage = this.handleApiError(\n validatedParams.error,\n \"getCategories validation\"\n );\n return { data: [], error: true, errorMessage };\n }\n\n const cacheKey = this.cache.buildCacheKey(\n \"getCategories\",\n validatedParams.data\n );\n return this.cache.cacheWrap(\n cacheKey,\n () => this.fetchCategoriesFromAPI(validatedParams.data),\n \"getCategories\",\n validatedParams.data\n );\n }\n\n private async fetchCategoriesFromAPI(\n params: GetCategoriesParams\n ): Promise<ApiResponse<Category[]>> {\n if (!this.baseURL || !this.apiKey) {\n return {\n data: [],\n error: true,\n errorMessage:\n \"SDK no configurado: PAKENTO_CMS_BASE_URL o PAKENTO_API_KEY faltantes.\",\n };\n }\n\n const query = `\n query GetEcommerceCategories(\n $where: EcommerceCategoriesWhere\n $limit: Int\n $page: Int\n $sort: String\n ) {\n GetEcommerceCategories(\n where: $where\n limit: $limit\n page: $page\n sort: $sort\n ) {\n docs {\n id\n name\n image_url\n }\n }\n }\n `;\n\n const { data, error, errorMessage } =\n await this.fetchGraphQL<CategoriesRawResponse>(\n query,\n params,\n (responseData) => responseData.GetEcommerceCategories\n );\n\n if (error) {\n return { data: [], error: true, errorMessage };\n }\n\n return {\n data: parseRawCategoriesToCategories(data!.docs),\n error: false,\n errorMessage: null,\n };\n }\n}\n\nexport const categoriesApi = new CategoriesApi();\n","import { z } from \"zod\";\n\nexport const brandsParamsSchema = z.object({\n limit: z.coerce.number().optional(),\n page: z.coerce.number().optional(),\n sort: z.string().optional(),\n});\n","import { Brand, BrandEcommerceRaw } from \"./types\";\n\n/**\n * Parses a raw GraphQL response brand to the normalized Brand type\n * @param rawBrand - The raw brand from GraphQL response\n * @returns Normalized Brand object\n */\nexport function parseRawBrandToBrand(rawBrand: BrandEcommerceRaw): Brand {\n return {\n id: rawBrand.id,\n name: rawBrand.name,\n description: rawBrand.description,\n items_count: rawBrand.items_count,\n image_url: rawBrand.image_url,\n image_thumbnail_url: rawBrand.image_thumbnail_url,\n };\n}\n\n/**\n * Parses an array of raw GraphQL response brands to normalized Brand types\n * @param rawBrands - Array of raw brands from GraphQL response\n * @returns Array of normalized Brand objects\n */\nexport function parseRawBrandsToBrands(\n rawBrands: BrandEcommerceRaw[]\n): Brand[] {\n return rawBrands.map(parseRawBrandToBrand);\n}\n","import { ApiClient } from \"../core/apiClient\";\nimport { brandsParamsSchema } from \"./validators\";\nimport { parseRawBrandsToBrands } from \"./parsers\";\nimport { GetBrandsParams, BrandsRawResponse, Brand } from \"./types\";\nimport { ApiResponse } from \"../core/types\";\n\nclass BrandsApi extends ApiClient {\n async getBrands(params: GetBrandsParams = {}): Promise<ApiResponse<Brand[]>> {\n const validatedParams = brandsParamsSchema.safeParse(params);\n if (!validatedParams.success) {\n const errorMessage = this.handleApiError(\n validatedParams.error,\n \"getBrands validation\"\n );\n return {\n data: [],\n totalDocs: 0,\n totalPages: 0,\n prevPage: null,\n nextPage: null,\n error: true,\n errorMessage,\n };\n }\n\n const cacheKey = this.cache.buildCacheKey(\n \"getBrands\",\n validatedParams.data\n );\n return this.cache.cacheWrap(\n cacheKey,\n () => this.fetchBrandsFromAPI(validatedParams.data),\n \"getBrands\",\n validatedParams.data\n );\n }\n\n private async fetchBrandsFromAPI(\n params: GetBrandsParams\n ): Promise<ApiResponse<Brand[]>> {\n if (!this.baseURL || !this.apiKey) {\n return {\n data: [],\n totalDocs: 0,\n totalPages: 0,\n prevPage: null,\n nextPage: null,\n error: true,\n errorMessage:\n \"SDK no configurado: PAKENTO_CMS_BASE_URL o PAKENTO_API_KEY faltantes.\",\n };\n }\n\n const query = `\n query GetEcommerceBrands(\n $limit: Int\n $page: Int\n $sort: String\n ) {\n GetEcommerceBrands(\n limit: $limit\n page: $page\n sort: $sort\n ) {\n totalDocs\n totalPages\n prevPage\n nextPage\n docs {\n id\n name\n description\n items_count\n image_url\n image_thumbnail_url\n }\n }\n }\n `;\n\n const { data, error, errorMessage } =\n await this.fetchGraphQL<BrandsRawResponse>(\n query,\n params,\n (responseData) => responseData.GetEcommerceBrands\n );\n\n if (error) {\n return {\n data: [],\n totalDocs: 0,\n totalPages: 0,\n prevPage: null,\n nextPage: null,\n error: true,\n errorMessage,\n };\n }\n\n return {\n data: parseRawBrandsToBrands(data!.docs),\n totalDocs: data!.totalDocs,\n totalPages: data!.totalPages,\n prevPage: data!.prevPage,\n nextPage: data!.nextPage,\n error: false,\n errorMessage: null,\n };\n }\n}\n\nexport const brandsApi = new BrandsApi();\n","import { Entity, EntityEcommerceRaw } from \"./types\";\n\n/**\n * Parses a raw GraphQL response entity to the normalized Entity type\n * @param rawEntity - The raw entity from GraphQL response\n * @returns Normalized Entity object\n */\nexport function parseRawEntityToEntity(rawEntity: EntityEcommerceRaw): Entity {\n return {\n id: rawEntity.id,\n tin: rawEntity.tin,\n name: rawEntity.name,\n web: rawEntity.web,\n address: rawEntity.address,\n country: rawEntity.country,\n city: rawEntity.city,\n currency_id: rawEntity.currency_id,\n currency_name: rawEntity.currency_name,\n currency_prefix: rawEntity.currency_prefix,\n currency_suffix: rawEntity.currency_suffix,\n logo_url: rawEntity.logo_url,\n logo_alt: rawEntity.logo_alt,\n logo_thumbnail_url: rawEntity.logo_thumbnail_url,\n logo_sizes_thumbnail_filename: rawEntity.logo_sizes_thumbnail_filename,\n logo_filename: rawEntity.logo_filename,\n logo_width: rawEntity.logo_width,\n logo_height: rawEntity.logo_height,\n logo_2_url: rawEntity.logo_2_url,\n logo_2_alt: rawEntity.logo_2_alt,\n logo_2_thumbnail_url: rawEntity.logo_2_thumbnail_url,\n logo_2_sizes_thumbnail_filename: rawEntity.logo_2_sizes_thumbnail_filename,\n logo_2_filename: rawEntity.logo_2_filename,\n logo_2_width: rawEntity.logo_2_width,\n logo_2_height: rawEntity.logo_2_height,\n featured_image_url: rawEntity.featured_image_url,\n featured_image_thumbnail_url: rawEntity.featured_image_thumbnail_url,\n featured_image_sizes_thumbnail_filename:\n rawEntity.featured_image_sizes_thumbnail_filename,\n featured_image_filename: rawEntity.featured_image_filename,\n featured_image_width: rawEntity.featured_image_width,\n featured_image_height: rawEntity.featured_image_height,\n };\n}\n","import { ApiClient } from \"../core/apiClient\";\nimport { parseRawEntityToEntity } from \"./parsers\";\nimport { GetEntityParams, EntityRawResponse, Entity } from \"./types\";\nimport { ApiResponse } from \"../core/types\";\n\nclass EntityApi extends ApiClient {\n async getEntity(params: GetEntityParams = {}): Promise<ApiResponse<Entity>> {\n const cacheKey = this.cache.buildCacheKey(\"getEntity\", params);\n return this.cache.cacheWrap(\n cacheKey,\n () => this.fetchEntityFromAPI(params),\n \"getEntity\",\n params\n );\n }\n\n private async fetchEntityFromAPI(\n params: GetEntityParams\n ): Promise<ApiResponse<Entity>> {\n if (!this.baseURL || !this.apiKey) {\n return {\n data: null,\n error: true,\n errorMessage:\n \"SDK no configurado: PAKENTO_CMS_BASE_URL o PAKENTO_API_KEY faltantes.\",\n };\n }\n\n const query = `\n query GetEntity {\n GetEntity {\n id\n tin\n name\n web\n address\n country\n city\n currency_id\n currency_name\n currency_prefix\n currency_suffix\n logo_url\n logo_alt\n logo_thumbnail_url\n logo_sizes_thumbnail_filename\n logo_filename\n logo_width\n logo_height\n logo_2_url\n logo_2_alt\n logo_2_thumbnail_url\n logo_2_sizes_thumbnail_filename\n logo_2_filename\n logo_2_width\n logo_2_height\n featured_image_url\n featured_image_thumbnail_url\n featured_image_sizes_thumbnail_filename\n featured_image_filename\n featured_image_width\n featured_image_height\n }\n }\n `;\n\n const { data, error, errorMessage } =\n await this.fetchGraphQL<EntityRawResponse>(\n query,\n params,\n (responseData) => responseData\n );\n\n if (error) {\n return { data: null, error: true, errorMessage };\n }\n\n return {\n data: parseRawEntityToEntity(data!.GetEntity),\n error: false,\n errorMessage: null,\n };\n }\n}\n\nexport const entityApi = new EntityApi();\n","import { z } from \"zod\";\n\nexport const orderSchema = z.object({\n name: z.string().min(1),\n email: z.string().email(),\n phone: z.string().optional(),\n notes: z.string().optional(),\n tin: z.string().optional(),\n items: z\n .array(\n z.object({ id: z.number().positive(), quantity: z.number().positive() })\n )\n .min(1),\n delivery_address: z.string().optional(),\n delivery_instructions: z.string().optional(),\n payment_method: z.enum([\"cash\", \"transfer\"]).optional(),\n});\n","import { ApiClient } from \"../core/apiClient\";\nimport { orderSchema } from \"./validators\";\nimport {\n CreateEcommerceOrderParams,\n CreateEcommerceOrderResponse,\n} from \"./types\";\n\nclass OrdersApi extends ApiClient {\n async createEcommerceOrder(\n params: CreateEcommerceOrderParams\n ): Promise<CreateEcommerceOrderResponse> {\n if (!this.baseURL || !this.apiKey) {\n return {\n message: \"SDK no configurado\",\n error: true,\n errorMessage: \"SDK no configurado\",\n };\n }\n\n const validated = orderSchema.safeParse(params);\n if (!validated.success) {\n const errorMessage = this.handleApiError(\n validated.error,\n \"createEcommerceOrder validation\"\n );\n return { message: errorMessage, error: true, errorMessage };\n }\n\n try {\n const response = await this.client.post(\n \"/api/orders/create-ecommerce-order\",\n validated.data\n );\n\n if (response.status === 200) {\n return {\n message: response.data.message || \"Orden creada exitosamente\",\n order_id: response.data.order_id,\n error: false,\n errorMessage: null,\n };\n } else {\n const errorMessage = response.data.message || \"Error al crear la orden\";\n return { message: errorMessage, error: true, errorMessage };\n }\n } catch (error) {\n const errorMessage = this.handleApiError(error, \"createEcommerceOrder\");\n return { message: errorMessage, error: true, errorMessage };\n }\n }\n}\n\nexport const ordersApi = new OrdersApi();\n","import { z } from \"zod\";\n\nexport const contactUsSchema = z.object({\n name: z.string().min(1),\n email: z.string().email(),\n phone: z.string().optional(),\n subject: z.string().optional(),\n notes: z.string().min(1),\n});\n","import { ApiClient } from \"../core/apiClient\";\nimport { contactUsSchema } from \"./validators\";\nimport { SendContactUsEmailParams, SendContactUsEmailResponse } from \"./types\";\n\nclass ContactApi extends ApiClient {\n async sendContactUsEmail(\n params: SendContactUsEmailParams\n ): Promise<SendContactUsEmailResponse> {\n if (!this.baseURL || !this.apiKey) {\n return {\n message: \"SDK no configurado\",\n error: true,\n errorMessage: \"SDK no configurado\",\n };\n }\n\n const validated = contactUsSchema.safeParse(params);\n if (!validated.success) {\n const errorMessage = this.handleApiError(\n validated.error,\n \"sendContactUsEmail validation\"\n );\n return { message: errorMessage, error: true, errorMessage };\n }\n\n try {\n const response = await this.client.post(\n \"/api/entities/send-contact-us-email\",\n validated.data\n );\n\n if (response.status === 200) {\n return {\n message: response.data.message || \"Mensaje enviado exitosamente\",\n error: false,\n errorMessage: null,\n };\n } else {\n const errorMessage =\n response.data.message || \"Error al enviar el mensaje\";\n return { message: errorMessage, error: true, errorMessage };\n }\n } catch (error) {\n const errorMessage = this.handleApiError(error, \"sendContactUsEmail\");\n return { message: errorMessage, error: true, errorMessage };\n }\n }\n}\n\nexport const contactApi = new ContactApi();\n","import { ApiClient } from \"../core/apiClient\";\nimport { CustomGraphQLParams, CustomGraphQLResponse } from \"./types\";\n\nclass CustomApi extends ApiClient {\n async executeCustomQuery<T>(\n params: CustomGraphQLParams\n ): Promise<CustomGraphQLResponse<T>> {\n if (!this.baseURL || !this.apiKey) {\n return {\n data: null as T,\n error: true,\n errorMessage:\n \"SDK no configurado: PAKENTO_CMS_BASE_URL o PAKENTO_API_KEY faltantes.\",\n };\n }\n\n if (\n !params.query ||\n typeof params.query !== \"string\" ||\n params.query.trim() === \"\"\n ) {\n return {\n data: null as T,\n error: true,\n errorMessage: \"Se requiere un query GraphQL válido.\",\n };\n }\n\n try {\n const response = await this.client.post(\"/api/graphql\", {\n query: params.query,\n variables: params.variables || {},\n });\n\n if (response.data.errors && response.data.errors.length > 0) {\n return {\n data: response.data.data || (null as T),\n errors: response.data.errors,\n error: true,\n errorMessage: `GraphQL Errors: ${response.data.errors\n .map((err: { message: string }) => err.message)\n .join(\", \")}`,\n };\n }\n\n return {\n data: response.data.data,\n error: false,\n errorMessage: null,\n };\n } catch (error) {\n const errorMessage = this.handleApiError(error, \"Custom GraphQL\");\n return { data: null as T, error: true, errorMessage };\n }\n }\n}\n\nexport const customApi = new CustomApi();\n"],"mappings":";AAAA,OAAO,SAAwB,kBAAkB;AACjD,SAAS,SAAS;;;ACDlB,SAAS,aAAa;AAEf,IAAM,eAAN,MAAmB;AAAA;AAAA,EAKxB,YAAY,QAAgB;AAF5B,SAAQ,aAAqB;AAG3B,SAAK,aAAa,OAAO,UAAU,GAAG,CAAC;AAEvC,QACE,QAAQ,IAAI,0BACZ,QAAQ,IAAI,0BACZ;AACA,WAAK,QAAQ,IAAI,MAAM;AAAA,QACrB,KAAK,QAAQ,IAAI;AAAA,QACjB,OAAO,QAAQ,IAAI;AAAA,MACrB,CAAC;AAAA,IACH;AAAA,EACF;AAAA,EAEQ,mBAAmB,QAAyC;AAClE,UAAM,eAAe,KAAK,UAAU,MAAM;AAC1C,WAAO,KAAK,YAAY;AAAA,EAC1B;AAAA,EAEO,cACL,cACA,SAAkC,CAAC,GAC3B;AACR,UAAM,aAAa,KAAK,mBAAmB,EAAE,GAAG,QAAQ,aAAa,CAAC;AACtE,WAAO,WAAW,KAAK,UAAU,IAAI,UAAU;AAAA,EACjD;AAAA,EAEA,MAAa,UACX,KACA,SACA,cACA,SACY;AACZ,QAAI,CAAC,KAAK,OAAO;AACf,aAAO,QAAQ;AAAA,IACjB;AAEA,QAAI,SAAwB;AAC5B,QAAI;AACF,eAAS,MAAM,KAAK,MAAM,IAAI,GAAG;AAEjC,UAAI,OAAO,WAAW,YAAY,WAAW,MAAM;AACjD,gBAAQ,IAAI,sCAAiC,GAAG;AAChD,eAAO;AAAA,MACT;AAEA,UAAI,QAAQ;AACV,gBAAQ,IAAI,sCAAiC,GAAG;AAChD,eAAO,KAAK,MAAM,MAAgB;AAAA,MACpC;AAAA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M,WAAW,MAAM,KAAK,OAAO,KAAK,gBAAgB;AAAA,QACtD,OAAO,OAAO;AAAA,QACd,WAAW,OAAO,aAAa,CAAC;AAAA,MAClC,CAAC;AAED,UAAI,SAAS,KAAK,UAAU,SAAS,KAAK,OAAO,SAAS,GAAG;AAC3D,eAAO;AAAA,UACL,MAAM,SAAS,KAAK,QAAS;AAAA,UAC7B,QAAQ,SAAS,KAAK;AAAA,UACtB,OAAO;AAAA,UACP,cAAc,mBAAmB,SAAS,KAAK,OAC5C,IAAI,CAAC,QAA6B,IAAI,OAAO,EAC7C,KAAK,IAAI,CAAC;AAAA,QACf;AAAA,MACF;AAEA,aAAO;AAAA,QACL,MAAM,SAAS,KAAK;AAAA,QACpB,OAAO;AAAA,QACP,cAAc;AAAA,MAChB;AAAA,IACF,SAAS,OAAO;AACd,YAAM,eAAe,KAAK,eAAe,OAAO,gBAAgB;AAChE,aAAO,EAAE,MAAM,MAAW,OAAO,MAAM,aAAa;AAAA,IACtD;AAAA,EACF;AACF;AAEO,IAAM,YAAY,IAAI,UAAU;","names":["z","z","z","z","z"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pakento/cms-sdk",
3
- "version": "4.3.11",
3
+ "version": "4.3.13",
4
4
  "description": "SDK para conectar tiendas en línea con Pakento CMS",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",