oneentry 1.0.38 → 1.0.40
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 +42 -133
- package/dist/admins/adminsApi.d.ts +2 -1
- package/dist/admins/adminsApi.js +3 -3
- package/dist/attribute-sets/attributeSetsApi.d.ts +2 -1
- package/dist/attribute-sets/attributeSetsApi.js +4 -4
- package/dist/base/oneEntry.d.ts +6 -7
- package/dist/base/oneEntry.js +25 -73
- package/dist/base/utils.d.ts +5 -1
- package/dist/blocks/blocksApi.d.ts +2 -1
- package/dist/blocks/blocksApi.js +3 -3
- package/dist/file-uploding/fileUploadingApi.d.ts +7 -6
- package/dist/file-uploding/fileUploadingApi.js +9 -7
- package/dist/file-uploding/fileUploadingInterfaces.d.ts +4 -4
- package/dist/forms/formsApi.d.ts +2 -1
- package/dist/forms/formsApi.js +4 -4
- package/dist/formsData/formsDataApi.d.ts +2 -1
- package/dist/formsData/formsDataApi.js +6 -6
- package/dist/formsData/formsDataInterfaces.d.ts +4 -7
- package/dist/general-types/GeneralTypesApi.d.ts +2 -1
- package/dist/general-types/GeneralTypesApi.js +2 -2
- package/dist/index.d.ts +2 -1
- package/dist/index.js +17 -17
- package/dist/locales/localesApi.d.ts +2 -1
- package/dist/locales/localesApi.js +2 -2
- package/dist/markers/markersApi.d.ts +2 -1
- package/dist/markers/markersApi.js +2 -2
- package/dist/menus/menusApi.d.ts +2 -1
- package/dist/menus/menusApi.js +2 -2
- package/dist/pages/pagesApi.d.ts +19 -19
- package/dist/pages/pagesApi.js +36 -36
- package/dist/pages/pagesInterfaces.d.ts +1 -1
- package/dist/product-statuses/productStatusesApi.d.ts +2 -1
- package/dist/product-statuses/productStatusesApi.js +2 -2
- package/dist/products/productsApi.d.ts +16 -16
- package/dist/products/productsApi.js +35 -56
- package/dist/system/systemApi.d.ts +2 -1
- package/dist/system/systemApi.js +2 -2
- package/dist/templates/templatesApi.d.ts +2 -2
- package/dist/templates/templatesApi.js +2 -2
- package/dist/templates-preview/templatesPreviewApi.d.ts +2 -1
- package/dist/templates-preview/templatesPreviewApi.js +2 -2
- package/package.json +1 -1
|
@@ -5,8 +5,8 @@ const oneEntry_1 = require("../base/oneEntry");
|
|
|
5
5
|
* Controllers for working with file uploading
|
|
6
6
|
*/
|
|
7
7
|
class FileUploadingApi extends oneEntry_1.default {
|
|
8
|
-
constructor(url,
|
|
9
|
-
super(url,
|
|
8
|
+
constructor(url, config) {
|
|
9
|
+
super(url, config);
|
|
10
10
|
this._defaultQuery = {
|
|
11
11
|
type: null,
|
|
12
12
|
entity: null,
|
|
@@ -20,12 +20,12 @@ class FileUploadingApi extends oneEntry_1.default {
|
|
|
20
20
|
/**
|
|
21
21
|
* Upload file function.
|
|
22
22
|
*
|
|
23
|
-
* @param {
|
|
23
|
+
* @param {File} [data] File objects. Get data as File from your unput as e.target.files[0]
|
|
24
24
|
*
|
|
25
25
|
* @param {IUploadingQuery} [fileQuery] - Optional set query parameters.
|
|
26
|
-
* @param {string}
|
|
27
|
-
* @param {string}
|
|
28
|
-
* @param {number}
|
|
26
|
+
* @param {string} fileQuery.type - Type, determines the folder name in the storage. Example : "page"
|
|
27
|
+
* @param {string} fileQuery.entity - Entity name from which the file is uploaded, determines the folder name in the storage. Example : "editor"
|
|
28
|
+
* @param {number} fileQuery.id - Identifier of the object from which the file is uploaded, determines the folder name in the storage. Example : 3787
|
|
29
29
|
* @param {number} [fileQuery.width] - Optional width parameter. Example : 0
|
|
30
30
|
* @param {number} [fileQuery.height] - Optional height parameter. Example : 0
|
|
31
31
|
* @param {boolean} [fileQuery.compress] - Optional flag of optimization (compression) for images. Example : true
|
|
@@ -34,7 +34,9 @@ class FileUploadingApi extends oneEntry_1.default {
|
|
|
34
34
|
*/
|
|
35
35
|
async upload(data, fileQuery) {
|
|
36
36
|
const query = { ...this._defaultQuery, ...fileQuery };
|
|
37
|
-
const
|
|
37
|
+
const body = new FormData();
|
|
38
|
+
body.append('files', data);
|
|
39
|
+
const result = await this._fetchPost('?' + this._queryParamsToString(query), body);
|
|
38
40
|
return result;
|
|
39
41
|
}
|
|
40
42
|
/**
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* @property {function} getFile - Get file by parameters.
|
|
7
7
|
*/
|
|
8
8
|
interface IFileUploading {
|
|
9
|
-
upload(data:
|
|
9
|
+
upload(data: File, fileQuery?: IUploadingQuery): Promise<IUploadingReturns>;
|
|
10
10
|
delete(filename: string, fileQuery?: IUploadingQuery): Promise<any>;
|
|
11
11
|
getFile(id: number, type: string, entity: string, filename?: string): Promise<IFileEntity>;
|
|
12
12
|
}
|
|
@@ -23,9 +23,9 @@ interface IFileEntity {
|
|
|
23
23
|
* @property {boolean} [compress] - Flag of optimization (compression) for images.
|
|
24
24
|
*/
|
|
25
25
|
interface IUploadingQuery {
|
|
26
|
-
type
|
|
27
|
-
entity
|
|
28
|
-
id
|
|
26
|
+
type: string | null;
|
|
27
|
+
entity: string | null;
|
|
28
|
+
id: number | null;
|
|
29
29
|
width?: number | null;
|
|
30
30
|
height?: string | null;
|
|
31
31
|
compress?: boolean | null;
|
package/dist/forms/formsApi.d.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import OneEntry from "../base/oneEntry";
|
|
2
2
|
import { IForms, IFormsEntity } from "./formsInterfaces";
|
|
3
|
+
import { IConfig } from "../base/utils";
|
|
3
4
|
/**
|
|
4
5
|
* Controllers for forms objects
|
|
5
6
|
*/
|
|
6
7
|
export default class FormsApi extends OneEntry implements IForms {
|
|
7
|
-
constructor(url: string,
|
|
8
|
+
constructor(url: string, config: IConfig);
|
|
8
9
|
/**
|
|
9
10
|
* Get all forms.
|
|
10
11
|
*
|
package/dist/forms/formsApi.js
CHANGED
|
@@ -5,8 +5,8 @@ const oneEntry_1 = require("../base/oneEntry");
|
|
|
5
5
|
* Controllers for forms objects
|
|
6
6
|
*/
|
|
7
7
|
class FormsApi extends oneEntry_1.default {
|
|
8
|
-
constructor(url,
|
|
9
|
-
super(url,
|
|
8
|
+
constructor(url, config) {
|
|
9
|
+
super(url, config);
|
|
10
10
|
this._url += '/api/content/forms';
|
|
11
11
|
}
|
|
12
12
|
/**
|
|
@@ -18,7 +18,7 @@ class FormsApi extends oneEntry_1.default {
|
|
|
18
18
|
*
|
|
19
19
|
* @returns Returns array for all objects of type FormEntity
|
|
20
20
|
*/
|
|
21
|
-
async getAllForms(langCode =
|
|
21
|
+
async getAllForms(langCode = this._defaultLangCode, offset = 0, limit = 30) {
|
|
22
22
|
const result = await this._fetchGet(`?langCode=${langCode}&offset=${offset}&limit=${limit}`);
|
|
23
23
|
return this._normalizeData(result);
|
|
24
24
|
}
|
|
@@ -30,7 +30,7 @@ class FormsApi extends oneEntry_1.default {
|
|
|
30
30
|
*
|
|
31
31
|
* @returns Returns object of type FormEntity
|
|
32
32
|
*/
|
|
33
|
-
async getFormByMarker(marker, langCode =
|
|
33
|
+
async getFormByMarker(marker, langCode = this._defaultLangCode) {
|
|
34
34
|
const result = await this._fetchGet(`/marker/${marker}?langCode=${langCode}`);
|
|
35
35
|
return this._normalizeData(result);
|
|
36
36
|
}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import OneEntry from '../base/oneEntry';
|
|
2
2
|
import { IFormsPost, IFormsData, IFormsDataEntity } from './formsDataInterfaces';
|
|
3
|
+
import { IConfig } from "../base/utils";
|
|
3
4
|
/**
|
|
4
5
|
* Controllers for working with form data
|
|
5
6
|
*/
|
|
6
7
|
export default class FormsDataApi extends OneEntry implements IFormsData {
|
|
7
|
-
constructor(url: string,
|
|
8
|
+
constructor(url: string, config: IConfig);
|
|
8
9
|
/**
|
|
9
10
|
* Get all forms data.
|
|
10
11
|
*
|
|
@@ -5,8 +5,8 @@ const oneEntry_1 = require("../base/oneEntry");
|
|
|
5
5
|
* Controllers for working with form data
|
|
6
6
|
*/
|
|
7
7
|
class FormsDataApi extends oneEntry_1.default {
|
|
8
|
-
constructor(url,
|
|
9
|
-
super(url,
|
|
8
|
+
constructor(url, config) {
|
|
9
|
+
super(url, config);
|
|
10
10
|
this._url += '/api/content/form-data';
|
|
11
11
|
}
|
|
12
12
|
/**
|
|
@@ -18,9 +18,9 @@ class FormsDataApi extends oneEntry_1.default {
|
|
|
18
18
|
*
|
|
19
19
|
* @returns Returns array for all objects of FormData
|
|
20
20
|
*/
|
|
21
|
-
async getFormsData(langCode =
|
|
21
|
+
async getFormsData(langCode = this._defaultLangCode, offset = 0, limit = 30) {
|
|
22
22
|
const result = await this._fetchGet(`?langCode=${langCode}&offset=${offset}&limit=${limit}`);
|
|
23
|
-
return this._normalizeData(result);
|
|
23
|
+
return this._normalizeData(result.items);
|
|
24
24
|
}
|
|
25
25
|
/**
|
|
26
26
|
* Find all product page objects with pagination and multiple filtering.
|
|
@@ -41,7 +41,7 @@ class FormsDataApi extends oneEntry_1.default {
|
|
|
41
41
|
* @returns - Returns created FormData objects.
|
|
42
42
|
*/
|
|
43
43
|
async postFormsData(data) {
|
|
44
|
-
const result = await this._fetchPost('', data);
|
|
44
|
+
const result = await this._fetchPost('', JSON.stringify(data));
|
|
45
45
|
return this._normalizeData(result);
|
|
46
46
|
}
|
|
47
47
|
/**
|
|
@@ -54,7 +54,7 @@ class FormsDataApi extends oneEntry_1.default {
|
|
|
54
54
|
*
|
|
55
55
|
* @returns Returns array of object FormDataEntity
|
|
56
56
|
*/
|
|
57
|
-
async getFormsDataByMarker(marker, langCode =
|
|
57
|
+
async getFormsDataByMarker(marker, langCode = this._defaultLangCode, offset = 0, limit = 30) {
|
|
58
58
|
const result = await this._fetchGet(`/${marker}?langCode=${langCode}&offset=${offset}&limit=${limit}`);
|
|
59
59
|
return this._normalizeData(result);
|
|
60
60
|
}
|
|
@@ -44,13 +44,10 @@ interface IFormsDataEntity {
|
|
|
44
44
|
* @property {string} value Form data value.
|
|
45
45
|
*/
|
|
46
46
|
interface IFormData {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
value?: string;
|
|
52
|
-
}>;
|
|
53
|
-
};
|
|
47
|
+
[langcode: string]: Array<{
|
|
48
|
+
marker?: string;
|
|
49
|
+
value?: string;
|
|
50
|
+
}>;
|
|
54
51
|
}
|
|
55
52
|
/**
|
|
56
53
|
* interface to create an object of information about saving data using the form
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import OneEntry from "../base/oneEntry";
|
|
2
2
|
import { IGeneralTypes, IGeneralTypesEntity } from "./generalTypesInterfaces";
|
|
3
|
+
import { IConfig } from "../base/utils";
|
|
3
4
|
/**
|
|
4
5
|
* Controllers for working with types
|
|
5
6
|
*/
|
|
6
7
|
export default class GeneralTypesApi extends OneEntry implements IGeneralTypes {
|
|
7
|
-
constructor(url: string,
|
|
8
|
+
constructor(url: string, config: IConfig);
|
|
8
9
|
/**
|
|
9
10
|
* Get all types.
|
|
10
11
|
*
|
|
@@ -5,8 +5,8 @@ const oneEntry_1 = require("../base/oneEntry");
|
|
|
5
5
|
* Controllers for working with types
|
|
6
6
|
*/
|
|
7
7
|
class GeneralTypesApi extends oneEntry_1.default {
|
|
8
|
-
constructor(url,
|
|
9
|
-
super(url,
|
|
8
|
+
constructor(url, config) {
|
|
9
|
+
super(url, config);
|
|
10
10
|
this._url += '/api/content/general-types';
|
|
11
11
|
}
|
|
12
12
|
/**
|
package/dist/index.d.ts
CHANGED
|
@@ -14,6 +14,7 @@ import SystemApi from "./system/systemApi";
|
|
|
14
14
|
import BlocksApi from "./blocks/blocksApi";
|
|
15
15
|
import AttributesSetsApi from "./attribute-sets/attributeSetsApi";
|
|
16
16
|
import MarkersApi from "./markers/markersApi";
|
|
17
|
+
import { IConfig } from "./base/utils";
|
|
17
18
|
interface IDefineApi {
|
|
18
19
|
Admins: AdminsApi;
|
|
19
20
|
AttributesSets: AttributesSetsApi;
|
|
@@ -37,5 +38,5 @@ interface IDefineApi {
|
|
|
37
38
|
* @param {string} url - URl of your project.
|
|
38
39
|
* @returns {IDefineApi} - List of methods set.
|
|
39
40
|
*/
|
|
40
|
-
export declare function defineOneEntry(url: string,
|
|
41
|
+
export declare function defineOneEntry(url: string, config: IConfig): IDefineApi;
|
|
41
42
|
export {};
|
package/dist/index.js
CHANGED
|
@@ -22,23 +22,23 @@ const markersApi_1 = require("./markers/markersApi");
|
|
|
22
22
|
* @param {string} url - URl of your project.
|
|
23
23
|
* @returns {IDefineApi} - List of methods set.
|
|
24
24
|
*/
|
|
25
|
-
function defineOneEntry(url,
|
|
26
|
-
const Admins = new adminsApi_1.default(url,
|
|
27
|
-
const AttributesSets = new attributeSetsApi_1.default(url,
|
|
28
|
-
const Blocks = new blocksApi_1.default(url,
|
|
29
|
-
const FileUploading = new fileUploadingApi_1.default(url,
|
|
30
|
-
const Forms = new formsApi_1.default(url,
|
|
31
|
-
const FormData = new formsDataApi_1.default(url,
|
|
32
|
-
const GeneralTypes = new GeneralTypesApi_1.default(url,
|
|
33
|
-
const Locales = new localesApi_1.default(url,
|
|
34
|
-
const Markers = new markersApi_1.default(url,
|
|
35
|
-
const Menus = new menusApi_1.default(url,
|
|
36
|
-
const Pages = new pagesApi_1.default(url,
|
|
37
|
-
const Products = new productsApi_1.default(url,
|
|
38
|
-
const ProductStatuses = new productStatusesApi_1.default(url,
|
|
39
|
-
const System = new systemApi_1.default(url,
|
|
40
|
-
const Templates = new templatesApi_1.default(url,
|
|
41
|
-
const TemplatePreviews = new templatesPreviewApi_1.default(url,
|
|
25
|
+
function defineOneEntry(url, config) {
|
|
26
|
+
const Admins = new adminsApi_1.default(url, config);
|
|
27
|
+
const AttributesSets = new attributeSetsApi_1.default(url, config);
|
|
28
|
+
const Blocks = new blocksApi_1.default(url, config);
|
|
29
|
+
const FileUploading = new fileUploadingApi_1.default(url, config);
|
|
30
|
+
const Forms = new formsApi_1.default(url, config);
|
|
31
|
+
const FormData = new formsDataApi_1.default(url, config);
|
|
32
|
+
const GeneralTypes = new GeneralTypesApi_1.default(url, config);
|
|
33
|
+
const Locales = new localesApi_1.default(url, config);
|
|
34
|
+
const Markers = new markersApi_1.default(url, config);
|
|
35
|
+
const Menus = new menusApi_1.default(url, config);
|
|
36
|
+
const Pages = new pagesApi_1.default(url, config);
|
|
37
|
+
const Products = new productsApi_1.default(url, config);
|
|
38
|
+
const ProductStatuses = new productStatusesApi_1.default(url, config);
|
|
39
|
+
const System = new systemApi_1.default(url, config);
|
|
40
|
+
const Templates = new templatesApi_1.default(url, config);
|
|
41
|
+
const TemplatePreviews = new templatesPreviewApi_1.default(url, config);
|
|
42
42
|
return {
|
|
43
43
|
Admins,
|
|
44
44
|
AttributesSets,
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import OneEntry from "../base/oneEntry";
|
|
2
2
|
import { ILocales, ILocalEntity } from "./localesInterfaces";
|
|
3
|
+
import { IConfig } from "../base/utils";
|
|
3
4
|
/**
|
|
4
5
|
* Controllers for working with localizations (content language)
|
|
5
6
|
*/
|
|
6
7
|
export default class LocalesApi extends OneEntry implements ILocales {
|
|
7
|
-
constructor(url: string,
|
|
8
|
+
constructor(url: string, config: IConfig);
|
|
8
9
|
/**
|
|
9
10
|
* Find all active language localization objects.
|
|
10
11
|
*
|
|
@@ -5,8 +5,8 @@ const oneEntry_1 = require("../base/oneEntry");
|
|
|
5
5
|
* Controllers for working with localizations (content language)
|
|
6
6
|
*/
|
|
7
7
|
class LocalesApi extends oneEntry_1.default {
|
|
8
|
-
constructor(url,
|
|
9
|
-
super(url,
|
|
8
|
+
constructor(url, config) {
|
|
9
|
+
super(url, config);
|
|
10
10
|
this._url += '/api/content/locales';
|
|
11
11
|
}
|
|
12
12
|
/**
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import OneEntry from "../base/oneEntry";
|
|
2
2
|
import { IMarkersApi, IMarkersEntity } from "./markersInterfaces";
|
|
3
|
+
import { IConfig } from "../base/utils";
|
|
3
4
|
/**
|
|
4
5
|
* Controllers for working with markers
|
|
5
6
|
*/
|
|
6
7
|
export default class MarkersApi extends OneEntry implements IMarkersApi {
|
|
7
|
-
constructor(url: string,
|
|
8
|
+
constructor(url: string, config: IConfig);
|
|
8
9
|
/**
|
|
9
10
|
* Get all markers.
|
|
10
11
|
*
|
|
@@ -5,8 +5,8 @@ const oneEntry_1 = require("../base/oneEntry");
|
|
|
5
5
|
* Controllers for working with markers
|
|
6
6
|
*/
|
|
7
7
|
class MarkersApi extends oneEntry_1.default {
|
|
8
|
-
constructor(url,
|
|
9
|
-
super(url,
|
|
8
|
+
constructor(url, config) {
|
|
9
|
+
super(url, config);
|
|
10
10
|
this._url += '/api/content/markers';
|
|
11
11
|
}
|
|
12
12
|
/**
|
package/dist/menus/menusApi.d.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import OneEntry from "../base/oneEntry";
|
|
2
2
|
import { IMenus, IMenusEntity } from "./menusInterfaces";
|
|
3
|
+
import { IConfig } from "../base/utils";
|
|
3
4
|
/**
|
|
4
5
|
* Controllers for working with menu objects
|
|
5
6
|
*/
|
|
6
7
|
export default class MenusApi extends OneEntry implements IMenus {
|
|
7
|
-
constructor(url: string,
|
|
8
|
+
constructor(url: string, config: IConfig);
|
|
8
9
|
/**
|
|
9
10
|
* Get pages includes in menu by marker.
|
|
10
11
|
*
|
package/dist/menus/menusApi.js
CHANGED
|
@@ -5,8 +5,8 @@ const oneEntry_1 = require("../base/oneEntry");
|
|
|
5
5
|
* Controllers for working with menu objects
|
|
6
6
|
*/
|
|
7
7
|
class MenusApi extends oneEntry_1.default {
|
|
8
|
-
constructor(url,
|
|
9
|
-
super(url,
|
|
8
|
+
constructor(url, config) {
|
|
9
|
+
super(url, config);
|
|
10
10
|
this._url += '/api/content/menus';
|
|
11
11
|
}
|
|
12
12
|
/**
|
package/dist/pages/pagesApi.d.ts
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
import OneEntry from "../base/oneEntry";
|
|
2
2
|
import { IPageApi, IPageConfig, IPagesEntity, IPositionForm, IPositionBlock } from "./pagesInterfaces";
|
|
3
|
-
import {
|
|
3
|
+
import { IConfig } from "../base/utils";
|
|
4
4
|
/**
|
|
5
5
|
* Controllers for working with page objects, including catalog pages
|
|
6
6
|
*/
|
|
7
7
|
export default class PageApi extends OneEntry implements IPageApi {
|
|
8
|
-
constructor(url: string,
|
|
8
|
+
constructor(url: string, config: IConfig);
|
|
9
9
|
/**
|
|
10
10
|
* Get all top-level page objects.
|
|
11
11
|
*
|
|
12
|
-
* @param {string
|
|
12
|
+
* @param {string} [langCode] Required parameter lang code
|
|
13
13
|
*
|
|
14
14
|
* @returns Returns all created pages without parents as an array of PageEntity objects or an empty array [] (if there is no data)
|
|
15
15
|
*/
|
|
16
|
-
getRootPages(langCode?:
|
|
16
|
+
getRootPages(langCode?: string): Promise<Array<IPagesEntity>>;
|
|
17
17
|
/**
|
|
18
18
|
* Get all page objects with product information as an array.
|
|
19
19
|
*
|
|
20
|
-
* @param {string
|
|
20
|
+
* @param {string} [langCode] Required parameter lang code
|
|
21
21
|
*
|
|
22
22
|
* @param {number} [limit] - Optional parameter for pagination, default is 30
|
|
23
23
|
*
|
|
@@ -25,65 +25,65 @@ export default class PageApi extends OneEntry implements IPageApi {
|
|
|
25
25
|
*
|
|
26
26
|
* @returns Returns all created pages as an array of PageEntity objects or an empty array [] (if there is no data)
|
|
27
27
|
*/
|
|
28
|
-
getCatalogPages(langCode?:
|
|
28
|
+
getCatalogPages(langCode?: string, limit?: number, offset?: number): Promise<Array<IPagesEntity>>;
|
|
29
29
|
/**
|
|
30
30
|
* Get all page objects with product information as an array.
|
|
31
31
|
*
|
|
32
|
-
* @param {string
|
|
32
|
+
* @param {string} [langCode] Required parameter lang code
|
|
33
33
|
*
|
|
34
34
|
* @returns Returns all created pages as an array of PageEntity objects or an empty array [] (if there is no data)
|
|
35
35
|
*/
|
|
36
|
-
getPages(langCode
|
|
36
|
+
getPages(langCode: string): Promise<Array<IPagesEntity>>;
|
|
37
37
|
/**
|
|
38
38
|
* Get page object with information about forms, blocks, menus, linked to the page.
|
|
39
39
|
*
|
|
40
|
-
* @param {string
|
|
40
|
+
* @param {string} [langCode] Required parameter lang code
|
|
41
41
|
*
|
|
42
42
|
* @param {number} [id] - Page object identifier
|
|
43
43
|
*
|
|
44
44
|
* @returns Returns PageEntity object
|
|
45
45
|
*/
|
|
46
|
-
getPageById(id: number, langCode?:
|
|
46
|
+
getPageById(id: number, langCode?: string): Promise<IPagesEntity>;
|
|
47
47
|
/**
|
|
48
48
|
* Get page object with information about forms, blocks, menus, linked to the page by URL.
|
|
49
49
|
*
|
|
50
|
-
* @param {string
|
|
50
|
+
* @param {string} [langCode] Required parameter lang code
|
|
51
51
|
*
|
|
52
52
|
* @param {string} [url] - Page URL
|
|
53
53
|
*
|
|
54
54
|
* @returns Returns PageEntity object
|
|
55
55
|
*/
|
|
56
|
-
getPageByUrl(url: string, langCode?:
|
|
56
|
+
getPageByUrl(url: string, langCode?: string): Promise<IPagesEntity>;
|
|
57
57
|
/**
|
|
58
58
|
* Get child pages object with information as an array.
|
|
59
59
|
*
|
|
60
|
-
* @param {string
|
|
60
|
+
* @param {string} [langCode] Required parameter lang code
|
|
61
61
|
*
|
|
62
62
|
* @param {string} [url] - Page URL
|
|
63
63
|
*
|
|
64
64
|
* @returns Returns all created pages as an array of PageEntity objects or an empty array [] (if there is no data) for the selected parent
|
|
65
65
|
*/
|
|
66
|
-
getChildPagesByParentUrl(url: string, langCode?:
|
|
66
|
+
getChildPagesByParentUrl(url: string, langCode?: string): Promise<Array<IPagesEntity>>;
|
|
67
67
|
/**
|
|
68
68
|
* Get all forms by page url.
|
|
69
69
|
*
|
|
70
|
-
* @param {string
|
|
70
|
+
* @param {string} [langCode] Required parameter lang code
|
|
71
71
|
*
|
|
72
72
|
* @param {string} [url] - Page URL
|
|
73
73
|
*
|
|
74
74
|
* @returns Returns all forms as an array of PositionForm objects or an empty array [] (if there is no data) for the selected parent
|
|
75
75
|
*/
|
|
76
|
-
getFormsByPageUrl(url: string, langCode?:
|
|
76
|
+
getFormsByPageUrl(url: string, langCode?: string): Promise<Array<IPositionForm>>;
|
|
77
77
|
/**
|
|
78
78
|
* Get all blocks by page url.
|
|
79
79
|
*
|
|
80
|
-
* @param {string
|
|
80
|
+
* @param {string} [langCode] Required parameter lang code
|
|
81
81
|
*
|
|
82
82
|
* @param {string} [url] - Page URL
|
|
83
83
|
*
|
|
84
84
|
* @returns Returns all blocks as an array of PositionBlock objects or an empty array [] (if there is no data) for the selected parent
|
|
85
85
|
*/
|
|
86
|
-
getBlocksByPageUrl(url: string, langCode?:
|
|
86
|
+
getBlocksByPageUrl(url: string, langCode?: string): Promise<Array<IPositionBlock>>;
|
|
87
87
|
/**
|
|
88
88
|
* Get settings for the page.
|
|
89
89
|
*
|
|
@@ -101,5 +101,5 @@ export default class PageApi extends OneEntry implements IPageApi {
|
|
|
101
101
|
*
|
|
102
102
|
* @returns Returns all created pages as an array of PageEntity objects or an empty array [] (if there is no data)
|
|
103
103
|
*/
|
|
104
|
-
searchPage(name: string, langCode?:
|
|
104
|
+
searchPage(name: string, langCode?: string): Promise<Array<IPagesEntity>>;
|
|
105
105
|
}
|
package/dist/pages/pagesApi.js
CHANGED
|
@@ -5,25 +5,25 @@ const oneEntry_1 = require("../base/oneEntry");
|
|
|
5
5
|
* Controllers for working with page objects, including catalog pages
|
|
6
6
|
*/
|
|
7
7
|
class PageApi extends oneEntry_1.default {
|
|
8
|
-
constructor(url,
|
|
9
|
-
super(url,
|
|
8
|
+
constructor(url, config) {
|
|
9
|
+
super(url, config);
|
|
10
10
|
this._url += '/api/content/pages';
|
|
11
11
|
}
|
|
12
12
|
/**
|
|
13
13
|
* Get all top-level page objects.
|
|
14
14
|
*
|
|
15
|
-
* @param {string
|
|
15
|
+
* @param {string} [langCode] Required parameter lang code
|
|
16
16
|
*
|
|
17
17
|
* @returns Returns all created pages without parents as an array of PageEntity objects or an empty array [] (if there is no data)
|
|
18
18
|
*/
|
|
19
|
-
async getRootPages(langCode =
|
|
20
|
-
const result = await this.
|
|
21
|
-
return result;
|
|
19
|
+
async getRootPages(langCode = this._defaultLangCode) {
|
|
20
|
+
const result = await this._fetchGet(`/root?langCode=${langCode}`);
|
|
21
|
+
return this._normalizeData(result.items);
|
|
22
22
|
}
|
|
23
23
|
/**
|
|
24
24
|
* Get all page objects with product information as an array.
|
|
25
25
|
*
|
|
26
|
-
* @param {string
|
|
26
|
+
* @param {string} [langCode] Required parameter lang code
|
|
27
27
|
*
|
|
28
28
|
* @param {number} [limit] - Optional parameter for pagination, default is 30
|
|
29
29
|
*
|
|
@@ -31,85 +31,85 @@ class PageApi extends oneEntry_1.default {
|
|
|
31
31
|
*
|
|
32
32
|
* @returns Returns all created pages as an array of PageEntity objects or an empty array [] (if there is no data)
|
|
33
33
|
*/
|
|
34
|
-
async getCatalogPages(langCode =
|
|
35
|
-
const result = await this.
|
|
36
|
-
return result;
|
|
34
|
+
async getCatalogPages(langCode = this._defaultLangCode, limit = 30, offset = 0) {
|
|
35
|
+
const result = await this._fetchGet(`/catalog?langCode=${langCode}&limit=${limit}&offset=${offset}`);
|
|
36
|
+
return this._normalizeData(result.items);
|
|
37
37
|
}
|
|
38
38
|
/**
|
|
39
39
|
* Get all page objects with product information as an array.
|
|
40
40
|
*
|
|
41
|
-
* @param {string
|
|
41
|
+
* @param {string} [langCode] Required parameter lang code
|
|
42
42
|
*
|
|
43
43
|
* @returns Returns all created pages as an array of PageEntity objects or an empty array [] (if there is no data)
|
|
44
44
|
*/
|
|
45
|
-
async getPages(langCode
|
|
46
|
-
const result = await this.
|
|
47
|
-
return result;
|
|
45
|
+
async getPages(langCode) {
|
|
46
|
+
const result = await this._fetchGet(`?langCode=${langCode}`);
|
|
47
|
+
return this._normalizeData(result.items);
|
|
48
48
|
}
|
|
49
49
|
/**
|
|
50
50
|
* Get page object with information about forms, blocks, menus, linked to the page.
|
|
51
51
|
*
|
|
52
|
-
* @param {string
|
|
52
|
+
* @param {string} [langCode] Required parameter lang code
|
|
53
53
|
*
|
|
54
54
|
* @param {number} [id] - Page object identifier
|
|
55
55
|
*
|
|
56
56
|
* @returns Returns PageEntity object
|
|
57
57
|
*/
|
|
58
|
-
async getPageById(id, langCode =
|
|
59
|
-
const result = await this.
|
|
60
|
-
return result;
|
|
58
|
+
async getPageById(id, langCode = this._defaultLangCode) {
|
|
59
|
+
const result = await this._fetchGet(`/${id}?langCode=${langCode}`);
|
|
60
|
+
return this._normalizeData(result);
|
|
61
61
|
}
|
|
62
62
|
/**
|
|
63
63
|
* Get page object with information about forms, blocks, menus, linked to the page by URL.
|
|
64
64
|
*
|
|
65
|
-
* @param {string
|
|
65
|
+
* @param {string} [langCode] Required parameter lang code
|
|
66
66
|
*
|
|
67
67
|
* @param {string} [url] - Page URL
|
|
68
68
|
*
|
|
69
69
|
* @returns Returns PageEntity object
|
|
70
70
|
*/
|
|
71
|
-
async getPageByUrl(url, langCode =
|
|
72
|
-
const result = await this.
|
|
73
|
-
return result;
|
|
71
|
+
async getPageByUrl(url, langCode = this._defaultLangCode) {
|
|
72
|
+
const result = await this._fetchGet(`/url/${url}?langCode=${langCode}`);
|
|
73
|
+
return this._normalizeData(result);
|
|
74
74
|
}
|
|
75
75
|
/**
|
|
76
76
|
* Get child pages object with information as an array.
|
|
77
77
|
*
|
|
78
|
-
* @param {string
|
|
78
|
+
* @param {string} [langCode] Required parameter lang code
|
|
79
79
|
*
|
|
80
80
|
* @param {string} [url] - Page URL
|
|
81
81
|
*
|
|
82
82
|
* @returns Returns all created pages as an array of PageEntity objects or an empty array [] (if there is no data) for the selected parent
|
|
83
83
|
*/
|
|
84
|
-
async getChildPagesByParentUrl(url, langCode =
|
|
85
|
-
const result = await this.
|
|
86
|
-
return result;
|
|
84
|
+
async getChildPagesByParentUrl(url, langCode = this._defaultLangCode) {
|
|
85
|
+
const result = await this._fetchGet(`/${url}/children?langCode=${langCode}`);
|
|
86
|
+
return this._normalizeData(result.items);
|
|
87
87
|
}
|
|
88
88
|
/**
|
|
89
89
|
* Get all forms by page url.
|
|
90
90
|
*
|
|
91
|
-
* @param {string
|
|
91
|
+
* @param {string} [langCode] Required parameter lang code
|
|
92
92
|
*
|
|
93
93
|
* @param {string} [url] - Page URL
|
|
94
94
|
*
|
|
95
95
|
* @returns Returns all forms as an array of PositionForm objects or an empty array [] (if there is no data) for the selected parent
|
|
96
96
|
*/
|
|
97
|
-
async getFormsByPageUrl(url, langCode =
|
|
98
|
-
const result = await this.
|
|
99
|
-
return result;
|
|
97
|
+
async getFormsByPageUrl(url, langCode = this._defaultLangCode) {
|
|
98
|
+
const result = await this._fetchGet(`/${url}/forms?langCode=${langCode}`);
|
|
99
|
+
return this._normalizeData(result.items);
|
|
100
100
|
}
|
|
101
101
|
/**
|
|
102
102
|
* Get all blocks by page url.
|
|
103
103
|
*
|
|
104
|
-
* @param {string
|
|
104
|
+
* @param {string} [langCode] Required parameter lang code
|
|
105
105
|
*
|
|
106
106
|
* @param {string} [url] - Page URL
|
|
107
107
|
*
|
|
108
108
|
* @returns Returns all blocks as an array of PositionBlock objects or an empty array [] (if there is no data) for the selected parent
|
|
109
109
|
*/
|
|
110
|
-
async getBlocksByPageUrl(url, langCode =
|
|
111
|
-
const result = await this.
|
|
112
|
-
return result;
|
|
110
|
+
async getBlocksByPageUrl(url, langCode = this._defaultLangCode) {
|
|
111
|
+
const result = await this._fetchGet(`/${url}/blocks?langCode=${langCode}`);
|
|
112
|
+
return this._normalizeData(result.items);
|
|
113
113
|
}
|
|
114
114
|
/**
|
|
115
115
|
* Get settings for the page.
|
|
@@ -131,9 +131,9 @@ class PageApi extends oneEntry_1.default {
|
|
|
131
131
|
*
|
|
132
132
|
* @returns Returns all created pages as an array of PageEntity objects or an empty array [] (if there is no data)
|
|
133
133
|
*/
|
|
134
|
-
async searchPage(name, langCode =
|
|
134
|
+
async searchPage(name, langCode = this._defaultLangCode) {
|
|
135
135
|
const result = await this._fetchGet(`/quick/search?lang=${langCode}&name=${name}`);
|
|
136
|
-
return result;
|
|
136
|
+
return this._normalizeData(result.items);
|
|
137
137
|
}
|
|
138
138
|
}
|
|
139
139
|
exports.default = PageApi;
|
|
@@ -26,7 +26,7 @@ interface IPageApi {
|
|
|
26
26
|
getPages(langCode: LangType): Promise<Array<IPagesEntity>>;
|
|
27
27
|
getPageById(id: number, langCode: LangType): Promise<IPagesEntity>;
|
|
28
28
|
getPageByUrl(url: string, langCode: LangType): Promise<IPagesEntity>;
|
|
29
|
-
getChildPagesByParentUrl(url: string, langCode: LangType): Promise<IPagesEntity
|
|
29
|
+
getChildPagesByParentUrl(url: string, langCode: LangType): Promise<Array<IPagesEntity>>;
|
|
30
30
|
getFormsByPageUrl(url: string, langCode: LangType): Promise<Array<IPositionForm>>;
|
|
31
31
|
getBlocksByPageUrl(url: string, langCode: LangType): Promise<Array<IPositionBlock>>;
|
|
32
32
|
getConfigPageByUrl(url: string): Promise<IPageConfig>;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import OneEntry from '../base/oneEntry';
|
|
2
2
|
import { IProductStatusEntity, IProductStatuses } from "./productStatusesInterfaces";
|
|
3
|
+
import { IConfig } from "../base/utils";
|
|
3
4
|
/**
|
|
4
5
|
* Controllers for working with product statuses
|
|
5
6
|
*/
|
|
6
7
|
export default class ProductStatusesApi extends OneEntry implements IProductStatuses {
|
|
7
|
-
constructor(url: string,
|
|
8
|
+
constructor(url: string, config: IConfig);
|
|
8
9
|
/**
|
|
9
10
|
* Search for all product status objects.
|
|
10
11
|
*
|