oneentry 1.0.16 → 1.0.18

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.
Files changed (33) hide show
  1. package/README.md +155 -270
  2. package/dist/admins/adminsApi.d.ts +1 -1
  3. package/dist/admins/adminsInterfaces.d.ts +50 -15
  4. package/dist/forms/formsApi.d.ts +1 -7
  5. package/dist/forms/formsApi.js +0 -11
  6. package/dist/forms/formsApi.js.map +1 -1
  7. package/dist/forms/formsInterfaces.d.ts +28 -17
  8. package/dist/formsData/formsDataApi.d.ts +3 -3
  9. package/dist/formsData/formsDataApi.js +1 -1
  10. package/dist/formsData/formsDataInterfaces.d.ts +43 -10
  11. package/dist/general-types/GeneralTypesApi.js +1 -1
  12. package/dist/general-types/GeneralTypesApi.js.map +1 -1
  13. package/dist/general-types/generalTypesInterfaces.d.ts +12 -0
  14. package/dist/index.d.ts +1 -1
  15. package/dist/index.js +2 -2
  16. package/dist/locales/localesInterfaces.d.ts +19 -1
  17. package/dist/menus/menusInterfaces.d.ts +24 -0
  18. package/dist/modules/modulesInterfaces.d.ts +1 -1
  19. package/dist/pages/pagesApi.d.ts +22 -2
  20. package/dist/pages/pagesApi.js +30 -13
  21. package/dist/pages/pagesApi.js.map +1 -1
  22. package/dist/pages/pagesInterfaces.d.ts +89 -4
  23. package/dist/product-statuses/productStatusesInterfaces.d.ts +22 -0
  24. package/dist/products/productsApi.d.ts +7 -15
  25. package/dist/products/productsApi.js +7 -20
  26. package/dist/products/productsApi.js.map +1 -1
  27. package/dist/products/productsInterfaces.d.ts +73 -18
  28. package/dist/templates/templatesApi.d.ts +4 -13
  29. package/dist/templates/templatesApi.js +4 -29
  30. package/dist/templates/templatesApi.js.map +1 -1
  31. package/dist/templates/templatesInterfaces.d.ts +32 -19
  32. package/dist/templates-preview/templatesPreviewInterfaces.d.ts +27 -11
  33. package/package.json +1 -1
package/README.md CHANGED
@@ -50,7 +50,7 @@ const api = defineOneEntry('your-url')
50
50
 
51
51
  The OneEntry Headless CMS SDK contains two classes: ProductApi and PageApi.
52
52
 
53
- ## AdminsApi
53
+ ## Admins
54
54
 
55
55
  ```
56
56
  const { Admins } = defineOneEntry('your-url')
@@ -70,35 +70,25 @@ Example return:
70
70
  [
71
71
  {
72
72
  "id": 1764,
73
- "updatedDate": "2023-09-23T12:06:18.345Z",
74
- "version": 10,
75
- "identifier": "catalog",
76
- "attributesSets": {
77
- "string_id19": "",
78
- "string_id18": ""
79
- },
80
- "attributeSetId": 0,
73
+ "identifier": "admin1",
74
+ "attributeSetId": 7,
75
+ "isSync": false,
81
76
  "login": "meteor",
82
- "email": "meteor@mydomen.ru",
83
- "restorePasswordCode": "",
84
- "position": {
85
- "id": 12,
86
- "objectId": 1,
87
- "objectType": "module",
88
- "position": "0|hzzzzz:"
89
- },
90
- "positionId": "0|hzzzzz:",
91
- "permissions": {
92
- "menu.create": true
77
+ "email": "meteor@mydomen.com",
78
+ "attributeValues": {
79
+ "en_US": {
80
+ "marker": {
81
+ "value": "",
82
+ "type": "string"
83
+ }
84
+ }
93
85
  },
94
- "selectedLanguage": "en_US",
95
- "selectedContentLanguage": "en_US",
96
- "selectedUITheme": "DARK"
86
+ "position": 192
97
87
  }
98
88
  ]
99
89
  ```
100
90
 
101
- ## FormApi
91
+ ## Forms
102
92
 
103
93
  const { Forms } = defineOneEntry('your-url');
104
94
 
@@ -112,94 +102,36 @@ const value = await Forms.getAllForms()
112
102
 
113
103
  Example return:
114
104
  ```
115
- {
116
- "id": 1764,
117
- "updatedDate": "2023-09-27T20:07:14.793Z",
118
- "version": 10,
119
- "identifier": "catalog",
120
- "attributesSets": {
121
- "string_id19": "",
122
- "string_id18": ""
123
- },
124
- "attributeSetId": 0,
125
- "processingType": "email",
126
- "localizeInfos": {
127
- "en_US": {
128
- "title": "My form",
129
- "titleForSite": "",
130
- "successMessage": "",
131
- "unsuccessMessage": "",
132
- "urlAddress": "",
133
- "database": "0",
134
- "script": "0"
135
- }
136
- },
137
- "processingData": {},
138
- "formPages": [
139
- {
140
- "id": 1764,
141
- "pageId": 1764,
142
- "formId": 164,
143
- "positionId": null,
144
- "position": {
145
- "id": 12,
146
- "objectId": 1,
147
- "objectType": "page",
148
- "position": "0|hzzzzz:"
105
+ [
106
+ {
107
+ "id": 1764,
108
+ "attributeSetId": 0,
109
+ "processingType": "email",
110
+ "localizeInfos": {
111
+ "ru_RU": {
112
+ "title": "My form",
113
+ "titleForSite": "",
114
+ "successMessage": "",
115
+ "unsuccessMessage": "",
116
+ "urlAddress": "",
117
+ "database": "0",
118
+ "script": "0"
149
119
  }
150
- }
151
- ]
152
- }
153
- ```
154
-
155
- ### getFormById
156
-
157
- ```
158
- const value = await Forms.getFormById(1)
159
- ```
160
-
161
- > This method retrieves a single form object based on its identifier (id) from the API. It returns a Promise that resolves to a FormEntity object.
162
-
163
- Example return:
164
- ```
165
- {
166
- "id": 1764,
167
- "updatedDate": "2023-09-27T20:10:37.321Z",
168
- "version": 10,
169
- "identifier": "catalog",
170
- "attributesSets": {
171
- "string_id19": "",
172
- "string_id18": ""
173
- },
174
- "attributeSetId": 0,
175
- "processingType": "email",
176
- "localizeInfos": {
177
- "en_US": {
178
- "title": "My form",
179
- "titleForSite": "",
180
- "successMessage": "",
181
- "unsuccessMessage": "",
182
- "urlAddress": "",
183
- "database": "0",
184
- "script": "0"
185
- }
186
- },
187
- "processingData": {},
188
- "formPages": [
189
- {
190
- "id": 1764,
191
- "pageId": 1764,
192
- "formId": 164,
193
- "positionId": null,
194
- "position": {
195
- "id": 12,
196
- "objectId": 1,
197
- "objectType": "page",
198
- "position": "0|hzzzzz:"
120
+ },
121
+ "processingData": "Unknown Type: ProcessingData",
122
+ "attributeValues": {
123
+ "en_US": {
124
+ "marker": {
125
+ "value": "",
126
+ "type": "string"
127
+ }
199
128
  }
200
- }
201
- ]
202
- }
129
+ },
130
+ "version": 10,
131
+ "identifier": "catalog",
132
+ "position": 192
133
+ }
134
+ ]
203
135
  ```
204
136
 
205
137
  ### getFormByMarker
@@ -215,18 +147,11 @@ Example return:
215
147
  ```
216
148
  {
217
149
  "id": 1764,
218
- "updatedDate": "2023-09-27T20:14:05.333Z",
219
- "version": 10,
220
- "identifier": "catalog",
221
- "attributesSets": {
222
- "string_id19": "",
223
- "string_id18": ""
224
- },
225
150
  "attributeSetId": 0,
226
151
  "processingType": "email",
227
152
  "localizeInfos": {
228
- "en_US": {
229
- "title": "My form",
153
+ "ru_RU": {
154
+ "title": "Моя форма",
230
155
  "titleForSite": "",
231
156
  "successMessage": "",
232
157
  "unsuccessMessage": "",
@@ -235,25 +160,22 @@ Example return:
235
160
  "script": "0"
236
161
  }
237
162
  },
238
- "processingData": {},
239
- "formPages": [
240
- {
241
- "id": 1764,
242
- "pageId": 1764,
243
- "formId": 164,
244
- "positionId": null,
245
- "position": {
246
- "id": 12,
247
- "objectId": 1,
248
- "objectType": "page",
249
- "position": "0|hzzzzz:"
163
+ "processingData": "Unknown Type: ProcessingData",
164
+ "attributeValues": {
165
+ "en_US": {
166
+ "marker": {
167
+ "value": "",
168
+ "type": "string"
250
169
  }
251
170
  }
252
- ]
171
+ },
172
+ "version": 10,
173
+ "identifier": "catalog",
174
+ "position": 192
253
175
  }
254
176
  ```
255
177
 
256
- ## FormsDataApi
178
+ ## FormsData
257
179
 
258
180
  const { FormsData } = defineOneEntry('your-url');
259
181
 
@@ -272,13 +194,14 @@ Example return:
272
194
  "id": 1764,
273
195
  "formIdentifier": "my-form",
274
196
  "time": "2023-02-12 10:56",
275
- "formData": [
276
- {
277
- "marker": "name_1",
278
- "value": "Name",
279
- "langCode": "en_US"
280
- }
281
- ]
197
+ "formData": {
198
+ "en_US": [
199
+ {
200
+ "marker": "naimenovanie_1",
201
+ "value": "Name"
202
+ }
203
+ ]
204
+ }
282
205
  }
283
206
  ```
284
207
 
@@ -298,13 +221,14 @@ Example return:
298
221
  "id": 1764,
299
222
  "formIdentifier": "my-form",
300
223
  "time": "2023-02-12 10:56",
301
- "formData": [
302
- {
303
- "marker": "name_1",
304
- "value": "Name",
305
- "langCode": "en_US"
306
- }
307
- ]
224
+ "formData": {
225
+ "en_US": [
226
+ {
227
+ "marker": "naimenovanie_1",
228
+ "value": "Name"
229
+ }
230
+ ]
231
+ }
308
232
  }
309
233
  ]
310
234
  ```
@@ -320,23 +244,22 @@ const value = await FormsData.getFormsDataByMarker('my-marker')
320
244
  Example return:
321
245
 
322
246
  ```
323
- [
324
- {
325
- "id": 1764,
326
- "formIdentifier": "my-form",
327
- "time": "2023-02-12 10:56",
328
- "formData": [
247
+ {
248
+ "id": 1764,
249
+ "formIdentifier": "my-form",
250
+ "time": "2023-02-12 10:56",
251
+ "formData": {
252
+ "en_US": [
329
253
  {
330
- "marker": "name_1",
331
- "value": "Name",
332
- "langCode": "en_US"
254
+ "marker": "naimenovanie_1",
255
+ "value": "Name"
333
256
  }
334
257
  ]
335
258
  }
336
- ]
259
+ }
337
260
  ```
338
261
 
339
- ## GeneralTypesApi
262
+ ## GeneralTypes
340
263
 
341
264
  const { GeneralTypes } = defineOneEntry('your-url');
342
265
 
@@ -357,7 +280,7 @@ Example return:
357
280
  }
358
281
  ]
359
282
  ```
360
- ## LocalesApi
283
+ ## Locales
361
284
 
362
285
  ```
363
286
  const { Locales } = defineOneEntry('your-url')
@@ -366,7 +289,7 @@ const { Locales } = defineOneEntry('your-url')
366
289
  ### getLocales
367
290
 
368
291
  ```
369
- const value = Locales.await getLocales()
292
+ const value = await Locales.getLocales()
370
293
  ```
371
294
 
372
295
  > This method retrieves all active language localization objects from the API. It returns a Promise that resolves to an array of LocaleEntity objects.
@@ -382,12 +305,12 @@ Example return:
382
305
  "nativeName": "বাংলা",
383
306
  "isActive": false,
384
307
  "image": "🇦🇨",
385
- "position": "0|hzzzzz:"
308
+ "position": 1
386
309
  }
387
310
  ]
388
311
  ```
389
312
 
390
- ## MenusApi
313
+ ## Menus
391
314
 
392
315
  ```
393
316
  const { Menus } = defineOneEntry('your-url')
@@ -430,7 +353,7 @@ Example return:
430
353
  }
431
354
  ```
432
355
 
433
- ## PagesApi
356
+ ## Pages
434
357
 
435
358
  ```
436
359
  const { Pages } = defineOneEntry('your-url')
@@ -742,7 +665,7 @@ Example return:
742
665
  ]
743
666
  ```
744
667
 
745
- ## ProductsApi
668
+ ## Products
746
669
 
747
670
  ```
748
671
  const { Products } = defineOneEntry('your-url')
@@ -752,15 +675,15 @@ This module accepts a set of user parameters called userQuery. If the parameters
752
675
 
753
676
  ```
754
677
  {
755
- offset: 0,
756
- limit: 30,
757
- statusMarker: null,
758
- conditionValue: null,
759
- conditionMarker: null,
760
- attributeMarker: null,
761
- langCode: 'en_US',
762
- sortOrder: 'DESC',
763
- sortKey: 'id'
678
+ offset: 0,
679
+ limit: 30,
680
+ statusMarker: null,
681
+ conditionValue: null,
682
+ conditionMarker: null,
683
+ attributeMarker: null,
684
+ langCode: 'en_US',
685
+ sortOrder: 'DESC',
686
+ sortKey: 'id'
764
687
  }
765
688
  ```
766
689
  "conditionMarker" by which values are filtered (not set by default), possible values:
@@ -1188,26 +1111,8 @@ Example return:
1188
1111
  }
1189
1112
  ]
1190
1113
  ```
1191
- ### getAttributesByProductId
1192
-
1193
- ```
1194
- const value = await Products.getAttributesByProductId(1)
1195
- ```
1196
1114
 
1197
- > This method retrieves all attributes of a product based on its identifier (id) from the API. It returns a Promise that resolves to an array of set attributes for the product.
1198
-
1199
- Example return:
1200
- ```
1201
- {
1202
- "en_US": {
1203
- "marker": {
1204
- "value": "",
1205
- "type": "string"
1206
- }
1207
- }
1208
- }
1209
- ```
1210
- ## ProductStatusApi
1115
+ ## ProductStatus
1211
1116
 
1212
1117
  ```
1213
1118
  const { ProductStatus } = defineOneEntry('your-url');
@@ -1293,7 +1198,7 @@ Example return:
1293
1198
  ```
1294
1199
  true
1295
1200
  ```
1296
- ## TemplatesApi
1201
+ ## Templates
1297
1202
 
1298
1203
  ```
1299
1204
  const { Templates } = defineOneEntry('your-url')
@@ -1309,88 +1214,68 @@ const value = await Templates.getAllTemplates()
1309
1214
 
1310
1215
  Example return:
1311
1216
  ```
1312
- string
1217
+ [
1218
+ {
1219
+ "id": 1764,
1220
+ "identifier": "admin1",
1221
+ "attributeSetId": 7,
1222
+ "generalTypeId": 2,
1223
+ "generalTypeName": "forProductPreview",
1224
+ "localizeInfos": {
1225
+ "ru_RU": {
1226
+ "title": "Product"
1227
+ }
1228
+ },
1229
+ "isSync": false,
1230
+ "attributeValues": {
1231
+ "en_US": {
1232
+ "marker": {
1233
+ "value": "",
1234
+ "type": "string"
1235
+ }
1236
+ }
1237
+ },
1238
+ "position": 192
1239
+ }
1240
+ ]
1313
1241
  ```
1314
- ### getTemplateById
1242
+ ### getTemplateByType
1315
1243
 
1316
1244
  ```
1317
- const value = await Templates.getTemplateById(1)
1245
+ const value = await Templates.getTemplateById('forCatalogProducts')
1318
1246
  ```
1319
1247
 
1320
1248
  > This method retrieves a single template object based on its identifier (id) from the API. It returns a Promise that resolves to a template object.
1321
1249
 
1322
1250
  Example return:
1323
1251
  ```
1324
- {
1325
- "id": 1764,
1326
- "updatedDate": "2023-09-25T13:49:05.070Z",
1327
- "version": 10,
1328
- "identifier": "catalog",
1329
- "attributesSets": {
1330
- "string_id19": "",
1331
- "string_id18": ""
1332
- },
1333
- "attributeSetId": 0,
1334
- "generalType": {
1335
- "id": 4,
1336
- "type": "forCatalogPages"
1337
- },
1338
- "generalTypeId": 4,
1339
- "localizeInfos": {
1340
- "en_US": {
1341
- "title": "Page template"
1342
- }
1343
- },
1344
- "position": {
1345
- "id": 12,
1346
- "objectId": 1,
1347
- "objectType": "module",
1348
- "position": "0|hzzzzz:"
1349
- },
1350
- "positionId": "0|hzzzzz:"
1351
- }
1352
- ```
1353
- ### getTemplateByMarker
1354
-
1355
- ```
1356
- const value = await Templates.getTemplateByMarker(1)
1252
+ [
1253
+ {
1254
+ "id": 1764,
1255
+ "identifier": "admin1",
1256
+ "attributeSetId": 7,
1257
+ "generalTypeId": 2,
1258
+ "generalTypeName": "forCatalogProducts",
1259
+ "localizeInfos": {
1260
+ "ru_RU": {
1261
+ "title": "Product"
1262
+ }
1263
+ },
1264
+ "isSync": false,
1265
+ "attributeValues": {
1266
+ "en_US": {
1267
+ "marker": {
1268
+ "value": "",
1269
+ "type": "string"
1270
+ }
1271
+ }
1272
+ },
1273
+ "position": 192
1274
+ }
1275
+ ]
1357
1276
  ```
1358
1277
 
1359
- > This method retrieves a single template object based on its textual identifier (marker) from the API. It returns a Promise that resolves to a template object.
1360
-
1361
- Example return:
1362
-
1363
- ```
1364
- {
1365
- "id": 1764,
1366
- "updatedDate": "2023-09-25T13:49:43.355Z",
1367
- "version": 10,
1368
- "identifier": "catalog",
1369
- "attributesSets": {
1370
- "string_id19": "",
1371
- "string_id18": ""
1372
- },
1373
- "attributeSetId": 0,
1374
- "generalType": {
1375
- "id": 4,
1376
- "type": "forCatalogPages"
1377
- },
1378
- "generalTypeId": 4,
1379
- "localizeInfos": {
1380
- "en_US": {
1381
- "title": "Page template"
1382
- }
1383
- },
1384
- "position": {
1385
- "id": 12,
1386
- "objectId": 1,
1387
- "objectType": "module",
1388
- "position": "0|hzzzzz:"
1389
- },
1390
- "positionId": "0|hzzzzz:"
1391
- }
1392
- ```
1393
- ## TemplatesPreviewApi
1278
+ ## TemplatesPreview
1394
1279
 
1395
1280
  ```
1396
1281
  const { TemplatesPreview } = defineOneEntry('your-url')
@@ -1426,9 +1311,9 @@ Example return:
1426
1311
  "id": 12,
1427
1312
  "objectId": 1,
1428
1313
  "objectType": "module",
1429
- "position": "0|hzzzzz:"
1314
+ "position": 1
1430
1315
  },
1431
- "positionId": "0|hzzzzz:"
1316
+ "positionId": 1
1432
1317
  }
1433
1318
  ]
1434
1319
  ```
@@ -1462,9 +1347,9 @@ Example return:
1462
1347
  "id": 12,
1463
1348
  "objectId": 1,
1464
1349
  "objectType": "module",
1465
- "position": "0|hzzzzz:"
1350
+ "position": 1
1466
1351
  },
1467
- "positionId": "0|hzzzzz:"
1352
+ "positionId": 1
1468
1353
  }
1469
1354
  ```
1470
1355
  ### getTemplatesPreviewByMarker
@@ -1497,8 +1382,8 @@ Example return:
1497
1382
  "id": 12,
1498
1383
  "objectId": 1,
1499
1384
  "objectType": "module",
1500
- "position": "0|hzzzzz:"
1385
+ "position": 1
1501
1386
  },
1502
- "positionId": "0|hzzzzz:"
1387
+ "positionId": 1
1503
1388
  }
1504
1389
  ```
@@ -10,5 +10,5 @@ export default class AdminsApi extends OneEntry implements IAdmins {
10
10
  *
11
11
  * @returns Returns all AdminEntity user objects
12
12
  */
13
- getAdminsInfo(): Promise<IAdminEntity>;
13
+ getAdminsInfo(): Promise<Array<IAdminEntity>>;
14
14
  }
@@ -1,32 +1,67 @@
1
+ /**
2
+ * Represents a interface object of Admins Api.
3
+ *
4
+ * @property {function} getAdminsInfo - Get all user objects - admins.
5
+ */
1
6
  interface IAdmins {
2
- getAdminsInfo(): Promise<IAdminEntity>;
7
+ getAdminsInfo(): Promise<Array<IAdminEntity>>;
3
8
  }
9
+ /**
10
+ * Represents a position object.
11
+ *
12
+ * @interface
13
+ * @property {number} id - The unique identifier of the position.
14
+ * @property {number} position - The position of the object.
15
+ * @property {number} objectId - The unique identifier of the object.
16
+ * @property {string} objectType - The type of the object.
17
+ * @property {boolean} isLocked - Indicates whether the position is locked or not.
18
+ * @property {number} objectCategoryId - The unique identifier of the object's category.
19
+ */
4
20
  interface IPosition {
5
21
  id: number;
6
- position: string;
22
+ position: number;
7
23
  objectId: number;
8
24
  objectType: string;
9
- isLocked: boolean;
10
- objectCategoryId: number;
25
+ isLocked?: boolean;
26
+ objectCategoryId?: number;
11
27
  }
28
+ /**
29
+ * Represents a position object.
30
+ *
31
+ * @interface
32
+ * @property {string} attr_name - Attributes with values used by the object.
33
+ */
12
34
  interface IAttributesSets {
13
35
  [key: string]: string;
14
36
  }
37
+ /**
38
+ * Represents an object with various properties.
39
+ *
40
+ * @interface
41
+ * @property {number} id - The identifier of the object.
42
+ * @property {string} updatedDate - The date of when the object was last updated.
43
+ * @property {number} version - The version number of the object.
44
+ * @property {string} identifier - The textual identifier for the record field.
45
+ * @property {IAttributesSets} attributesSets - The attributes with values used by the object.
46
+ * @property {number} attributeSetId - The identifier of the attribute set being used.
47
+ * @property {string} login - The login username.
48
+ * @property {string} email - The email address.
49
+ * @property {number} restorePasswordCode - The code for password restoration.
50
+ * @property {IPosition} position - The position of the object.
51
+ * @property {number} positionId - The identifier of the position object.
52
+ * @property {Record<string, boolean>} permissions - The user's available permissions.
53
+ * @property {string} selectedLanguage - The selected language for the interface.
54
+ * @property {string} selectedContentLanguage - The selected language for content.
55
+ * @property {string} selectedUITheme - The selected theme for the interface.
56
+ */
15
57
  interface IAdminEntity {
16
58
  id: number;
17
- updatedDate: string;
18
- version: number;
19
59
  identifier: string;
20
60
  attributesSets: IAttributesSets;
21
- attributeSetId: number;
22
- login: string;
61
+ isSync: boolean;
62
+ attributeSetId: number | null;
63
+ login?: string;
23
64
  email?: string;
24
- restorePasswordCode: number;
25
65
  position: IPosition;
26
- positionId: number;
27
- permissions: Record<string, boolean>;
28
- selectedLanguage: string;
29
- selectedContentLanguage: string;
30
- selectedUITheme: string;
31
66
  }
32
- export { IAdmins, IAdminEntity };
67
+ export { IAdmins, IAdminEntity, IPosition };