@pakento/cms-sdk 4.3.2 → 4.3.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.mts CHANGED
@@ -25,7 +25,7 @@ declare class ApiClient {
25
25
  }
26
26
 
27
27
  interface ApiResponse<T> {
28
- data: T[] | null;
28
+ data: T | null;
29
29
  totalDocs?: number;
30
30
  totalPages?: number;
31
31
  prevPage?: number | null;
@@ -116,7 +116,7 @@ interface ItemsRawResponse {
116
116
  }
117
117
 
118
118
  declare class ItemsApi extends ApiClient {
119
- getItems(params?: GetItemsParams): Promise<ApiResponse<Item>>;
119
+ getItems(params?: GetItemsParams): Promise<ApiResponse<Item[]>>;
120
120
  private fetchItemsFromAPI;
121
121
  }
122
122
  declare const itemsApi: ItemsApi;
@@ -126,6 +126,11 @@ interface Category {
126
126
  name: string;
127
127
  image_url: string;
128
128
  }
129
+ interface CategoryEcommerceRaw {
130
+ id: number;
131
+ name: string;
132
+ image_url: string;
133
+ }
129
134
  interface CategoriesWhere {
130
135
  item_super_category_id?: WhereClause;
131
136
  brand_id?: WhereClause;
@@ -135,19 +140,14 @@ interface GetCategoriesParams {
135
140
  limit?: number;
136
141
  page?: number;
137
142
  sort?: string;
143
+ [key: string]: unknown;
138
144
  }
139
145
  interface CategoriesRawResponse {
140
- docs: Category[];
141
- }
142
- interface CategoriesApiResponse {
143
- data: Category[] | null;
144
- categories: Category[];
145
- error: boolean;
146
- errorMessage: string | null;
146
+ docs: CategoryEcommerceRaw[];
147
147
  }
148
148
 
149
149
  declare class CategoriesApi extends ApiClient {
150
- getCategories(params?: GetCategoriesParams): Promise<CategoriesApiResponse>;
150
+ getCategories(params?: GetCategoriesParams): Promise<ApiResponse<Category[]>>;
151
151
  private fetchCategoriesFromAPI;
152
152
  }
153
153
  declare const categoriesApi: CategoriesApi;
@@ -161,13 +161,23 @@ interface Brand {
161
161
  image_thumbnail_url: string;
162
162
  image_alt: string;
163
163
  }
164
+ interface BrandEcommerceRaw {
165
+ id: string;
166
+ name: string;
167
+ description: string;
168
+ items_count: number;
169
+ image_url: string;
170
+ image_thumbnail_url: string;
171
+ image_alt: string;
172
+ }
164
173
  interface GetBrandsParams {
165
174
  limit?: number;
166
175
  page?: number;
167
176
  sort?: string;
177
+ [key: string]: unknown;
168
178
  }
169
179
  interface BrandsRawResponse {
170
- docs: Brand[];
180
+ docs: BrandEcommerceRaw[];
171
181
  hasNextPage: boolean;
172
182
  hasPrevPage: boolean;
173
183
  limit: number;
@@ -179,25 +189,9 @@ interface BrandsRawResponse {
179
189
  totalDocs: number;
180
190
  totalPages: number;
181
191
  }
182
- interface BrandsApiResponse {
183
- data: BrandsRawResponse | null;
184
- brands: Brand[];
185
- hasNextPage: boolean;
186
- hasPrevPage: boolean;
187
- limit: number;
188
- nextPage: number;
189
- offset: number;
190
- page: number;
191
- pagingCounter: number;
192
- prevPage: number;
193
- totalDocs: number;
194
- totalPages: number;
195
- error: boolean;
196
- errorMessage: string | null;
197
- }
198
192
 
199
193
  declare class BrandsApi extends ApiClient {
200
- getBrands(params?: GetBrandsParams): Promise<BrandsApiResponse>;
194
+ getBrands(params?: GetBrandsParams): Promise<ApiResponse<Brand[]>>;
201
195
  private fetchBrandsFromAPI;
202
196
  }
203
197
  declare const brandsApi: BrandsApi;
@@ -236,21 +230,49 @@ interface Entity {
236
230
  featured_image_width: string;
237
231
  featured_image_height: string;
238
232
  }
233
+ interface EntityEcommerceRaw {
234
+ id: string;
235
+ tin: string;
236
+ name: string;
237
+ web: string;
238
+ address: string;
239
+ country: string;
240
+ city: string;
241
+ currency_id: string;
242
+ currency_name: string;
243
+ currency_prefix: string;
244
+ currency_suffix: string;
245
+ logo_url: string;
246
+ logo_alt: string;
247
+ logo_thumbnail_url: string;
248
+ logo_sizes_thumbnail_filename: string;
249
+ logo_filename: string;
250
+ logo_width: string;
251
+ logo_height: string;
252
+ logo_2_url: string;
253
+ logo_2_alt: string;
254
+ logo_2_thumbnail_url: string;
255
+ logo_2_sizes_thumbnail_filename: string;
256
+ logo_2_filename: string;
257
+ logo_2_width: string;
258
+ logo_2_height: string;
259
+ featured_image_url: string;
260
+ featured_image_alt: string;
261
+ featured_image_thumbnail_url: string;
262
+ featured_image_sizes_thumbnail_filename: string;
263
+ featured_image_filename: string;
264
+ featured_image_width: string;
265
+ featured_image_height: string;
266
+ }
239
267
  interface GetEntityParams {
240
268
  [key: string]: unknown;
241
269
  }
242
270
  interface EntityRawResponse {
243
- GetEntity: Entity;
244
- }
245
- interface EntityApiResponse {
246
- data: Entity | null;
247
- entity: Entity | null;
248
- error: boolean;
249
- errorMessage: string | null;
271
+ GetEntity: EntityEcommerceRaw;
250
272
  }
251
273
 
252
274
  declare class EntityApi extends ApiClient {
253
- getEntity(params?: GetEntityParams): Promise<EntityApiResponse>;
275
+ getEntity(params?: GetEntityParams): Promise<ApiResponse<Entity>>;
254
276
  private fetchEntityFromAPI;
255
277
  }
256
278
  declare const entityApi: EntityApi;
@@ -288,6 +310,7 @@ interface SendContactUsEmailParams {
288
310
  phone?: string;
289
311
  notes?: string;
290
312
  subject?: string;
313
+ [key: string]: unknown;
291
314
  }
292
315
  interface SendContactUsEmailResponse {
293
316
  message: string;
@@ -316,4 +339,4 @@ declare class CustomApi extends ApiClient {
316
339
  }
317
340
  declare const customApi: CustomApi;
318
341
 
319
- export { ApiClient, type ApiResponse, type Brand, type BrandsApiResponse, type BrandsRawResponse, type CategoriesApiResponse, type CategoriesRawResponse, type CategoriesWhere, type Category, type CreateEcommerceOrderItem, type CreateEcommerceOrderParams, type CreateEcommerceOrderResponse, type CustomGraphQLParams, type CustomGraphQLResponse, type Entity, type EntityApiResponse, 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 };
342
+ export { ApiClient, type ApiResponse, type Brand, type BrandEcommerceRaw, type BrandsRawResponse, 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 };
package/dist/index.d.ts CHANGED
@@ -25,7 +25,7 @@ declare class ApiClient {
25
25
  }
26
26
 
27
27
  interface ApiResponse<T> {
28
- data: T[] | null;
28
+ data: T | null;
29
29
  totalDocs?: number;
30
30
  totalPages?: number;
31
31
  prevPage?: number | null;
@@ -116,7 +116,7 @@ interface ItemsRawResponse {
116
116
  }
117
117
 
118
118
  declare class ItemsApi extends ApiClient {
119
- getItems(params?: GetItemsParams): Promise<ApiResponse<Item>>;
119
+ getItems(params?: GetItemsParams): Promise<ApiResponse<Item[]>>;
120
120
  private fetchItemsFromAPI;
121
121
  }
122
122
  declare const itemsApi: ItemsApi;
@@ -126,6 +126,11 @@ interface Category {
126
126
  name: string;
127
127
  image_url: string;
128
128
  }
129
+ interface CategoryEcommerceRaw {
130
+ id: number;
131
+ name: string;
132
+ image_url: string;
133
+ }
129
134
  interface CategoriesWhere {
130
135
  item_super_category_id?: WhereClause;
131
136
  brand_id?: WhereClause;
@@ -135,19 +140,14 @@ interface GetCategoriesParams {
135
140
  limit?: number;
136
141
  page?: number;
137
142
  sort?: string;
143
+ [key: string]: unknown;
138
144
  }
139
145
  interface CategoriesRawResponse {
140
- docs: Category[];
141
- }
142
- interface CategoriesApiResponse {
143
- data: Category[] | null;
144
- categories: Category[];
145
- error: boolean;
146
- errorMessage: string | null;
146
+ docs: CategoryEcommerceRaw[];
147
147
  }
148
148
 
149
149
  declare class CategoriesApi extends ApiClient {
150
- getCategories(params?: GetCategoriesParams): Promise<CategoriesApiResponse>;
150
+ getCategories(params?: GetCategoriesParams): Promise<ApiResponse<Category[]>>;
151
151
  private fetchCategoriesFromAPI;
152
152
  }
153
153
  declare const categoriesApi: CategoriesApi;
@@ -161,13 +161,23 @@ interface Brand {
161
161
  image_thumbnail_url: string;
162
162
  image_alt: string;
163
163
  }
164
+ interface BrandEcommerceRaw {
165
+ id: string;
166
+ name: string;
167
+ description: string;
168
+ items_count: number;
169
+ image_url: string;
170
+ image_thumbnail_url: string;
171
+ image_alt: string;
172
+ }
164
173
  interface GetBrandsParams {
165
174
  limit?: number;
166
175
  page?: number;
167
176
  sort?: string;
177
+ [key: string]: unknown;
168
178
  }
169
179
  interface BrandsRawResponse {
170
- docs: Brand[];
180
+ docs: BrandEcommerceRaw[];
171
181
  hasNextPage: boolean;
172
182
  hasPrevPage: boolean;
173
183
  limit: number;
@@ -179,25 +189,9 @@ interface BrandsRawResponse {
179
189
  totalDocs: number;
180
190
  totalPages: number;
181
191
  }
182
- interface BrandsApiResponse {
183
- data: BrandsRawResponse | null;
184
- brands: Brand[];
185
- hasNextPage: boolean;
186
- hasPrevPage: boolean;
187
- limit: number;
188
- nextPage: number;
189
- offset: number;
190
- page: number;
191
- pagingCounter: number;
192
- prevPage: number;
193
- totalDocs: number;
194
- totalPages: number;
195
- error: boolean;
196
- errorMessage: string | null;
197
- }
198
192
 
199
193
  declare class BrandsApi extends ApiClient {
200
- getBrands(params?: GetBrandsParams): Promise<BrandsApiResponse>;
194
+ getBrands(params?: GetBrandsParams): Promise<ApiResponse<Brand[]>>;
201
195
  private fetchBrandsFromAPI;
202
196
  }
203
197
  declare const brandsApi: BrandsApi;
@@ -236,21 +230,49 @@ interface Entity {
236
230
  featured_image_width: string;
237
231
  featured_image_height: string;
238
232
  }
233
+ interface EntityEcommerceRaw {
234
+ id: string;
235
+ tin: string;
236
+ name: string;
237
+ web: string;
238
+ address: string;
239
+ country: string;
240
+ city: string;
241
+ currency_id: string;
242
+ currency_name: string;
243
+ currency_prefix: string;
244
+ currency_suffix: string;
245
+ logo_url: string;
246
+ logo_alt: string;
247
+ logo_thumbnail_url: string;
248
+ logo_sizes_thumbnail_filename: string;
249
+ logo_filename: string;
250
+ logo_width: string;
251
+ logo_height: string;
252
+ logo_2_url: string;
253
+ logo_2_alt: string;
254
+ logo_2_thumbnail_url: string;
255
+ logo_2_sizes_thumbnail_filename: string;
256
+ logo_2_filename: string;
257
+ logo_2_width: string;
258
+ logo_2_height: string;
259
+ featured_image_url: string;
260
+ featured_image_alt: string;
261
+ featured_image_thumbnail_url: string;
262
+ featured_image_sizes_thumbnail_filename: string;
263
+ featured_image_filename: string;
264
+ featured_image_width: string;
265
+ featured_image_height: string;
266
+ }
239
267
  interface GetEntityParams {
240
268
  [key: string]: unknown;
241
269
  }
242
270
  interface EntityRawResponse {
243
- GetEntity: Entity;
244
- }
245
- interface EntityApiResponse {
246
- data: Entity | null;
247
- entity: Entity | null;
248
- error: boolean;
249
- errorMessage: string | null;
271
+ GetEntity: EntityEcommerceRaw;
250
272
  }
251
273
 
252
274
  declare class EntityApi extends ApiClient {
253
- getEntity(params?: GetEntityParams): Promise<EntityApiResponse>;
275
+ getEntity(params?: GetEntityParams): Promise<ApiResponse<Entity>>;
254
276
  private fetchEntityFromAPI;
255
277
  }
256
278
  declare const entityApi: EntityApi;
@@ -288,6 +310,7 @@ interface SendContactUsEmailParams {
288
310
  phone?: string;
289
311
  notes?: string;
290
312
  subject?: string;
313
+ [key: string]: unknown;
291
314
  }
292
315
  interface SendContactUsEmailResponse {
293
316
  message: string;
@@ -316,4 +339,4 @@ declare class CustomApi extends ApiClient {
316
339
  }
317
340
  declare const customApi: CustomApi;
318
341
 
319
- export { ApiClient, type ApiResponse, type Brand, type BrandsApiResponse, type BrandsRawResponse, type CategoriesApiResponse, type CategoriesRawResponse, type CategoriesWhere, type Category, type CreateEcommerceOrderItem, type CreateEcommerceOrderParams, type CreateEcommerceOrderResponse, type CustomGraphQLParams, type CustomGraphQLResponse, type Entity, type EntityApiResponse, 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 };
342
+ export { ApiClient, type ApiResponse, type Brand, type BrandEcommerceRaw, type BrandsRawResponse, 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 };
package/dist/index.js CHANGED
@@ -218,7 +218,7 @@ var ItemsApi = class extends ApiClient {
218
218
  "getItems validation"
219
219
  );
220
220
  return {
221
- data: null,
221
+ data: [],
222
222
  totalDocs: 0,
223
223
  totalPages: 0,
224
224
  prevPage: null,
@@ -239,7 +239,7 @@ var ItemsApi = class extends ApiClient {
239
239
  async fetchItemsFromAPI(params) {
240
240
  if (!this.baseURL || !this.apiKey) {
241
241
  return {
242
- data: null,
242
+ data: [],
243
243
  totalDocs: 0,
244
244
  totalPages: 0,
245
245
  prevPage: null,
@@ -335,7 +335,7 @@ var ItemsApi = class extends ApiClient {
335
335
  );
336
336
  if (error) {
337
337
  return {
338
- data: null,
338
+ data: [],
339
339
  totalDocs: 0,
340
340
  totalPages: 0,
341
341
  prevPage: null,
@@ -369,6 +369,18 @@ var categoriesParamsSchema = import_zod3.z.object({
369
369
  sort: import_zod3.z.string().optional()
370
370
  });
371
371
 
372
+ // src/api/categories/parsers.ts
373
+ function parseRawCategoryToCategory(rawCategory) {
374
+ return {
375
+ id: rawCategory.id,
376
+ name: rawCategory.name,
377
+ image_url: rawCategory.image_url
378
+ };
379
+ }
380
+ function parseRawCategoriesToCategories(rawCategories) {
381
+ return rawCategories.map(parseRawCategoryToCategory);
382
+ }
383
+
372
384
  // src/api/categories/api.ts
373
385
  var CategoriesApi = class extends ApiClient {
374
386
  async getCategories(params = {}) {
@@ -378,7 +390,7 @@ var CategoriesApi = class extends ApiClient {
378
390
  validatedParams.error,
379
391
  "getCategories validation"
380
392
  );
381
- return { data: null, categories: [], error: true, errorMessage };
393
+ return { data: [], error: true, errorMessage };
382
394
  }
383
395
  const cacheKey = this.cache.buildCacheKey(
384
396
  "GetEcommerceCategories",
@@ -392,8 +404,7 @@ var CategoriesApi = class extends ApiClient {
392
404
  async fetchCategoriesFromAPI(params) {
393
405
  if (!this.baseURL || !this.apiKey) {
394
406
  return {
395
- data: null,
396
- categories: [],
407
+ data: [],
397
408
  error: true,
398
409
  errorMessage: "SDK no configurado: PAKENTO_CMS_BASE_URL o PAKENTO_API_KEY faltantes."
399
410
  };
@@ -425,11 +436,10 @@ var CategoriesApi = class extends ApiClient {
425
436
  (responseData) => responseData.GetEcommerceCategories
426
437
  );
427
438
  if (error) {
428
- return { data: null, categories: [], error: true, errorMessage };
439
+ return { data: [], error: true, errorMessage };
429
440
  }
430
441
  return {
431
- data: data.docs,
432
- categories: data.docs,
442
+ data: parseRawCategoriesToCategories(data.docs),
433
443
  error: false,
434
444
  errorMessage: null
435
445
  };
@@ -445,6 +455,22 @@ var brandsParamsSchema = import_zod4.z.object({
445
455
  sort: import_zod4.z.string().optional()
446
456
  });
447
457
 
458
+ // src/api/brands/parsers.ts
459
+ function parseRawBrandToBrand(rawBrand) {
460
+ return {
461
+ id: rawBrand.id,
462
+ name: rawBrand.name,
463
+ description: rawBrand.description,
464
+ items_count: rawBrand.items_count,
465
+ image_url: rawBrand.image_url,
466
+ image_thumbnail_url: rawBrand.image_thumbnail_url,
467
+ image_alt: rawBrand.image_alt
468
+ };
469
+ }
470
+ function parseRawBrandsToBrands(rawBrands) {
471
+ return rawBrands.map(parseRawBrandToBrand);
472
+ }
473
+
448
474
  // src/api/brands/api.ts
449
475
  var BrandsApi = class extends ApiClient {
450
476
  async getBrands(params = {}) {
@@ -455,18 +481,11 @@ var BrandsApi = class extends ApiClient {
455
481
  "getBrands validation"
456
482
  );
457
483
  return {
458
- data: null,
459
- brands: [],
460
- hasNextPage: false,
461
- hasPrevPage: false,
462
- limit: 0,
463
- nextPage: 0,
464
- offset: 0,
465
- page: 0,
466
- pagingCounter: 0,
467
- prevPage: 0,
484
+ data: [],
468
485
  totalDocs: 0,
469
486
  totalPages: 0,
487
+ prevPage: null,
488
+ nextPage: null,
470
489
  error: true,
471
490
  errorMessage
472
491
  };
@@ -483,18 +502,11 @@ var BrandsApi = class extends ApiClient {
483
502
  async fetchBrandsFromAPI(params) {
484
503
  if (!this.baseURL || !this.apiKey) {
485
504
  return {
486
- data: null,
487
- brands: [],
488
- hasNextPage: false,
489
- hasPrevPage: false,
490
- limit: 0,
491
- nextPage: 0,
492
- offset: 0,
493
- page: 0,
494
- pagingCounter: 0,
495
- prevPage: 0,
505
+ data: [],
496
506
  totalDocs: 0,
497
507
  totalPages: 0,
508
+ prevPage: null,
509
+ nextPage: null,
498
510
  error: true,
499
511
  errorMessage: "SDK no configurado: PAKENTO_CMS_BASE_URL o PAKENTO_API_KEY faltantes."
500
512
  };
@@ -510,6 +522,10 @@ var BrandsApi = class extends ApiClient {
510
522
  page: $page
511
523
  sort: $sort
512
524
  ) {
525
+ totalDocs
526
+ totalPages
527
+ prevPage
528
+ nextPage
513
529
  docs {
514
530
  id
515
531
  name
@@ -519,16 +535,6 @@ var BrandsApi = class extends ApiClient {
519
535
  image_thumbnail_url
520
536
  image_alt
521
537
  }
522
- hasNextPage
523
- hasPrevPage
524
- limit
525
- nextPage
526
- offset
527
- page
528
- pagingCounter
529
- prevPage
530
- totalDocs
531
- totalPages
532
538
  }
533
539
  }
534
540
  `;
@@ -539,35 +545,21 @@ var BrandsApi = class extends ApiClient {
539
545
  );
540
546
  if (error) {
541
547
  return {
542
- data: null,
543
- brands: [],
544
- hasNextPage: false,
545
- hasPrevPage: false,
546
- limit: 0,
547
- nextPage: 0,
548
- offset: 0,
549
- page: 0,
550
- pagingCounter: 0,
551
- prevPage: 0,
548
+ data: [],
552
549
  totalDocs: 0,
553
550
  totalPages: 0,
551
+ prevPage: null,
552
+ nextPage: null,
554
553
  error: true,
555
554
  errorMessage
556
555
  };
557
556
  }
558
557
  return {
559
- data,
560
- brands: data.docs,
561
- hasNextPage: data.hasNextPage,
562
- hasPrevPage: data.hasPrevPage,
563
- limit: data.limit,
564
- nextPage: data.nextPage,
565
- offset: data.offset,
566
- page: data.page,
567
- pagingCounter: data.pagingCounter,
568
- prevPage: data.prevPage,
558
+ data: parseRawBrandsToBrands(data.docs),
569
559
  totalDocs: data.totalDocs,
570
560
  totalPages: data.totalPages,
561
+ prevPage: data.prevPage,
562
+ nextPage: data.nextPage,
571
563
  error: false,
572
564
  errorMessage: null
573
565
  };
@@ -575,6 +567,44 @@ var BrandsApi = class extends ApiClient {
575
567
  };
576
568
  var brandsApi = new BrandsApi();
577
569
 
570
+ // src/api/entity/parsers.ts
571
+ function parseRawEntityToEntity(rawEntity) {
572
+ return {
573
+ id: rawEntity.id,
574
+ tin: rawEntity.tin,
575
+ name: rawEntity.name,
576
+ web: rawEntity.web,
577
+ address: rawEntity.address,
578
+ country: rawEntity.country,
579
+ city: rawEntity.city,
580
+ currency_id: rawEntity.currency_id,
581
+ currency_name: rawEntity.currency_name,
582
+ currency_prefix: rawEntity.currency_prefix,
583
+ currency_suffix: rawEntity.currency_suffix,
584
+ logo_url: rawEntity.logo_url,
585
+ logo_alt: rawEntity.logo_alt,
586
+ logo_thumbnail_url: rawEntity.logo_thumbnail_url,
587
+ logo_sizes_thumbnail_filename: rawEntity.logo_sizes_thumbnail_filename,
588
+ logo_filename: rawEntity.logo_filename,
589
+ logo_width: rawEntity.logo_width,
590
+ logo_height: rawEntity.logo_height,
591
+ logo_2_url: rawEntity.logo_2_url,
592
+ logo_2_alt: rawEntity.logo_2_alt,
593
+ logo_2_thumbnail_url: rawEntity.logo_2_thumbnail_url,
594
+ logo_2_sizes_thumbnail_filename: rawEntity.logo_2_sizes_thumbnail_filename,
595
+ logo_2_filename: rawEntity.logo_2_filename,
596
+ logo_2_width: rawEntity.logo_2_width,
597
+ logo_2_height: rawEntity.logo_2_height,
598
+ featured_image_url: rawEntity.featured_image_url,
599
+ featured_image_alt: rawEntity.featured_image_alt,
600
+ featured_image_thumbnail_url: rawEntity.featured_image_thumbnail_url,
601
+ featured_image_sizes_thumbnail_filename: rawEntity.featured_image_sizes_thumbnail_filename,
602
+ featured_image_filename: rawEntity.featured_image_filename,
603
+ featured_image_width: rawEntity.featured_image_width,
604
+ featured_image_height: rawEntity.featured_image_height
605
+ };
606
+ }
607
+
578
608
  // src/api/entity/api.ts
579
609
  var EntityApi = class extends ApiClient {
580
610
  async getEntity(params = {}) {
@@ -588,7 +618,6 @@ var EntityApi = class extends ApiClient {
588
618
  if (!this.baseURL || !this.apiKey) {
589
619
  return {
590
620
  data: null,
591
- entity: null,
592
621
  error: true,
593
622
  errorMessage: "SDK no configurado: PAKENTO_CMS_BASE_URL o PAKENTO_API_KEY faltantes."
594
623
  };
@@ -637,11 +666,10 @@ var EntityApi = class extends ApiClient {
637
666
  (responseData) => responseData
638
667
  );
639
668
  if (error) {
640
- return { data: null, entity: null, error: true, errorMessage };
669
+ return { data: null, error: true, errorMessage };
641
670
  }
642
671
  return {
643
- data: data.GetEntity,
644
- entity: data.GetEntity,
672
+ data: parseRawEntityToEntity(data.GetEntity),
645
673
  error: false,
646
674
  errorMessage: null
647
675
  };
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/api.ts","../src/api/brands/validators.ts","../src/api/brands/api.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// 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\";\nimport { createHash } from \"crypto\";\n\nexport class CacheService {\n private redis?: Redis;\n private apiKeyHash: string;\n private defaultTTL: number = 86400; // 24 hours\n\n constructor(apiKey: string) {\n this.apiKeyHash = createHash(\"sha256\")\n .update(apiKey)\n .digest(\"hex\")\n .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, Object.keys(params).sort());\n return createHash(\"sha256\")\n .update(paramsString)\n .digest(\"hex\")\n .substring(0, 16);\n }\n\n public buildCacheKey(\n functionName: string,\n params: Record<string, unknown> = {}\n ): string {\n const paramsHash = this.generateParamsHash(params);\n return `pakento:${this.apiKeyHash}:${functionName}:${paramsHash}`;\n }\n\n public async cacheWrap<T>(\n key: string,\n fetcher: () => Promise<T>\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 console.log(\"[Cache] ✅ Writing to cache:\", key);\n await this.redis.set(key, JSON.stringify(result), {\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","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: null,\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 \"GetEcommerceItems\",\n validatedParams.data\n );\n return this.cache.cacheWrap(cacheKey, () =>\n this.fetchItemsFromAPI(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: null,\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: null,\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 { ApiClient } from \"../core/apiClient\";\nimport { categoriesParamsSchema } from \"./validators\";\nimport {\n GetCategoriesParams,\n CategoriesRawResponse,\n CategoriesApiResponse,\n} from \"./types\";\n\nclass CategoriesApi extends ApiClient {\n async getCategories(\n params: GetCategoriesParams = {}\n ): Promise<CategoriesApiResponse> {\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: null, categories: [], error: true, errorMessage };\n }\n\n const cacheKey = this.cache.buildCacheKey(\n \"GetEcommerceCategories\",\n validatedParams.data\n );\n return this.cache.cacheWrap(cacheKey, () =>\n this.fetchCategoriesFromAPI(validatedParams.data)\n );\n }\n\n private async fetchCategoriesFromAPI(\n params: GetCategoriesParams\n ): Promise<CategoriesApiResponse> {\n if (!this.baseURL || !this.apiKey) {\n return {\n data: null,\n categories: [],\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: null, categories: [], error: true, errorMessage };\n }\n\n return {\n data: data!.docs,\n categories: 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 { ApiClient } from \"../core/apiClient\";\nimport { brandsParamsSchema } from \"./validators\";\nimport { GetBrandsParams, BrandsRawResponse, BrandsApiResponse } from \"./types\";\n\nclass BrandsApi extends ApiClient {\n async getBrands(params: GetBrandsParams = {}): Promise<BrandsApiResponse> {\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: null,\n brands: [],\n hasNextPage: false,\n hasPrevPage: false,\n limit: 0,\n nextPage: 0,\n offset: 0,\n page: 0,\n pagingCounter: 0,\n prevPage: 0,\n totalDocs: 0,\n totalPages: 0,\n error: true,\n errorMessage,\n };\n }\n\n const cacheKey = this.cache.buildCacheKey(\n \"GetEcommerceBrands\",\n validatedParams.data\n );\n return this.cache.cacheWrap(cacheKey, () =>\n this.fetchBrandsFromAPI(validatedParams.data)\n );\n }\n\n private async fetchBrandsFromAPI(\n params: GetBrandsParams\n ): Promise<BrandsApiResponse> {\n if (!this.baseURL || !this.apiKey) {\n return {\n data: null,\n brands: [],\n hasNextPage: false,\n hasPrevPage: false,\n limit: 0,\n nextPage: 0,\n offset: 0,\n page: 0,\n pagingCounter: 0,\n prevPage: 0,\n totalDocs: 0,\n totalPages: 0,\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 docs {\n id\n name\n description\n items_count\n image_url\n image_thumbnail_url\n image_alt\n }\n hasNextPage\n hasPrevPage\n limit\n nextPage\n offset\n page\n pagingCounter\n prevPage\n totalDocs\n totalPages\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: null,\n brands: [],\n hasNextPage: false,\n hasPrevPage: false,\n limit: 0,\n nextPage: 0,\n offset: 0,\n page: 0,\n pagingCounter: 0,\n prevPage: 0,\n totalDocs: 0,\n totalPages: 0,\n error: true,\n errorMessage,\n };\n }\n\n return {\n data: data!,\n brands: data!.docs,\n hasNextPage: data!.hasNextPage,\n hasPrevPage: data!.hasPrevPage,\n limit: data!.limit,\n nextPage: data!.nextPage,\n offset: data!.offset,\n page: data!.page,\n pagingCounter: data!.pagingCounter,\n prevPage: data!.prevPage,\n totalDocs: data!.totalDocs,\n totalPages: data!.totalPages,\n error: false,\n errorMessage: null,\n };\n }\n}\n\nexport const brandsApi = new BrandsApi();\n","import { ApiClient } from \"../core/apiClient\";\nimport { GetEntityParams, EntityRawResponse, EntityApiResponse } from \"./types\";\n\nclass EntityApi extends ApiClient {\n async getEntity(params: GetEntityParams = {}): Promise<EntityApiResponse> {\n const cacheKey = this.cache.buildCacheKey(\"GetEntity\", params);\n return this.cache.cacheWrap(cacheKey, () =>\n this.fetchEntityFromAPI(params)\n );\n }\n\n private async fetchEntityFromAPI(\n params: GetEntityParams\n ): Promise<EntityApiResponse> {\n if (!this.baseURL || !this.apiKey) {\n return {\n data: null,\n entity: 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_alt\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, entity: null, error: true, errorMessage };\n }\n\n return {\n data: data!.GetEntity,\n entity: 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;;;ACAA,mBAAiD;AACjD,iBAAkB;;;ACDlB,mBAAsB;AACtB,oBAA2B;AAEpB,IAAM,eAAN,MAAmB;AAAA;AAAA,EAKxB,YAAY,QAAgB;AAF5B,SAAQ,aAAqB;AAG3B,SAAK,iBAAa,0BAAW,QAAQ,EAClC,OAAO,MAAM,EACb,OAAO,KAAK,EACZ,UAAU,GAAG,CAAC;AAEjB,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,QAAQ,OAAO,KAAK,MAAM,EAAE,KAAK,CAAC;AACtE,eAAO,0BAAW,QAAQ,EACvB,OAAO,YAAY,EACnB,OAAO,KAAK,EACZ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AC3D,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// 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\";\nimport { createHash } from \"crypto\";\n\nexport class CacheService {\n private redis?: Redis;\n private apiKeyHash: string;\n private defaultTTL: number = 86400; // 24 hours\n\n constructor(apiKey: string) {\n this.apiKeyHash = createHash(\"sha256\")\n .update(apiKey)\n .digest(\"hex\")\n .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, Object.keys(params).sort());\n return createHash(\"sha256\")\n .update(paramsString)\n .digest(\"hex\")\n .substring(0, 16);\n }\n\n public buildCacheKey(\n functionName: string,\n params: Record<string, unknown> = {}\n ): string {\n const paramsHash = this.generateParamsHash(params);\n return `pakento:${this.apiKeyHash}:${functionName}:${paramsHash}`;\n }\n\n public async cacheWrap<T>(\n key: string,\n fetcher: () => Promise<T>\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 console.log(\"[Cache] ✅ Writing to cache:\", key);\n await this.redis.set(key, JSON.stringify(result), {\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","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 const cacheKey = this.cache.buildCacheKey(\n \"GetEcommerceItems\",\n validatedParams.data\n );\n return this.cache.cacheWrap(cacheKey, () =>\n this.fetchItemsFromAPI(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(\n \"GetEcommerceCategories\",\n validatedParams.data\n );\n return this.cache.cacheWrap(cacheKey, () =>\n this.fetchCategoriesFromAPI(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 image_alt: rawBrand.image_alt,\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(rawBrands: BrandEcommerceRaw[]): 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 \"GetEcommerceBrands\",\n validatedParams.data\n );\n return this.cache.cacheWrap(cacheKey, () =>\n this.fetchBrandsFromAPI(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 image_alt\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_alt: rawEntity.featured_image_alt,\n featured_image_thumbnail_url: rawEntity.featured_image_thumbnail_url,\n featured_image_sizes_thumbnail_filename: 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(cacheKey, () =>\n this.fetchEntityFromAPI(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_alt\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;;;ACAA,mBAAiD;AACjD,iBAAkB;;;ACDlB,mBAAsB;AACtB,oBAA2B;AAEpB,IAAM,eAAN,MAAmB;AAAA;AAAA,EAKxB,YAAY,QAAgB;AAF5B,SAAQ,aAAqB;AAG3B,SAAK,iBAAa,0BAAW,QAAQ,EAClC,OAAO,MAAM,EACb,OAAO,KAAK,EACZ,UAAU,GAAG,CAAC;AAEjB,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,QAAQ,OAAO,KAAK,MAAM,EAAE,KAAK,CAAC;AACtE,eAAO,0BAAW,QAAQ,EACvB,OAAO,YAAY,EACnB,OAAO,KAAK,EACZ,UAAU,GAAG,EAAE;AAAA,EACpB;AAAA,EAEO,cACL,cACA,SAAkC,CAAC,GAC3B;AACR,UAAM,aAAa,KAAK,mBAAmB,MAAM;AACjD,WAAO,WAAW,KAAK,UAAU,IAAI,YAAY,IAAI,UAAU;AAAA,EACjE;AAAA,EAEA,MAAa,UACX,KACA,SACY;AAC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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"]}
package/dist/index.mjs CHANGED
@@ -175,7 +175,7 @@ var ItemsApi = class extends ApiClient {
175
175
  "getItems validation"
176
176
  );
177
177
  return {
178
- data: null,
178
+ data: [],
179
179
  totalDocs: 0,
180
180
  totalPages: 0,
181
181
  prevPage: null,
@@ -196,7 +196,7 @@ var ItemsApi = class extends ApiClient {
196
196
  async fetchItemsFromAPI(params) {
197
197
  if (!this.baseURL || !this.apiKey) {
198
198
  return {
199
- data: null,
199
+ data: [],
200
200
  totalDocs: 0,
201
201
  totalPages: 0,
202
202
  prevPage: null,
@@ -292,7 +292,7 @@ var ItemsApi = class extends ApiClient {
292
292
  );
293
293
  if (error) {
294
294
  return {
295
- data: null,
295
+ data: [],
296
296
  totalDocs: 0,
297
297
  totalPages: 0,
298
298
  prevPage: null,
@@ -326,6 +326,18 @@ var categoriesParamsSchema = z3.object({
326
326
  sort: z3.string().optional()
327
327
  });
328
328
 
329
+ // src/api/categories/parsers.ts
330
+ function parseRawCategoryToCategory(rawCategory) {
331
+ return {
332
+ id: rawCategory.id,
333
+ name: rawCategory.name,
334
+ image_url: rawCategory.image_url
335
+ };
336
+ }
337
+ function parseRawCategoriesToCategories(rawCategories) {
338
+ return rawCategories.map(parseRawCategoryToCategory);
339
+ }
340
+
329
341
  // src/api/categories/api.ts
330
342
  var CategoriesApi = class extends ApiClient {
331
343
  async getCategories(params = {}) {
@@ -335,7 +347,7 @@ var CategoriesApi = class extends ApiClient {
335
347
  validatedParams.error,
336
348
  "getCategories validation"
337
349
  );
338
- return { data: null, categories: [], error: true, errorMessage };
350
+ return { data: [], error: true, errorMessage };
339
351
  }
340
352
  const cacheKey = this.cache.buildCacheKey(
341
353
  "GetEcommerceCategories",
@@ -349,8 +361,7 @@ var CategoriesApi = class extends ApiClient {
349
361
  async fetchCategoriesFromAPI(params) {
350
362
  if (!this.baseURL || !this.apiKey) {
351
363
  return {
352
- data: null,
353
- categories: [],
364
+ data: [],
354
365
  error: true,
355
366
  errorMessage: "SDK no configurado: PAKENTO_CMS_BASE_URL o PAKENTO_API_KEY faltantes."
356
367
  };
@@ -382,11 +393,10 @@ var CategoriesApi = class extends ApiClient {
382
393
  (responseData) => responseData.GetEcommerceCategories
383
394
  );
384
395
  if (error) {
385
- return { data: null, categories: [], error: true, errorMessage };
396
+ return { data: [], error: true, errorMessage };
386
397
  }
387
398
  return {
388
- data: data.docs,
389
- categories: data.docs,
399
+ data: parseRawCategoriesToCategories(data.docs),
390
400
  error: false,
391
401
  errorMessage: null
392
402
  };
@@ -402,6 +412,22 @@ var brandsParamsSchema = z4.object({
402
412
  sort: z4.string().optional()
403
413
  });
404
414
 
415
+ // src/api/brands/parsers.ts
416
+ function parseRawBrandToBrand(rawBrand) {
417
+ return {
418
+ id: rawBrand.id,
419
+ name: rawBrand.name,
420
+ description: rawBrand.description,
421
+ items_count: rawBrand.items_count,
422
+ image_url: rawBrand.image_url,
423
+ image_thumbnail_url: rawBrand.image_thumbnail_url,
424
+ image_alt: rawBrand.image_alt
425
+ };
426
+ }
427
+ function parseRawBrandsToBrands(rawBrands) {
428
+ return rawBrands.map(parseRawBrandToBrand);
429
+ }
430
+
405
431
  // src/api/brands/api.ts
406
432
  var BrandsApi = class extends ApiClient {
407
433
  async getBrands(params = {}) {
@@ -412,18 +438,11 @@ var BrandsApi = class extends ApiClient {
412
438
  "getBrands validation"
413
439
  );
414
440
  return {
415
- data: null,
416
- brands: [],
417
- hasNextPage: false,
418
- hasPrevPage: false,
419
- limit: 0,
420
- nextPage: 0,
421
- offset: 0,
422
- page: 0,
423
- pagingCounter: 0,
424
- prevPage: 0,
441
+ data: [],
425
442
  totalDocs: 0,
426
443
  totalPages: 0,
444
+ prevPage: null,
445
+ nextPage: null,
427
446
  error: true,
428
447
  errorMessage
429
448
  };
@@ -440,18 +459,11 @@ var BrandsApi = class extends ApiClient {
440
459
  async fetchBrandsFromAPI(params) {
441
460
  if (!this.baseURL || !this.apiKey) {
442
461
  return {
443
- data: null,
444
- brands: [],
445
- hasNextPage: false,
446
- hasPrevPage: false,
447
- limit: 0,
448
- nextPage: 0,
449
- offset: 0,
450
- page: 0,
451
- pagingCounter: 0,
452
- prevPage: 0,
462
+ data: [],
453
463
  totalDocs: 0,
454
464
  totalPages: 0,
465
+ prevPage: null,
466
+ nextPage: null,
455
467
  error: true,
456
468
  errorMessage: "SDK no configurado: PAKENTO_CMS_BASE_URL o PAKENTO_API_KEY faltantes."
457
469
  };
@@ -467,6 +479,10 @@ var BrandsApi = class extends ApiClient {
467
479
  page: $page
468
480
  sort: $sort
469
481
  ) {
482
+ totalDocs
483
+ totalPages
484
+ prevPage
485
+ nextPage
470
486
  docs {
471
487
  id
472
488
  name
@@ -476,16 +492,6 @@ var BrandsApi = class extends ApiClient {
476
492
  image_thumbnail_url
477
493
  image_alt
478
494
  }
479
- hasNextPage
480
- hasPrevPage
481
- limit
482
- nextPage
483
- offset
484
- page
485
- pagingCounter
486
- prevPage
487
- totalDocs
488
- totalPages
489
495
  }
490
496
  }
491
497
  `;
@@ -496,35 +502,21 @@ var BrandsApi = class extends ApiClient {
496
502
  );
497
503
  if (error) {
498
504
  return {
499
- data: null,
500
- brands: [],
501
- hasNextPage: false,
502
- hasPrevPage: false,
503
- limit: 0,
504
- nextPage: 0,
505
- offset: 0,
506
- page: 0,
507
- pagingCounter: 0,
508
- prevPage: 0,
505
+ data: [],
509
506
  totalDocs: 0,
510
507
  totalPages: 0,
508
+ prevPage: null,
509
+ nextPage: null,
511
510
  error: true,
512
511
  errorMessage
513
512
  };
514
513
  }
515
514
  return {
516
- data,
517
- brands: data.docs,
518
- hasNextPage: data.hasNextPage,
519
- hasPrevPage: data.hasPrevPage,
520
- limit: data.limit,
521
- nextPage: data.nextPage,
522
- offset: data.offset,
523
- page: data.page,
524
- pagingCounter: data.pagingCounter,
525
- prevPage: data.prevPage,
515
+ data: parseRawBrandsToBrands(data.docs),
526
516
  totalDocs: data.totalDocs,
527
517
  totalPages: data.totalPages,
518
+ prevPage: data.prevPage,
519
+ nextPage: data.nextPage,
528
520
  error: false,
529
521
  errorMessage: null
530
522
  };
@@ -532,6 +524,44 @@ var BrandsApi = class extends ApiClient {
532
524
  };
533
525
  var brandsApi = new BrandsApi();
534
526
 
527
+ // src/api/entity/parsers.ts
528
+ function parseRawEntityToEntity(rawEntity) {
529
+ return {
530
+ id: rawEntity.id,
531
+ tin: rawEntity.tin,
532
+ name: rawEntity.name,
533
+ web: rawEntity.web,
534
+ address: rawEntity.address,
535
+ country: rawEntity.country,
536
+ city: rawEntity.city,
537
+ currency_id: rawEntity.currency_id,
538
+ currency_name: rawEntity.currency_name,
539
+ currency_prefix: rawEntity.currency_prefix,
540
+ currency_suffix: rawEntity.currency_suffix,
541
+ logo_url: rawEntity.logo_url,
542
+ logo_alt: rawEntity.logo_alt,
543
+ logo_thumbnail_url: rawEntity.logo_thumbnail_url,
544
+ logo_sizes_thumbnail_filename: rawEntity.logo_sizes_thumbnail_filename,
545
+ logo_filename: rawEntity.logo_filename,
546
+ logo_width: rawEntity.logo_width,
547
+ logo_height: rawEntity.logo_height,
548
+ logo_2_url: rawEntity.logo_2_url,
549
+ logo_2_alt: rawEntity.logo_2_alt,
550
+ logo_2_thumbnail_url: rawEntity.logo_2_thumbnail_url,
551
+ logo_2_sizes_thumbnail_filename: rawEntity.logo_2_sizes_thumbnail_filename,
552
+ logo_2_filename: rawEntity.logo_2_filename,
553
+ logo_2_width: rawEntity.logo_2_width,
554
+ logo_2_height: rawEntity.logo_2_height,
555
+ featured_image_url: rawEntity.featured_image_url,
556
+ featured_image_alt: rawEntity.featured_image_alt,
557
+ featured_image_thumbnail_url: rawEntity.featured_image_thumbnail_url,
558
+ featured_image_sizes_thumbnail_filename: rawEntity.featured_image_sizes_thumbnail_filename,
559
+ featured_image_filename: rawEntity.featured_image_filename,
560
+ featured_image_width: rawEntity.featured_image_width,
561
+ featured_image_height: rawEntity.featured_image_height
562
+ };
563
+ }
564
+
535
565
  // src/api/entity/api.ts
536
566
  var EntityApi = class extends ApiClient {
537
567
  async getEntity(params = {}) {
@@ -545,7 +575,6 @@ var EntityApi = class extends ApiClient {
545
575
  if (!this.baseURL || !this.apiKey) {
546
576
  return {
547
577
  data: null,
548
- entity: null,
549
578
  error: true,
550
579
  errorMessage: "SDK no configurado: PAKENTO_CMS_BASE_URL o PAKENTO_API_KEY faltantes."
551
580
  };
@@ -594,11 +623,10 @@ var EntityApi = class extends ApiClient {
594
623
  (responseData) => responseData
595
624
  );
596
625
  if (error) {
597
- return { data: null, entity: null, error: true, errorMessage };
626
+ return { data: null, error: true, errorMessage };
598
627
  }
599
628
  return {
600
- data: data.GetEntity,
601
- entity: data.GetEntity,
629
+ data: parseRawEntityToEntity(data.GetEntity),
602
630
  error: false,
603
631
  errorMessage: null
604
632
  };
@@ -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/api.ts","../src/api/brands/validators.ts","../src/api/brands/api.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\";\nimport { createHash } from \"crypto\";\n\nexport class CacheService {\n private redis?: Redis;\n private apiKeyHash: string;\n private defaultTTL: number = 86400; // 24 hours\n\n constructor(apiKey: string) {\n this.apiKeyHash = createHash(\"sha256\")\n .update(apiKey)\n .digest(\"hex\")\n .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, Object.keys(params).sort());\n return createHash(\"sha256\")\n .update(paramsString)\n .digest(\"hex\")\n .substring(0, 16);\n }\n\n public buildCacheKey(\n functionName: string,\n params: Record<string, unknown> = {}\n ): string {\n const paramsHash = this.generateParamsHash(params);\n return `pakento:${this.apiKeyHash}:${functionName}:${paramsHash}`;\n }\n\n public async cacheWrap<T>(\n key: string,\n fetcher: () => Promise<T>\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 console.log(\"[Cache] ✅ Writing to cache:\", key);\n await this.redis.set(key, JSON.stringify(result), {\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","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: null,\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 \"GetEcommerceItems\",\n validatedParams.data\n );\n return this.cache.cacheWrap(cacheKey, () =>\n this.fetchItemsFromAPI(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: null,\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: null,\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 { ApiClient } from \"../core/apiClient\";\nimport { categoriesParamsSchema } from \"./validators\";\nimport {\n GetCategoriesParams,\n CategoriesRawResponse,\n CategoriesApiResponse,\n} from \"./types\";\n\nclass CategoriesApi extends ApiClient {\n async getCategories(\n params: GetCategoriesParams = {}\n ): Promise<CategoriesApiResponse> {\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: null, categories: [], error: true, errorMessage };\n }\n\n const cacheKey = this.cache.buildCacheKey(\n \"GetEcommerceCategories\",\n validatedParams.data\n );\n return this.cache.cacheWrap(cacheKey, () =>\n this.fetchCategoriesFromAPI(validatedParams.data)\n );\n }\n\n private async fetchCategoriesFromAPI(\n params: GetCategoriesParams\n ): Promise<CategoriesApiResponse> {\n if (!this.baseURL || !this.apiKey) {\n return {\n data: null,\n categories: [],\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: null, categories: [], error: true, errorMessage };\n }\n\n return {\n data: data!.docs,\n categories: 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 { ApiClient } from \"../core/apiClient\";\nimport { brandsParamsSchema } from \"./validators\";\nimport { GetBrandsParams, BrandsRawResponse, BrandsApiResponse } from \"./types\";\n\nclass BrandsApi extends ApiClient {\n async getBrands(params: GetBrandsParams = {}): Promise<BrandsApiResponse> {\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: null,\n brands: [],\n hasNextPage: false,\n hasPrevPage: false,\n limit: 0,\n nextPage: 0,\n offset: 0,\n page: 0,\n pagingCounter: 0,\n prevPage: 0,\n totalDocs: 0,\n totalPages: 0,\n error: true,\n errorMessage,\n };\n }\n\n const cacheKey = this.cache.buildCacheKey(\n \"GetEcommerceBrands\",\n validatedParams.data\n );\n return this.cache.cacheWrap(cacheKey, () =>\n this.fetchBrandsFromAPI(validatedParams.data)\n );\n }\n\n private async fetchBrandsFromAPI(\n params: GetBrandsParams\n ): Promise<BrandsApiResponse> {\n if (!this.baseURL || !this.apiKey) {\n return {\n data: null,\n brands: [],\n hasNextPage: false,\n hasPrevPage: false,\n limit: 0,\n nextPage: 0,\n offset: 0,\n page: 0,\n pagingCounter: 0,\n prevPage: 0,\n totalDocs: 0,\n totalPages: 0,\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 docs {\n id\n name\n description\n items_count\n image_url\n image_thumbnail_url\n image_alt\n }\n hasNextPage\n hasPrevPage\n limit\n nextPage\n offset\n page\n pagingCounter\n prevPage\n totalDocs\n totalPages\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: null,\n brands: [],\n hasNextPage: false,\n hasPrevPage: false,\n limit: 0,\n nextPage: 0,\n offset: 0,\n page: 0,\n pagingCounter: 0,\n prevPage: 0,\n totalDocs: 0,\n totalPages: 0,\n error: true,\n errorMessage,\n };\n }\n\n return {\n data: data!,\n brands: data!.docs,\n hasNextPage: data!.hasNextPage,\n hasPrevPage: data!.hasPrevPage,\n limit: data!.limit,\n nextPage: data!.nextPage,\n offset: data!.offset,\n page: data!.page,\n pagingCounter: data!.pagingCounter,\n prevPage: data!.prevPage,\n totalDocs: data!.totalDocs,\n totalPages: data!.totalPages,\n error: false,\n errorMessage: null,\n };\n }\n}\n\nexport const brandsApi = new BrandsApi();\n","import { ApiClient } from \"../core/apiClient\";\nimport { GetEntityParams, EntityRawResponse, EntityApiResponse } from \"./types\";\n\nclass EntityApi extends ApiClient {\n async getEntity(params: GetEntityParams = {}): Promise<EntityApiResponse> {\n const cacheKey = this.cache.buildCacheKey(\"GetEntity\", params);\n return this.cache.cacheWrap(cacheKey, () =>\n this.fetchEntityFromAPI(params)\n );\n }\n\n private async fetchEntityFromAPI(\n params: GetEntityParams\n ): Promise<EntityApiResponse> {\n if (!this.baseURL || !this.apiKey) {\n return {\n data: null,\n entity: 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_alt\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, entity: null, error: true, errorMessage };\n }\n\n return {\n data: data!.GetEntity,\n entity: 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;AACtB,SAAS,kBAAkB;AAEpB,IAAM,eAAN,MAAmB;AAAA;AAAA,EAKxB,YAAY,QAAgB;AAF5B,SAAQ,aAAqB;AAG3B,SAAK,aAAa,WAAW,QAAQ,EAClC,OAAO,MAAM,EACb,OAAO,KAAK,EACZ,UAAU,GAAG,CAAC;AAEjB,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,QAAQ,OAAO,KAAK,MAAM,EAAE,KAAK,CAAC;AACtE,WAAO,WAAW,QAAQ,EACvB,OAAO,YAAY,EACnB,OAAO,KAAK,EACZ,UAAU,GAAG,EAAE;AAAA,EACpB;AAAA,EAEO,cACL,cACA,SAAkC,CAAC,GAC3B;AACR,UAAM,aAAa,KAAK,mBAAmB,MAAM;AACjD,WAAO,WAAW,KAAK,UAAU,IAAI,YAAY,IAAI,UAAU;AAAA,EACjE;AAAA,EAEA,MAAa,UACX,KACA,SACY;AACZ,QAAI,CAAC,KAAK,OAAO;AACf,aAAO,QAAQ;AAAA,I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AA,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"]}
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\";\nimport { createHash } from \"crypto\";\n\nexport class CacheService {\n private redis?: Redis;\n private apiKeyHash: string;\n private defaultTTL: number = 86400; // 24 hours\n\n constructor(apiKey: string) {\n this.apiKeyHash = createHash(\"sha256\")\n .update(apiKey)\n .digest(\"hex\")\n .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, Object.keys(params).sort());\n return createHash(\"sha256\")\n .update(paramsString)\n .digest(\"hex\")\n .substring(0, 16);\n }\n\n public buildCacheKey(\n functionName: string,\n params: Record<string, unknown> = {}\n ): string {\n const paramsHash = this.generateParamsHash(params);\n return `pakento:${this.apiKeyHash}:${functionName}:${paramsHash}`;\n }\n\n public async cacheWrap<T>(\n key: string,\n fetcher: () => Promise<T>\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 console.log(\"[Cache] ✅ Writing to cache:\", key);\n await this.redis.set(key, JSON.stringify(result), {\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","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 const cacheKey = this.cache.buildCacheKey(\n \"GetEcommerceItems\",\n validatedParams.data\n );\n return this.cache.cacheWrap(cacheKey, () =>\n this.fetchItemsFromAPI(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(\n \"GetEcommerceCategories\",\n validatedParams.data\n );\n return this.cache.cacheWrap(cacheKey, () =>\n this.fetchCategoriesFromAPI(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 image_alt: rawBrand.image_alt,\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(rawBrands: BrandEcommerceRaw[]): 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 \"GetEcommerceBrands\",\n validatedParams.data\n );\n return this.cache.cacheWrap(cacheKey, () =>\n this.fetchBrandsFromAPI(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 image_alt\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_alt: rawEntity.featured_image_alt,\n featured_image_thumbnail_url: rawEntity.featured_image_thumbnail_url,\n featured_image_sizes_thumbnail_filename: 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(cacheKey, () =>\n this.fetchEntityFromAPI(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_alt\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;AACtB,SAAS,kBAAkB;AAEpB,IAAM,eAAN,MAAmB;AAAA;AAAA,EAKxB,YAAY,QAAgB;AAF5B,SAAQ,aAAqB;AAG3B,SAAK,aAAa,WAAW,QAAQ,EAClC,OAAO,MAAM,EACb,OAAO,KAAK,EACZ,UAAU,GAAG,CAAC;AAEjB,QACE,QAAQ,IAAI,0BACZ,QAAQ,IAAI,0BACZ;AACA,WAAK,QAAQ,IAAI,MAAM;AAAA,QACrB,KAAK,QAAQ,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,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.2",
3
+ "version": "4.3.3",
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",