oneentry 1.0.84 → 1.0.85

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.
@@ -1,4 +1,4 @@
1
- import { IProductsQuery, IFilterParams, IProductApi, IProductsEntity, IProductInfo, IProductBlock, IProductEntity } from './productsInterfaces';
1
+ import { IProductsQuery, IFilterParams, IProductApi, IProductsEntity, IProductBlock, IProductEntity, IProductsResponse, IProductsInfo } from './productsInterfaces';
2
2
  import AsyncModules from '../base/asyncModules';
3
3
  import StateModule from "../base/stateModule";
4
4
  /**
@@ -53,7 +53,7 @@ export default class ProductApi extends AsyncModules implements IProductApi {
53
53
  *
54
54
  * @returns Array with ProductEntity objects
55
55
  */
56
- getProducts(body?: Array<IFilterParams>, langCode?: string, userQuery?: IProductsQuery): Promise<Array<IProductsEntity>>;
56
+ getProducts(body?: Array<IFilterParams>, langCode?: string, userQuery?: IProductsQuery): Promise<IProductsResponse>;
57
57
  /**
58
58
  * Search for all product page objects with pagination that do not have a category.
59
59
  *
@@ -77,7 +77,7 @@ export default class ProductApi extends AsyncModules implements IProductApi {
77
77
  *
78
78
  * @returns Array with ProductEntity objects
79
79
  */
80
- getProductsEmptyPage(langCode?: string, userQuery?: IProductsQuery): Promise<Array<IProductsEntity>>;
80
+ getProductsEmptyPage(langCode?: string, userQuery?: IProductsQuery): Promise<IProductsResponse>;
81
81
  /**
82
82
  * Search for all products with pagination for the selected category.
83
83
  * @param {Array<IFilterParams>} body - Request body.
@@ -123,7 +123,7 @@ export default class ProductApi extends AsyncModules implements IProductApi {
123
123
  *
124
124
  * @returns Array with ProductEntity objects
125
125
  */
126
- getProductsByPageId(id: number, body?: Array<IFilterParams>, langCode?: string, userQuery?: IProductsQuery): Promise<Array<IProductsEntity>>;
126
+ getProductsByPageId(id: number, body?: Array<IFilterParams>, langCode?: string, userQuery?: IProductsQuery): Promise<IProductsResponse>;
127
127
  /**
128
128
  * Search for information about products and prices for the selected category.
129
129
  * @param {string} url - Page url.
@@ -147,7 +147,7 @@ export default class ProductApi extends AsyncModules implements IProductApi {
147
147
  *
148
148
  * @returns Array with ProductInformation objects
149
149
  */
150
- getProductsPriceByPageUrl(url: string, langCode?: string, userQuery?: IProductsQuery): Promise<Array<IProductInfo>>;
150
+ getProductsPriceByPageUrl(url: string, langCode?: string, userQuery?: IProductsQuery): Promise<IProductsInfo>;
151
151
  /**
152
152
  * Search for all products with pagination for the selected category.
153
153
  * @param {Array<IFilterParams>} body - Request body.
@@ -193,7 +193,7 @@ export default class ProductApi extends AsyncModules implements IProductApi {
193
193
  *
194
194
  * @returns Array with ProductEntity objects
195
195
  */
196
- getProductsByPageUrl(url: string, body?: Array<IFilterParams>, langCode?: string, userQuery?: IProductsQuery): Promise<Array<IProductsEntity>>;
196
+ getProductsByPageUrl(url: string, body?: Array<IFilterParams>, langCode?: string, userQuery?: IProductsQuery): Promise<IProductsResponse>;
197
197
  /**
198
198
  * Find all related product page objects.
199
199
  *
@@ -212,7 +212,7 @@ export default class ProductApi extends AsyncModules implements IProductApi {
212
212
  *
213
213
  * @returns Array with ProductEntity objects
214
214
  */
215
- getRelatedProductsById(id: number, langCode?: string, userQuery?: IProductsQuery): Promise<Array<IProductsEntity>>;
215
+ getRelatedProductsById(id: number, langCode?: string, userQuery?: IProductsQuery): Promise<IProductsResponse>;
216
216
  /**
217
217
  * Retrieve one product object.
218
218
  *
@@ -67,7 +67,7 @@ class ProductApi extends asyncModules_1.default {
67
67
  async getProducts(body = [], langCode = this.state.lang, userQuery) {
68
68
  const query = { ...this._defaultQuery, ...userQuery, langCode };
69
69
  const result = await this._fetchPost(`/all?` + this._queryParamsToString(query), body);
70
- return this._dataPostProcess(result.items, langCode);
70
+ return this._dataPostProcess(result, langCode);
71
71
  }
72
72
  /**
73
73
  * Search for all product page objects with pagination that do not have a category.
@@ -95,7 +95,7 @@ class ProductApi extends asyncModules_1.default {
95
95
  async getProductsEmptyPage(langCode = this.state.lang, userQuery) {
96
96
  const query = { ...this._defaultQuery, ...userQuery };
97
97
  const result = await this._fetchGet(`/empty-page?langCode=${langCode}&` + this._queryParamsToString(query));
98
- return this._dataPostProcess(result.items, langCode);
98
+ return this._dataPostProcess(result, langCode);
99
99
  }
100
100
  /**
101
101
  * Search for all products with pagination for the selected category.
@@ -145,7 +145,7 @@ class ProductApi extends asyncModules_1.default {
145
145
  async getProductsByPageId(id, body = [], langCode = this.state.lang, userQuery) {
146
146
  const query = { ...this._defaultQuery, ...userQuery };
147
147
  const result = await this._fetchPost(`/page/${id}?langCode=${langCode}&` + this._queryParamsToString(query), body);
148
- return this._dataPostProcess(result.items, langCode);
148
+ return this._dataPostProcess(result, langCode);
149
149
  }
150
150
  /**
151
151
  * Search for information about products and prices for the selected category.
@@ -173,7 +173,7 @@ class ProductApi extends asyncModules_1.default {
173
173
  async getProductsPriceByPageUrl(url, langCode = this.state.lang, userQuery) {
174
174
  const query = { ...this._defaultQuery, ...userQuery, langCode };
175
175
  const result = await this._fetchGet(`/page/${url}/prices?` + this._queryParamsToString(query));
176
- return result.items;
176
+ return result;
177
177
  }
178
178
  /**
179
179
  * Search for all products with pagination for the selected category.
@@ -223,7 +223,7 @@ class ProductApi extends asyncModules_1.default {
223
223
  async getProductsByPageUrl(url, body = [], langCode = this.state.lang, userQuery) {
224
224
  const query = { ...this._defaultQuery, ...userQuery };
225
225
  const result = await this._fetchPost(`/page/url/${url}?langCode=${langCode}&` + this._queryParamsToString(query), body);
226
- return this._dataPostProcess(result.items, langCode);
226
+ return this._dataPostProcess(result, langCode);
227
227
  }
228
228
  /**
229
229
  * Find all related product page objects.
@@ -246,7 +246,7 @@ class ProductApi extends asyncModules_1.default {
246
246
  async getRelatedProductsById(id, langCode = this.state.lang, userQuery) {
247
247
  const query = { ...this._defaultQuery, ...userQuery };
248
248
  const result = await this._fetchGet(`/${id}/related?langCode=${langCode}&` + this._queryParamsToString(query));
249
- return this._dataPostProcess(result.items, langCode);
249
+ return this._dataPostProcess(result, langCode);
250
250
  }
251
251
  /**
252
252
  * Retrieve one product object.
@@ -13,12 +13,12 @@ import { LangType, Types } from "../base/utils";
13
13
  * @property {function} searchProduct - Quick search for product page objects with limited output.
14
14
  */
15
15
  interface IProductApi {
16
- getProducts(body?: Array<IFilterParams>, langCode?: string, userQuery?: IProductsQuery): Promise<Array<IProductsEntity>>;
17
- getProductsEmptyPage(langCode?: LangType, userQuery?: IProductsQuery): Promise<Array<IProductsEntity>>;
18
- getProductsByPageId(id: number, body?: Array<IFilterParams>, langCode?: string, userQuery?: IProductsQuery): Promise<Array<IProductsEntity>>;
19
- getProductsPriceByPageUrl(url: string, langCode?: string, userQuery?: IProductsQuery): Promise<Array<IProductInfo>>;
20
- getProductsByPageUrl(url: string, body?: Array<IFilterParams>, langCode?: string, userQuery?: IProductsQuery): Promise<Array<IProductsEntity>>;
21
- getRelatedProductsById(id: number, langCode?: string, userQuery?: IProductsQuery): Promise<Array<IProductsEntity>>;
16
+ getProducts(body?: Array<IFilterParams>, langCode?: string, userQuery?: IProductsQuery): Promise<IProductsResponse>;
17
+ getProductsEmptyPage(langCode?: LangType, userQuery?: IProductsQuery): Promise<IProductsResponse>;
18
+ getProductsByPageId(id: number, body?: Array<IFilterParams>, langCode?: string, userQuery?: IProductsQuery): Promise<IProductsResponse>;
19
+ getProductsPriceByPageUrl(url: string, langCode?: string, userQuery?: IProductsQuery): Promise<IProductsInfo>;
20
+ getProductsByPageUrl(url: string, body?: Array<IFilterParams>, langCode?: string, userQuery?: IProductsQuery): Promise<IProductsResponse>;
21
+ getRelatedProductsById(id: number, langCode?: string, userQuery?: IProductsQuery): Promise<IProductsResponse>;
22
22
  getProductById(id: number, langCode: string): Promise<IProductEntity>;
23
23
  getProductBlockById(id: number): Promise<Array<IProductBlock>>;
24
24
  searchProduct(name: string, langCode: string): Promise<Array<IProductsEntity>>;
@@ -125,9 +125,17 @@ interface IProductsEntity {
125
125
  sku: string | null;
126
126
  }
127
127
  interface IProductEntity extends IProductsEntity {
128
- blocks?: Array<IProductBlock>;
128
+ blocks?: Array<string>;
129
129
  productPages?: Array<Record<string, any>> | Record<string, any>;
130
130
  }
131
+ interface IProductsResponse {
132
+ total: number;
133
+ items: Array<IProductsEntity>;
134
+ }
135
+ interface IProductsInfo {
136
+ total: number;
137
+ items: Array<IProductsInfo>;
138
+ }
131
139
  interface IProductInfo {
132
140
  id: number;
133
141
  price: number;
@@ -162,4 +170,4 @@ interface IProductBlock {
162
170
  isSync: boolean;
163
171
  attributeValues: Record<string, any>;
164
172
  }
165
- export { IFilterParams, IProductsQuery, IProductApi, IProductsEntity, IProductInfo, IProductBlock, IProductEntity };
173
+ export { IFilterParams, IProductsQuery, IProductApi, IProductsEntity, IProductsInfo, IProductInfo, IProductBlock, IProductEntity, IProductsResponse };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "oneentry",
3
- "version": "1.0.84",
3
+ "version": "1.0.85",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",