@pakento/cms-sdk 4.3.14 → 4.3.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -1
- package/dist/index.d.mts +31 -60
- package/dist/index.d.ts +31 -60
- package/dist/index.js +36 -65
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +36 -65
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
package/dist/index.d.mts
CHANGED
|
@@ -37,6 +37,17 @@ interface ApiResponse<T> {
|
|
|
37
37
|
interface WhereClause {
|
|
38
38
|
equals?: string;
|
|
39
39
|
}
|
|
40
|
+
interface GraphQLCurrency {
|
|
41
|
+
prefix: string;
|
|
42
|
+
plural_name: string;
|
|
43
|
+
name: string;
|
|
44
|
+
}
|
|
45
|
+
interface GraphQLImage {
|
|
46
|
+
thumbnailURL: string;
|
|
47
|
+
url: string;
|
|
48
|
+
width: number;
|
|
49
|
+
height: number;
|
|
50
|
+
}
|
|
40
51
|
|
|
41
52
|
interface ItemImage {
|
|
42
53
|
url: string;
|
|
@@ -244,76 +255,36 @@ declare class BrandsApi extends ApiClient {
|
|
|
244
255
|
declare const brandsApi: BrandsApi;
|
|
245
256
|
|
|
246
257
|
interface Entity {
|
|
247
|
-
id: string;
|
|
248
|
-
tin: string;
|
|
249
258
|
name: string;
|
|
250
|
-
web: string;
|
|
251
259
|
address: string;
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
logo_sizes_thumbnail_filename: string;
|
|
262
|
-
logo_filename: string;
|
|
263
|
-
logo_width: string;
|
|
264
|
-
logo_height: string;
|
|
265
|
-
logo_2_url: string;
|
|
266
|
-
logo_2_alt: string;
|
|
267
|
-
logo_2_thumbnail_url: string;
|
|
268
|
-
logo_2_sizes_thumbnail_filename: string;
|
|
269
|
-
logo_2_filename: string;
|
|
270
|
-
logo_2_width: string;
|
|
271
|
-
logo_2_height: string;
|
|
272
|
-
featured_image_url: string;
|
|
273
|
-
featured_image_thumbnail_url: string;
|
|
274
|
-
featured_image_sizes_thumbnail_filename: string;
|
|
275
|
-
featured_image_filename: string;
|
|
276
|
-
featured_image_width: string;
|
|
277
|
-
featured_image_height: string;
|
|
260
|
+
instagram: string | null;
|
|
261
|
+
facebook: string | null;
|
|
262
|
+
whatsapp_number: string | null;
|
|
263
|
+
tiktok: string | null;
|
|
264
|
+
youtube: string | null;
|
|
265
|
+
currency: GraphQLCurrency;
|
|
266
|
+
featured_image: GraphQLImage | null;
|
|
267
|
+
logo: GraphQLImage | null;
|
|
268
|
+
logo_2: GraphQLImage | null;
|
|
278
269
|
}
|
|
279
270
|
interface EntityEcommerceRaw {
|
|
280
|
-
id: string;
|
|
281
|
-
tin: string;
|
|
282
271
|
name: string;
|
|
283
|
-
web: string;
|
|
284
272
|
address: string;
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
logo_sizes_thumbnail_filename: string;
|
|
295
|
-
logo_filename: string;
|
|
296
|
-
logo_width: string;
|
|
297
|
-
logo_height: string;
|
|
298
|
-
logo_2_url: string;
|
|
299
|
-
logo_2_alt: string;
|
|
300
|
-
logo_2_thumbnail_url: string;
|
|
301
|
-
logo_2_sizes_thumbnail_filename: string;
|
|
302
|
-
logo_2_filename: string;
|
|
303
|
-
logo_2_width: string;
|
|
304
|
-
logo_2_height: string;
|
|
305
|
-
featured_image_url: string;
|
|
306
|
-
featured_image_thumbnail_url: string;
|
|
307
|
-
featured_image_sizes_thumbnail_filename: string;
|
|
308
|
-
featured_image_filename: string;
|
|
309
|
-
featured_image_width: string;
|
|
310
|
-
featured_image_height: string;
|
|
273
|
+
instagram: string | null;
|
|
274
|
+
facebook: string | null;
|
|
275
|
+
whatsapp_number: string | null;
|
|
276
|
+
tiktok: string | null;
|
|
277
|
+
youtube: string | null;
|
|
278
|
+
currency: GraphQLCurrency;
|
|
279
|
+
featured_image: GraphQLImage | null;
|
|
280
|
+
logo: GraphQLImage | null;
|
|
281
|
+
logo_2: GraphQLImage | null;
|
|
311
282
|
}
|
|
312
283
|
interface GetEntityParams {
|
|
313
284
|
[key: string]: unknown;
|
|
314
285
|
}
|
|
315
286
|
interface EntityRawResponse {
|
|
316
|
-
|
|
287
|
+
docs: EntityEcommerceRaw[];
|
|
317
288
|
}
|
|
318
289
|
|
|
319
290
|
declare class EntityApi extends ApiClient {
|
|
@@ -384,4 +355,4 @@ declare class CustomApi extends ApiClient {
|
|
|
384
355
|
}
|
|
385
356
|
declare const customApi: CustomApi;
|
|
386
357
|
|
|
387
|
-
export { ApiClient, type ApiResponse, type AttributeValue, type Brand, type BrandEcommerceRaw, type BrandsRawResponse, CacheService, type CategoriesRawResponse, type CategoriesWhere, type Category, type CategoryEcommerceRaw, type CreateEcommerceOrderItem, type CreateEcommerceOrderParams, type CreateEcommerceOrderResponse, type CustomGraphQLParams, type CustomGraphQLResponse, type Entity, type EntityEcommerceRaw, type EntityRawResponse, type GetBrandsParams, type GetCategoriesParams, type GetEntityParams, type GetItemsParams, type Item, type ItemEcommerceRaw, type ItemImage, type ItemsRawResponse, type ItemsWhere, type MasterAttribute, type SendContactUsEmailParams, type SendContactUsEmailResponse, type Variation, type VariationAttributeValue, type WhereClause, brandsApi, categoriesApi, contactApi, customApi, entityApi, itemsApi, ordersApi };
|
|
358
|
+
export { ApiClient, type ApiResponse, type AttributeValue, type Brand, type BrandEcommerceRaw, type BrandsRawResponse, CacheService, type CategoriesRawResponse, type CategoriesWhere, type Category, type CategoryEcommerceRaw, type CreateEcommerceOrderItem, type CreateEcommerceOrderParams, type CreateEcommerceOrderResponse, type CustomGraphQLParams, type CustomGraphQLResponse, type Entity, type EntityEcommerceRaw, type EntityRawResponse, type GetBrandsParams, type GetCategoriesParams, type GetEntityParams, type GetItemsParams, type GraphQLCurrency, type GraphQLImage, type Item, type ItemEcommerceRaw, type ItemImage, type ItemsRawResponse, type ItemsWhere, type MasterAttribute, type SendContactUsEmailParams, type SendContactUsEmailResponse, type Variation, type VariationAttributeValue, type WhereClause, brandsApi, categoriesApi, contactApi, customApi, entityApi, itemsApi, ordersApi };
|
package/dist/index.d.ts
CHANGED
|
@@ -37,6 +37,17 @@ interface ApiResponse<T> {
|
|
|
37
37
|
interface WhereClause {
|
|
38
38
|
equals?: string;
|
|
39
39
|
}
|
|
40
|
+
interface GraphQLCurrency {
|
|
41
|
+
prefix: string;
|
|
42
|
+
plural_name: string;
|
|
43
|
+
name: string;
|
|
44
|
+
}
|
|
45
|
+
interface GraphQLImage {
|
|
46
|
+
thumbnailURL: string;
|
|
47
|
+
url: string;
|
|
48
|
+
width: number;
|
|
49
|
+
height: number;
|
|
50
|
+
}
|
|
40
51
|
|
|
41
52
|
interface ItemImage {
|
|
42
53
|
url: string;
|
|
@@ -244,76 +255,36 @@ declare class BrandsApi extends ApiClient {
|
|
|
244
255
|
declare const brandsApi: BrandsApi;
|
|
245
256
|
|
|
246
257
|
interface Entity {
|
|
247
|
-
id: string;
|
|
248
|
-
tin: string;
|
|
249
258
|
name: string;
|
|
250
|
-
web: string;
|
|
251
259
|
address: string;
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
logo_sizes_thumbnail_filename: string;
|
|
262
|
-
logo_filename: string;
|
|
263
|
-
logo_width: string;
|
|
264
|
-
logo_height: string;
|
|
265
|
-
logo_2_url: string;
|
|
266
|
-
logo_2_alt: string;
|
|
267
|
-
logo_2_thumbnail_url: string;
|
|
268
|
-
logo_2_sizes_thumbnail_filename: string;
|
|
269
|
-
logo_2_filename: string;
|
|
270
|
-
logo_2_width: string;
|
|
271
|
-
logo_2_height: string;
|
|
272
|
-
featured_image_url: string;
|
|
273
|
-
featured_image_thumbnail_url: string;
|
|
274
|
-
featured_image_sizes_thumbnail_filename: string;
|
|
275
|
-
featured_image_filename: string;
|
|
276
|
-
featured_image_width: string;
|
|
277
|
-
featured_image_height: string;
|
|
260
|
+
instagram: string | null;
|
|
261
|
+
facebook: string | null;
|
|
262
|
+
whatsapp_number: string | null;
|
|
263
|
+
tiktok: string | null;
|
|
264
|
+
youtube: string | null;
|
|
265
|
+
currency: GraphQLCurrency;
|
|
266
|
+
featured_image: GraphQLImage | null;
|
|
267
|
+
logo: GraphQLImage | null;
|
|
268
|
+
logo_2: GraphQLImage | null;
|
|
278
269
|
}
|
|
279
270
|
interface EntityEcommerceRaw {
|
|
280
|
-
id: string;
|
|
281
|
-
tin: string;
|
|
282
271
|
name: string;
|
|
283
|
-
web: string;
|
|
284
272
|
address: string;
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
logo_sizes_thumbnail_filename: string;
|
|
295
|
-
logo_filename: string;
|
|
296
|
-
logo_width: string;
|
|
297
|
-
logo_height: string;
|
|
298
|
-
logo_2_url: string;
|
|
299
|
-
logo_2_alt: string;
|
|
300
|
-
logo_2_thumbnail_url: string;
|
|
301
|
-
logo_2_sizes_thumbnail_filename: string;
|
|
302
|
-
logo_2_filename: string;
|
|
303
|
-
logo_2_width: string;
|
|
304
|
-
logo_2_height: string;
|
|
305
|
-
featured_image_url: string;
|
|
306
|
-
featured_image_thumbnail_url: string;
|
|
307
|
-
featured_image_sizes_thumbnail_filename: string;
|
|
308
|
-
featured_image_filename: string;
|
|
309
|
-
featured_image_width: string;
|
|
310
|
-
featured_image_height: string;
|
|
273
|
+
instagram: string | null;
|
|
274
|
+
facebook: string | null;
|
|
275
|
+
whatsapp_number: string | null;
|
|
276
|
+
tiktok: string | null;
|
|
277
|
+
youtube: string | null;
|
|
278
|
+
currency: GraphQLCurrency;
|
|
279
|
+
featured_image: GraphQLImage | null;
|
|
280
|
+
logo: GraphQLImage | null;
|
|
281
|
+
logo_2: GraphQLImage | null;
|
|
311
282
|
}
|
|
312
283
|
interface GetEntityParams {
|
|
313
284
|
[key: string]: unknown;
|
|
314
285
|
}
|
|
315
286
|
interface EntityRawResponse {
|
|
316
|
-
|
|
287
|
+
docs: EntityEcommerceRaw[];
|
|
317
288
|
}
|
|
318
289
|
|
|
319
290
|
declare class EntityApi extends ApiClient {
|
|
@@ -384,4 +355,4 @@ declare class CustomApi extends ApiClient {
|
|
|
384
355
|
}
|
|
385
356
|
declare const customApi: CustomApi;
|
|
386
357
|
|
|
387
|
-
export { ApiClient, type ApiResponse, type AttributeValue, type Brand, type BrandEcommerceRaw, type BrandsRawResponse, CacheService, type CategoriesRawResponse, type CategoriesWhere, type Category, type CategoryEcommerceRaw, type CreateEcommerceOrderItem, type CreateEcommerceOrderParams, type CreateEcommerceOrderResponse, type CustomGraphQLParams, type CustomGraphQLResponse, type Entity, type EntityEcommerceRaw, type EntityRawResponse, type GetBrandsParams, type GetCategoriesParams, type GetEntityParams, type GetItemsParams, type Item, type ItemEcommerceRaw, type ItemImage, type ItemsRawResponse, type ItemsWhere, type MasterAttribute, type SendContactUsEmailParams, type SendContactUsEmailResponse, type Variation, type VariationAttributeValue, type WhereClause, brandsApi, categoriesApi, contactApi, customApi, entityApi, itemsApi, ordersApi };
|
|
358
|
+
export { ApiClient, type ApiResponse, type AttributeValue, type Brand, type BrandEcommerceRaw, type BrandsRawResponse, CacheService, type CategoriesRawResponse, type CategoriesWhere, type Category, type CategoryEcommerceRaw, type CreateEcommerceOrderItem, type CreateEcommerceOrderParams, type CreateEcommerceOrderResponse, type CustomGraphQLParams, type CustomGraphQLResponse, type Entity, type EntityEcommerceRaw, type EntityRawResponse, type GetBrandsParams, type GetCategoriesParams, type GetEntityParams, type GetItemsParams, type GraphQLCurrency, type GraphQLImage, type Item, type ItemEcommerceRaw, type ItemImage, type ItemsRawResponse, type ItemsWhere, type MasterAttribute, type SendContactUsEmailParams, type SendContactUsEmailResponse, type Variation, type VariationAttributeValue, type WhereClause, brandsApi, categoriesApi, contactApi, customApi, entityApi, itemsApi, ordersApi };
|
package/dist/index.js
CHANGED
|
@@ -651,37 +651,7 @@ var brandsApi = new BrandsApi();
|
|
|
651
651
|
// src/api/entity/parsers.ts
|
|
652
652
|
function parseRawEntityToEntity(rawEntity) {
|
|
653
653
|
return {
|
|
654
|
-
|
|
655
|
-
tin: rawEntity.tin,
|
|
656
|
-
name: rawEntity.name,
|
|
657
|
-
web: rawEntity.web,
|
|
658
|
-
address: rawEntity.address,
|
|
659
|
-
country: rawEntity.country,
|
|
660
|
-
city: rawEntity.city,
|
|
661
|
-
currency_id: rawEntity.currency_id,
|
|
662
|
-
currency_name: rawEntity.currency_name,
|
|
663
|
-
currency_prefix: rawEntity.currency_prefix,
|
|
664
|
-
currency_suffix: rawEntity.currency_suffix,
|
|
665
|
-
logo_url: rawEntity.logo_url,
|
|
666
|
-
logo_alt: rawEntity.logo_alt,
|
|
667
|
-
logo_thumbnail_url: rawEntity.logo_thumbnail_url,
|
|
668
|
-
logo_sizes_thumbnail_filename: rawEntity.logo_sizes_thumbnail_filename,
|
|
669
|
-
logo_filename: rawEntity.logo_filename,
|
|
670
|
-
logo_width: rawEntity.logo_width,
|
|
671
|
-
logo_height: rawEntity.logo_height,
|
|
672
|
-
logo_2_url: rawEntity.logo_2_url,
|
|
673
|
-
logo_2_alt: rawEntity.logo_2_alt,
|
|
674
|
-
logo_2_thumbnail_url: rawEntity.logo_2_thumbnail_url,
|
|
675
|
-
logo_2_sizes_thumbnail_filename: rawEntity.logo_2_sizes_thumbnail_filename,
|
|
676
|
-
logo_2_filename: rawEntity.logo_2_filename,
|
|
677
|
-
logo_2_width: rawEntity.logo_2_width,
|
|
678
|
-
logo_2_height: rawEntity.logo_2_height,
|
|
679
|
-
featured_image_url: rawEntity.featured_image_url,
|
|
680
|
-
featured_image_thumbnail_url: rawEntity.featured_image_thumbnail_url,
|
|
681
|
-
featured_image_sizes_thumbnail_filename: rawEntity.featured_image_sizes_thumbnail_filename,
|
|
682
|
-
featured_image_filename: rawEntity.featured_image_filename,
|
|
683
|
-
featured_image_width: rawEntity.featured_image_width,
|
|
684
|
-
featured_image_height: rawEntity.featured_image_height
|
|
654
|
+
...rawEntity
|
|
685
655
|
};
|
|
686
656
|
}
|
|
687
657
|
|
|
@@ -705,52 +675,53 @@ var EntityApi = class extends ApiClient {
|
|
|
705
675
|
};
|
|
706
676
|
}
|
|
707
677
|
const query = `
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
tin
|
|
678
|
+
query GetEntity {
|
|
679
|
+
Entities (limit: 1, trash: false) {
|
|
680
|
+
docs {
|
|
712
681
|
name
|
|
713
|
-
web
|
|
714
682
|
address
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
683
|
+
instagram
|
|
684
|
+
facebook
|
|
685
|
+
whatsapp_number
|
|
686
|
+
tiktok
|
|
687
|
+
youtube
|
|
688
|
+
currency {
|
|
689
|
+
prefix
|
|
690
|
+
plural_name
|
|
691
|
+
name
|
|
692
|
+
}
|
|
693
|
+
featured_image {
|
|
694
|
+
thumbnailURL
|
|
695
|
+
url
|
|
696
|
+
width
|
|
697
|
+
height
|
|
698
|
+
}
|
|
699
|
+
logo {
|
|
700
|
+
thumbnailURL
|
|
701
|
+
url
|
|
702
|
+
width
|
|
703
|
+
height
|
|
704
|
+
}
|
|
705
|
+
logo_2 {
|
|
706
|
+
thumbnailURL
|
|
707
|
+
url
|
|
708
|
+
width
|
|
709
|
+
height
|
|
710
|
+
}
|
|
741
711
|
}
|
|
742
712
|
}
|
|
713
|
+
}
|
|
743
714
|
`;
|
|
744
715
|
const { data, error, errorMessage } = await this.fetchGraphQL(
|
|
745
716
|
query,
|
|
746
717
|
params,
|
|
747
|
-
(responseData) => responseData
|
|
718
|
+
(responseData) => responseData?.Entities
|
|
748
719
|
);
|
|
749
720
|
if (error) {
|
|
750
721
|
return { data: null, error: true, errorMessage };
|
|
751
722
|
}
|
|
752
723
|
return {
|
|
753
|
-
data: parseRawEntityToEntity(data.
|
|
724
|
+
data: parseRawEntityToEntity(data.docs[0]),
|
|
754
725
|
error: false,
|
|
755
726
|
errorMessage: null
|
|
756
727
|
};
|
|
@@ -823,7 +794,7 @@ var contactUsSchema = import_zod6.z.object({
|
|
|
823
794
|
email: import_zod6.z.string().email(),
|
|
824
795
|
phone: import_zod6.z.string().optional(),
|
|
825
796
|
subject: import_zod6.z.string().optional(),
|
|
826
|
-
|
|
797
|
+
message: import_zod6.z.string().min(1)
|
|
827
798
|
});
|
|
828
799
|
|
|
829
800
|
// src/api/contact/api.ts
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts","../src/api/core/apiClient.ts","../src/api/core/cache.ts","../src/api/items/parsers.ts","../src/api/items/validators.ts","../src/api/items/api.ts","../src/api/categories/validators.ts","../src/api/categories/parsers.ts","../src/api/categories/api.ts","../src/api/brands/validators.ts","../src/api/brands/parsers.ts","../src/api/brands/api.ts","../src/api/entity/parsers.ts","../src/api/entity/api.ts","../src/api/orders/validators.ts","../src/api/orders/api.ts","../src/api/contact/validators.ts","../src/api/contact/api.ts","../src/api/custom/api.ts"],"sourcesContent":["// Core\nexport { ApiClient } from \"./api/core/apiClient\";\n\n// Cache\nexport { CacheService } from \"./api/core/cache\";\n\n// Items\nexport { itemsApi } from \"./api/items\";\n\n// Categories\nexport { categoriesApi } from \"./api/categories\";\n\n// Brands\nexport { brandsApi } from \"./api/brands\";\n\n// Entity\nexport { entityApi } from \"./api/entity\";\n\n// Orders\nexport { ordersApi } from \"./api/orders\";\n\n// Contact\nexport { contactApi } from \"./api/contact\";\n\n// Custom\nexport { customApi } from \"./api/custom\";\n\n// Types (re-export if needed)\nexport * from \"./api/items/types\";\nexport * from \"./api/categories/types\";\nexport * from \"./api/brands/types\";\nexport * from \"./api/entity/types\";\nexport * from \"./api/orders/types\";\nexport * from \"./api/contact/types\";\nexport * from \"./api/custom/types\";\nexport * from \"./api/core/types\";\n","import axios, { AxiosInstance, AxiosError } from \"axios\";\nimport { z } from \"zod\";\nimport { CacheService } from \"./cache\";\n\nexport class ApiClient {\n protected client: AxiosInstance;\n protected cache: CacheService;\n protected baseURL: string;\n protected apiKey: string;\n\n constructor() {\n this.baseURL = process.env.PAKENTO_CMS_BASE_URL || \"\";\n this.apiKey = process.env.PAKENTO_API_KEY || \"\";\n this.cache = new CacheService(this.apiKey);\n\n this.client = axios.create({\n baseURL: this.baseURL,\n headers: {\n \"Content-Type\": \"application/json\",\n Authorization: `users API-Key ${this.apiKey}`,\n },\n });\n\n this.client.interceptors.request.use(\n (config) => {\n const fullUrl = `${config.baseURL}${config.url}`;\n console.log(`🌐 API Call: ${config.method?.toUpperCase()} ${fullUrl}`);\n return config;\n },\n (error) => Promise.reject(error)\n );\n }\n\n protected handleApiError(error: unknown, context: string): string {\n if (error instanceof AxiosError) {\n const status = error.response?.status;\n const responseMessage = error.response?.data?.message;\n if (status === 401) return \"API Key inválida o expirada\";\n if (status === 404) return `${context} no encontrado`;\n if (status && status >= 500) return \"Error del servidor CMS\";\n return (\n responseMessage || `Error de conexión en ${context}: ${error.message}`\n );\n } else if (error instanceof z.ZodError) {\n return `Validación fallida: ${error.issues\n .map((e) => e.message)\n .join(\", \")}`;\n } else if (error instanceof Error) {\n return error.message;\n }\n return \"Error desconocido\";\n }\n\n protected async fetchGraphQL<T>(\n query: string,\n variables: any,\n extractData: (responseData: any) => T\n ): Promise<{ data: T | null; error: boolean; errorMessage: string | null }> {\n try {\n const response = await this.client.post(\"/api/graphql\", {\n query,\n variables,\n });\n if (response.data.errors) {\n const errorMessage = `GraphQL Error: ${response.data.errors[0].message}`;\n return { data: null, error: true, errorMessage };\n }\n const data = extractData(response.data.data);\n return { data, error: false, errorMessage: null };\n } catch (error) {\n const errorMessage = this.handleApiError(error, \"GraphQL query\");\n return { data: null, error: true, errorMessage };\n }\n }\n}\n","import { Redis } from \"@upstash/redis\";\n\nexport class CacheService {\n private redis?: Redis;\n private apiKeyHash: string;\n private defaultTTL: number = 172800; // 48 hours\n\n constructor(apiKey: string) {\n this.apiKeyHash = apiKey.substring(0, 8);\n\n if (\n process.env.UPSTASH_REDIS_REST_URL &&\n process.env.UPSTASH_REDIS_REST_TOKEN\n ) {\n this.redis = new Redis({\n url: process.env.UPSTASH_REDIS_REST_URL,\n token: process.env.UPSTASH_REDIS_REST_TOKEN,\n });\n }\n }\n\n private generateParamsHash(params: Record<string, unknown>): string {\n const paramsString = JSON.stringify(params);\n return btoa(paramsString);\n }\n\n public buildCacheKey(\n functionName: string,\n params: Record<string, unknown> = {}\n ): string {\n const paramsHash = this.generateParamsHash({ ...params, functionName });\n return `pakento:${this.apiKeyHash}:${paramsHash}`;\n }\n\n public async cacheWrap<T>(\n key: string,\n fetcher: () => Promise<T>,\n functionName: string,\n filters?: Record<string, unknown>\n ): Promise<T> {\n if (!this.redis) {\n return fetcher();\n }\n\n let cached: string | null = null;\n try {\n cached = await this.redis.get(key);\n\n if (typeof cached === \"object\" && cached !== null) {\n console.log(\"[Cache] ✅ Reading from cache:\", key);\n return cached as T;\n }\n\n if (cached) {\n console.log(\"[Cache] ✅ Reading from cache:\", key);\n return JSON.parse(cached as string) as T;\n }\n } catch (err) {\n console.warn(\"[Cache] ❌ Error reading from cache:\", err);\n console.log(`[Cache] ❌ Key: ${key}, type: ${typeof cached}`);\n }\n\n const result = await fetcher();\n\n try {\n // Crear objeto de caché con datos y filtros para visualización\n const cacheData = {\n _function: functionName,\n _filters: filters || {},\n _cachedAt: new Date().toISOString(),\n ...result,\n };\n\n console.log(\"[Cache] ✅ Writing to cache:\", key);\n await this.redis.set(key, JSON.stringify(cacheData), {\n ex: this.defaultTTL,\n });\n } catch (err) {\n console.warn(\"[Cache] ❌ Error writing to cache:\", err);\n }\n\n return result;\n }\n\n public async clearAllCache(): Promise<boolean> {\n if (!this.redis) {\n console.warn(\"[Cache] ❌ Redis no configurado\");\n return false;\n }\n\n try {\n const pattern = `pakento:${this.apiKeyHash}:*`;\n const keys = await this.redis.keys(pattern);\n\n if (keys.length > 0) {\n await this.redis.del(...keys);\n console.log(\"[Cache] ✅ Cache limpiado\");\n }\n\n return true;\n } catch (err) {\n console.warn(\"[Cache] ❌ Error limpiando todo el cache\", err);\n return false;\n }\n }\n}\n","import { Item, ItemEcommerceRaw } from \"./types\";\n\n/**\n * Parses a raw GraphQL response item to the normalized Item type\n * @param rawItem - The raw item from GraphQL response\n * @returns Normalized Item object\n */\nexport function parseRawItemToItem(rawItem: ItemEcommerceRaw): Item {\n const images = rawItem.images.map((img) => ({\n url: img.url,\n thumbnail_url: img.thumbnail_url,\n }));\n\n const variations = rawItem.variations.map((v) => ({\n id: v.id,\n name: v.name,\n description: v.description,\n cover_image_url: v.cover_image_url,\n cover_image_thumbnail_url: v.cover_image_thumbnail_url,\n price: v.price,\n old_price: v.old_price,\n price_notes: v.price_notes,\n price_text: v.price_text,\n old_price_text: v.old_price_text,\n currency_prefix: v.currency_prefix,\n attribute_values: v.attribute_values,\n images: v.images.map((img) => ({\n url: img.url,\n thumbnail_url: img.thumbnail_url,\n })),\n }));\n\n return {\n id: rawItem.id,\n name: rawItem.name,\n featured: rawItem.featured,\n url_safe_name: rawItem.url_safe_name,\n currency_prefix: rawItem.currency_prefix,\n description: rawItem.description,\n old_price: rawItem.old_price,\n item_category_name: rawItem.item_category_name,\n item_category_id: parseInt(rawItem.item_category_id || \"0\", 10),\n item_super_category_name: rawItem.item_super_category_name,\n item_super_category_id: parseInt(rawItem.item_super_category_id || \"0\", 10),\n price_text: rawItem.price_text,\n old_price_text: rawItem.old_price_text,\n price_notes: rawItem.price_notes,\n price: rawItem.price,\n brand_id: parseInt(rawItem.brand_id || \"0\", 10),\n brand_name: rawItem.brand_name,\n cover_image_url: rawItem.cover_image_url,\n cover_image_thumbnail_url: rawItem.cover_image_thumbnail_url,\n images,\n master_attributes: rawItem.master_attributes,\n variations,\n };\n}\n\n/**\n * Parses an array of raw GraphQL response items to normalized Item types\n * @param rawItems - Array of raw items from GraphQL response\n * @returns Array of normalized Item objects\n */\nexport function parseRawItemsToItems(rawItems: ItemEcommerceRaw[]): Item[] {\n return rawItems.map(parseRawItemToItem);\n}\n","import { z } from \"zod\";\n\nexport const itemsParamsSchema = z.object({\n where: z\n .object({\n item_category_id: z.object({ equals: z.string().optional() }).optional(),\n item_super_category_id: z\n .object({ equals: z.string().optional() })\n .optional(),\n brand_id: z.object({ equals: z.string().optional() }).optional(),\n id: z.object({ equals: z.string().optional() }).optional(),\n })\n .optional(),\n onlyOffers: z.boolean().optional(),\n limit: z.coerce.number().optional(),\n page: z.coerce.number().optional(),\n search: z.string().optional(),\n sort: z.string().optional(),\n minPrice: z.coerce.number().optional(),\n maxPrice: z.coerce.number().optional(),\n});\n","import { ApiClient } from \"../core/apiClient\";\nimport { itemsParamsSchema } from \"./validators\";\nimport { parseRawItemsToItems } from \"./parsers\";\nimport { GetItemsParams, ItemsRawResponse, ItemsWhere, Item } from \"./types\";\nimport { ApiResponse } from \"../core/types\";\n\nclass ItemsApi extends ApiClient {\n async getItems(params: GetItemsParams = {}): Promise<ApiResponse<Item[]>> {\n const validatedParams = itemsParamsSchema.safeParse(params);\n if (!validatedParams.success) {\n const errorMessage = this.handleApiError(\n validatedParams.error,\n \"getItems validation\"\n );\n return {\n data: [],\n totalDocs: 0,\n totalPages: 0,\n prevPage: null,\n nextPage: null,\n error: true,\n errorMessage,\n };\n }\n\n const cacheKey = this.cache.buildCacheKey(\"getItems\", validatedParams.data);\n return this.cache.cacheWrap(\n cacheKey,\n () => this.fetchItemsFromAPI(validatedParams.data),\n \"getItems\",\n validatedParams.data\n );\n }\n\n private async fetchItemsFromAPI(\n params: GetItemsParams\n ): Promise<ApiResponse<Item[]>> {\n if (!this.baseURL || !this.apiKey) {\n return {\n data: [],\n totalDocs: 0,\n totalPages: 0,\n prevPage: null,\n nextPage: null,\n error: true,\n errorMessage:\n \"SDK no configurado: PAKENTO_CMS_BASE_URL o PAKENTO_API_KEY faltantes.\",\n };\n }\n\n const query = `\n query GetEcommerceItems(\n $where: EcommerceItemsWhere\n $onlyOffers: Boolean\n $limit: Int\n $page: Int\n $search: String\n $sort: String\n $minPrice: Float\n $maxPrice: Float\n ) {\n GetEcommerceItems(\n where: $where\n onlyOffers: $onlyOffers\n limit: $limit\n page: $page\n search: $search\n sort: $sort\n minPrice: $minPrice\n maxPrice: $maxPrice\n ) {\n totalDocs\n totalPages\n prevPage\n nextPage\n docs {\n id\n name\n featured\n description\n url_safe_name\n\n item_super_category_id\n item_super_category_name\n\n item_category_id\n item_category_name\n\n cover_image_url\n cover_image_thumbnail_url\n\n price\n old_price\n price_notes\n price_text\n old_price_text\n currency_prefix\n\n brand_id\n brand_name\n\n master_attributes {\n id\n name\n values {\n id\n value\n }\n }\n\n variations {\n id\n name\n description\n\n cover_image_url\n cover_image_thumbnail_url\n\n price\n old_price\n price_notes\n price_text\n old_price_text\n currency_prefix\n\n attribute_values {\n attribute_id\n attribute_name\n value\n value_id\n }\n\n images {\n url\n thumbnail_url\n }\n }\n\n images {\n url\n thumbnail_url\n }\n }\n }\n }\n `;\n\n const whereConditions: ItemsWhere = {};\n if (params.where?.item_category_id?.equals) {\n whereConditions.item_category_id = {\n equals: params.where.item_category_id.equals,\n };\n }\n if (params.where?.item_super_category_id?.equals) {\n whereConditions.item_super_category_id = {\n equals: params.where.item_super_category_id.equals,\n };\n }\n if (params.where?.brand_id?.equals) {\n whereConditions.brand_id = { equals: params.where.brand_id.equals };\n }\n if (params.where?.id?.equals) {\n whereConditions.id = { equals: params.where.id.equals };\n }\n\n const variables = {\n ...params,\n where:\n Object.keys(whereConditions).length > 0 ? whereConditions : undefined,\n };\n\n const { data, error, errorMessage } =\n await this.fetchGraphQL<ItemsRawResponse>(\n query,\n variables,\n (responseData) => responseData.GetEcommerceItems\n );\n\n if (error) {\n return {\n data: [],\n totalDocs: 0,\n totalPages: 0,\n prevPage: null,\n nextPage: null,\n error: true,\n errorMessage,\n };\n }\n\n return {\n data: parseRawItemsToItems(data!.docs),\n totalDocs: data!.totalDocs,\n totalPages: data!.totalPages,\n prevPage: data!.prevPage,\n nextPage: data!.nextPage,\n error: false,\n errorMessage: null,\n };\n }\n}\n\nexport const itemsApi = new ItemsApi();\n","import { z } from \"zod\";\n\nexport const categoriesParamsSchema = z.object({\n where: z\n .object({\n item_super_category_id: z\n .object({ equals: z.string().optional() })\n .optional(),\n brand_id: z.object({ equals: z.string().optional() }).optional(),\n })\n .optional(),\n limit: z.coerce.number().optional(),\n page: z.coerce.number().optional(),\n sort: z.string().optional(),\n});\n","import { Category, CategoryEcommerceRaw } from \"./types\";\n\n/**\n * Parses a raw GraphQL response category to the normalized Category type\n * @param rawCategory - The raw category from GraphQL response\n * @returns Normalized Category object\n */\nexport function parseRawCategoryToCategory(\n rawCategory: CategoryEcommerceRaw\n): Category {\n return {\n id: rawCategory.id,\n name: rawCategory.name,\n image_url: rawCategory.image_url,\n };\n}\n\n/**\n * Parses an array of raw GraphQL response categories to normalized Category types\n * @param rawCategories - Array of raw categories from GraphQL response\n * @returns Array of normalized Category objects\n */\nexport function parseRawCategoriesToCategories(\n rawCategories: CategoryEcommerceRaw[]\n): Category[] {\n return rawCategories.map(parseRawCategoryToCategory);\n}\n","import { ApiClient } from \"../core/apiClient\";\nimport { categoriesParamsSchema } from \"./validators\";\nimport { parseRawCategoriesToCategories } from \"./parsers\";\nimport { GetCategoriesParams, CategoriesRawResponse, Category } from \"./types\";\nimport { ApiResponse } from \"../core/types\";\n\nclass CategoriesApi extends ApiClient {\n async getCategories(\n params: GetCategoriesParams = {}\n ): Promise<ApiResponse<Category[]>> {\n const validatedParams = categoriesParamsSchema.safeParse(params);\n if (!validatedParams.success) {\n const errorMessage = this.handleApiError(\n validatedParams.error,\n \"getCategories validation\"\n );\n return { data: [], error: true, errorMessage };\n }\n\n const cacheKey = this.cache.buildCacheKey(\n \"getCategories\",\n validatedParams.data\n );\n return this.cache.cacheWrap(\n cacheKey,\n () => this.fetchCategoriesFromAPI(validatedParams.data),\n \"getCategories\",\n validatedParams.data\n );\n }\n\n private async fetchCategoriesFromAPI(\n params: GetCategoriesParams\n ): Promise<ApiResponse<Category[]>> {\n if (!this.baseURL || !this.apiKey) {\n return {\n data: [],\n error: true,\n errorMessage:\n \"SDK no configurado: PAKENTO_CMS_BASE_URL o PAKENTO_API_KEY faltantes.\",\n };\n }\n\n const query = `\n query GetEcommerceCategories(\n $where: EcommerceCategoriesWhere\n $limit: Int\n $page: Int\n $sort: String\n ) {\n GetEcommerceCategories(\n where: $where\n limit: $limit\n page: $page\n sort: $sort\n ) {\n docs {\n id\n name\n image_url\n }\n }\n }\n `;\n\n const { data, error, errorMessage } =\n await this.fetchGraphQL<CategoriesRawResponse>(\n query,\n params,\n (responseData) => responseData.GetEcommerceCategories\n );\n\n if (error) {\n return { data: [], error: true, errorMessage };\n }\n\n return {\n data: parseRawCategoriesToCategories(data!.docs),\n error: false,\n errorMessage: null,\n };\n }\n}\n\nexport const categoriesApi = new CategoriesApi();\n","import { z } from \"zod\";\n\nexport const brandsParamsSchema = z.object({\n limit: z.coerce.number().optional(),\n page: z.coerce.number().optional(),\n sort: z.string().optional(),\n});\n","import { Brand, BrandEcommerceRaw } from \"./types\";\n\n/**\n * Parses a raw GraphQL response brand to the normalized Brand type\n * @param rawBrand - The raw brand from GraphQL response\n * @returns Normalized Brand object\n */\nexport function parseRawBrandToBrand(rawBrand: BrandEcommerceRaw): Brand {\n return {\n id: rawBrand.id,\n name: rawBrand.name,\n description: rawBrand.description,\n items_count: rawBrand.items_count,\n image_url: rawBrand.image_url,\n image_thumbnail_url: rawBrand.image_thumbnail_url,\n };\n}\n\n/**\n * Parses an array of raw GraphQL response brands to normalized Brand types\n * @param rawBrands - Array of raw brands from GraphQL response\n * @returns Array of normalized Brand objects\n */\nexport function parseRawBrandsToBrands(\n rawBrands: BrandEcommerceRaw[]\n): Brand[] {\n return rawBrands.map(parseRawBrandToBrand);\n}\n","import { ApiClient } from \"../core/apiClient\";\nimport { brandsParamsSchema } from \"./validators\";\nimport { parseRawBrandsToBrands } from \"./parsers\";\nimport { GetBrandsParams, BrandsRawResponse, Brand } from \"./types\";\nimport { ApiResponse } from \"../core/types\";\n\nclass BrandsApi extends ApiClient {\n async getBrands(params: GetBrandsParams = {}): Promise<ApiResponse<Brand[]>> {\n const validatedParams = brandsParamsSchema.safeParse(params);\n if (!validatedParams.success) {\n const errorMessage = this.handleApiError(\n validatedParams.error,\n \"getBrands validation\"\n );\n return {\n data: [],\n totalDocs: 0,\n totalPages: 0,\n prevPage: null,\n nextPage: null,\n error: true,\n errorMessage,\n };\n }\n\n const cacheKey = this.cache.buildCacheKey(\n \"getBrands\",\n validatedParams.data\n );\n return this.cache.cacheWrap(\n cacheKey,\n () => this.fetchBrandsFromAPI(validatedParams.data),\n \"getBrands\",\n validatedParams.data\n );\n }\n\n private async fetchBrandsFromAPI(\n params: GetBrandsParams\n ): Promise<ApiResponse<Brand[]>> {\n if (!this.baseURL || !this.apiKey) {\n return {\n data: [],\n totalDocs: 0,\n totalPages: 0,\n prevPage: null,\n nextPage: null,\n error: true,\n errorMessage:\n \"SDK no configurado: PAKENTO_CMS_BASE_URL o PAKENTO_API_KEY faltantes.\",\n };\n }\n\n const query = `\n query GetEcommerceBrands(\n $limit: Int\n $page: Int\n $sort: String\n ) {\n GetEcommerceBrands(\n limit: $limit\n page: $page\n sort: $sort\n ) {\n totalDocs\n totalPages\n prevPage\n nextPage\n docs {\n id\n name\n description\n items_count\n image_url\n image_thumbnail_url\n }\n }\n }\n `;\n\n const { data, error, errorMessage } =\n await this.fetchGraphQL<BrandsRawResponse>(\n query,\n params,\n (responseData) => responseData.GetEcommerceBrands\n );\n\n if (error) {\n return {\n data: [],\n totalDocs: 0,\n totalPages: 0,\n prevPage: null,\n nextPage: null,\n error: true,\n errorMessage,\n };\n }\n\n return {\n data: parseRawBrandsToBrands(data!.docs),\n totalDocs: data!.totalDocs,\n totalPages: data!.totalPages,\n prevPage: data!.prevPage,\n nextPage: data!.nextPage,\n error: false,\n errorMessage: null,\n };\n }\n}\n\nexport const brandsApi = new BrandsApi();\n","import { Entity, EntityEcommerceRaw } from \"./types\";\n\n/**\n * Parses a raw GraphQL response entity to the normalized Entity type\n * @param rawEntity - The raw entity from GraphQL response\n * @returns Normalized Entity object\n */\nexport function parseRawEntityToEntity(rawEntity: EntityEcommerceRaw): Entity {\n return {\n id: rawEntity.id,\n tin: rawEntity.tin,\n name: rawEntity.name,\n web: rawEntity.web,\n address: rawEntity.address,\n country: rawEntity.country,\n city: rawEntity.city,\n currency_id: rawEntity.currency_id,\n currency_name: rawEntity.currency_name,\n currency_prefix: rawEntity.currency_prefix,\n currency_suffix: rawEntity.currency_suffix,\n logo_url: rawEntity.logo_url,\n logo_alt: rawEntity.logo_alt,\n logo_thumbnail_url: rawEntity.logo_thumbnail_url,\n logo_sizes_thumbnail_filename: rawEntity.logo_sizes_thumbnail_filename,\n logo_filename: rawEntity.logo_filename,\n logo_width: rawEntity.logo_width,\n logo_height: rawEntity.logo_height,\n logo_2_url: rawEntity.logo_2_url,\n logo_2_alt: rawEntity.logo_2_alt,\n logo_2_thumbnail_url: rawEntity.logo_2_thumbnail_url,\n logo_2_sizes_thumbnail_filename: rawEntity.logo_2_sizes_thumbnail_filename,\n logo_2_filename: rawEntity.logo_2_filename,\n logo_2_width: rawEntity.logo_2_width,\n logo_2_height: rawEntity.logo_2_height,\n featured_image_url: rawEntity.featured_image_url,\n featured_image_thumbnail_url: rawEntity.featured_image_thumbnail_url,\n featured_image_sizes_thumbnail_filename:\n rawEntity.featured_image_sizes_thumbnail_filename,\n featured_image_filename: rawEntity.featured_image_filename,\n featured_image_width: rawEntity.featured_image_width,\n featured_image_height: rawEntity.featured_image_height,\n };\n}\n","import { ApiClient } from \"../core/apiClient\";\nimport { parseRawEntityToEntity } from \"./parsers\";\nimport { GetEntityParams, EntityRawResponse, Entity } from \"./types\";\nimport { ApiResponse } from \"../core/types\";\n\nclass EntityApi extends ApiClient {\n async getEntity(params: GetEntityParams = {}): Promise<ApiResponse<Entity>> {\n const cacheKey = this.cache.buildCacheKey(\"getEntity\", params);\n return this.cache.cacheWrap(\n cacheKey,\n () => this.fetchEntityFromAPI(params),\n \"getEntity\",\n params\n );\n }\n\n private async fetchEntityFromAPI(\n params: GetEntityParams\n ): Promise<ApiResponse<Entity>> {\n if (!this.baseURL || !this.apiKey) {\n return {\n data: null,\n error: true,\n errorMessage:\n \"SDK no configurado: PAKENTO_CMS_BASE_URL o PAKENTO_API_KEY faltantes.\",\n };\n }\n\n const query = `\n query GetEntity {\n GetEntity {\n id\n tin\n name\n web\n address\n country\n city\n currency_id\n currency_name\n currency_prefix\n currency_suffix\n logo_url\n logo_alt\n logo_thumbnail_url\n logo_sizes_thumbnail_filename\n logo_filename\n logo_width\n logo_height\n logo_2_url\n logo_2_alt\n logo_2_thumbnail_url\n logo_2_sizes_thumbnail_filename\n logo_2_filename\n logo_2_width\n logo_2_height\n featured_image_url\n featured_image_thumbnail_url\n featured_image_sizes_thumbnail_filename\n featured_image_filename\n featured_image_width\n featured_image_height\n }\n }\n `;\n\n const { data, error, errorMessage } =\n await this.fetchGraphQL<EntityRawResponse>(\n query,\n params,\n (responseData) => responseData\n );\n\n if (error) {\n return { data: null, error: true, errorMessage };\n }\n\n return {\n data: parseRawEntityToEntity(data!.GetEntity),\n error: false,\n errorMessage: null,\n };\n }\n}\n\nexport const entityApi = new EntityApi();\n","import { z } from \"zod\";\n\nexport const orderSchema = z.object({\n name: z.string().min(1),\n email: z.string().email(),\n phone: z.string().optional(),\n notes: z.string().optional(),\n tin: z.string().optional(),\n items: z\n .array(\n z.object({ id: z.number().positive(), quantity: z.number().positive() })\n )\n .min(1),\n delivery_address: z.string().optional(),\n delivery_instructions: z.string().optional(),\n payment_method: z.enum([\"cash\", \"transfer\"]).optional(),\n});\n","import { ApiClient } from \"../core/apiClient\";\nimport { orderSchema } from \"./validators\";\nimport {\n CreateEcommerceOrderParams,\n CreateEcommerceOrderResponse,\n} from \"./types\";\n\nclass OrdersApi extends ApiClient {\n async createEcommerceOrder(\n params: CreateEcommerceOrderParams\n ): Promise<CreateEcommerceOrderResponse> {\n if (!this.baseURL || !this.apiKey) {\n return {\n message: \"SDK no configurado\",\n error: true,\n errorMessage: \"SDK no configurado\",\n };\n }\n\n const validated = orderSchema.safeParse(params);\n if (!validated.success) {\n const errorMessage = this.handleApiError(\n validated.error,\n \"createEcommerceOrder validation\"\n );\n return { message: errorMessage, error: true, errorMessage };\n }\n\n try {\n const response = await this.client.post(\n \"/api/orders/create-ecommerce-order\",\n validated.data\n );\n\n if (response.status === 200) {\n return {\n message: response.data.message || \"Orden creada exitosamente\",\n order_id: response.data.order_id,\n error: false,\n errorMessage: null,\n };\n } else {\n const errorMessage = response.data.message || \"Error al crear la orden\";\n return { message: errorMessage, error: true, errorMessage };\n }\n } catch (error) {\n const errorMessage = this.handleApiError(error, \"createEcommerceOrder\");\n return { message: errorMessage, error: true, errorMessage };\n }\n }\n}\n\nexport const ordersApi = new OrdersApi();\n","import { z } from \"zod\";\n\nexport const contactUsSchema = z.object({\n name: z.string().min(1),\n email: z.string().email(),\n phone: z.string().optional(),\n subject: z.string().optional(),\n notes: z.string().min(1),\n});\n","import { ApiClient } from \"../core/apiClient\";\nimport { contactUsSchema } from \"./validators\";\nimport { SendContactUsEmailParams, SendContactUsEmailResponse } from \"./types\";\n\nclass ContactApi extends ApiClient {\n async sendContactUsEmail(\n params: SendContactUsEmailParams\n ): Promise<SendContactUsEmailResponse> {\n if (!this.baseURL || !this.apiKey) {\n return {\n message: \"SDK no configurado\",\n error: true,\n errorMessage: \"SDK no configurado\",\n };\n }\n\n const validated = contactUsSchema.safeParse(params);\n if (!validated.success) {\n const errorMessage = this.handleApiError(\n validated.error,\n \"sendContactUsEmail validation\"\n );\n return { message: errorMessage, error: true, errorMessage };\n }\n\n try {\n const response = await this.client.post(\n \"/api/entities/send-contact-us-email\",\n validated.data\n );\n\n if (response.status === 200) {\n return {\n message: response.data.message || \"Mensaje enviado exitosamente\",\n error: false,\n errorMessage: null,\n };\n } else {\n const errorMessage =\n response.data.message || \"Error al enviar el mensaje\";\n return { message: errorMessage, error: true, errorMessage };\n }\n } catch (error) {\n const errorMessage = this.handleApiError(error, \"sendContactUsEmail\");\n return { message: errorMessage, error: true, errorMessage };\n }\n }\n}\n\nexport const contactApi = new ContactApi();\n","import { ApiClient } from \"../core/apiClient\";\nimport { CustomGraphQLParams, CustomGraphQLResponse } from \"./types\";\n\nclass CustomApi extends ApiClient {\n async executeCustomQuery<T>(\n params: CustomGraphQLParams\n ): Promise<CustomGraphQLResponse<T>> {\n if (!this.baseURL || !this.apiKey) {\n return {\n data: null as T,\n error: true,\n errorMessage:\n \"SDK no configurado: PAKENTO_CMS_BASE_URL o PAKENTO_API_KEY faltantes.\",\n };\n }\n\n if (\n !params.query ||\n typeof params.query !== \"string\" ||\n params.query.trim() === \"\"\n ) {\n return {\n data: null as T,\n error: true,\n errorMessage: \"Se requiere un query GraphQL válido.\",\n };\n }\n\n try {\n const response = await this.client.post(\"/api/graphql\", {\n query: params.query,\n variables: params.variables || {},\n });\n\n if (response.data.errors && response.data.errors.length > 0) {\n return {\n data: response.data.data || (null as T),\n errors: response.data.errors,\n error: true,\n errorMessage: `GraphQL Errors: ${response.data.errors\n .map((err: { message: string }) => err.message)\n .join(\", \")}`,\n };\n }\n\n return {\n data: response.data.data,\n error: false,\n errorMessage: null,\n };\n } catch (error) {\n const errorMessage = this.handleApiError(error, \"Custom GraphQL\");\n return { data: null as T, error: true, errorMessage };\n }\n }\n}\n\nexport const customApi = new CustomApi();\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,mBAAiD;AACjD,iBAAkB;;;ACDlB,mBAAsB;AAEf,IAAM,eAAN,MAAmB;AAAA;AAAA,EAKxB,YAAY,QAAgB;AAF5B,SAAQ,aAAqB;AAG3B,SAAK,aAAa,OAAO,UAAU,GAAG,CAAC;AAEvC,QACE,QAAQ,IAAI,0BACZ,QAAQ,IAAI,0BACZ;AACA,WAAK,QAAQ,IAAI,mBAAM;AAAA,QACrB,KAAK,QAAQ,IAAI;AAAA,QACjB,OAAO,QAAQ,IAAI;AAAA,MACrB,CAAC;AAAA,IACH;AAAA,EACF;AAAA,EAEQ,mBAAmB,QAAyC;AAClE,UAAM,eAAe,KAAK,UAAU,MAAM;AAC1C,WAAO,KAAK,YAAY;AAAA,EAC1B;AAAA,EAEO,cACL,cACA,SAAkC,CAAC,GAC3B;AACR,UAAM,aAAa,KAAK,mBAAmB,EAAE,GAAG,QAAQ,aAAa,CAAC;AACtE,WAAO,WAAW,KAAK,UAAU,IAAI,UAAU;AAAA,EACjD;AAAA,EAEA,MAAa,UACX,KACA,SACA,cACA,SACY;AACZ,QAAI,CAAC,KAAK,OAAO;AACf,aAAO,QAAQ;AAAA,IACjB;AAEA,QAAI,SAAwB;AAC5B,QAAI;AACF,eAAS,MAAM,KAAK,MAAM,IAAI,GAAG;AAEjC,UAAI,OAAO,WAAW,YAAY,WAAW,MAAM;AACjD,gBAAQ,IAAI,sCAAiC,GAAG;AAChD,eAAO;AAAA,MACT;AAEA,UAAI,QAAQ;AACV,gBAAQ,IAAI,sCAAiC,GAAG;AAChD,eAAO,KAAK,MAAM,MAAgB;AAAA,MACp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ACF,YAAM,WAAW,MAAM,KAAK,OAAO,KAAK,gBAAgB;AAAA,QACtD,OAAO,OAAO;AAAA,QACd,WAAW,OAAO,aAAa,CAAC;AAAA,MAClC,CAAC;AAED,UAAI,SAAS,KAAK,UAAU,SAAS,KAAK,OAAO,SAAS,GAAG;AAC3D,eAAO;AAAA,UACL,MAAM,SAAS,KAAK,QAAS;AAAA,UAC7B,QAAQ,SAAS,KAAK;AAAA,UACtB,OAAO;AAAA,UACP,cAAc,mBAAmB,SAAS,KAAK,OAC5C,IAAI,CAAC,QAA6B,IAAI,OAAO,EAC7C,KAAK,IAAI,CAAC;AAAA,QACf;AAAA,MACF;AAEA,aAAO;AAAA,QACL,MAAM,SAAS,KAAK;AAAA,QACpB,OAAO;AAAA,QACP,cAAc;AAAA,MAChB;AAAA,IACF,SAAS,OAAO;AACd,YAAM,eAAe,KAAK,eAAe,OAAO,gBAAgB;AAChE,aAAO,EAAE,MAAM,MAAW,OAAO,MAAM,aAAa;AAAA,IACtD;AAAA,EACF;AACF;AAEO,IAAM,YAAY,IAAI,UAAU;","names":["axios","import_zod","import_zod","import_zod","import_zod","import_zod"]}
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/api/core/apiClient.ts","../src/api/core/cache.ts","../src/api/items/parsers.ts","../src/api/items/validators.ts","../src/api/items/api.ts","../src/api/categories/validators.ts","../src/api/categories/parsers.ts","../src/api/categories/api.ts","../src/api/brands/validators.ts","../src/api/brands/parsers.ts","../src/api/brands/api.ts","../src/api/entity/parsers.ts","../src/api/entity/api.ts","../src/api/orders/validators.ts","../src/api/orders/api.ts","../src/api/contact/validators.ts","../src/api/contact/api.ts","../src/api/custom/api.ts"],"sourcesContent":["// Core\nexport { ApiClient } from \"./api/core/apiClient\";\n\n// Cache\nexport { CacheService } from \"./api/core/cache\";\n\n// Items\nexport { itemsApi } from \"./api/items\";\n\n// Categories\nexport { categoriesApi } from \"./api/categories\";\n\n// Brands\nexport { brandsApi } from \"./api/brands\";\n\n// Entity\nexport { entityApi } from \"./api/entity\";\n\n// Orders\nexport { ordersApi } from \"./api/orders\";\n\n// Contact\nexport { contactApi } from \"./api/contact\";\n\n// Custom\nexport { customApi } from \"./api/custom\";\n\n// Types (re-export if needed)\nexport * from \"./api/items/types\";\nexport * from \"./api/categories/types\";\nexport * from \"./api/brands/types\";\nexport * from \"./api/entity/types\";\nexport * from \"./api/orders/types\";\nexport * from \"./api/contact/types\";\nexport * from \"./api/custom/types\";\nexport * from \"./api/core/types\";\n","import axios, { AxiosInstance, AxiosError } from \"axios\";\nimport { z } from \"zod\";\nimport { CacheService } from \"./cache\";\n\nexport class ApiClient {\n protected client: AxiosInstance;\n protected cache: CacheService;\n protected baseURL: string;\n protected apiKey: string;\n\n constructor() {\n this.baseURL = process.env.PAKENTO_CMS_BASE_URL || \"\";\n this.apiKey = process.env.PAKENTO_API_KEY || \"\";\n this.cache = new CacheService(this.apiKey);\n\n this.client = axios.create({\n baseURL: this.baseURL,\n headers: {\n \"Content-Type\": \"application/json\",\n Authorization: `users API-Key ${this.apiKey}`,\n },\n });\n\n this.client.interceptors.request.use(\n (config) => {\n const fullUrl = `${config.baseURL}${config.url}`;\n console.log(`🌐 API Call: ${config.method?.toUpperCase()} ${fullUrl}`);\n return config;\n },\n (error) => Promise.reject(error)\n );\n }\n\n protected handleApiError(error: unknown, context: string): string {\n if (error instanceof AxiosError) {\n const status = error.response?.status;\n const responseMessage = error.response?.data?.message;\n if (status === 401) return \"API Key inválida o expirada\";\n if (status === 404) return `${context} no encontrado`;\n if (status && status >= 500) return \"Error del servidor CMS\";\n return (\n responseMessage || `Error de conexión en ${context}: ${error.message}`\n );\n } else if (error instanceof z.ZodError) {\n return `Validación fallida: ${error.issues\n .map((e) => e.message)\n .join(\", \")}`;\n } else if (error instanceof Error) {\n return error.message;\n }\n return \"Error desconocido\";\n }\n\n protected async fetchGraphQL<T>(\n query: string,\n variables: any,\n extractData: (responseData: any) => T\n ): Promise<{ data: T | null; error: boolean; errorMessage: string | null }> {\n try {\n const response = await this.client.post(\"/api/graphql\", {\n query,\n variables,\n });\n if (response.data.errors) {\n const errorMessage = `GraphQL Error: ${response.data.errors[0].message}`;\n return { data: null, error: true, errorMessage };\n }\n const data = extractData(response.data.data);\n return { data, error: false, errorMessage: null };\n } catch (error) {\n const errorMessage = this.handleApiError(error, \"GraphQL query\");\n return { data: null, error: true, errorMessage };\n }\n }\n}\n","import { Redis } from \"@upstash/redis\";\n\nexport class CacheService {\n private redis?: Redis;\n private apiKeyHash: string;\n private defaultTTL: number = 172800; // 48 hours\n\n constructor(apiKey: string) {\n this.apiKeyHash = apiKey.substring(0, 8);\n\n if (\n process.env.UPSTASH_REDIS_REST_URL &&\n process.env.UPSTASH_REDIS_REST_TOKEN\n ) {\n this.redis = new Redis({\n url: process.env.UPSTASH_REDIS_REST_URL,\n token: process.env.UPSTASH_REDIS_REST_TOKEN,\n });\n }\n }\n\n private generateParamsHash(params: Record<string, unknown>): string {\n const paramsString = JSON.stringify(params);\n return btoa(paramsString);\n }\n\n public buildCacheKey(\n functionName: string,\n params: Record<string, unknown> = {}\n ): string {\n const paramsHash = this.generateParamsHash({ ...params, functionName });\n return `pakento:${this.apiKeyHash}:${paramsHash}`;\n }\n\n public async cacheWrap<T>(\n key: string,\n fetcher: () => Promise<T>,\n functionName: string,\n filters?: Record<string, unknown>\n ): Promise<T> {\n if (!this.redis) {\n return fetcher();\n }\n\n let cached: string | null = null;\n try {\n cached = await this.redis.get(key);\n\n if (typeof cached === \"object\" && cached !== null) {\n console.log(\"[Cache] ✅ Reading from cache:\", key);\n return cached as T;\n }\n\n if (cached) {\n console.log(\"[Cache] ✅ Reading from cache:\", key);\n return JSON.parse(cached as string) as T;\n }\n } catch (err) {\n console.warn(\"[Cache] ❌ Error reading from cache:\", err);\n console.log(`[Cache] ❌ Key: ${key}, type: ${typeof cached}`);\n }\n\n const result = await fetcher();\n\n try {\n // Crear objeto de caché con datos y filtros para visualización\n const cacheData = {\n _function: functionName,\n _filters: filters || {},\n _cachedAt: new Date().toISOString(),\n ...result,\n };\n\n console.log(\"[Cache] ✅ Writing to cache:\", key);\n await this.redis.set(key, JSON.stringify(cacheData), {\n ex: this.defaultTTL,\n });\n } catch (err) {\n console.warn(\"[Cache] ❌ Error writing to cache:\", err);\n }\n\n return result;\n }\n\n public async clearAllCache(): Promise<boolean> {\n if (!this.redis) {\n console.warn(\"[Cache] ❌ Redis no configurado\");\n return false;\n }\n\n try {\n const pattern = `pakento:${this.apiKeyHash}:*`;\n const keys = await this.redis.keys(pattern);\n\n if (keys.length > 0) {\n await this.redis.del(...keys);\n console.log(\"[Cache] ✅ Cache limpiado\");\n }\n\n return true;\n } catch (err) {\n console.warn(\"[Cache] ❌ Error limpiando todo el cache\", err);\n return false;\n }\n }\n}\n","import { Item, ItemEcommerceRaw } from \"./types\";\n\n/**\n * Parses a raw GraphQL response item to the normalized Item type\n * @param rawItem - The raw item from GraphQL response\n * @returns Normalized Item object\n */\nexport function parseRawItemToItem(rawItem: ItemEcommerceRaw): Item {\n const images = rawItem.images.map((img) => ({\n url: img.url,\n thumbnail_url: img.thumbnail_url,\n }));\n\n const variations = rawItem.variations.map((v) => ({\n id: v.id,\n name: v.name,\n description: v.description,\n cover_image_url: v.cover_image_url,\n cover_image_thumbnail_url: v.cover_image_thumbnail_url,\n price: v.price,\n old_price: v.old_price,\n price_notes: v.price_notes,\n price_text: v.price_text,\n old_price_text: v.old_price_text,\n currency_prefix: v.currency_prefix,\n attribute_values: v.attribute_values,\n images: v.images.map((img) => ({\n url: img.url,\n thumbnail_url: img.thumbnail_url,\n })),\n }));\n\n return {\n id: rawItem.id,\n name: rawItem.name,\n featured: rawItem.featured,\n url_safe_name: rawItem.url_safe_name,\n currency_prefix: rawItem.currency_prefix,\n description: rawItem.description,\n old_price: rawItem.old_price,\n item_category_name: rawItem.item_category_name,\n item_category_id: parseInt(rawItem.item_category_id || \"0\", 10),\n item_super_category_name: rawItem.item_super_category_name,\n item_super_category_id: parseInt(rawItem.item_super_category_id || \"0\", 10),\n price_text: rawItem.price_text,\n old_price_text: rawItem.old_price_text,\n price_notes: rawItem.price_notes,\n price: rawItem.price,\n brand_id: parseInt(rawItem.brand_id || \"0\", 10),\n brand_name: rawItem.brand_name,\n cover_image_url: rawItem.cover_image_url,\n cover_image_thumbnail_url: rawItem.cover_image_thumbnail_url,\n images,\n master_attributes: rawItem.master_attributes,\n variations,\n };\n}\n\n/**\n * Parses an array of raw GraphQL response items to normalized Item types\n * @param rawItems - Array of raw items from GraphQL response\n * @returns Array of normalized Item objects\n */\nexport function parseRawItemsToItems(rawItems: ItemEcommerceRaw[]): Item[] {\n return rawItems.map(parseRawItemToItem);\n}\n","import { z } from \"zod\";\n\nexport const itemsParamsSchema = z.object({\n where: z\n .object({\n item_category_id: z.object({ equals: z.string().optional() }).optional(),\n item_super_category_id: z\n .object({ equals: z.string().optional() })\n .optional(),\n brand_id: z.object({ equals: z.string().optional() }).optional(),\n id: z.object({ equals: z.string().optional() }).optional(),\n })\n .optional(),\n onlyOffers: z.boolean().optional(),\n limit: z.coerce.number().optional(),\n page: z.coerce.number().optional(),\n search: z.string().optional(),\n sort: z.string().optional(),\n minPrice: z.coerce.number().optional(),\n maxPrice: z.coerce.number().optional(),\n});\n","import { ApiClient } from \"../core/apiClient\";\nimport { itemsParamsSchema } from \"./validators\";\nimport { parseRawItemsToItems } from \"./parsers\";\nimport { GetItemsParams, ItemsRawResponse, ItemsWhere, Item } from \"./types\";\nimport { ApiResponse } from \"../core/types\";\n\nclass ItemsApi extends ApiClient {\n async getItems(params: GetItemsParams = {}): Promise<ApiResponse<Item[]>> {\n const validatedParams = itemsParamsSchema.safeParse(params);\n if (!validatedParams.success) {\n const errorMessage = this.handleApiError(\n validatedParams.error,\n \"getItems validation\"\n );\n return {\n data: [],\n totalDocs: 0,\n totalPages: 0,\n prevPage: null,\n nextPage: null,\n error: true,\n errorMessage,\n };\n }\n\n const cacheKey = this.cache.buildCacheKey(\"getItems\", validatedParams.data);\n return this.cache.cacheWrap(\n cacheKey,\n () => this.fetchItemsFromAPI(validatedParams.data),\n \"getItems\",\n validatedParams.data\n );\n }\n\n private async fetchItemsFromAPI(\n params: GetItemsParams\n ): Promise<ApiResponse<Item[]>> {\n if (!this.baseURL || !this.apiKey) {\n return {\n data: [],\n totalDocs: 0,\n totalPages: 0,\n prevPage: null,\n nextPage: null,\n error: true,\n errorMessage:\n \"SDK no configurado: PAKENTO_CMS_BASE_URL o PAKENTO_API_KEY faltantes.\",\n };\n }\n\n const query = `\n query GetEcommerceItems(\n $where: EcommerceItemsWhere\n $onlyOffers: Boolean\n $limit: Int\n $page: Int\n $search: String\n $sort: String\n $minPrice: Float\n $maxPrice: Float\n ) {\n GetEcommerceItems(\n where: $where\n onlyOffers: $onlyOffers\n limit: $limit\n page: $page\n search: $search\n sort: $sort\n minPrice: $minPrice\n maxPrice: $maxPrice\n ) {\n totalDocs\n totalPages\n prevPage\n nextPage\n docs {\n id\n name\n featured\n description\n url_safe_name\n\n item_super_category_id\n item_super_category_name\n\n item_category_id\n item_category_name\n\n cover_image_url\n cover_image_thumbnail_url\n\n price\n old_price\n price_notes\n price_text\n old_price_text\n currency_prefix\n\n brand_id\n brand_name\n\n master_attributes {\n id\n name\n values {\n id\n value\n }\n }\n\n variations {\n id\n name\n description\n\n cover_image_url\n cover_image_thumbnail_url\n\n price\n old_price\n price_notes\n price_text\n old_price_text\n currency_prefix\n\n attribute_values {\n attribute_id\n attribute_name\n value\n value_id\n }\n\n images {\n url\n thumbnail_url\n }\n }\n\n images {\n url\n thumbnail_url\n }\n }\n }\n }\n `;\n\n const whereConditions: ItemsWhere = {};\n if (params.where?.item_category_id?.equals) {\n whereConditions.item_category_id = {\n equals: params.where.item_category_id.equals,\n };\n }\n if (params.where?.item_super_category_id?.equals) {\n whereConditions.item_super_category_id = {\n equals: params.where.item_super_category_id.equals,\n };\n }\n if (params.where?.brand_id?.equals) {\n whereConditions.brand_id = { equals: params.where.brand_id.equals };\n }\n if (params.where?.id?.equals) {\n whereConditions.id = { equals: params.where.id.equals };\n }\n\n const variables = {\n ...params,\n where:\n Object.keys(whereConditions).length > 0 ? whereConditions : undefined,\n };\n\n const { data, error, errorMessage } =\n await this.fetchGraphQL<ItemsRawResponse>(\n query,\n variables,\n (responseData) => responseData.GetEcommerceItems\n );\n\n if (error) {\n return {\n data: [],\n totalDocs: 0,\n totalPages: 0,\n prevPage: null,\n nextPage: null,\n error: true,\n errorMessage,\n };\n }\n\n return {\n data: parseRawItemsToItems(data!.docs),\n totalDocs: data!.totalDocs,\n totalPages: data!.totalPages,\n prevPage: data!.prevPage,\n nextPage: data!.nextPage,\n error: false,\n errorMessage: null,\n };\n }\n}\n\nexport const itemsApi = new ItemsApi();\n","import { z } from \"zod\";\n\nexport const categoriesParamsSchema = z.object({\n where: z\n .object({\n item_super_category_id: z\n .object({ equals: z.string().optional() })\n .optional(),\n brand_id: z.object({ equals: z.string().optional() }).optional(),\n })\n .optional(),\n limit: z.coerce.number().optional(),\n page: z.coerce.number().optional(),\n sort: z.string().optional(),\n});\n","import { Category, CategoryEcommerceRaw } from \"./types\";\n\n/**\n * Parses a raw GraphQL response category to the normalized Category type\n * @param rawCategory - The raw category from GraphQL response\n * @returns Normalized Category object\n */\nexport function parseRawCategoryToCategory(\n rawCategory: CategoryEcommerceRaw\n): Category {\n return {\n id: rawCategory.id,\n name: rawCategory.name,\n image_url: rawCategory.image_url,\n };\n}\n\n/**\n * Parses an array of raw GraphQL response categories to normalized Category types\n * @param rawCategories - Array of raw categories from GraphQL response\n * @returns Array of normalized Category objects\n */\nexport function parseRawCategoriesToCategories(\n rawCategories: CategoryEcommerceRaw[]\n): Category[] {\n return rawCategories.map(parseRawCategoryToCategory);\n}\n","import { ApiClient } from \"../core/apiClient\";\nimport { categoriesParamsSchema } from \"./validators\";\nimport { parseRawCategoriesToCategories } from \"./parsers\";\nimport { GetCategoriesParams, CategoriesRawResponse, Category } from \"./types\";\nimport { ApiResponse } from \"../core/types\";\n\nclass CategoriesApi extends ApiClient {\n async getCategories(\n params: GetCategoriesParams = {}\n ): Promise<ApiResponse<Category[]>> {\n const validatedParams = categoriesParamsSchema.safeParse(params);\n if (!validatedParams.success) {\n const errorMessage = this.handleApiError(\n validatedParams.error,\n \"getCategories validation\"\n );\n return { data: [], error: true, errorMessage };\n }\n\n const cacheKey = this.cache.buildCacheKey(\n \"getCategories\",\n validatedParams.data\n );\n return this.cache.cacheWrap(\n cacheKey,\n () => this.fetchCategoriesFromAPI(validatedParams.data),\n \"getCategories\",\n validatedParams.data\n );\n }\n\n private async fetchCategoriesFromAPI(\n params: GetCategoriesParams\n ): Promise<ApiResponse<Category[]>> {\n if (!this.baseURL || !this.apiKey) {\n return {\n data: [],\n error: true,\n errorMessage:\n \"SDK no configurado: PAKENTO_CMS_BASE_URL o PAKENTO_API_KEY faltantes.\",\n };\n }\n\n const query = `\n query GetEcommerceCategories(\n $where: EcommerceCategoriesWhere\n $limit: Int\n $page: Int\n $sort: String\n ) {\n GetEcommerceCategories(\n where: $where\n limit: $limit\n page: $page\n sort: $sort\n ) {\n docs {\n id\n name\n image_url\n }\n }\n }\n `;\n\n const { data, error, errorMessage } =\n await this.fetchGraphQL<CategoriesRawResponse>(\n query,\n params,\n (responseData) => responseData.GetEcommerceCategories\n );\n\n if (error) {\n return { data: [], error: true, errorMessage };\n }\n\n return {\n data: parseRawCategoriesToCategories(data!.docs),\n error: false,\n errorMessage: null,\n };\n }\n}\n\nexport const categoriesApi = new CategoriesApi();\n","import { z } from \"zod\";\n\nexport const brandsParamsSchema = z.object({\n limit: z.coerce.number().optional(),\n page: z.coerce.number().optional(),\n sort: z.string().optional(),\n});\n","import { Brand, BrandEcommerceRaw } from \"./types\";\n\n/**\n * Parses a raw GraphQL response brand to the normalized Brand type\n * @param rawBrand - The raw brand from GraphQL response\n * @returns Normalized Brand object\n */\nexport function parseRawBrandToBrand(rawBrand: BrandEcommerceRaw): Brand {\n return {\n id: rawBrand.id,\n name: rawBrand.name,\n description: rawBrand.description,\n items_count: rawBrand.items_count,\n image_url: rawBrand.image_url,\n image_thumbnail_url: rawBrand.image_thumbnail_url,\n };\n}\n\n/**\n * Parses an array of raw GraphQL response brands to normalized Brand types\n * @param rawBrands - Array of raw brands from GraphQL response\n * @returns Array of normalized Brand objects\n */\nexport function parseRawBrandsToBrands(\n rawBrands: BrandEcommerceRaw[]\n): Brand[] {\n return rawBrands.map(parseRawBrandToBrand);\n}\n","import { ApiClient } from \"../core/apiClient\";\nimport { brandsParamsSchema } from \"./validators\";\nimport { parseRawBrandsToBrands } from \"./parsers\";\nimport { GetBrandsParams, BrandsRawResponse, Brand } from \"./types\";\nimport { ApiResponse } from \"../core/types\";\n\nclass BrandsApi extends ApiClient {\n async getBrands(params: GetBrandsParams = {}): Promise<ApiResponse<Brand[]>> {\n const validatedParams = brandsParamsSchema.safeParse(params);\n if (!validatedParams.success) {\n const errorMessage = this.handleApiError(\n validatedParams.error,\n \"getBrands validation\"\n );\n return {\n data: [],\n totalDocs: 0,\n totalPages: 0,\n prevPage: null,\n nextPage: null,\n error: true,\n errorMessage,\n };\n }\n\n const cacheKey = this.cache.buildCacheKey(\n \"getBrands\",\n validatedParams.data\n );\n return this.cache.cacheWrap(\n cacheKey,\n () => this.fetchBrandsFromAPI(validatedParams.data),\n \"getBrands\",\n validatedParams.data\n );\n }\n\n private async fetchBrandsFromAPI(\n params: GetBrandsParams\n ): Promise<ApiResponse<Brand[]>> {\n if (!this.baseURL || !this.apiKey) {\n return {\n data: [],\n totalDocs: 0,\n totalPages: 0,\n prevPage: null,\n nextPage: null,\n error: true,\n errorMessage:\n \"SDK no configurado: PAKENTO_CMS_BASE_URL o PAKENTO_API_KEY faltantes.\",\n };\n }\n\n const query = `\n query GetEcommerceBrands(\n $limit: Int\n $page: Int\n $sort: String\n ) {\n GetEcommerceBrands(\n limit: $limit\n page: $page\n sort: $sort\n ) {\n totalDocs\n totalPages\n prevPage\n nextPage\n docs {\n id\n name\n description\n items_count\n image_url\n image_thumbnail_url\n }\n }\n }\n `;\n\n const { data, error, errorMessage } =\n await this.fetchGraphQL<BrandsRawResponse>(\n query,\n params,\n (responseData) => responseData.GetEcommerceBrands\n );\n\n if (error) {\n return {\n data: [],\n totalDocs: 0,\n totalPages: 0,\n prevPage: null,\n nextPage: null,\n error: true,\n errorMessage,\n };\n }\n\n return {\n data: parseRawBrandsToBrands(data!.docs),\n totalDocs: data!.totalDocs,\n totalPages: data!.totalPages,\n prevPage: data!.prevPage,\n nextPage: data!.nextPage,\n error: false,\n errorMessage: null,\n };\n }\n}\n\nexport const brandsApi = new BrandsApi();\n","import { Entity, EntityEcommerceRaw } from \"./types\";\n\n/**\n * Parses a raw GraphQL response entity to the normalized Entity type\n * @param rawEntity - The raw entity from GraphQL response\n * @returns Normalized Entity object\n */\nexport function parseRawEntityToEntity(rawEntity: EntityEcommerceRaw): Entity {\n return {\n ...rawEntity,\n };\n}\n","import { ApiClient } from \"../core/apiClient\";\nimport { parseRawEntityToEntity } from \"./parsers\";\nimport { GetEntityParams, EntityRawResponse, Entity } from \"./types\";\nimport { ApiResponse } from \"../core/types\";\n\nclass EntityApi extends ApiClient {\n async getEntity(params: GetEntityParams = {}): Promise<ApiResponse<Entity>> {\n const cacheKey = this.cache.buildCacheKey(\"getEntity\", params);\n return this.cache.cacheWrap(\n cacheKey,\n () => this.fetchEntityFromAPI(params),\n \"getEntity\",\n params\n );\n }\n\n private async fetchEntityFromAPI(\n params: GetEntityParams\n ): Promise<ApiResponse<Entity>> {\n if (!this.baseURL || !this.apiKey) {\n return {\n data: null,\n error: true,\n errorMessage:\n \"SDK no configurado: PAKENTO_CMS_BASE_URL o PAKENTO_API_KEY faltantes.\",\n };\n }\n\n const query = `\n query GetEntity {\n Entities (limit: 1, trash: false) {\n docs {\n name\n address\n instagram\n facebook\n whatsapp_number\n tiktok\n youtube\n currency {\n prefix\n plural_name\n name\n }\n featured_image {\n thumbnailURL\n url\n width\n height\n }\n logo {\n thumbnailURL\n url\n width\n height\n }\n logo_2 {\n thumbnailURL\n url\n width\n height\n }\n }\n }\n }\n `;\n\n const { data, error, errorMessage } =\n await this.fetchGraphQL<EntityRawResponse>(\n query,\n params,\n (responseData) => responseData?.Entities\n );\n\n if (error) {\n return { data: null, error: true, errorMessage };\n }\n\n return {\n data: parseRawEntityToEntity(data!.docs[0]),\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 message: z.string().min(1),\n});\n","import { ApiClient } from \"../core/apiClient\";\nimport { contactUsSchema } from \"./validators\";\nimport { SendContactUsEmailParams, SendContactUsEmailResponse } from \"./types\";\n\nclass ContactApi extends ApiClient {\n async sendContactUsEmail(\n params: SendContactUsEmailParams\n ): Promise<SendContactUsEmailResponse> {\n if (!this.baseURL || !this.apiKey) {\n return {\n message: \"SDK no configurado\",\n error: true,\n errorMessage: \"SDK no configurado\",\n };\n }\n\n const validated = contactUsSchema.safeParse(params);\n if (!validated.success) {\n const errorMessage = this.handleApiError(\n validated.error,\n \"sendContactUsEmail validation\"\n );\n return { message: errorMessage, error: true, errorMessage };\n }\n\n try {\n const response = await this.client.post(\n \"/api/entities/send-contact-us-email\",\n validated.data\n );\n\n if (response.status === 200) {\n return {\n message: response.data.message || \"Mensaje enviado exitosamente\",\n error: false,\n errorMessage: null,\n };\n } else {\n const errorMessage =\n response.data.message || \"Error al enviar el mensaje\";\n return { message: errorMessage, error: true, errorMessage };\n }\n } catch (error) {\n const errorMessage = this.handleApiError(error, \"sendContactUsEmail\");\n return { message: errorMessage, error: true, errorMessage };\n }\n }\n}\n\nexport const contactApi = new ContactApi();\n","import { ApiClient } from \"../core/apiClient\";\nimport { CustomGraphQLParams, CustomGraphQLResponse } from \"./types\";\n\nclass CustomApi extends ApiClient {\n async executeCustomQuery<T>(\n params: CustomGraphQLParams\n ): Promise<CustomGraphQLResponse<T>> {\n if (!this.baseURL || !this.apiKey) {\n return {\n data: null as T,\n error: true,\n errorMessage:\n \"SDK no configurado: PAKENTO_CMS_BASE_URL o PAKENTO_API_KEY faltantes.\",\n };\n }\n\n if (\n !params.query ||\n typeof params.query !== \"string\" ||\n params.query.trim() === \"\"\n ) {\n return {\n data: null as T,\n error: true,\n errorMessage: \"Se requiere un query GraphQL válido.\",\n };\n }\n\n try {\n const response = await this.client.post(\"/api/graphql\", {\n query: params.query,\n variables: params.variables || {},\n });\n\n if (response.data.errors && response.data.errors.length > 0) {\n return {\n data: response.data.data || (null as T),\n errors: response.data.errors,\n error: true,\n errorMessage: `GraphQL Errors: ${response.data.errors\n .map((err: { message: string }) => err.message)\n .join(\", \")}`,\n };\n }\n\n return {\n data: response.data.data,\n error: false,\n errorMessage: null,\n };\n } catch (error) {\n const errorMessage = this.handleApiError(error, \"Custom GraphQL\");\n return { data: null as T, error: true, errorMessage };\n }\n }\n}\n\nexport const customApi = new CustomApi();\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,mBAAiD;AACjD,iBAAkB;;;ACDlB,mBAAsB;AAEf,IAAM,eAAN,MAAmB;AAAA;AAAA,EAKxB,YAAY,QAAgB;AAF5B,SAAQ,aAAqB;AAG3B,SAAK,aAAa,OAAO,UAAU,GAAG,CAAC;AAEvC,QACE,QAAQ,IAAI,0BACZ,QAAQ,IAAI,0BACZ;AACA,WAAK,QAAQ,IAAI,mBAAM;AAAA,QACrB,KAAK,QAAQ,IAAI;AAAA,QACjB,OAAO,QAAQ,IAAI;AAAA,MACrB,CAAC;AAAA,IACH;AAAA,EACF;AAAA,EAEQ,mBAAmB,QAAyC;AAClE,UAAM,eAAe,KAAK,UAAU,MAAM;AAC1C,WAAO,KAAK,YAAY;AAAA,EAC1B;AAAA,EAEO,cACL,cACA,SAAkC,CAAC,GAC3B;AACR,UAAM,aAAa,KAAK,mBAAmB,EAAE,GAAG,QAAQ,aAAa,CAAC;AACtE,WAAO,WAAW,KAAK,UAAU,IAAI,UAAU;AAAA,EACjD;AAAA,EAEA,MAAa,UACX,KACA,SACA,cACA,SACY;AACZ,QAAI,CAAC,KAAK,OAAO;AACf,aAAO,QAAQ;AAAA,IACjB;AAEA,QAAI,SAAwB;AAC5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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
|
@@ -607,37 +607,7 @@ var brandsApi = new BrandsApi();
|
|
|
607
607
|
// src/api/entity/parsers.ts
|
|
608
608
|
function parseRawEntityToEntity(rawEntity) {
|
|
609
609
|
return {
|
|
610
|
-
|
|
611
|
-
tin: rawEntity.tin,
|
|
612
|
-
name: rawEntity.name,
|
|
613
|
-
web: rawEntity.web,
|
|
614
|
-
address: rawEntity.address,
|
|
615
|
-
country: rawEntity.country,
|
|
616
|
-
city: rawEntity.city,
|
|
617
|
-
currency_id: rawEntity.currency_id,
|
|
618
|
-
currency_name: rawEntity.currency_name,
|
|
619
|
-
currency_prefix: rawEntity.currency_prefix,
|
|
620
|
-
currency_suffix: rawEntity.currency_suffix,
|
|
621
|
-
logo_url: rawEntity.logo_url,
|
|
622
|
-
logo_alt: rawEntity.logo_alt,
|
|
623
|
-
logo_thumbnail_url: rawEntity.logo_thumbnail_url,
|
|
624
|
-
logo_sizes_thumbnail_filename: rawEntity.logo_sizes_thumbnail_filename,
|
|
625
|
-
logo_filename: rawEntity.logo_filename,
|
|
626
|
-
logo_width: rawEntity.logo_width,
|
|
627
|
-
logo_height: rawEntity.logo_height,
|
|
628
|
-
logo_2_url: rawEntity.logo_2_url,
|
|
629
|
-
logo_2_alt: rawEntity.logo_2_alt,
|
|
630
|
-
logo_2_thumbnail_url: rawEntity.logo_2_thumbnail_url,
|
|
631
|
-
logo_2_sizes_thumbnail_filename: rawEntity.logo_2_sizes_thumbnail_filename,
|
|
632
|
-
logo_2_filename: rawEntity.logo_2_filename,
|
|
633
|
-
logo_2_width: rawEntity.logo_2_width,
|
|
634
|
-
logo_2_height: rawEntity.logo_2_height,
|
|
635
|
-
featured_image_url: rawEntity.featured_image_url,
|
|
636
|
-
featured_image_thumbnail_url: rawEntity.featured_image_thumbnail_url,
|
|
637
|
-
featured_image_sizes_thumbnail_filename: rawEntity.featured_image_sizes_thumbnail_filename,
|
|
638
|
-
featured_image_filename: rawEntity.featured_image_filename,
|
|
639
|
-
featured_image_width: rawEntity.featured_image_width,
|
|
640
|
-
featured_image_height: rawEntity.featured_image_height
|
|
610
|
+
...rawEntity
|
|
641
611
|
};
|
|
642
612
|
}
|
|
643
613
|
|
|
@@ -661,52 +631,53 @@ var EntityApi = class extends ApiClient {
|
|
|
661
631
|
};
|
|
662
632
|
}
|
|
663
633
|
const query = `
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
tin
|
|
634
|
+
query GetEntity {
|
|
635
|
+
Entities (limit: 1, trash: false) {
|
|
636
|
+
docs {
|
|
668
637
|
name
|
|
669
|
-
web
|
|
670
638
|
address
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
639
|
+
instagram
|
|
640
|
+
facebook
|
|
641
|
+
whatsapp_number
|
|
642
|
+
tiktok
|
|
643
|
+
youtube
|
|
644
|
+
currency {
|
|
645
|
+
prefix
|
|
646
|
+
plural_name
|
|
647
|
+
name
|
|
648
|
+
}
|
|
649
|
+
featured_image {
|
|
650
|
+
thumbnailURL
|
|
651
|
+
url
|
|
652
|
+
width
|
|
653
|
+
height
|
|
654
|
+
}
|
|
655
|
+
logo {
|
|
656
|
+
thumbnailURL
|
|
657
|
+
url
|
|
658
|
+
width
|
|
659
|
+
height
|
|
660
|
+
}
|
|
661
|
+
logo_2 {
|
|
662
|
+
thumbnailURL
|
|
663
|
+
url
|
|
664
|
+
width
|
|
665
|
+
height
|
|
666
|
+
}
|
|
697
667
|
}
|
|
698
668
|
}
|
|
669
|
+
}
|
|
699
670
|
`;
|
|
700
671
|
const { data, error, errorMessage } = await this.fetchGraphQL(
|
|
701
672
|
query,
|
|
702
673
|
params,
|
|
703
|
-
(responseData) => responseData
|
|
674
|
+
(responseData) => responseData?.Entities
|
|
704
675
|
);
|
|
705
676
|
if (error) {
|
|
706
677
|
return { data: null, error: true, errorMessage };
|
|
707
678
|
}
|
|
708
679
|
return {
|
|
709
|
-
data: parseRawEntityToEntity(data.
|
|
680
|
+
data: parseRawEntityToEntity(data.docs[0]),
|
|
710
681
|
error: false,
|
|
711
682
|
errorMessage: null
|
|
712
683
|
};
|
|
@@ -779,7 +750,7 @@ var contactUsSchema = z6.object({
|
|
|
779
750
|
email: z6.string().email(),
|
|
780
751
|
phone: z6.string().optional(),
|
|
781
752
|
subject: z6.string().optional(),
|
|
782
|
-
|
|
753
|
+
message: z6.string().min(1)
|
|
783
754
|
});
|
|
784
755
|
|
|
785
756
|
// src/api/contact/api.ts
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/api/core/apiClient.ts","../src/api/core/cache.ts","../src/api/items/parsers.ts","../src/api/items/validators.ts","../src/api/items/api.ts","../src/api/categories/validators.ts","../src/api/categories/parsers.ts","../src/api/categories/api.ts","../src/api/brands/validators.ts","../src/api/brands/parsers.ts","../src/api/brands/api.ts","../src/api/entity/parsers.ts","../src/api/entity/api.ts","../src/api/orders/validators.ts","../src/api/orders/api.ts","../src/api/contact/validators.ts","../src/api/contact/api.ts","../src/api/custom/api.ts"],"sourcesContent":["import axios, { AxiosInstance, AxiosError } from \"axios\";\nimport { z } from \"zod\";\nimport { CacheService } from \"./cache\";\n\nexport class ApiClient {\n protected client: AxiosInstance;\n protected cache: CacheService;\n protected baseURL: string;\n protected apiKey: string;\n\n constructor() {\n this.baseURL = process.env.PAKENTO_CMS_BASE_URL || \"\";\n this.apiKey = process.env.PAKENTO_API_KEY || \"\";\n this.cache = new CacheService(this.apiKey);\n\n this.client = axios.create({\n baseURL: this.baseURL,\n headers: {\n \"Content-Type\": \"application/json\",\n Authorization: `users API-Key ${this.apiKey}`,\n },\n });\n\n this.client.interceptors.request.use(\n (config) => {\n const fullUrl = `${config.baseURL}${config.url}`;\n console.log(`🌐 API Call: ${config.method?.toUpperCase()} ${fullUrl}`);\n return config;\n },\n (error) => Promise.reject(error)\n );\n }\n\n protected handleApiError(error: unknown, context: string): string {\n if (error instanceof AxiosError) {\n const status = error.response?.status;\n const responseMessage = error.response?.data?.message;\n if (status === 401) return \"API Key inválida o expirada\";\n if (status === 404) return `${context} no encontrado`;\n if (status && status >= 500) return \"Error del servidor CMS\";\n return (\n responseMessage || `Error de conexión en ${context}: ${error.message}`\n );\n } else if (error instanceof z.ZodError) {\n return `Validación fallida: ${error.issues\n .map((e) => e.message)\n .join(\", \")}`;\n } else if (error instanceof Error) {\n return error.message;\n }\n return \"Error desconocido\";\n }\n\n protected async fetchGraphQL<T>(\n query: string,\n variables: any,\n extractData: (responseData: any) => T\n ): Promise<{ data: T | null; error: boolean; errorMessage: string | null }> {\n try {\n const response = await this.client.post(\"/api/graphql\", {\n query,\n variables,\n });\n if (response.data.errors) {\n const errorMessage = `GraphQL Error: ${response.data.errors[0].message}`;\n return { data: null, error: true, errorMessage };\n }\n const data = extractData(response.data.data);\n return { data, error: false, errorMessage: null };\n } catch (error) {\n const errorMessage = this.handleApiError(error, \"GraphQL query\");\n return { data: null, error: true, errorMessage };\n }\n }\n}\n","import { Redis } from \"@upstash/redis\";\n\nexport class CacheService {\n private redis?: Redis;\n private apiKeyHash: string;\n private defaultTTL: number = 172800; // 48 hours\n\n constructor(apiKey: string) {\n this.apiKeyHash = apiKey.substring(0, 8);\n\n if (\n process.env.UPSTASH_REDIS_REST_URL &&\n process.env.UPSTASH_REDIS_REST_TOKEN\n ) {\n this.redis = new Redis({\n url: process.env.UPSTASH_REDIS_REST_URL,\n token: process.env.UPSTASH_REDIS_REST_TOKEN,\n });\n }\n }\n\n private generateParamsHash(params: Record<string, unknown>): string {\n const paramsString = JSON.stringify(params);\n return btoa(paramsString);\n }\n\n public buildCacheKey(\n functionName: string,\n params: Record<string, unknown> = {}\n ): string {\n const paramsHash = this.generateParamsHash({ ...params, functionName });\n return `pakento:${this.apiKeyHash}:${paramsHash}`;\n }\n\n public async cacheWrap<T>(\n key: string,\n fetcher: () => Promise<T>,\n functionName: string,\n filters?: Record<string, unknown>\n ): Promise<T> {\n if (!this.redis) {\n return fetcher();\n }\n\n let cached: string | null = null;\n try {\n cached = await this.redis.get(key);\n\n if (typeof cached === \"object\" && cached !== null) {\n console.log(\"[Cache] ✅ Reading from cache:\", key);\n return cached as T;\n }\n\n if (cached) {\n console.log(\"[Cache] ✅ Reading from cache:\", key);\n return JSON.parse(cached as string) as T;\n }\n } catch (err) {\n console.warn(\"[Cache] ❌ Error reading from cache:\", err);\n console.log(`[Cache] ❌ Key: ${key}, type: ${typeof cached}`);\n }\n\n const result = await fetcher();\n\n try {\n // Crear objeto de caché con datos y filtros para visualización\n const cacheData = {\n _function: functionName,\n _filters: filters || {},\n _cachedAt: new Date().toISOString(),\n ...result,\n };\n\n console.log(\"[Cache] ✅ Writing to cache:\", key);\n await this.redis.set(key, JSON.stringify(cacheData), {\n ex: this.defaultTTL,\n });\n } catch (err) {\n console.warn(\"[Cache] ❌ Error writing to cache:\", err);\n }\n\n return result;\n }\n\n public async clearAllCache(): Promise<boolean> {\n if (!this.redis) {\n console.warn(\"[Cache] ❌ Redis no configurado\");\n return false;\n }\n\n try {\n const pattern = `pakento:${this.apiKeyHash}:*`;\n const keys = await this.redis.keys(pattern);\n\n if (keys.length > 0) {\n await this.redis.del(...keys);\n console.log(\"[Cache] ✅ Cache limpiado\");\n }\n\n return true;\n } catch (err) {\n console.warn(\"[Cache] ❌ Error limpiando todo el cache\", err);\n return false;\n }\n }\n}\n","import { Item, ItemEcommerceRaw } from \"./types\";\n\n/**\n * Parses a raw GraphQL response item to the normalized Item type\n * @param rawItem - The raw item from GraphQL response\n * @returns Normalized Item object\n */\nexport function parseRawItemToItem(rawItem: ItemEcommerceRaw): Item {\n const images = rawItem.images.map((img) => ({\n url: img.url,\n thumbnail_url: img.thumbnail_url,\n }));\n\n const variations = rawItem.variations.map((v) => ({\n id: v.id,\n name: v.name,\n description: v.description,\n cover_image_url: v.cover_image_url,\n cover_image_thumbnail_url: v.cover_image_thumbnail_url,\n price: v.price,\n old_price: v.old_price,\n price_notes: v.price_notes,\n price_text: v.price_text,\n old_price_text: v.old_price_text,\n currency_prefix: v.currency_prefix,\n attribute_values: v.attribute_values,\n images: v.images.map((img) => ({\n url: img.url,\n thumbnail_url: img.thumbnail_url,\n })),\n }));\n\n return {\n id: rawItem.id,\n name: rawItem.name,\n featured: rawItem.featured,\n url_safe_name: rawItem.url_safe_name,\n currency_prefix: rawItem.currency_prefix,\n description: rawItem.description,\n old_price: rawItem.old_price,\n item_category_name: rawItem.item_category_name,\n item_category_id: parseInt(rawItem.item_category_id || \"0\", 10),\n item_super_category_name: rawItem.item_super_category_name,\n item_super_category_id: parseInt(rawItem.item_super_category_id || \"0\", 10),\n price_text: rawItem.price_text,\n old_price_text: rawItem.old_price_text,\n price_notes: rawItem.price_notes,\n price: rawItem.price,\n brand_id: parseInt(rawItem.brand_id || \"0\", 10),\n brand_name: rawItem.brand_name,\n cover_image_url: rawItem.cover_image_url,\n cover_image_thumbnail_url: rawItem.cover_image_thumbnail_url,\n images,\n master_attributes: rawItem.master_attributes,\n variations,\n };\n}\n\n/**\n * Parses an array of raw GraphQL response items to normalized Item types\n * @param rawItems - Array of raw items from GraphQL response\n * @returns Array of normalized Item objects\n */\nexport function parseRawItemsToItems(rawItems: ItemEcommerceRaw[]): Item[] {\n return rawItems.map(parseRawItemToItem);\n}\n","import { z } from \"zod\";\n\nexport const itemsParamsSchema = z.object({\n where: z\n .object({\n item_category_id: z.object({ equals: z.string().optional() }).optional(),\n item_super_category_id: z\n .object({ equals: z.string().optional() })\n .optional(),\n brand_id: z.object({ equals: z.string().optional() }).optional(),\n id: z.object({ equals: z.string().optional() }).optional(),\n })\n .optional(),\n onlyOffers: z.boolean().optional(),\n limit: z.coerce.number().optional(),\n page: z.coerce.number().optional(),\n search: z.string().optional(),\n sort: z.string().optional(),\n minPrice: z.coerce.number().optional(),\n maxPrice: z.coerce.number().optional(),\n});\n","import { ApiClient } from \"../core/apiClient\";\nimport { itemsParamsSchema } from \"./validators\";\nimport { parseRawItemsToItems } from \"./parsers\";\nimport { GetItemsParams, ItemsRawResponse, ItemsWhere, Item } from \"./types\";\nimport { ApiResponse } from \"../core/types\";\n\nclass ItemsApi extends ApiClient {\n async getItems(params: GetItemsParams = {}): Promise<ApiResponse<Item[]>> {\n const validatedParams = itemsParamsSchema.safeParse(params);\n if (!validatedParams.success) {\n const errorMessage = this.handleApiError(\n validatedParams.error,\n \"getItems validation\"\n );\n return {\n data: [],\n totalDocs: 0,\n totalPages: 0,\n prevPage: null,\n nextPage: null,\n error: true,\n errorMessage,\n };\n }\n\n const cacheKey = this.cache.buildCacheKey(\"getItems\", validatedParams.data);\n return this.cache.cacheWrap(\n cacheKey,\n () => this.fetchItemsFromAPI(validatedParams.data),\n \"getItems\",\n validatedParams.data\n );\n }\n\n private async fetchItemsFromAPI(\n params: GetItemsParams\n ): Promise<ApiResponse<Item[]>> {\n if (!this.baseURL || !this.apiKey) {\n return {\n data: [],\n totalDocs: 0,\n totalPages: 0,\n prevPage: null,\n nextPage: null,\n error: true,\n errorMessage:\n \"SDK no configurado: PAKENTO_CMS_BASE_URL o PAKENTO_API_KEY faltantes.\",\n };\n }\n\n const query = `\n query GetEcommerceItems(\n $where: EcommerceItemsWhere\n $onlyOffers: Boolean\n $limit: Int\n $page: Int\n $search: String\n $sort: String\n $minPrice: Float\n $maxPrice: Float\n ) {\n GetEcommerceItems(\n where: $where\n onlyOffers: $onlyOffers\n limit: $limit\n page: $page\n search: $search\n sort: $sort\n minPrice: $minPrice\n maxPrice: $maxPrice\n ) {\n totalDocs\n totalPages\n prevPage\n nextPage\n docs {\n id\n name\n featured\n description\n url_safe_name\n\n item_super_category_id\n item_super_category_name\n\n item_category_id\n item_category_name\n\n cover_image_url\n cover_image_thumbnail_url\n\n price\n old_price\n price_notes\n price_text\n old_price_text\n currency_prefix\n\n brand_id\n brand_name\n\n master_attributes {\n id\n name\n values {\n id\n value\n }\n }\n\n variations {\n id\n name\n description\n\n cover_image_url\n cover_image_thumbnail_url\n\n price\n old_price\n price_notes\n price_text\n old_price_text\n currency_prefix\n\n attribute_values {\n attribute_id\n attribute_name\n value\n value_id\n }\n\n images {\n url\n thumbnail_url\n }\n }\n\n images {\n url\n thumbnail_url\n }\n }\n }\n }\n `;\n\n const whereConditions: ItemsWhere = {};\n if (params.where?.item_category_id?.equals) {\n whereConditions.item_category_id = {\n equals: params.where.item_category_id.equals,\n };\n }\n if (params.where?.item_super_category_id?.equals) {\n whereConditions.item_super_category_id = {\n equals: params.where.item_super_category_id.equals,\n };\n }\n if (params.where?.brand_id?.equals) {\n whereConditions.brand_id = { equals: params.where.brand_id.equals };\n }\n if (params.where?.id?.equals) {\n whereConditions.id = { equals: params.where.id.equals };\n }\n\n const variables = {\n ...params,\n where:\n Object.keys(whereConditions).length > 0 ? whereConditions : undefined,\n };\n\n const { data, error, errorMessage } =\n await this.fetchGraphQL<ItemsRawResponse>(\n query,\n variables,\n (responseData) => responseData.GetEcommerceItems\n );\n\n if (error) {\n return {\n data: [],\n totalDocs: 0,\n totalPages: 0,\n prevPage: null,\n nextPage: null,\n error: true,\n errorMessage,\n };\n }\n\n return {\n data: parseRawItemsToItems(data!.docs),\n totalDocs: data!.totalDocs,\n totalPages: data!.totalPages,\n prevPage: data!.prevPage,\n nextPage: data!.nextPage,\n error: false,\n errorMessage: null,\n };\n }\n}\n\nexport const itemsApi = new ItemsApi();\n","import { z } from \"zod\";\n\nexport const categoriesParamsSchema = z.object({\n where: z\n .object({\n item_super_category_id: z\n .object({ equals: z.string().optional() })\n .optional(),\n brand_id: z.object({ equals: z.string().optional() }).optional(),\n })\n .optional(),\n limit: z.coerce.number().optional(),\n page: z.coerce.number().optional(),\n sort: z.string().optional(),\n});\n","import { Category, CategoryEcommerceRaw } from \"./types\";\n\n/**\n * Parses a raw GraphQL response category to the normalized Category type\n * @param rawCategory - The raw category from GraphQL response\n * @returns Normalized Category object\n */\nexport function parseRawCategoryToCategory(\n rawCategory: CategoryEcommerceRaw\n): Category {\n return {\n id: rawCategory.id,\n name: rawCategory.name,\n image_url: rawCategory.image_url,\n };\n}\n\n/**\n * Parses an array of raw GraphQL response categories to normalized Category types\n * @param rawCategories - Array of raw categories from GraphQL response\n * @returns Array of normalized Category objects\n */\nexport function parseRawCategoriesToCategories(\n rawCategories: CategoryEcommerceRaw[]\n): Category[] {\n return rawCategories.map(parseRawCategoryToCategory);\n}\n","import { ApiClient } from \"../core/apiClient\";\nimport { categoriesParamsSchema } from \"./validators\";\nimport { parseRawCategoriesToCategories } from \"./parsers\";\nimport { GetCategoriesParams, CategoriesRawResponse, Category } from \"./types\";\nimport { ApiResponse } from \"../core/types\";\n\nclass CategoriesApi extends ApiClient {\n async getCategories(\n params: GetCategoriesParams = {}\n ): Promise<ApiResponse<Category[]>> {\n const validatedParams = categoriesParamsSchema.safeParse(params);\n if (!validatedParams.success) {\n const errorMessage = this.handleApiError(\n validatedParams.error,\n \"getCategories validation\"\n );\n return { data: [], error: true, errorMessage };\n }\n\n const cacheKey = this.cache.buildCacheKey(\n \"getCategories\",\n validatedParams.data\n );\n return this.cache.cacheWrap(\n cacheKey,\n () => this.fetchCategoriesFromAPI(validatedParams.data),\n \"getCategories\",\n validatedParams.data\n );\n }\n\n private async fetchCategoriesFromAPI(\n params: GetCategoriesParams\n ): Promise<ApiResponse<Category[]>> {\n if (!this.baseURL || !this.apiKey) {\n return {\n data: [],\n error: true,\n errorMessage:\n \"SDK no configurado: PAKENTO_CMS_BASE_URL o PAKENTO_API_KEY faltantes.\",\n };\n }\n\n const query = `\n query GetEcommerceCategories(\n $where: EcommerceCategoriesWhere\n $limit: Int\n $page: Int\n $sort: String\n ) {\n GetEcommerceCategories(\n where: $where\n limit: $limit\n page: $page\n sort: $sort\n ) {\n docs {\n id\n name\n image_url\n }\n }\n }\n `;\n\n const { data, error, errorMessage } =\n await this.fetchGraphQL<CategoriesRawResponse>(\n query,\n params,\n (responseData) => responseData.GetEcommerceCategories\n );\n\n if (error) {\n return { data: [], error: true, errorMessage };\n }\n\n return {\n data: parseRawCategoriesToCategories(data!.docs),\n error: false,\n errorMessage: null,\n };\n }\n}\n\nexport const categoriesApi = new CategoriesApi();\n","import { z } from \"zod\";\n\nexport const brandsParamsSchema = z.object({\n limit: z.coerce.number().optional(),\n page: z.coerce.number().optional(),\n sort: z.string().optional(),\n});\n","import { Brand, BrandEcommerceRaw } from \"./types\";\n\n/**\n * Parses a raw GraphQL response brand to the normalized Brand type\n * @param rawBrand - The raw brand from GraphQL response\n * @returns Normalized Brand object\n */\nexport function parseRawBrandToBrand(rawBrand: BrandEcommerceRaw): Brand {\n return {\n id: rawBrand.id,\n name: rawBrand.name,\n description: rawBrand.description,\n items_count: rawBrand.items_count,\n image_url: rawBrand.image_url,\n image_thumbnail_url: rawBrand.image_thumbnail_url,\n };\n}\n\n/**\n * Parses an array of raw GraphQL response brands to normalized Brand types\n * @param rawBrands - Array of raw brands from GraphQL response\n * @returns Array of normalized Brand objects\n */\nexport function parseRawBrandsToBrands(\n rawBrands: BrandEcommerceRaw[]\n): Brand[] {\n return rawBrands.map(parseRawBrandToBrand);\n}\n","import { ApiClient } from \"../core/apiClient\";\nimport { brandsParamsSchema } from \"./validators\";\nimport { parseRawBrandsToBrands } from \"./parsers\";\nimport { GetBrandsParams, BrandsRawResponse, Brand } from \"./types\";\nimport { ApiResponse } from \"../core/types\";\n\nclass BrandsApi extends ApiClient {\n async getBrands(params: GetBrandsParams = {}): Promise<ApiResponse<Brand[]>> {\n const validatedParams = brandsParamsSchema.safeParse(params);\n if (!validatedParams.success) {\n const errorMessage = this.handleApiError(\n validatedParams.error,\n \"getBrands validation\"\n );\n return {\n data: [],\n totalDocs: 0,\n totalPages: 0,\n prevPage: null,\n nextPage: null,\n error: true,\n errorMessage,\n };\n }\n\n const cacheKey = this.cache.buildCacheKey(\n \"getBrands\",\n validatedParams.data\n );\n return this.cache.cacheWrap(\n cacheKey,\n () => this.fetchBrandsFromAPI(validatedParams.data),\n \"getBrands\",\n validatedParams.data\n );\n }\n\n private async fetchBrandsFromAPI(\n params: GetBrandsParams\n ): Promise<ApiResponse<Brand[]>> {\n if (!this.baseURL || !this.apiKey) {\n return {\n data: [],\n totalDocs: 0,\n totalPages: 0,\n prevPage: null,\n nextPage: null,\n error: true,\n errorMessage:\n \"SDK no configurado: PAKENTO_CMS_BASE_URL o PAKENTO_API_KEY faltantes.\",\n };\n }\n\n const query = `\n query GetEcommerceBrands(\n $limit: Int\n $page: Int\n $sort: String\n ) {\n GetEcommerceBrands(\n limit: $limit\n page: $page\n sort: $sort\n ) {\n totalDocs\n totalPages\n prevPage\n nextPage\n docs {\n id\n name\n description\n items_count\n image_url\n image_thumbnail_url\n }\n }\n }\n `;\n\n const { data, error, errorMessage } =\n await this.fetchGraphQL<BrandsRawResponse>(\n query,\n params,\n (responseData) => responseData.GetEcommerceBrands\n );\n\n if (error) {\n return {\n data: [],\n totalDocs: 0,\n totalPages: 0,\n prevPage: null,\n nextPage: null,\n error: true,\n errorMessage,\n };\n }\n\n return {\n data: parseRawBrandsToBrands(data!.docs),\n totalDocs: data!.totalDocs,\n totalPages: data!.totalPages,\n prevPage: data!.prevPage,\n nextPage: data!.nextPage,\n error: false,\n errorMessage: null,\n };\n }\n}\n\nexport const brandsApi = new BrandsApi();\n","import { Entity, EntityEcommerceRaw } from \"./types\";\n\n/**\n * Parses a raw GraphQL response entity to the normalized Entity type\n * @param rawEntity - The raw entity from GraphQL response\n * @returns Normalized Entity object\n */\nexport function parseRawEntityToEntity(rawEntity: EntityEcommerceRaw): Entity {\n return {\n id: rawEntity.id,\n tin: rawEntity.tin,\n name: rawEntity.name,\n web: rawEntity.web,\n address: rawEntity.address,\n country: rawEntity.country,\n city: rawEntity.city,\n currency_id: rawEntity.currency_id,\n currency_name: rawEntity.currency_name,\n currency_prefix: rawEntity.currency_prefix,\n currency_suffix: rawEntity.currency_suffix,\n logo_url: rawEntity.logo_url,\n logo_alt: rawEntity.logo_alt,\n logo_thumbnail_url: rawEntity.logo_thumbnail_url,\n logo_sizes_thumbnail_filename: rawEntity.logo_sizes_thumbnail_filename,\n logo_filename: rawEntity.logo_filename,\n logo_width: rawEntity.logo_width,\n logo_height: rawEntity.logo_height,\n logo_2_url: rawEntity.logo_2_url,\n logo_2_alt: rawEntity.logo_2_alt,\n logo_2_thumbnail_url: rawEntity.logo_2_thumbnail_url,\n logo_2_sizes_thumbnail_filename: rawEntity.logo_2_sizes_thumbnail_filename,\n logo_2_filename: rawEntity.logo_2_filename,\n logo_2_width: rawEntity.logo_2_width,\n logo_2_height: rawEntity.logo_2_height,\n featured_image_url: rawEntity.featured_image_url,\n featured_image_thumbnail_url: rawEntity.featured_image_thumbnail_url,\n featured_image_sizes_thumbnail_filename:\n rawEntity.featured_image_sizes_thumbnail_filename,\n featured_image_filename: rawEntity.featured_image_filename,\n featured_image_width: rawEntity.featured_image_width,\n featured_image_height: rawEntity.featured_image_height,\n };\n}\n","import { ApiClient } from \"../core/apiClient\";\nimport { parseRawEntityToEntity } from \"./parsers\";\nimport { GetEntityParams, EntityRawResponse, Entity } from \"./types\";\nimport { ApiResponse } from \"../core/types\";\n\nclass EntityApi extends ApiClient {\n async getEntity(params: GetEntityParams = {}): Promise<ApiResponse<Entity>> {\n const cacheKey = this.cache.buildCacheKey(\"getEntity\", params);\n return this.cache.cacheWrap(\n cacheKey,\n () => this.fetchEntityFromAPI(params),\n \"getEntity\",\n params\n );\n }\n\n private async fetchEntityFromAPI(\n params: GetEntityParams\n ): Promise<ApiResponse<Entity>> {\n if (!this.baseURL || !this.apiKey) {\n return {\n data: null,\n error: true,\n errorMessage:\n \"SDK no configurado: PAKENTO_CMS_BASE_URL o PAKENTO_API_KEY faltantes.\",\n };\n }\n\n const query = `\n query GetEntity {\n GetEntity {\n id\n tin\n name\n web\n address\n country\n city\n currency_id\n currency_name\n currency_prefix\n currency_suffix\n logo_url\n logo_alt\n logo_thumbnail_url\n logo_sizes_thumbnail_filename\n logo_filename\n logo_width\n logo_height\n logo_2_url\n logo_2_alt\n logo_2_thumbnail_url\n logo_2_sizes_thumbnail_filename\n logo_2_filename\n logo_2_width\n logo_2_height\n featured_image_url\n featured_image_thumbnail_url\n featured_image_sizes_thumbnail_filename\n featured_image_filename\n featured_image_width\n featured_image_height\n }\n }\n `;\n\n const { data, error, errorMessage } =\n await this.fetchGraphQL<EntityRawResponse>(\n query,\n params,\n (responseData) => responseData\n );\n\n if (error) {\n return { data: null, error: true, errorMessage };\n }\n\n return {\n data: parseRawEntityToEntity(data!.GetEntity),\n error: false,\n errorMessage: null,\n };\n }\n}\n\nexport const entityApi = new EntityApi();\n","import { z } from \"zod\";\n\nexport const orderSchema = z.object({\n name: z.string().min(1),\n email: z.string().email(),\n phone: z.string().optional(),\n notes: z.string().optional(),\n tin: z.string().optional(),\n items: z\n .array(\n z.object({ id: z.number().positive(), quantity: z.number().positive() })\n )\n .min(1),\n delivery_address: z.string().optional(),\n delivery_instructions: z.string().optional(),\n payment_method: z.enum([\"cash\", \"transfer\"]).optional(),\n});\n","import { ApiClient } from \"../core/apiClient\";\nimport { orderSchema } from \"./validators\";\nimport {\n CreateEcommerceOrderParams,\n CreateEcommerceOrderResponse,\n} from \"./types\";\n\nclass OrdersApi extends ApiClient {\n async createEcommerceOrder(\n params: CreateEcommerceOrderParams\n ): Promise<CreateEcommerceOrderResponse> {\n if (!this.baseURL || !this.apiKey) {\n return {\n message: \"SDK no configurado\",\n error: true,\n errorMessage: \"SDK no configurado\",\n };\n }\n\n const validated = orderSchema.safeParse(params);\n if (!validated.success) {\n const errorMessage = this.handleApiError(\n validated.error,\n \"createEcommerceOrder validation\"\n );\n return { message: errorMessage, error: true, errorMessage };\n }\n\n try {\n const response = await this.client.post(\n \"/api/orders/create-ecommerce-order\",\n validated.data\n );\n\n if (response.status === 200) {\n return {\n message: response.data.message || \"Orden creada exitosamente\",\n order_id: response.data.order_id,\n error: false,\n errorMessage: null,\n };\n } else {\n const errorMessage = response.data.message || \"Error al crear la orden\";\n return { message: errorMessage, error: true, errorMessage };\n }\n } catch (error) {\n const errorMessage = this.handleApiError(error, \"createEcommerceOrder\");\n return { message: errorMessage, error: true, errorMessage };\n }\n }\n}\n\nexport const ordersApi = new OrdersApi();\n","import { z } from \"zod\";\n\nexport const contactUsSchema = z.object({\n name: z.string().min(1),\n email: z.string().email(),\n phone: z.string().optional(),\n subject: z.string().optional(),\n notes: z.string().min(1),\n});\n","import { ApiClient } from \"../core/apiClient\";\nimport { contactUsSchema } from \"./validators\";\nimport { SendContactUsEmailParams, SendContactUsEmailResponse } from \"./types\";\n\nclass ContactApi extends ApiClient {\n async sendContactUsEmail(\n params: SendContactUsEmailParams\n ): Promise<SendContactUsEmailResponse> {\n if (!this.baseURL || !this.apiKey) {\n return {\n message: \"SDK no configurado\",\n error: true,\n errorMessage: \"SDK no configurado\",\n };\n }\n\n const validated = contactUsSchema.safeParse(params);\n if (!validated.success) {\n const errorMessage = this.handleApiError(\n validated.error,\n \"sendContactUsEmail validation\"\n );\n return { message: errorMessage, error: true, errorMessage };\n }\n\n try {\n const response = await this.client.post(\n \"/api/entities/send-contact-us-email\",\n validated.data\n );\n\n if (response.status === 200) {\n return {\n message: response.data.message || \"Mensaje enviado exitosamente\",\n error: false,\n errorMessage: null,\n };\n } else {\n const errorMessage =\n response.data.message || \"Error al enviar el mensaje\";\n return { message: errorMessage, error: true, errorMessage };\n }\n } catch (error) {\n const errorMessage = this.handleApiError(error, \"sendContactUsEmail\");\n return { message: errorMessage, error: true, errorMessage };\n }\n }\n}\n\nexport const contactApi = new ContactApi();\n","import { ApiClient } from \"../core/apiClient\";\nimport { CustomGraphQLParams, CustomGraphQLResponse } from \"./types\";\n\nclass CustomApi extends ApiClient {\n async executeCustomQuery<T>(\n params: CustomGraphQLParams\n ): Promise<CustomGraphQLResponse<T>> {\n if (!this.baseURL || !this.apiKey) {\n return {\n data: null as T,\n error: true,\n errorMessage:\n \"SDK no configurado: PAKENTO_CMS_BASE_URL o PAKENTO_API_KEY faltantes.\",\n };\n }\n\n if (\n !params.query ||\n typeof params.query !== \"string\" ||\n params.query.trim() === \"\"\n ) {\n return {\n data: null as T,\n error: true,\n errorMessage: \"Se requiere un query GraphQL válido.\",\n };\n }\n\n try {\n const response = await this.client.post(\"/api/graphql\", {\n query: params.query,\n variables: params.variables || {},\n });\n\n if (response.data.errors && response.data.errors.length > 0) {\n return {\n data: response.data.data || (null as T),\n errors: response.data.errors,\n error: true,\n errorMessage: `GraphQL Errors: ${response.data.errors\n .map((err: { message: string }) => err.message)\n .join(\", \")}`,\n };\n }\n\n return {\n data: response.data.data,\n error: false,\n errorMessage: null,\n };\n } catch (error) {\n const errorMessage = this.handleApiError(error, \"Custom GraphQL\");\n return { data: null as T, error: true, errorMessage };\n }\n }\n}\n\nexport const customApi = new CustomApi();\n"],"mappings":";AAAA,OAAO,SAAwB,kBAAkB;AACjD,SAAS,SAAS;;;ACDlB,SAAS,aAAa;AAEf,IAAM,eAAN,MAAmB;AAAA;AAAA,EAKxB,YAAY,QAAgB;AAF5B,SAAQ,aAAqB;AAG3B,SAAK,aAAa,OAAO,UAAU,GAAG,CAAC;AAEvC,QACE,QAAQ,IAAI,0BACZ,QAAQ,IAAI,0BACZ;AACA,WAAK,QAAQ,IAAI,MAAM;AAAA,QACrB,KAAK,QAAQ,IAAI;AAAA,QACjB,O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AAc;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\";\n\nexport class CacheService {\n private redis?: Redis;\n private apiKeyHash: string;\n private defaultTTL: number = 172800; // 48 hours\n\n constructor(apiKey: string) {\n this.apiKeyHash = apiKey.substring(0, 8);\n\n if (\n process.env.UPSTASH_REDIS_REST_URL &&\n process.env.UPSTASH_REDIS_REST_TOKEN\n ) {\n this.redis = new Redis({\n url: process.env.UPSTASH_REDIS_REST_URL,\n token: process.env.UPSTASH_REDIS_REST_TOKEN,\n });\n }\n }\n\n private generateParamsHash(params: Record<string, unknown>): string {\n const paramsString = JSON.stringify(params);\n return btoa(paramsString);\n }\n\n public buildCacheKey(\n functionName: string,\n params: Record<string, unknown> = {}\n ): string {\n const paramsHash = this.generateParamsHash({ ...params, functionName });\n return `pakento:${this.apiKeyHash}:${paramsHash}`;\n }\n\n public async cacheWrap<T>(\n key: string,\n fetcher: () => Promise<T>,\n functionName: string,\n filters?: Record<string, unknown>\n ): Promise<T> {\n if (!this.redis) {\n return fetcher();\n }\n\n let cached: string | null = null;\n try {\n cached = await this.redis.get(key);\n\n if (typeof cached === \"object\" && cached !== null) {\n console.log(\"[Cache] ✅ Reading from cache:\", key);\n return cached as T;\n }\n\n if (cached) {\n console.log(\"[Cache] ✅ Reading from cache:\", key);\n return JSON.parse(cached as string) as T;\n }\n } catch (err) {\n console.warn(\"[Cache] ❌ Error reading from cache:\", err);\n console.log(`[Cache] ❌ Key: ${key}, type: ${typeof cached}`);\n }\n\n const result = await fetcher();\n\n try {\n // Crear objeto de caché con datos y filtros para visualización\n const cacheData = {\n _function: functionName,\n _filters: filters || {},\n _cachedAt: new Date().toISOString(),\n ...result,\n };\n\n console.log(\"[Cache] ✅ Writing to cache:\", key);\n await this.redis.set(key, JSON.stringify(cacheData), {\n ex: this.defaultTTL,\n });\n } catch (err) {\n console.warn(\"[Cache] ❌ Error writing to cache:\", err);\n }\n\n return result;\n }\n\n public async clearAllCache(): Promise<boolean> {\n if (!this.redis) {\n console.warn(\"[Cache] ❌ Redis no configurado\");\n return false;\n }\n\n try {\n const pattern = `pakento:${this.apiKeyHash}:*`;\n const keys = await this.redis.keys(pattern);\n\n if (keys.length > 0) {\n await this.redis.del(...keys);\n console.log(\"[Cache] ✅ Cache limpiado\");\n }\n\n return true;\n } catch (err) {\n console.warn(\"[Cache] ❌ Error limpiando todo el cache\", err);\n return false;\n }\n }\n}\n","import { Item, ItemEcommerceRaw } from \"./types\";\n\n/**\n * Parses a raw GraphQL response item to the normalized Item type\n * @param rawItem - The raw item from GraphQL response\n * @returns Normalized Item object\n */\nexport function parseRawItemToItem(rawItem: ItemEcommerceRaw): Item {\n const images = rawItem.images.map((img) => ({\n url: img.url,\n thumbnail_url: img.thumbnail_url,\n }));\n\n const variations = rawItem.variations.map((v) => ({\n id: v.id,\n name: v.name,\n description: v.description,\n cover_image_url: v.cover_image_url,\n cover_image_thumbnail_url: v.cover_image_thumbnail_url,\n price: v.price,\n old_price: v.old_price,\n price_notes: v.price_notes,\n price_text: v.price_text,\n old_price_text: v.old_price_text,\n currency_prefix: v.currency_prefix,\n attribute_values: v.attribute_values,\n images: v.images.map((img) => ({\n url: img.url,\n thumbnail_url: img.thumbnail_url,\n })),\n }));\n\n return {\n id: rawItem.id,\n name: rawItem.name,\n featured: rawItem.featured,\n url_safe_name: rawItem.url_safe_name,\n currency_prefix: rawItem.currency_prefix,\n description: rawItem.description,\n old_price: rawItem.old_price,\n item_category_name: rawItem.item_category_name,\n item_category_id: parseInt(rawItem.item_category_id || \"0\", 10),\n item_super_category_name: rawItem.item_super_category_name,\n item_super_category_id: parseInt(rawItem.item_super_category_id || \"0\", 10),\n price_text: rawItem.price_text,\n old_price_text: rawItem.old_price_text,\n price_notes: rawItem.price_notes,\n price: rawItem.price,\n brand_id: parseInt(rawItem.brand_id || \"0\", 10),\n brand_name: rawItem.brand_name,\n cover_image_url: rawItem.cover_image_url,\n cover_image_thumbnail_url: rawItem.cover_image_thumbnail_url,\n images,\n master_attributes: rawItem.master_attributes,\n variations,\n };\n}\n\n/**\n * Parses an array of raw GraphQL response items to normalized Item types\n * @param rawItems - Array of raw items from GraphQL response\n * @returns Array of normalized Item objects\n */\nexport function parseRawItemsToItems(rawItems: ItemEcommerceRaw[]): Item[] {\n return rawItems.map(parseRawItemToItem);\n}\n","import { z } from \"zod\";\n\nexport const itemsParamsSchema = z.object({\n where: z\n .object({\n item_category_id: z.object({ equals: z.string().optional() }).optional(),\n item_super_category_id: z\n .object({ equals: z.string().optional() })\n .optional(),\n brand_id: z.object({ equals: z.string().optional() }).optional(),\n id: z.object({ equals: z.string().optional() }).optional(),\n })\n .optional(),\n onlyOffers: z.boolean().optional(),\n limit: z.coerce.number().optional(),\n page: z.coerce.number().optional(),\n search: z.string().optional(),\n sort: z.string().optional(),\n minPrice: z.coerce.number().optional(),\n maxPrice: z.coerce.number().optional(),\n});\n","import { ApiClient } from \"../core/apiClient\";\nimport { itemsParamsSchema } from \"./validators\";\nimport { parseRawItemsToItems } from \"./parsers\";\nimport { GetItemsParams, ItemsRawResponse, ItemsWhere, Item } from \"./types\";\nimport { ApiResponse } from \"../core/types\";\n\nclass ItemsApi extends ApiClient {\n async getItems(params: GetItemsParams = {}): Promise<ApiResponse<Item[]>> {\n const validatedParams = itemsParamsSchema.safeParse(params);\n if (!validatedParams.success) {\n const errorMessage = this.handleApiError(\n validatedParams.error,\n \"getItems validation\"\n );\n return {\n data: [],\n totalDocs: 0,\n totalPages: 0,\n prevPage: null,\n nextPage: null,\n error: true,\n errorMessage,\n };\n }\n\n const cacheKey = this.cache.buildCacheKey(\"getItems\", validatedParams.data);\n return this.cache.cacheWrap(\n cacheKey,\n () => this.fetchItemsFromAPI(validatedParams.data),\n \"getItems\",\n validatedParams.data\n );\n }\n\n private async fetchItemsFromAPI(\n params: GetItemsParams\n ): Promise<ApiResponse<Item[]>> {\n if (!this.baseURL || !this.apiKey) {\n return {\n data: [],\n totalDocs: 0,\n totalPages: 0,\n prevPage: null,\n nextPage: null,\n error: true,\n errorMessage:\n \"SDK no configurado: PAKENTO_CMS_BASE_URL o PAKENTO_API_KEY faltantes.\",\n };\n }\n\n const query = `\n query GetEcommerceItems(\n $where: EcommerceItemsWhere\n $onlyOffers: Boolean\n $limit: Int\n $page: Int\n $search: String\n $sort: String\n $minPrice: Float\n $maxPrice: Float\n ) {\n GetEcommerceItems(\n where: $where\n onlyOffers: $onlyOffers\n limit: $limit\n page: $page\n search: $search\n sort: $sort\n minPrice: $minPrice\n maxPrice: $maxPrice\n ) {\n totalDocs\n totalPages\n prevPage\n nextPage\n docs {\n id\n name\n featured\n description\n url_safe_name\n\n item_super_category_id\n item_super_category_name\n\n item_category_id\n item_category_name\n\n cover_image_url\n cover_image_thumbnail_url\n\n price\n old_price\n price_notes\n price_text\n old_price_text\n currency_prefix\n\n brand_id\n brand_name\n\n master_attributes {\n id\n name\n values {\n id\n value\n }\n }\n\n variations {\n id\n name\n description\n\n cover_image_url\n cover_image_thumbnail_url\n\n price\n old_price\n price_notes\n price_text\n old_price_text\n currency_prefix\n\n attribute_values {\n attribute_id\n attribute_name\n value\n value_id\n }\n\n images {\n url\n thumbnail_url\n }\n }\n\n images {\n url\n thumbnail_url\n }\n }\n }\n }\n `;\n\n const whereConditions: ItemsWhere = {};\n if (params.where?.item_category_id?.equals) {\n whereConditions.item_category_id = {\n equals: params.where.item_category_id.equals,\n };\n }\n if (params.where?.item_super_category_id?.equals) {\n whereConditions.item_super_category_id = {\n equals: params.where.item_super_category_id.equals,\n };\n }\n if (params.where?.brand_id?.equals) {\n whereConditions.brand_id = { equals: params.where.brand_id.equals };\n }\n if (params.where?.id?.equals) {\n whereConditions.id = { equals: params.where.id.equals };\n }\n\n const variables = {\n ...params,\n where:\n Object.keys(whereConditions).length > 0 ? whereConditions : undefined,\n };\n\n const { data, error, errorMessage } =\n await this.fetchGraphQL<ItemsRawResponse>(\n query,\n variables,\n (responseData) => responseData.GetEcommerceItems\n );\n\n if (error) {\n return {\n data: [],\n totalDocs: 0,\n totalPages: 0,\n prevPage: null,\n nextPage: null,\n error: true,\n errorMessage,\n };\n }\n\n return {\n data: parseRawItemsToItems(data!.docs),\n totalDocs: data!.totalDocs,\n totalPages: data!.totalPages,\n prevPage: data!.prevPage,\n nextPage: data!.nextPage,\n error: false,\n errorMessage: null,\n };\n }\n}\n\nexport const itemsApi = new ItemsApi();\n","import { z } from \"zod\";\n\nexport const categoriesParamsSchema = z.object({\n where: z\n .object({\n item_super_category_id: z\n .object({ equals: z.string().optional() })\n .optional(),\n brand_id: z.object({ equals: z.string().optional() }).optional(),\n })\n .optional(),\n limit: z.coerce.number().optional(),\n page: z.coerce.number().optional(),\n sort: z.string().optional(),\n});\n","import { Category, CategoryEcommerceRaw } from \"./types\";\n\n/**\n * Parses a raw GraphQL response category to the normalized Category type\n * @param rawCategory - The raw category from GraphQL response\n * @returns Normalized Category object\n */\nexport function parseRawCategoryToCategory(\n rawCategory: CategoryEcommerceRaw\n): Category {\n return {\n id: rawCategory.id,\n name: rawCategory.name,\n image_url: rawCategory.image_url,\n };\n}\n\n/**\n * Parses an array of raw GraphQL response categories to normalized Category types\n * @param rawCategories - Array of raw categories from GraphQL response\n * @returns Array of normalized Category objects\n */\nexport function parseRawCategoriesToCategories(\n rawCategories: CategoryEcommerceRaw[]\n): Category[] {\n return rawCategories.map(parseRawCategoryToCategory);\n}\n","import { ApiClient } from \"../core/apiClient\";\nimport { categoriesParamsSchema } from \"./validators\";\nimport { parseRawCategoriesToCategories } from \"./parsers\";\nimport { GetCategoriesParams, CategoriesRawResponse, Category } from \"./types\";\nimport { ApiResponse } from \"../core/types\";\n\nclass CategoriesApi extends ApiClient {\n async getCategories(\n params: GetCategoriesParams = {}\n ): Promise<ApiResponse<Category[]>> {\n const validatedParams = categoriesParamsSchema.safeParse(params);\n if (!validatedParams.success) {\n const errorMessage = this.handleApiError(\n validatedParams.error,\n \"getCategories validation\"\n );\n return { data: [], error: true, errorMessage };\n }\n\n const cacheKey = this.cache.buildCacheKey(\n \"getCategories\",\n validatedParams.data\n );\n return this.cache.cacheWrap(\n cacheKey,\n () => this.fetchCategoriesFromAPI(validatedParams.data),\n \"getCategories\",\n validatedParams.data\n );\n }\n\n private async fetchCategoriesFromAPI(\n params: GetCategoriesParams\n ): Promise<ApiResponse<Category[]>> {\n if (!this.baseURL || !this.apiKey) {\n return {\n data: [],\n error: true,\n errorMessage:\n \"SDK no configurado: PAKENTO_CMS_BASE_URL o PAKENTO_API_KEY faltantes.\",\n };\n }\n\n const query = `\n query GetEcommerceCategories(\n $where: EcommerceCategoriesWhere\n $limit: Int\n $page: Int\n $sort: String\n ) {\n GetEcommerceCategories(\n where: $where\n limit: $limit\n page: $page\n sort: $sort\n ) {\n docs {\n id\n name\n image_url\n }\n }\n }\n `;\n\n const { data, error, errorMessage } =\n await this.fetchGraphQL<CategoriesRawResponse>(\n query,\n params,\n (responseData) => responseData.GetEcommerceCategories\n );\n\n if (error) {\n return { data: [], error: true, errorMessage };\n }\n\n return {\n data: parseRawCategoriesToCategories(data!.docs),\n error: false,\n errorMessage: null,\n };\n }\n}\n\nexport const categoriesApi = new CategoriesApi();\n","import { z } from \"zod\";\n\nexport const brandsParamsSchema = z.object({\n limit: z.coerce.number().optional(),\n page: z.coerce.number().optional(),\n sort: z.string().optional(),\n});\n","import { Brand, BrandEcommerceRaw } from \"./types\";\n\n/**\n * Parses a raw GraphQL response brand to the normalized Brand type\n * @param rawBrand - The raw brand from GraphQL response\n * @returns Normalized Brand object\n */\nexport function parseRawBrandToBrand(rawBrand: BrandEcommerceRaw): Brand {\n return {\n id: rawBrand.id,\n name: rawBrand.name,\n description: rawBrand.description,\n items_count: rawBrand.items_count,\n image_url: rawBrand.image_url,\n image_thumbnail_url: rawBrand.image_thumbnail_url,\n };\n}\n\n/**\n * Parses an array of raw GraphQL response brands to normalized Brand types\n * @param rawBrands - Array of raw brands from GraphQL response\n * @returns Array of normalized Brand objects\n */\nexport function parseRawBrandsToBrands(\n rawBrands: BrandEcommerceRaw[]\n): Brand[] {\n return rawBrands.map(parseRawBrandToBrand);\n}\n","import { ApiClient } from \"../core/apiClient\";\nimport { brandsParamsSchema } from \"./validators\";\nimport { parseRawBrandsToBrands } from \"./parsers\";\nimport { GetBrandsParams, BrandsRawResponse, Brand } from \"./types\";\nimport { ApiResponse } from \"../core/types\";\n\nclass BrandsApi extends ApiClient {\n async getBrands(params: GetBrandsParams = {}): Promise<ApiResponse<Brand[]>> {\n const validatedParams = brandsParamsSchema.safeParse(params);\n if (!validatedParams.success) {\n const errorMessage = this.handleApiError(\n validatedParams.error,\n \"getBrands validation\"\n );\n return {\n data: [],\n totalDocs: 0,\n totalPages: 0,\n prevPage: null,\n nextPage: null,\n error: true,\n errorMessage,\n };\n }\n\n const cacheKey = this.cache.buildCacheKey(\n \"getBrands\",\n validatedParams.data\n );\n return this.cache.cacheWrap(\n cacheKey,\n () => this.fetchBrandsFromAPI(validatedParams.data),\n \"getBrands\",\n validatedParams.data\n );\n }\n\n private async fetchBrandsFromAPI(\n params: GetBrandsParams\n ): Promise<ApiResponse<Brand[]>> {\n if (!this.baseURL || !this.apiKey) {\n return {\n data: [],\n totalDocs: 0,\n totalPages: 0,\n prevPage: null,\n nextPage: null,\n error: true,\n errorMessage:\n \"SDK no configurado: PAKENTO_CMS_BASE_URL o PAKENTO_API_KEY faltantes.\",\n };\n }\n\n const query = `\n query GetEcommerceBrands(\n $limit: Int\n $page: Int\n $sort: String\n ) {\n GetEcommerceBrands(\n limit: $limit\n page: $page\n sort: $sort\n ) {\n totalDocs\n totalPages\n prevPage\n nextPage\n docs {\n id\n name\n description\n items_count\n image_url\n image_thumbnail_url\n }\n }\n }\n `;\n\n const { data, error, errorMessage } =\n await this.fetchGraphQL<BrandsRawResponse>(\n query,\n params,\n (responseData) => responseData.GetEcommerceBrands\n );\n\n if (error) {\n return {\n data: [],\n totalDocs: 0,\n totalPages: 0,\n prevPage: null,\n nextPage: null,\n error: true,\n errorMessage,\n };\n }\n\n return {\n data: parseRawBrandsToBrands(data!.docs),\n totalDocs: data!.totalDocs,\n totalPages: data!.totalPages,\n prevPage: data!.prevPage,\n nextPage: data!.nextPage,\n error: false,\n errorMessage: null,\n };\n }\n}\n\nexport const brandsApi = new BrandsApi();\n","import { Entity, EntityEcommerceRaw } from \"./types\";\n\n/**\n * Parses a raw GraphQL response entity to the normalized Entity type\n * @param rawEntity - The raw entity from GraphQL response\n * @returns Normalized Entity object\n */\nexport function parseRawEntityToEntity(rawEntity: EntityEcommerceRaw): Entity {\n return {\n ...rawEntity,\n };\n}\n","import { ApiClient } from \"../core/apiClient\";\nimport { parseRawEntityToEntity } from \"./parsers\";\nimport { GetEntityParams, EntityRawResponse, Entity } from \"./types\";\nimport { ApiResponse } from \"../core/types\";\n\nclass EntityApi extends ApiClient {\n async getEntity(params: GetEntityParams = {}): Promise<ApiResponse<Entity>> {\n const cacheKey = this.cache.buildCacheKey(\"getEntity\", params);\n return this.cache.cacheWrap(\n cacheKey,\n () => this.fetchEntityFromAPI(params),\n \"getEntity\",\n params\n );\n }\n\n private async fetchEntityFromAPI(\n params: GetEntityParams\n ): Promise<ApiResponse<Entity>> {\n if (!this.baseURL || !this.apiKey) {\n return {\n data: null,\n error: true,\n errorMessage:\n \"SDK no configurado: PAKENTO_CMS_BASE_URL o PAKENTO_API_KEY faltantes.\",\n };\n }\n\n const query = `\n query GetEntity {\n Entities (limit: 1, trash: false) {\n docs {\n name\n address\n instagram\n facebook\n whatsapp_number\n tiktok\n youtube\n currency {\n prefix\n plural_name\n name\n }\n featured_image {\n thumbnailURL\n url\n width\n height\n }\n logo {\n thumbnailURL\n url\n width\n height\n }\n logo_2 {\n thumbnailURL\n url\n width\n height\n }\n }\n }\n }\n `;\n\n const { data, error, errorMessage } =\n await this.fetchGraphQL<EntityRawResponse>(\n query,\n params,\n (responseData) => responseData?.Entities\n );\n\n if (error) {\n return { data: null, error: true, errorMessage };\n }\n\n return {\n data: parseRawEntityToEntity(data!.docs[0]),\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 message: z.string().min(1),\n});\n","import { ApiClient } from \"../core/apiClient\";\nimport { contactUsSchema } from \"./validators\";\nimport { SendContactUsEmailParams, SendContactUsEmailResponse } from \"./types\";\n\nclass ContactApi extends ApiClient {\n async sendContactUsEmail(\n params: SendContactUsEmailParams\n ): Promise<SendContactUsEmailResponse> {\n if (!this.baseURL || !this.apiKey) {\n return {\n message: \"SDK no configurado\",\n error: true,\n errorMessage: \"SDK no configurado\",\n };\n }\n\n const validated = contactUsSchema.safeParse(params);\n if (!validated.success) {\n const errorMessage = this.handleApiError(\n validated.error,\n \"sendContactUsEmail validation\"\n );\n return { message: errorMessage, error: true, errorMessage };\n }\n\n try {\n const response = await this.client.post(\n \"/api/entities/send-contact-us-email\",\n validated.data\n );\n\n if (response.status === 200) {\n return {\n message: response.data.message || \"Mensaje enviado exitosamente\",\n error: false,\n errorMessage: null,\n };\n } else {\n const errorMessage =\n response.data.message || \"Error al enviar el mensaje\";\n return { message: errorMessage, error: true, errorMessage };\n }\n } catch (error) {\n const errorMessage = this.handleApiError(error, \"sendContactUsEmail\");\n return { message: errorMessage, error: true, errorMessage };\n }\n }\n}\n\nexport const contactApi = new ContactApi();\n","import { ApiClient } from \"../core/apiClient\";\nimport { CustomGraphQLParams, CustomGraphQLResponse } from \"./types\";\n\nclass CustomApi extends ApiClient {\n async executeCustomQuery<T>(\n params: CustomGraphQLParams\n ): Promise<CustomGraphQLResponse<T>> {\n if (!this.baseURL || !this.apiKey) {\n return {\n data: null as T,\n error: true,\n errorMessage:\n \"SDK no configurado: PAKENTO_CMS_BASE_URL o PAKENTO_API_KEY faltantes.\",\n };\n }\n\n if (\n !params.query ||\n typeof params.query !== \"string\" ||\n params.query.trim() === \"\"\n ) {\n return {\n data: null as T,\n error: true,\n errorMessage: \"Se requiere un query GraphQL válido.\",\n };\n }\n\n try {\n const response = await this.client.post(\"/api/graphql\", {\n query: params.query,\n variables: params.variables || {},\n });\n\n if (response.data.errors && response.data.errors.length > 0) {\n return {\n data: response.data.data || (null as T),\n errors: response.data.errors,\n error: true,\n errorMessage: `GraphQL Errors: ${response.data.errors\n .map((err: { message: string }) => err.message)\n .join(\", \")}`,\n };\n }\n\n return {\n data: response.data.data,\n error: false,\n errorMessage: null,\n };\n } catch (error) {\n const errorMessage = this.handleApiError(error, \"Custom GraphQL\");\n return { data: null as T, error: true, errorMessage };\n }\n }\n}\n\nexport const customApi = new CustomApi();\n"],"mappings":";AAAA,OAAO,SAAwB,kBAAkB;AACjD,SAAS,SAAS;;;ACDlB,SAAS,aAAa;AAEf,IAAM,eAAN,MAAmB;AAAA;AAAA,EAKxB,YAAY,QAAgB;AAF5B,SAAQ,aAAqB;AAG3B,SAAK,aAAa,OAAO,UAAU,GAAG,CAAC;AAEvC,QACE,QAAQ,IAAI,0BACZ,QAAQ,IAAI,0BACZ;AACA,WAAK,QAAQ,IAAI,MAAM;AAAA,QACrB,KAAK,QAAQ,IAAI;AAAA,QACjB,OAAO,QAAQ,IAAI;AAAA,MACrB,CAAC;AAAA,IACH;AAAA,EACF;AAAA,EAEQ,mBAAmB,QAAyC;AAClE,UAAM,eAAe,KAAK,UAAU,MAAM;AAC1C,WAAO,KAAK,YAAY;AAAA,EAC1B;AAAA,EAEO,cACL,cACA,SAAkC,CAAC,GAC3B;AACR,UAAM,aAAa,KAAK,mBAAmB,EAAE,GAAG,QAAQ,aAAa,CAAC;AACtE,WAAO,WAAW,KAAK,UAAU,IAAI,UAAU;A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