oneentry 1.0.30 → 1.0.32
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 +107 -0
- package/dist/forms/formsInterfaces.d.ts +2 -2
- package/dist/formsData/formsDataApi.d.ts +1 -1
- package/dist/formsData/formsDataInterfaces.d.ts +14 -5
- package/dist/index.d.ts +2 -0
- package/dist/index.js +3 -0
- package/dist/pages/pagesApi.d.ts +11 -1
- package/dist/pages/pagesApi.js +13 -0
- package/dist/pages/pagesInterfaces.d.ts +46 -3
- package/dist/products/productsInterfaces.d.ts +9 -2
- package/dist/products/productsInterfaces.js +8 -0
- package/package.json +1 -2
package/README.md
CHANGED
|
@@ -26,6 +26,7 @@ import { defineOneEntry } from 'oneentry'
|
|
|
26
26
|
|
|
27
27
|
const {
|
|
28
28
|
Admins,
|
|
29
|
+
Blocks
|
|
29
30
|
Forms,
|
|
30
31
|
FormData,
|
|
31
32
|
FileUploading,
|
|
@@ -90,6 +91,112 @@ Example return:
|
|
|
90
91
|
]
|
|
91
92
|
```
|
|
92
93
|
|
|
94
|
+
## Blocks
|
|
95
|
+
|
|
96
|
+
const { Blocks } = defineOneEntry('your-url');
|
|
97
|
+
|
|
98
|
+
### Blocks.getBlocks(langCode, offset, limit)
|
|
99
|
+
|
|
100
|
+
```
|
|
101
|
+
const value = await Blocks.getBlocks('en_US', 0, 30)
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
> This method return all blocks objects.
|
|
105
|
+
|
|
106
|
+
Example return:
|
|
107
|
+
```
|
|
108
|
+
[
|
|
109
|
+
{
|
|
110
|
+
"id": 1764,
|
|
111
|
+
"attributeSetId": 7,
|
|
112
|
+
"localizeInfos": {
|
|
113
|
+
"en_US": {
|
|
114
|
+
"title": "My block"
|
|
115
|
+
}
|
|
116
|
+
},
|
|
117
|
+
"customSettings": {
|
|
118
|
+
"sliderDelay": 0,
|
|
119
|
+
"sliderDelayType": "",
|
|
120
|
+
"productQuantity": 4,
|
|
121
|
+
"productSortType": "By_ID",
|
|
122
|
+
"productSortOrder": "Descending",
|
|
123
|
+
"productCountElementsPerRow": 10,
|
|
124
|
+
"similarProductRules": [
|
|
125
|
+
{
|
|
126
|
+
"property": "Descending",
|
|
127
|
+
"includes": "",
|
|
128
|
+
"keywords": "",
|
|
129
|
+
"strict": ""
|
|
130
|
+
}
|
|
131
|
+
]
|
|
132
|
+
},
|
|
133
|
+
"version": 10,
|
|
134
|
+
"identifier": "catalog",
|
|
135
|
+
"position": 192,
|
|
136
|
+
"attributeValues": {
|
|
137
|
+
"en_US": {
|
|
138
|
+
"marker": {
|
|
139
|
+
"value": "",
|
|
140
|
+
"type": "string"
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
},
|
|
144
|
+
"type": "forNewsPage",
|
|
145
|
+
"templateIdentifier": null
|
|
146
|
+
}
|
|
147
|
+
]
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
### Blocks.getBlockByMarker(marker, langCode)
|
|
151
|
+
|
|
152
|
+
```
|
|
153
|
+
const value = await Blocks.getBlockByMarker('my-marker', 'en_US')
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
> This method return one blocks object by marker.
|
|
157
|
+
|
|
158
|
+
Example return:
|
|
159
|
+
```
|
|
160
|
+
{
|
|
161
|
+
"id": 1764,
|
|
162
|
+
"attributeSetId": 7,
|
|
163
|
+
"localizeInfos": {
|
|
164
|
+
"en_US": {
|
|
165
|
+
"title": "My block"
|
|
166
|
+
}
|
|
167
|
+
},
|
|
168
|
+
"customSettings": {
|
|
169
|
+
"sliderDelay": 0,
|
|
170
|
+
"sliderDelayType": "",
|
|
171
|
+
"productQuantity": 4,
|
|
172
|
+
"productSortType": "By_ID",
|
|
173
|
+
"productSortOrder": "Descending",
|
|
174
|
+
"productCountElementsPerRow": 10,
|
|
175
|
+
"similarProductRules": [
|
|
176
|
+
{
|
|
177
|
+
"property": "Descending",
|
|
178
|
+
"includes": "",
|
|
179
|
+
"keywords": "",
|
|
180
|
+
"strict": ""
|
|
181
|
+
}
|
|
182
|
+
]
|
|
183
|
+
},
|
|
184
|
+
"version": 10,
|
|
185
|
+
"identifier": "catalog",
|
|
186
|
+
"position": 192,
|
|
187
|
+
"attributeValues": {
|
|
188
|
+
"en_US": {
|
|
189
|
+
"marker": {
|
|
190
|
+
"value": "",
|
|
191
|
+
"type": "string"
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
},
|
|
195
|
+
"type": "forNewsPage",
|
|
196
|
+
"templateIdentifier": null
|
|
197
|
+
}
|
|
198
|
+
```
|
|
199
|
+
|
|
93
200
|
## FileUploading
|
|
94
201
|
|
|
95
202
|
const { FileUploading } = defineOneEntry('your-url');
|
|
@@ -19,14 +19,14 @@ interface IForms {
|
|
|
19
19
|
* @property {string} processingType - Type of form processing.
|
|
20
20
|
* @property {ILocalizeInfos} localizeInfos - The name of the form, taking into account localization.
|
|
21
21
|
* @property {object} processingData - Form data.
|
|
22
|
-
* @property {IAttributes} attribute - Array of attribute values from the used attribute set for displaying the form (taking into account the specified language)
|
|
22
|
+
* @property {Array<IAttributes>} attribute - Array of attribute values from the used attribute set for displaying the form (taking into account the specified language)
|
|
23
23
|
* @property {number} version - The version number of the object.
|
|
24
24
|
* @property {string} identifier - The textual identifier for the record field.
|
|
25
25
|
* @property {number} position - The position of the object.
|
|
26
26
|
*/
|
|
27
27
|
interface IFormsEntity {
|
|
28
28
|
attributeSetId: number;
|
|
29
|
-
attributes: IAttributes
|
|
29
|
+
attributes: Array<IAttributes>;
|
|
30
30
|
id: number;
|
|
31
31
|
identifier: string;
|
|
32
32
|
localizeInfos: ILocalizeInfos;
|
|
@@ -33,7 +33,7 @@ export default class FormsDataApi extends OneEntry implements IFormsData {
|
|
|
33
33
|
*
|
|
34
34
|
* @returns - Returns created FormData objects.
|
|
35
35
|
*/
|
|
36
|
-
postFormsData(data:
|
|
36
|
+
postFormsData(data: IFormsPost): Promise<IFormsDataEntity>;
|
|
37
37
|
/**
|
|
38
38
|
* Get one object of form data by marker.
|
|
39
39
|
*
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
*/
|
|
10
10
|
interface IFormsData {
|
|
11
11
|
getFormsData(langCode: string, offset?: number, limit?: number): Promise<Array<IFormsDataEntity>>;
|
|
12
|
-
postFormsData(data:
|
|
12
|
+
postFormsData(data: IFormsPost): Promise<IFormsDataEntity>;
|
|
13
13
|
getFormsDataByMarker(marker: string, langCode: string, offset?: number, limit?: number): Promise<Array<IFormsDataEntity>>;
|
|
14
14
|
}
|
|
15
15
|
/**
|
|
@@ -30,6 +30,8 @@ interface IFormsDataEntity {
|
|
|
30
30
|
attributeSetIdentifier: string;
|
|
31
31
|
}
|
|
32
32
|
/**
|
|
33
|
+
* @property {string} [formIdentifier] - Text identifier of the form object (marker)
|
|
34
|
+
*
|
|
33
35
|
* Form data get by langcode identifier
|
|
34
36
|
* @example formData['en_US']
|
|
35
37
|
*
|
|
@@ -42,19 +44,26 @@ interface IFormsDataEntity {
|
|
|
42
44
|
* @property {string} value Form data value.
|
|
43
45
|
*/
|
|
44
46
|
interface IFormData {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
47
|
+
formIdentifier?: string;
|
|
48
|
+
formData: {
|
|
49
|
+
[langcode: string]: Array<{
|
|
50
|
+
marker?: string;
|
|
51
|
+
value?: string;
|
|
52
|
+
}>;
|
|
53
|
+
};
|
|
49
54
|
}
|
|
50
55
|
/**
|
|
51
56
|
* interface to create an object of information about saving data using the form
|
|
52
57
|
*
|
|
58
|
+
* @property {number} id
|
|
53
59
|
* @property {string} formIdentifier - The identifier of the page.
|
|
60
|
+
* @property {Date | string} time - Date and time of form modification
|
|
54
61
|
* @property {IFormData} formData - The identifier of the page.
|
|
55
62
|
*/
|
|
56
63
|
interface IFormsPost {
|
|
64
|
+
id: number;
|
|
57
65
|
formIdentifier: string;
|
|
66
|
+
time: Date | string;
|
|
58
67
|
formData: IFormData;
|
|
59
68
|
}
|
|
60
69
|
export { IFormsPost, IFormsData, IFormsDataEntity };
|
package/dist/index.d.ts
CHANGED
|
@@ -11,8 +11,10 @@ import FormsApi from "./forms/formsApi";
|
|
|
11
11
|
import FormsDataApi from "./formsData/formsDataApi";
|
|
12
12
|
import FileUploadingApi from "./file-uploding/fileUploadingApi";
|
|
13
13
|
import SystemApi from "./system/systemApi";
|
|
14
|
+
import BlocksApi from "./blocks/blocksApi";
|
|
14
15
|
interface IDefineApi {
|
|
15
16
|
Admins: AdminsApi;
|
|
17
|
+
Blocks: BlocksApi;
|
|
16
18
|
FileUploading: FileUploadingApi;
|
|
17
19
|
Forms: FormsApi;
|
|
18
20
|
FormData: FormsDataApi;
|
package/dist/index.js
CHANGED
|
@@ -14,6 +14,7 @@ const formsApi_1 = require("./forms/formsApi");
|
|
|
14
14
|
const formsDataApi_1 = require("./formsData/formsDataApi");
|
|
15
15
|
const fileUploadingApi_1 = require("./file-uploding/fileUploadingApi");
|
|
16
16
|
const systemApi_1 = require("./system/systemApi");
|
|
17
|
+
const blocksApi_1 = require("./blocks/blocksApi");
|
|
17
18
|
/**
|
|
18
19
|
* Define API.
|
|
19
20
|
* @param {string} url - URl of your project.
|
|
@@ -21,6 +22,7 @@ const systemApi_1 = require("./system/systemApi");
|
|
|
21
22
|
*/
|
|
22
23
|
function defineOneEntry(url, token) {
|
|
23
24
|
const Admins = new adminsApi_1.default(url, token);
|
|
25
|
+
const Blocks = new blocksApi_1.default(url, token);
|
|
24
26
|
const FileUploading = new fileUploadingApi_1.default(url, token);
|
|
25
27
|
const Forms = new formsApi_1.default(url, token);
|
|
26
28
|
const FormData = new formsDataApi_1.default(url, token);
|
|
@@ -35,6 +37,7 @@ function defineOneEntry(url, token) {
|
|
|
35
37
|
const TemplatePreviews = new templatesPreviewApi_1.default(url, token);
|
|
36
38
|
return {
|
|
37
39
|
Admins,
|
|
40
|
+
Blocks,
|
|
38
41
|
FileUploading,
|
|
39
42
|
Forms,
|
|
40
43
|
FormData,
|
package/dist/pages/pagesApi.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import OneEntry from "../base/oneEntry";
|
|
2
|
-
import { IPageApi, IPageConfig, IPagesEntity, IPositionForm } from "./pagesInterfaces";
|
|
2
|
+
import { IPageApi, IPageConfig, IPagesEntity, IPositionForm, IPositionBlock } from "./pagesInterfaces";
|
|
3
3
|
import { LangType } from "../base/utils";
|
|
4
4
|
/**
|
|
5
5
|
* Controllers for working with page objects, including catalog pages
|
|
@@ -74,6 +74,16 @@ export default class PageApi extends OneEntry implements IPageApi {
|
|
|
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
76
|
getFormsByPageUrl(url: string, langCode: LangType): Promise<Array<IPositionForm>>;
|
|
77
|
+
/**
|
|
78
|
+
* Get all blocks by page url.
|
|
79
|
+
*
|
|
80
|
+
* @param {string | Array<string>} [langCode] Required parameter lang code
|
|
81
|
+
*
|
|
82
|
+
* @param {string} [url] - Page URL
|
|
83
|
+
*
|
|
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
|
+
*/
|
|
86
|
+
getBlocksByPageUrl(url: string, langCode: LangType): Promise<Array<IPositionBlock>>;
|
|
77
87
|
/**
|
|
78
88
|
* Get settings for the page.
|
|
79
89
|
*
|
package/dist/pages/pagesApi.js
CHANGED
|
@@ -98,6 +98,19 @@ class PageApi extends oneEntry_1.default {
|
|
|
98
98
|
const result = await this._fetchRequests(`/${url}/forms?langCode=${this._LANGCODE_KEY}`, langCode);
|
|
99
99
|
return result;
|
|
100
100
|
}
|
|
101
|
+
/**
|
|
102
|
+
* Get all blocks by page url.
|
|
103
|
+
*
|
|
104
|
+
* @param {string | Array<string>} [langCode] Required parameter lang code
|
|
105
|
+
*
|
|
106
|
+
* @param {string} [url] - Page URL
|
|
107
|
+
*
|
|
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
|
+
*/
|
|
110
|
+
async getBlocksByPageUrl(url, langCode) {
|
|
111
|
+
const result = await this._fetchRequests(`/${url}/blocks?langCode=${this._LANGCODE_KEY}`, langCode);
|
|
112
|
+
return result;
|
|
113
|
+
}
|
|
101
114
|
/**
|
|
102
115
|
* Get settings for the page.
|
|
103
116
|
*
|
|
@@ -28,6 +28,7 @@ interface IPageApi {
|
|
|
28
28
|
getPageByUrl(url: string, langCode: LangType): Promise<IPagesEntity>;
|
|
29
29
|
getChildPagesByParentUrl(url: string, langCode: LangType): Promise<IPagesEntity>;
|
|
30
30
|
getFormsByPageUrl(url: string, langCode: LangType): Promise<Array<IPositionForm>>;
|
|
31
|
+
getBlocksByPageUrl(url: string, langCode: LangType): Promise<Array<IPositionBlock>>;
|
|
31
32
|
getConfigPageByUrl(url: string): Promise<IPageConfig>;
|
|
32
33
|
searchPage(name: string, langCode: LangType): Promise<Array<IPagesEntity>>;
|
|
33
34
|
}
|
|
@@ -50,7 +51,7 @@ interface IPageConfig {
|
|
|
50
51
|
* @property {number} id - The identifier of the object.
|
|
51
52
|
* @property {number} version - The version number of the object.
|
|
52
53
|
* @property {string} identifier - The textual identifier for the record field.
|
|
53
|
-
* @property {IAttributes} attributes - Array of attribute values from the used attribute set for displaying the form (taking into account the specified language).
|
|
54
|
+
* @property {Array<IAttributes>} attributes - Array of attribute values from the used attribute set for displaying the form (taking into account the specified language).
|
|
54
55
|
* @property {number} attributeSetId - The identifier of the attribute set being used.
|
|
55
56
|
* @property {string} processingType - Type of form processing.
|
|
56
57
|
* @property {LocalizeType} localizeInfos - The name of the page, taking into account localization.
|
|
@@ -61,13 +62,55 @@ interface IPositionForm {
|
|
|
61
62
|
id: number;
|
|
62
63
|
version: number;
|
|
63
64
|
identifier: string;
|
|
64
|
-
attributes: IAttributes
|
|
65
|
+
attributes: Array<IAttributes>;
|
|
65
66
|
attributeSetId: number;
|
|
66
67
|
processingType: string;
|
|
67
68
|
localizeInfos: LocalizeType;
|
|
68
69
|
processingData: object;
|
|
69
70
|
position: number;
|
|
70
71
|
}
|
|
72
|
+
/**
|
|
73
|
+
* Represents an object with various properties.
|
|
74
|
+
*
|
|
75
|
+
* @interface
|
|
76
|
+
* @property {number} id - The identifier of the object.
|
|
77
|
+
* @property {number} version - The version number of the object.
|
|
78
|
+
* @property {string} identifier - The textual identifier for the record field.
|
|
79
|
+
* @property {number} attributeSetId - The identifier of the attribute set being used.
|
|
80
|
+
* @property {LocalizeType} localizeInfos - The name of the page, taking into account localization.
|
|
81
|
+
* @property {object} customSettings - Custom settings for different types of blocks.
|
|
82
|
+
* @property {number} position - The position of the object.
|
|
83
|
+
* @property {boolean} isSync - Indication of page indexing.
|
|
84
|
+
* @property {AttributeType} attributeValues - Array of attribute values from the index (represented as a pair of user attribute id: attribute value).
|
|
85
|
+
* @property {Types} type - Page type.
|
|
86
|
+
* @property {string} templateIdentifier - User id of the linked template.
|
|
87
|
+
*/
|
|
88
|
+
interface IPositionBlock {
|
|
89
|
+
id: number;
|
|
90
|
+
version: number;
|
|
91
|
+
identifier: string;
|
|
92
|
+
attributeSetId: number;
|
|
93
|
+
localizeInfos: LocalizeType;
|
|
94
|
+
customSettings: {
|
|
95
|
+
sliderDelay: number;
|
|
96
|
+
sliderDelayType: string;
|
|
97
|
+
productQuantity: number;
|
|
98
|
+
productSortType: string;
|
|
99
|
+
productSortOrder: string;
|
|
100
|
+
productCountElementsPerRow: number;
|
|
101
|
+
similarProductRules: Array<{
|
|
102
|
+
property: string;
|
|
103
|
+
includes: string;
|
|
104
|
+
keywords: string;
|
|
105
|
+
strict: string;
|
|
106
|
+
}>;
|
|
107
|
+
};
|
|
108
|
+
position: number;
|
|
109
|
+
isSync: boolean;
|
|
110
|
+
attributeValues: AttributeType;
|
|
111
|
+
type: string;
|
|
112
|
+
templateIdentifier: string | null;
|
|
113
|
+
}
|
|
71
114
|
/**
|
|
72
115
|
* Represents an object with various properties.
|
|
73
116
|
*
|
|
@@ -111,4 +154,4 @@ interface IPagesEntity {
|
|
|
111
154
|
templateIdentifier: string;
|
|
112
155
|
type: Types;
|
|
113
156
|
}
|
|
114
|
-
export { IPageApi, IPageConfig, IPagesEntity, IPositionForm };
|
|
157
|
+
export { IPageApi, IPageConfig, IPagesEntity, IPositionForm, IPositionBlock };
|
|
@@ -28,6 +28,13 @@ interface IProductApi {
|
|
|
28
28
|
filterProduct(data: Array<IFilterParams>, langCode: LangType, userQuery?: IProductsQuery): Promise<Array<IProductsEntity>>;
|
|
29
29
|
searchProduct(name: string, langCode: string): Promise<Array<IProductsEntity>>;
|
|
30
30
|
}
|
|
31
|
+
declare enum SortKey {
|
|
32
|
+
id = "id",
|
|
33
|
+
position = "position",
|
|
34
|
+
title = "title",
|
|
35
|
+
date = "date",
|
|
36
|
+
price = "price"
|
|
37
|
+
}
|
|
31
38
|
/**
|
|
32
39
|
* Represents a product query parameters object.
|
|
33
40
|
*
|
|
@@ -40,7 +47,7 @@ interface IProductApi {
|
|
|
40
47
|
* @property {string | null} attributeMarker - The text identifier of the indexed attribute by which values are filtered, default null.
|
|
41
48
|
* @property {string} sortOrder - Sort order 'DESC' | 'ASC', default 'DESC'.
|
|
42
49
|
* @property {string} langCode - localization language code (used only when searching with a filter, default 'en_US'.
|
|
43
|
-
* @property {string} sortKey -
|
|
50
|
+
* @property {string} sortKey - Field for sorting (default - null)
|
|
44
51
|
*/
|
|
45
52
|
interface IProductsQuery {
|
|
46
53
|
offset?: number;
|
|
@@ -60,7 +67,7 @@ interface IProductsQuery {
|
|
|
60
67
|
conditionMarker?: 'in' | 'nin' | 'eq' | 'neq' | 'mth' | 'lth' | 'exs' | 'nexs' | null;
|
|
61
68
|
attributeMarker?: string | null;
|
|
62
69
|
sortOrder?: 'DESC' | 'ASC' | null;
|
|
63
|
-
sortKey?:
|
|
70
|
+
sortKey?: SortKey | null;
|
|
64
71
|
[key: string]: string | number | null;
|
|
65
72
|
}
|
|
66
73
|
/**
|
|
@@ -1,2 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
var SortKey;
|
|
4
|
+
(function (SortKey) {
|
|
5
|
+
SortKey["id"] = "id";
|
|
6
|
+
SortKey["position"] = "position";
|
|
7
|
+
SortKey["title"] = "title";
|
|
8
|
+
SortKey["date"] = "date";
|
|
9
|
+
SortKey["price"] = "price";
|
|
10
|
+
})(SortKey || (SortKey = {}));
|
package/package.json
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "oneentry",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.32",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
7
7
|
"files": [
|
|
8
8
|
"/dist"
|
|
9
9
|
],
|
|
10
|
-
|
|
11
10
|
"author": "ONEENTRY PORTAL CO.",
|
|
12
11
|
"license": "ISC",
|
|
13
12
|
"dependencies": {
|