@pakento/cms-sdk 4.3.2 → 4.3.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.mts CHANGED
@@ -7,7 +7,7 @@ declare class CacheService {
7
7
  constructor(apiKey: string);
8
8
  private generateParamsHash;
9
9
  buildCacheKey(functionName: string, params?: Record<string, unknown>): string;
10
- cacheWrap<T>(key: string, fetcher: () => Promise<T>): Promise<T>;
10
+ cacheWrap<T>(key: string, fetcher: () => Promise<T>, filters?: Record<string, unknown>): Promise<T>;
11
11
  }
12
12
 
13
13
  declare class ApiClient {
@@ -25,7 +25,7 @@ declare class ApiClient {
25
25
  }
26
26
 
27
27
  interface ApiResponse<T> {
28
- data: T[] | null;
28
+ data: T | null;
29
29
  totalDocs?: number;
30
30
  totalPages?: number;
31
31
  prevPage?: number | null;
@@ -116,7 +116,7 @@ interface ItemsRawResponse {
116
116
  }
117
117
 
118
118
  declare class ItemsApi extends ApiClient {
119
- getItems(params?: GetItemsParams): Promise<ApiResponse<Item>>;
119
+ getItems(params?: GetItemsParams): Promise<ApiResponse<Item[]>>;
120
120
  private fetchItemsFromAPI;
121
121
  }
122
122
  declare const itemsApi: ItemsApi;
@@ -126,6 +126,11 @@ interface Category {
126
126
  name: string;
127
127
  image_url: string;
128
128
  }
129
+ interface CategoryEcommerceRaw {
130
+ id: number;
131
+ name: string;
132
+ image_url: string;
133
+ }
129
134
  interface CategoriesWhere {
130
135
  item_super_category_id?: WhereClause;
131
136
  brand_id?: WhereClause;
@@ -135,19 +140,14 @@ interface GetCategoriesParams {
135
140
  limit?: number;
136
141
  page?: number;
137
142
  sort?: string;
143
+ [key: string]: unknown;
138
144
  }
139
145
  interface CategoriesRawResponse {
140
- docs: Category[];
141
- }
142
- interface CategoriesApiResponse {
143
- data: Category[] | null;
144
- categories: Category[];
145
- error: boolean;
146
- errorMessage: string | null;
146
+ docs: CategoryEcommerceRaw[];
147
147
  }
148
148
 
149
149
  declare class CategoriesApi extends ApiClient {
150
- getCategories(params?: GetCategoriesParams): Promise<CategoriesApiResponse>;
150
+ getCategories(params?: GetCategoriesParams): Promise<ApiResponse<Category[]>>;
151
151
  private fetchCategoriesFromAPI;
152
152
  }
153
153
  declare const categoriesApi: CategoriesApi;
@@ -159,15 +159,23 @@ interface Brand {
159
159
  items_count: number;
160
160
  image_url: string;
161
161
  image_thumbnail_url: string;
162
- image_alt: string;
162
+ }
163
+ interface BrandEcommerceRaw {
164
+ id: string;
165
+ name: string;
166
+ description: string;
167
+ items_count: number;
168
+ image_url: string;
169
+ image_thumbnail_url: string;
163
170
  }
164
171
  interface GetBrandsParams {
165
172
  limit?: number;
166
173
  page?: number;
167
174
  sort?: string;
175
+ [key: string]: unknown;
168
176
  }
169
177
  interface BrandsRawResponse {
170
- docs: Brand[];
178
+ docs: BrandEcommerceRaw[];
171
179
  hasNextPage: boolean;
172
180
  hasPrevPage: boolean;
173
181
  limit: number;
@@ -179,25 +187,9 @@ interface BrandsRawResponse {
179
187
  totalDocs: number;
180
188
  totalPages: number;
181
189
  }
182
- interface BrandsApiResponse {
183
- data: BrandsRawResponse | null;
184
- brands: Brand[];
185
- hasNextPage: boolean;
186
- hasPrevPage: boolean;
187
- limit: number;
188
- nextPage: number;
189
- offset: number;
190
- page: number;
191
- pagingCounter: number;
192
- prevPage: number;
193
- totalDocs: number;
194
- totalPages: number;
195
- error: boolean;
196
- errorMessage: string | null;
197
- }
198
190
 
199
191
  declare class BrandsApi extends ApiClient {
200
- getBrands(params?: GetBrandsParams): Promise<BrandsApiResponse>;
192
+ getBrands(params?: GetBrandsParams): Promise<ApiResponse<Brand[]>>;
201
193
  private fetchBrandsFromAPI;
202
194
  }
203
195
  declare const brandsApi: BrandsApi;
@@ -229,7 +221,39 @@ interface Entity {
229
221
  logo_2_width: string;
230
222
  logo_2_height: string;
231
223
  featured_image_url: string;
232
- featured_image_alt: string;
224
+ featured_image_thumbnail_url: string;
225
+ featured_image_sizes_thumbnail_filename: string;
226
+ featured_image_filename: string;
227
+ featured_image_width: string;
228
+ featured_image_height: string;
229
+ }
230
+ interface EntityEcommerceRaw {
231
+ id: string;
232
+ tin: string;
233
+ name: string;
234
+ web: string;
235
+ address: string;
236
+ country: string;
237
+ city: string;
238
+ currency_id: string;
239
+ currency_name: string;
240
+ currency_prefix: string;
241
+ currency_suffix: string;
242
+ logo_url: string;
243
+ logo_alt: string;
244
+ logo_thumbnail_url: string;
245
+ logo_sizes_thumbnail_filename: string;
246
+ logo_filename: string;
247
+ logo_width: string;
248
+ logo_height: string;
249
+ logo_2_url: string;
250
+ logo_2_alt: string;
251
+ logo_2_thumbnail_url: string;
252
+ logo_2_sizes_thumbnail_filename: string;
253
+ logo_2_filename: string;
254
+ logo_2_width: string;
255
+ logo_2_height: string;
256
+ featured_image_url: string;
233
257
  featured_image_thumbnail_url: string;
234
258
  featured_image_sizes_thumbnail_filename: string;
235
259
  featured_image_filename: string;
@@ -240,17 +264,11 @@ interface GetEntityParams {
240
264
  [key: string]: unknown;
241
265
  }
242
266
  interface EntityRawResponse {
243
- GetEntity: Entity;
244
- }
245
- interface EntityApiResponse {
246
- data: Entity | null;
247
- entity: Entity | null;
248
- error: boolean;
249
- errorMessage: string | null;
267
+ GetEntity: EntityEcommerceRaw;
250
268
  }
251
269
 
252
270
  declare class EntityApi extends ApiClient {
253
- getEntity(params?: GetEntityParams): Promise<EntityApiResponse>;
271
+ getEntity(params?: GetEntityParams): Promise<ApiResponse<Entity>>;
254
272
  private fetchEntityFromAPI;
255
273
  }
256
274
  declare const entityApi: EntityApi;
@@ -288,6 +306,7 @@ interface SendContactUsEmailParams {
288
306
  phone?: string;
289
307
  notes?: string;
290
308
  subject?: string;
309
+ [key: string]: unknown;
291
310
  }
292
311
  interface SendContactUsEmailResponse {
293
312
  message: string;
@@ -316,4 +335,4 @@ declare class CustomApi extends ApiClient {
316
335
  }
317
336
  declare const customApi: CustomApi;
318
337
 
319
- export { ApiClient, type ApiResponse, type Brand, type BrandsApiResponse, type BrandsRawResponse, type CategoriesApiResponse, type CategoriesRawResponse, type CategoriesWhere, type Category, type CreateEcommerceOrderItem, type CreateEcommerceOrderParams, type CreateEcommerceOrderResponse, type CustomGraphQLParams, type CustomGraphQLResponse, type Entity, type EntityApiResponse, type EntityRawResponse, type GetBrandsParams, type GetCategoriesParams, type GetEntityParams, type GetItemsParams, type Item, type ItemEcommerceRaw, type ItemImage, type ItemsRawResponse, type ItemsWhere, type SendContactUsEmailParams, type SendContactUsEmailResponse, type WhereClause, brandsApi, categoriesApi, contactApi, customApi, entityApi, itemsApi, ordersApi };
338
+ export { ApiClient, type ApiResponse, type Brand, type BrandEcommerceRaw, type BrandsRawResponse, type CategoriesRawResponse, type CategoriesWhere, type Category, type CategoryEcommerceRaw, type CreateEcommerceOrderItem, type CreateEcommerceOrderParams, type CreateEcommerceOrderResponse, type CustomGraphQLParams, type CustomGraphQLResponse, type Entity, type EntityEcommerceRaw, type EntityRawResponse, type GetBrandsParams, type GetCategoriesParams, type GetEntityParams, type GetItemsParams, type Item, type ItemEcommerceRaw, type ItemImage, type ItemsRawResponse, type ItemsWhere, type SendContactUsEmailParams, type SendContactUsEmailResponse, type WhereClause, brandsApi, categoriesApi, contactApi, customApi, entityApi, itemsApi, ordersApi };
package/dist/index.d.ts CHANGED
@@ -7,7 +7,7 @@ declare class CacheService {
7
7
  constructor(apiKey: string);
8
8
  private generateParamsHash;
9
9
  buildCacheKey(functionName: string, params?: Record<string, unknown>): string;
10
- cacheWrap<T>(key: string, fetcher: () => Promise<T>): Promise<T>;
10
+ cacheWrap<T>(key: string, fetcher: () => Promise<T>, filters?: Record<string, unknown>): Promise<T>;
11
11
  }
12
12
 
13
13
  declare class ApiClient {
@@ -25,7 +25,7 @@ declare class ApiClient {
25
25
  }
26
26
 
27
27
  interface ApiResponse<T> {
28
- data: T[] | null;
28
+ data: T | null;
29
29
  totalDocs?: number;
30
30
  totalPages?: number;
31
31
  prevPage?: number | null;
@@ -116,7 +116,7 @@ interface ItemsRawResponse {
116
116
  }
117
117
 
118
118
  declare class ItemsApi extends ApiClient {
119
- getItems(params?: GetItemsParams): Promise<ApiResponse<Item>>;
119
+ getItems(params?: GetItemsParams): Promise<ApiResponse<Item[]>>;
120
120
  private fetchItemsFromAPI;
121
121
  }
122
122
  declare const itemsApi: ItemsApi;
@@ -126,6 +126,11 @@ interface Category {
126
126
  name: string;
127
127
  image_url: string;
128
128
  }
129
+ interface CategoryEcommerceRaw {
130
+ id: number;
131
+ name: string;
132
+ image_url: string;
133
+ }
129
134
  interface CategoriesWhere {
130
135
  item_super_category_id?: WhereClause;
131
136
  brand_id?: WhereClause;
@@ -135,19 +140,14 @@ interface GetCategoriesParams {
135
140
  limit?: number;
136
141
  page?: number;
137
142
  sort?: string;
143
+ [key: string]: unknown;
138
144
  }
139
145
  interface CategoriesRawResponse {
140
- docs: Category[];
141
- }
142
- interface CategoriesApiResponse {
143
- data: Category[] | null;
144
- categories: Category[];
145
- error: boolean;
146
- errorMessage: string | null;
146
+ docs: CategoryEcommerceRaw[];
147
147
  }
148
148
 
149
149
  declare class CategoriesApi extends ApiClient {
150
- getCategories(params?: GetCategoriesParams): Promise<CategoriesApiResponse>;
150
+ getCategories(params?: GetCategoriesParams): Promise<ApiResponse<Category[]>>;
151
151
  private fetchCategoriesFromAPI;
152
152
  }
153
153
  declare const categoriesApi: CategoriesApi;
@@ -159,15 +159,23 @@ interface Brand {
159
159
  items_count: number;
160
160
  image_url: string;
161
161
  image_thumbnail_url: string;
162
- image_alt: string;
162
+ }
163
+ interface BrandEcommerceRaw {
164
+ id: string;
165
+ name: string;
166
+ description: string;
167
+ items_count: number;
168
+ image_url: string;
169
+ image_thumbnail_url: string;
163
170
  }
164
171
  interface GetBrandsParams {
165
172
  limit?: number;
166
173
  page?: number;
167
174
  sort?: string;
175
+ [key: string]: unknown;
168
176
  }
169
177
  interface BrandsRawResponse {
170
- docs: Brand[];
178
+ docs: BrandEcommerceRaw[];
171
179
  hasNextPage: boolean;
172
180
  hasPrevPage: boolean;
173
181
  limit: number;
@@ -179,25 +187,9 @@ interface BrandsRawResponse {
179
187
  totalDocs: number;
180
188
  totalPages: number;
181
189
  }
182
- interface BrandsApiResponse {
183
- data: BrandsRawResponse | null;
184
- brands: Brand[];
185
- hasNextPage: boolean;
186
- hasPrevPage: boolean;
187
- limit: number;
188
- nextPage: number;
189
- offset: number;
190
- page: number;
191
- pagingCounter: number;
192
- prevPage: number;
193
- totalDocs: number;
194
- totalPages: number;
195
- error: boolean;
196
- errorMessage: string | null;
197
- }
198
190
 
199
191
  declare class BrandsApi extends ApiClient {
200
- getBrands(params?: GetBrandsParams): Promise<BrandsApiResponse>;
192
+ getBrands(params?: GetBrandsParams): Promise<ApiResponse<Brand[]>>;
201
193
  private fetchBrandsFromAPI;
202
194
  }
203
195
  declare const brandsApi: BrandsApi;
@@ -229,7 +221,39 @@ interface Entity {
229
221
  logo_2_width: string;
230
222
  logo_2_height: string;
231
223
  featured_image_url: string;
232
- featured_image_alt: string;
224
+ featured_image_thumbnail_url: string;
225
+ featured_image_sizes_thumbnail_filename: string;
226
+ featured_image_filename: string;
227
+ featured_image_width: string;
228
+ featured_image_height: string;
229
+ }
230
+ interface EntityEcommerceRaw {
231
+ id: string;
232
+ tin: string;
233
+ name: string;
234
+ web: string;
235
+ address: string;
236
+ country: string;
237
+ city: string;
238
+ currency_id: string;
239
+ currency_name: string;
240
+ currency_prefix: string;
241
+ currency_suffix: string;
242
+ logo_url: string;
243
+ logo_alt: string;
244
+ logo_thumbnail_url: string;
245
+ logo_sizes_thumbnail_filename: string;
246
+ logo_filename: string;
247
+ logo_width: string;
248
+ logo_height: string;
249
+ logo_2_url: string;
250
+ logo_2_alt: string;
251
+ logo_2_thumbnail_url: string;
252
+ logo_2_sizes_thumbnail_filename: string;
253
+ logo_2_filename: string;
254
+ logo_2_width: string;
255
+ logo_2_height: string;
256
+ featured_image_url: string;
233
257
  featured_image_thumbnail_url: string;
234
258
  featured_image_sizes_thumbnail_filename: string;
235
259
  featured_image_filename: string;
@@ -240,17 +264,11 @@ interface GetEntityParams {
240
264
  [key: string]: unknown;
241
265
  }
242
266
  interface EntityRawResponse {
243
- GetEntity: Entity;
244
- }
245
- interface EntityApiResponse {
246
- data: Entity | null;
247
- entity: Entity | null;
248
- error: boolean;
249
- errorMessage: string | null;
267
+ GetEntity: EntityEcommerceRaw;
250
268
  }
251
269
 
252
270
  declare class EntityApi extends ApiClient {
253
- getEntity(params?: GetEntityParams): Promise<EntityApiResponse>;
271
+ getEntity(params?: GetEntityParams): Promise<ApiResponse<Entity>>;
254
272
  private fetchEntityFromAPI;
255
273
  }
256
274
  declare const entityApi: EntityApi;
@@ -288,6 +306,7 @@ interface SendContactUsEmailParams {
288
306
  phone?: string;
289
307
  notes?: string;
290
308
  subject?: string;
309
+ [key: string]: unknown;
291
310
  }
292
311
  interface SendContactUsEmailResponse {
293
312
  message: string;
@@ -316,4 +335,4 @@ declare class CustomApi extends ApiClient {
316
335
  }
317
336
  declare const customApi: CustomApi;
318
337
 
319
- export { ApiClient, type ApiResponse, type Brand, type BrandsApiResponse, type BrandsRawResponse, type CategoriesApiResponse, type CategoriesRawResponse, type CategoriesWhere, type Category, type CreateEcommerceOrderItem, type CreateEcommerceOrderParams, type CreateEcommerceOrderResponse, type CustomGraphQLParams, type CustomGraphQLResponse, type Entity, type EntityApiResponse, type EntityRawResponse, type GetBrandsParams, type GetCategoriesParams, type GetEntityParams, type GetItemsParams, type Item, type ItemEcommerceRaw, type ItemImage, type ItemsRawResponse, type ItemsWhere, type SendContactUsEmailParams, type SendContactUsEmailResponse, type WhereClause, brandsApi, categoriesApi, contactApi, customApi, entityApi, itemsApi, ordersApi };
338
+ export { ApiClient, type ApiResponse, type Brand, type BrandEcommerceRaw, type BrandsRawResponse, type CategoriesRawResponse, type CategoriesWhere, type Category, type CategoryEcommerceRaw, type CreateEcommerceOrderItem, type CreateEcommerceOrderParams, type CreateEcommerceOrderResponse, type CustomGraphQLParams, type CustomGraphQLResponse, type Entity, type EntityEcommerceRaw, type EntityRawResponse, type GetBrandsParams, type GetCategoriesParams, type GetEntityParams, type GetItemsParams, type Item, type ItemEcommerceRaw, type ItemImage, type ItemsRawResponse, type ItemsWhere, type SendContactUsEmailParams, type SendContactUsEmailResponse, type WhereClause, brandsApi, categoriesApi, contactApi, customApi, entityApi, itemsApi, ordersApi };