oneentry 1.0.159 → 1.0.161
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 +2 -0
- package/changelog.md +56 -1
- package/dist/admins/adminsApi.d.ts +15 -1
- package/dist/admins/adminsApi.js +29 -0
- package/dist/admins/adminsInterfaces.d.ts +37 -1
- package/dist/base/lazySchema.d.ts +15 -0
- package/dist/base/lazySchema.js +20 -0
- package/dist/discounts/discountsApi.d.ts +14 -1
- package/dist/discounts/discountsApi.js +21 -0
- package/dist/discounts/discountsInterfaces.d.ts +27 -1
- package/dist/filters/filtersInterfaces.d.ts +2 -2
- package/dist/filters/filtersSchemas.d.ts +1 -1
- package/dist/filters/filtersSchemas.js +4 -1
- package/dist/forms-data/formsDataApi.d.ts +14 -1
- package/dist/forms-data/formsDataApi.js +21 -0
- package/dist/forms-data/formsDataInterfaces.d.ts +74 -1
- package/dist/index.d.ts +4 -0
- package/dist/index.js +3 -0
- package/dist/orders/ordersApi.d.ts +15 -1
- package/dist/orders/ordersApi.js +22 -0
- package/dist/orders/ordersInterfaces.d.ts +27 -1
- package/dist/pages/pagesApi.d.ts +14 -1
- package/dist/pages/pagesApi.js +21 -0
- package/dist/pages/pagesInterfaces.d.ts +38 -1
- package/dist/payments/paymentsInterfaces.d.ts +2 -2
- package/dist/products/productsInterfaces.d.ts +1 -1
- package/dist/search/searchApi.d.ts +35 -0
- package/dist/search/searchApi.js +86 -0
- package/dist/search/searchInterfaces.d.ts +94 -0
- package/dist/search/searchInterfaces.js +2 -0
- package/dist/search/searchSchemas.d.ts +73 -0
- package/dist/search/searchSchemas.js +44 -0
- package/dist/templates-preview/templatesPreviewInterfaces.d.ts +0 -2
- package/dist/templates-preview/templatesPreviewSchemas.d.ts +0 -2
- package/dist/templates-preview/templatesPreviewSchemas.js +0 -1
- package/dist/types.d.ts +35 -0
- package/dist/types.js +2 -0
- package/dist/users/usersApi.d.ts +15 -1
- package/dist/users/usersApi.js +22 -0
- package/dist/users/usersInterfaces.d.ts +39 -1
- package/dist/web-socket/lazySocket.d.ts +18 -0
- package/dist/web-socket/lazySocket.js +70 -0
- package/esm/admins/adminsApi.d.ts +66 -0
- package/esm/admins/adminsApi.js +90 -0
- package/esm/admins/adminsInterfaces.d.ts +137 -0
- package/esm/admins/adminsInterfaces.js +1 -0
- package/esm/admins/adminsSchemas.d.ts +48 -0
- package/esm/admins/adminsSchemas.js +31 -0
- package/esm/attribute-sets/attributeSetsApi.d.ts +67 -0
- package/esm/attribute-sets/attributeSetsApi.js +97 -0
- package/esm/attribute-sets/attributeSetsInterfaces.d.ts +285 -0
- package/esm/attribute-sets/attributeSetsInterfaces.js +1 -0
- package/esm/attribute-sets/attributeSetsSchemas.d.ts +84 -0
- package/esm/attribute-sets/attributeSetsSchemas.js +66 -0
- package/esm/auth-provider/authProviderApi.d.ts +262 -0
- package/esm/auth-provider/authProviderApi.js +362 -0
- package/esm/auth-provider/authProviderSchemas.d.ts +124 -0
- package/esm/auth-provider/authProviderSchemas.js +92 -0
- package/esm/auth-provider/authProvidersInterfaces.d.ts +430 -0
- package/esm/auth-provider/authProvidersInterfaces.js +1 -0
- package/esm/base/asyncModules.d.ts +123 -0
- package/esm/base/asyncModules.js +382 -0
- package/esm/base/lazySchema.d.ts +15 -0
- package/esm/base/lazySchema.js +17 -0
- package/esm/base/stateModule.d.ts +35 -0
- package/esm/base/stateModule.js +51 -0
- package/esm/base/syncModules.d.ts +245 -0
- package/esm/base/syncModules.js +555 -0
- package/esm/base/timeIntervals.d.ts +95 -0
- package/esm/base/timeIntervals.js +317 -0
- package/esm/base/utils.d.ts +354 -0
- package/esm/base/utils.js +1 -0
- package/esm/base/validation.d.ts +98 -0
- package/esm/base/validation.js +118 -0
- package/esm/blocks/blocksApi.d.ts +252 -0
- package/esm/blocks/blocksApi.js +394 -0
- package/esm/blocks/blocksInterfaces.d.ts +361 -0
- package/esm/blocks/blocksInterfaces.js +1 -0
- package/esm/blocks/blocksSchemas.d.ts +213 -0
- package/esm/blocks/blocksSchemas.js +40 -0
- package/esm/discounts/discountsApi.d.ts +94 -0
- package/esm/discounts/discountsApi.js +136 -0
- package/esm/discounts/discountsInterfaces.d.ts +293 -0
- package/esm/discounts/discountsInterfaces.js +1 -0
- package/esm/events/eventsApi.d.ts +108 -0
- package/esm/events/eventsApi.js +141 -0
- package/esm/events/eventsInterfaces.d.ts +176 -0
- package/esm/events/eventsInterfaces.js +1 -0
- package/esm/file-uploading/fileUploadingApi.d.ts +91 -0
- package/esm/file-uploading/fileUploadingApi.js +127 -0
- package/esm/file-uploading/fileUploadingInterfaces.d.ts +116 -0
- package/esm/file-uploading/fileUploadingInterfaces.js +1 -0
- package/esm/file-uploading/fileUploadingSchemas.d.ts +24 -0
- package/esm/file-uploading/fileUploadingSchemas.js +19 -0
- package/esm/filters/filtersApi.d.ts +32 -0
- package/esm/filters/filtersApi.js +36 -0
- package/esm/filters/filtersInterfaces.d.ts +56 -0
- package/esm/filters/filtersInterfaces.js +1 -0
- package/esm/filters/filtersSchemas.d.ts +32 -0
- package/esm/filters/filtersSchemas.js +29 -0
- package/esm/forms/formsApi.d.ts +44 -0
- package/esm/forms/formsApi.js +54 -0
- package/esm/forms/formsInterfaces.d.ts +237 -0
- package/esm/forms/formsInterfaces.js +1 -0
- package/esm/forms/formsSchemas.d.ts +56 -0
- package/esm/forms/formsSchemas.js +32 -0
- package/esm/forms-data/formsDataApi.d.ts +124 -0
- package/esm/forms-data/formsDataApi.js +210 -0
- package/esm/forms-data/formsDataInterfaces.d.ts +670 -0
- package/esm/forms-data/formsDataInterfaces.js +1 -0
- package/esm/forms-data/formsDataSchemas.d.ts +107 -0
- package/esm/forms-data/formsDataSchemas.js +83 -0
- package/esm/general-types/generalTypesApi.d.ts +29 -0
- package/esm/general-types/generalTypesApi.js +34 -0
- package/esm/general-types/generalTypesInterfaces.d.ts +29 -0
- package/esm/general-types/generalTypesInterfaces.js +1 -0
- package/esm/general-types/generalTypesSchemas.d.ts +68 -0
- package/esm/general-types/generalTypesSchemas.js +42 -0
- package/esm/index.d.ts +143 -0
- package/esm/index.js +124 -0
- package/esm/integration-collections/integrationCollectionsApi.d.ts +172 -0
- package/esm/integration-collections/integrationCollectionsApi.js +224 -0
- package/esm/integration-collections/integrationCollectionsInterfaces.d.ts +317 -0
- package/esm/integration-collections/integrationCollectionsInterfaces.js +1 -0
- package/esm/integration-collections/integrationCollectionsSchemas.d.ts +84 -0
- package/esm/integration-collections/integrationCollectionsSchemas.js +60 -0
- package/esm/locales/localesApi.d.ts +28 -0
- package/esm/locales/localesApi.js +33 -0
- package/esm/locales/localesInterfaces.d.ts +40 -0
- package/esm/locales/localesInterfaces.js +1 -0
- package/esm/locales/localesSchemas.d.ts +32 -0
- package/esm/locales/localesSchemas.js +23 -0
- package/esm/menus/menusApi.d.ts +30 -0
- package/esm/menus/menusApi.js +35 -0
- package/esm/menus/menusInterfaces.d.ts +87 -0
- package/esm/menus/menusInterfaces.js +2 -0
- package/esm/menus/menusSchemas.d.ts +16 -0
- package/esm/menus/menusSchemas.js +25 -0
- package/esm/orders/ordersApi.d.ts +213 -0
- package/esm/orders/ordersApi.js +288 -0
- package/esm/orders/ordersInterfaces.d.ts +763 -0
- package/esm/orders/ordersInterfaces.js +1 -0
- package/esm/orders/ordersSchemas.d.ts +312 -0
- package/esm/orders/ordersSchemas.js +171 -0
- package/esm/package.json +4 -0
- package/esm/pages/pagesApi.d.ts +173 -0
- package/esm/pages/pagesApi.js +414 -0
- package/esm/pages/pagesInterfaces.d.ts +344 -0
- package/esm/pages/pagesInterfaces.js +1 -0
- package/esm/pages/pagesSchemas.d.ts +121 -0
- package/esm/pages/pagesSchemas.js +60 -0
- package/esm/payments/paymentsApi.d.ts +88 -0
- package/esm/payments/paymentsApi.js +122 -0
- package/esm/payments/paymentsInterfaces.d.ts +189 -0
- package/esm/payments/paymentsInterfaces.js +1 -0
- package/esm/payments/paymentsSchemas.d.ts +94 -0
- package/esm/payments/paymentsSchemas.js +53 -0
- package/esm/product-statuses/productStatusesApi.d.ts +50 -0
- package/esm/product-statuses/productStatusesApi.js +68 -0
- package/esm/product-statuses/productStatusesInterfaces.d.ts +62 -0
- package/esm/product-statuses/productStatusesInterfaces.js +1 -0
- package/esm/product-statuses/productStatusesSchemas.d.ts +34 -0
- package/esm/product-statuses/productStatusesSchemas.js +27 -0
- package/esm/products/productsApi.d.ts +366 -0
- package/esm/products/productsApi.js +468 -0
- package/esm/products/productsInterfaces.d.ts +723 -0
- package/esm/products/productsInterfaces.js +1 -0
- package/esm/products/productsSchemas.d.ts +234 -0
- package/esm/products/productsSchemas.js +121 -0
- package/esm/search/searchApi.d.ts +35 -0
- package/esm/search/searchApi.js +47 -0
- package/esm/search/searchInterfaces.d.ts +94 -0
- package/esm/search/searchInterfaces.js +1 -0
- package/esm/search/searchSchemas.d.ts +73 -0
- package/esm/search/searchSchemas.js +41 -0
- package/esm/sitemap/sitemapApi.d.ts +37 -0
- package/esm/sitemap/sitemapApi.js +41 -0
- package/esm/sitemap/sitemapInterfaces.d.ts +51 -0
- package/esm/sitemap/sitemapInterfaces.js +1 -0
- package/esm/subscriptions/subscriptionsApi.d.ts +74 -0
- package/esm/subscriptions/subscriptionsApi.js +90 -0
- package/esm/subscriptions/subscriptionsInterfaces.d.ts +111 -0
- package/esm/subscriptions/subscriptionsInterfaces.js +1 -0
- package/esm/subscriptions/subscriptionsSchemas.d.ts +46 -0
- package/esm/subscriptions/subscriptionsSchemas.js +38 -0
- package/esm/system/systemApi.d.ts +46 -0
- package/esm/system/systemApi.js +53 -0
- package/esm/system/systemInterfaces.d.ts +29 -0
- package/esm/system/systemInterfaces.js +1 -0
- package/esm/templates/templatesApi.d.ts +53 -0
- package/esm/templates/templatesApi.js +78 -0
- package/esm/templates/templatesInterfaces.d.ts +68 -0
- package/esm/templates/templatesInterfaces.js +1 -0
- package/esm/templates/templatesSchemas.d.ts +48 -0
- package/esm/templates/templatesSchemas.js +28 -0
- package/esm/templates-preview/templatesPreviewApi.d.ts +40 -0
- package/esm/templates-preview/templatesPreviewApi.js +50 -0
- package/esm/templates-preview/templatesPreviewInterfaces.d.ts +129 -0
- package/esm/templates-preview/templatesPreviewInterfaces.js +1 -0
- package/esm/templates-preview/templatesPreviewSchemas.d.ts +79 -0
- package/esm/templates-preview/templatesPreviewSchemas.js +43 -0
- package/esm/types.d.ts +35 -0
- package/esm/types.js +1 -0
- package/esm/user-activity/userActivityApi.d.ts +31 -0
- package/esm/user-activity/userActivityApi.js +37 -0
- package/esm/user-activity/userActivityInterfaces.d.ts +42 -0
- package/esm/user-activity/userActivityInterfaces.js +1 -0
- package/esm/users/usersApi.d.ts +249 -0
- package/esm/users/usersApi.js +312 -0
- package/esm/users/usersInterfaces.d.ts +419 -0
- package/esm/users/usersInterfaces.js +1 -0
- package/esm/users/usersSchemas.d.ts +72 -0
- package/esm/users/usersSchemas.js +55 -0
- package/esm/web-socket/lazySocket.d.ts +18 -0
- package/esm/web-socket/lazySocket.js +67 -0
- package/esm/web-socket/wsApi.d.ts +27 -0
- package/esm/web-socket/wsApi.js +43 -0
- package/esm/web-socket/wsInterfaces.d.ts +16 -0
- package/esm/web-socket/wsInterfaces.js +1 -0
- package/package.json +47 -2
- package/types.d.ts +1 -0
- package/types.js +1 -0
|
@@ -0,0 +1,317 @@
|
|
|
1
|
+
import type { IError, ILocalizeInfo } from '../base/utils.js';
|
|
2
|
+
/**
|
|
3
|
+
* @interface ICollectionsApi
|
|
4
|
+
* @description This interface defines methods for managing collections and their records in the system.
|
|
5
|
+
*/
|
|
6
|
+
interface ICollectionsApi {
|
|
7
|
+
/**
|
|
8
|
+
* Get all collections.
|
|
9
|
+
* @handleName getICollections
|
|
10
|
+
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
11
|
+
* @param {ICollectionQuery} [userQuery] - Query parameters.
|
|
12
|
+
* @example
|
|
13
|
+
{
|
|
14
|
+
"limit": 30,
|
|
15
|
+
"offset": 0,
|
|
16
|
+
"entityType": "orders",
|
|
17
|
+
"entityId": 1
|
|
18
|
+
}
|
|
19
|
+
* @param {number} [userQuery.limit] - Parameter for pagination. Default: 0.
|
|
20
|
+
* @param {number} [userQuery.offset] - Parameter for pagination. Default: 30.
|
|
21
|
+
* @param {string} [userQuery.entityType] - Entity type. Example: "orders".
|
|
22
|
+
* @param {number} [userQuery.entityId] - Entity identifier. Example: 1.
|
|
23
|
+
* @returns {ICollectionEntity[]} Returns an array of ICollection objects or an error object if there was an issue.
|
|
24
|
+
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
25
|
+
* @description This method gets all collections.
|
|
26
|
+
*/
|
|
27
|
+
getICollections(langCode: string, userQuery?: ICollectionQuery): Promise<ICollectionEntity[] | IError>;
|
|
28
|
+
/**
|
|
29
|
+
* Get a single collection object by id.
|
|
30
|
+
* @handleName getICollectionById
|
|
31
|
+
* @param {number} id - Collection id. Example: 1.
|
|
32
|
+
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
33
|
+
* @returns {ICollectionEntity} Returns an ICollection object or an error object if there was an issue.
|
|
34
|
+
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
35
|
+
* @description This method gets a single collection object by id.
|
|
36
|
+
*/
|
|
37
|
+
getICollectionById(id: number, langCode: string): Promise<ICollectionEntity | IError>;
|
|
38
|
+
/**
|
|
39
|
+
* Get all records belonging to the collection by collection id.
|
|
40
|
+
* @handleName getICollectionRowsById
|
|
41
|
+
* @param {number} id - Collection id.
|
|
42
|
+
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
43
|
+
* @param {ICollectionQuery} [userQuery] - Optional set query parameters.
|
|
44
|
+
* @example
|
|
45
|
+
{
|
|
46
|
+
"limit": 30,
|
|
47
|
+
"offset": 0,
|
|
48
|
+
"entityType": "orders",
|
|
49
|
+
"entityId": 1
|
|
50
|
+
}
|
|
51
|
+
* @param {number} [userQuery.limit] - Optional parameter for pagination. Default: 30.
|
|
52
|
+
* @param {number} [userQuery.offset] - Optional parameter for pagination. Default: 0.
|
|
53
|
+
* @param {string} [userQuery.entityType] - Entity type. Example: "orders".
|
|
54
|
+
* @param {number} [userQuery.entityId] - Entity identifier. Example: 1.
|
|
55
|
+
* @returns {ICollectionRowsResponce} Returns object ItemsWithTotal, where items is an array of requested objects.
|
|
56
|
+
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
57
|
+
* @description This method gets all records belonging to the collection by collection id.
|
|
58
|
+
*/
|
|
59
|
+
getICollectionRowsById(id: number, langCode: string, userQuery?: ICollectionQuery): Promise<ICollectionRowsResponce | IError>;
|
|
60
|
+
/**
|
|
61
|
+
* Check for the existence of a text identifier (marker).
|
|
62
|
+
* @handleName validateICollectionMarker
|
|
63
|
+
* @param {string} marker - Collection marker. Example: "collection1".
|
|
64
|
+
* @returns {ICollectionIsValid} Returns an object with a boolean property `valid` indicating whether the marker is valid or not.
|
|
65
|
+
* @example
|
|
66
|
+
{
|
|
67
|
+
"valid": true
|
|
68
|
+
}
|
|
69
|
+
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
70
|
+
* @description This method checks for the existence of a text identifier (marker).
|
|
71
|
+
*/
|
|
72
|
+
validateICollectionMarker(marker: string): Promise<ICollectionIsValid | IError>;
|
|
73
|
+
/**
|
|
74
|
+
* Getting all records from the collection.
|
|
75
|
+
* @handleName getICollectionRowsByMarker
|
|
76
|
+
* @param {string} marker - Collection text identifier. Example: "collection1".
|
|
77
|
+
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
78
|
+
* @returns {ICollectionRowsResponce} Returns collection row entity object.
|
|
79
|
+
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
80
|
+
* @description This method gets all records from the collection.
|
|
81
|
+
*/
|
|
82
|
+
getICollectionRowsByMarker(marker: string, langCode?: string): Promise<ICollectionRowsResponce | IError>;
|
|
83
|
+
/**
|
|
84
|
+
* Getting one record from the collection.
|
|
85
|
+
* @handleName getICollectionRowByMarkerAndId
|
|
86
|
+
* @param {string} marker - Collection text identifier. Example: "collection1".
|
|
87
|
+
* @param {number} id - Collection record identifier. Example: 1.
|
|
88
|
+
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
89
|
+
* @returns {ICollectionRow} Returns collection row entity object.
|
|
90
|
+
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
91
|
+
* @description This method gets one record from the collection.
|
|
92
|
+
*/
|
|
93
|
+
getICollectionRowByMarkerAndId(marker: string, id: number, langCode: string): Promise<ICollectionRow | IError>;
|
|
94
|
+
/**
|
|
95
|
+
* Create a record in the collection.
|
|
96
|
+
* @handleName createICollectionRow
|
|
97
|
+
* @param {string} marker - Collection text identifier. Example: "collection1".
|
|
98
|
+
* @param {ICollectionFormObject} body - Object for creating a record.
|
|
99
|
+
* @example
|
|
100
|
+
{
|
|
101
|
+
"formIdentifier": "collection-form",
|
|
102
|
+
"formData": [
|
|
103
|
+
{
|
|
104
|
+
"marker": "collection_marker",
|
|
105
|
+
"type": "string",
|
|
106
|
+
"value": "Collection marker"
|
|
107
|
+
}
|
|
108
|
+
]
|
|
109
|
+
}
|
|
110
|
+
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
111
|
+
* @returns {ICollectionRow} Returns object of type ICollectionRow.
|
|
112
|
+
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
113
|
+
* @description This method creates a record in the collection.
|
|
114
|
+
*/
|
|
115
|
+
createICollectionRow(marker: string, body: ICollectionFormObject, langCode: string): Promise<ICollectionRow | IError>;
|
|
116
|
+
/**
|
|
117
|
+
* Edit a record in the collection.
|
|
118
|
+
* @handleName updateICollectionRow
|
|
119
|
+
* @param {string} marker - Text identifier of the collection. Example: "collection1".
|
|
120
|
+
* @param {number} id - Row id. Example: 12.
|
|
121
|
+
* @param {ICollectionFormObject} body - Object for updating a record in the collection.
|
|
122
|
+
* @example
|
|
123
|
+
{
|
|
124
|
+
"formIdentifier": "collection-form",
|
|
125
|
+
"formData": [
|
|
126
|
+
{
|
|
127
|
+
"marker": "collection_marker",
|
|
128
|
+
"type": "string",
|
|
129
|
+
"value": "Collection marker"
|
|
130
|
+
}
|
|
131
|
+
]
|
|
132
|
+
}
|
|
133
|
+
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
134
|
+
* @returns {ICollectionRow} Returns object of type ICollectionRow.
|
|
135
|
+
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
136
|
+
* @description This method edits a record in the collection.
|
|
137
|
+
*/
|
|
138
|
+
updateICollectionRow(marker: string, id: number, body: ICollectionFormObject, langCode: string): Promise<ICollectionRow | IError>;
|
|
139
|
+
/**
|
|
140
|
+
* Deletion of collection record object
|
|
141
|
+
* @handleName deleteICollectionRowByMarkerAndId
|
|
142
|
+
* @param {string} marker - text identifier of the collection Example: "collection1".
|
|
143
|
+
* @param {number} id - record identifier in the collection Example: 12.
|
|
144
|
+
* @returns {boolean} Returns true (in case of successful deletion) or false (in case of unsuccessful deletion) (permission "collections.row.delete" required for access)
|
|
145
|
+
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
146
|
+
* @description This method deletes a collection record object.
|
|
147
|
+
*/
|
|
148
|
+
deleteICollectionRowByMarkerAndId(marker: string, id: number): Promise<boolean | IError>;
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* Collection object
|
|
152
|
+
* @interface ICollectionEntity
|
|
153
|
+
* @property {number} id - Object identifier. Example: 1.
|
|
154
|
+
* @property {string | null} identifier - Text identifier for record field. Example: "collection1".
|
|
155
|
+
* @property {number | null} formId - Identifier for the form used by the order storage. Example: 1234.
|
|
156
|
+
* @property {ILocalizeInfo} localizeInfos - Localized information about the collection.
|
|
157
|
+
* @example
|
|
158
|
+
{
|
|
159
|
+
"title": "Admins text"
|
|
160
|
+
}
|
|
161
|
+
* @property {number | null} attributeSetId - Identifier of the set of attributes used by the form attached to the collection. Example: 1234 or null if not applicable.
|
|
162
|
+
* @property {string | null} selectedAttributeMarkers - Text identifiers of form object attributes for display in the data table. Example: "collection_marker".
|
|
163
|
+
* @description Represents a collection object with various properties, including identifiers, form information, and localized data.
|
|
164
|
+
*/
|
|
165
|
+
interface ICollectionEntity {
|
|
166
|
+
id: number;
|
|
167
|
+
identifier: string | null;
|
|
168
|
+
formId: number | null;
|
|
169
|
+
localizeInfos: ILocalizeInfo;
|
|
170
|
+
attributeSetId: number | null;
|
|
171
|
+
selectedAttributeMarkers: string | null;
|
|
172
|
+
}
|
|
173
|
+
/**
|
|
174
|
+
* Collection response object
|
|
175
|
+
* @interface ICollectionResponce
|
|
176
|
+
* @property {ICollectionEntity[]} items - Array of collection objects.
|
|
177
|
+
* @example
|
|
178
|
+
[
|
|
179
|
+
{
|
|
180
|
+
"id": 1,
|
|
181
|
+
"identifier": "collection1"
|
|
182
|
+
}
|
|
183
|
+
]
|
|
184
|
+
* @property {number} total - Total number of found records. Example: 10.
|
|
185
|
+
* @description Represents a response from the collections API containing a total count and an array of collection objects.
|
|
186
|
+
*/
|
|
187
|
+
interface ICollectionResponce {
|
|
188
|
+
items: ICollectionEntity[];
|
|
189
|
+
total: number;
|
|
190
|
+
}
|
|
191
|
+
/**
|
|
192
|
+
* Collection form data object
|
|
193
|
+
* @interface ICollectionFormData
|
|
194
|
+
* @property {string} marker - Text identifier (marker) of the form field. Example: "collection_marker".
|
|
195
|
+
* @property {string} type - Type of the form field, such as "text", "number", "date", "etc". Example: "number".
|
|
196
|
+
* @property {string} value - Value of the form field, which can be a "string", "number", "date", "etc". Example: "Collection marker".
|
|
197
|
+
* @description Represents a form data object within a collection, containing a marker, type, and value.
|
|
198
|
+
*/
|
|
199
|
+
interface ICollectionFormData {
|
|
200
|
+
marker: string;
|
|
201
|
+
type: string;
|
|
202
|
+
value: string;
|
|
203
|
+
}
|
|
204
|
+
/**
|
|
205
|
+
* Collection form object
|
|
206
|
+
* @interface ICollectionFormObject
|
|
207
|
+
* @property {string} formIdentifier - Text identifier (marker) of the form. Example: "collection-form".
|
|
208
|
+
* @property {Record<string, ICollectionFormData>} formData - An object where keys are form field markers and values are arrays of ICollectionFormData objects.
|
|
209
|
+
* @example
|
|
210
|
+
[
|
|
211
|
+
{
|
|
212
|
+
"marker": "name_1",
|
|
213
|
+
"type": "string",
|
|
214
|
+
"value": "Value"
|
|
215
|
+
}
|
|
216
|
+
]
|
|
217
|
+
* @property {string} formData[].marker - Text identifier (marker) of the form field. Example: "name_1".
|
|
218
|
+
* @property {string} formData[].type - Type of the form field. Example: "string".
|
|
219
|
+
* @property {string} formData[].value - Value of the form field. Example: "Value".
|
|
220
|
+
* @description Represents a collection form object that contains a form identifier and associated form data. This interface defines the structure of a collection form object, which includes a form identifier and a set of form data organized by markers.
|
|
221
|
+
*/
|
|
222
|
+
interface ICollectionFormObject {
|
|
223
|
+
formIdentifier: string;
|
|
224
|
+
formData: {
|
|
225
|
+
[key: string]: ICollectionFormData[];
|
|
226
|
+
};
|
|
227
|
+
}
|
|
228
|
+
/**
|
|
229
|
+
* Collection row object
|
|
230
|
+
* @interface ICollectionRow
|
|
231
|
+
* @property {number} id - Object identifier. Example: 1.
|
|
232
|
+
* @property {string} createdDate - Date of creation of the record. Example: "2023-01-01T00:00:00Z".
|
|
233
|
+
* @property {string} updatedDate - Date of last update of the record. Example: "2023-01-02T00:00:00Z".
|
|
234
|
+
* @property {number | null} [collectionId] - collectionId associated with the collection row. Example: "product", "order", "etc".
|
|
235
|
+
* @property {ICollectionFormData[]} formData - Array of form data objects associated with the collection row.
|
|
236
|
+
* @example
|
|
237
|
+
[
|
|
238
|
+
{
|
|
239
|
+
"marker": "name_1",
|
|
240
|
+
"type": "string",
|
|
241
|
+
"value": "Value"
|
|
242
|
+
}
|
|
243
|
+
]
|
|
244
|
+
* @property {string | null} entityType - Type of the entity associated with the collection row. Example: "product", "order", "etc".
|
|
245
|
+
* @property {number | null} entityId - Identifier of the entity associated with the collection row. Example: 12345.
|
|
246
|
+
* @property {string | null} [attributeSetIdentifier] - Identifier of the attribute set used by the form attached to the collection row, or null if not applicable. Example: "attributeSet1" or null.
|
|
247
|
+
* @property {string | null} [langCode] - Language code the row was stored under. Example: "en_US".
|
|
248
|
+
* @property {string | null} [formIdentifier] - Text identifier of the form the row was created from; returned by the create/update row endpoints. Example: "collection_form".
|
|
249
|
+
* @property {string} total - Total count. Example: "1".
|
|
250
|
+
* @description Represents a row in a collection, containing various properties such as identifiers, dates, form data, and an optional total value.
|
|
251
|
+
*/
|
|
252
|
+
interface ICollectionRow {
|
|
253
|
+
id: number;
|
|
254
|
+
createdDate: string;
|
|
255
|
+
updatedDate: string;
|
|
256
|
+
collectionId?: number | null;
|
|
257
|
+
formData: ICollectionFormData[];
|
|
258
|
+
entityType: string | null;
|
|
259
|
+
entityId: number | null;
|
|
260
|
+
attributeSetIdentifier?: string | null;
|
|
261
|
+
langCode?: string | null;
|
|
262
|
+
formIdentifier?: string | null;
|
|
263
|
+
total?: string;
|
|
264
|
+
}
|
|
265
|
+
/**
|
|
266
|
+
* Collection rows response object
|
|
267
|
+
* @interface ICollectionRowsResponce
|
|
268
|
+
* @property {ICollectionRow[]} items - Array of collection row objects.
|
|
269
|
+
* @example
|
|
270
|
+
[
|
|
271
|
+
{
|
|
272
|
+
"id": 1,
|
|
273
|
+
"createdDate": "2025-06-06T19:08:54.616Z",
|
|
274
|
+
"updatedDate": "2025-06-06T19:08:54.616Z",
|
|
275
|
+
"entityId": null,
|
|
276
|
+
"entityType": null,
|
|
277
|
+
"formData": [
|
|
278
|
+
{
|
|
279
|
+
"marker": "name_1",
|
|
280
|
+
"type": "string",
|
|
281
|
+
"value": "Value"
|
|
282
|
+
}
|
|
283
|
+
],
|
|
284
|
+
"attributeSetIdentifier": null
|
|
285
|
+
}
|
|
286
|
+
]
|
|
287
|
+
* @property {number} total - Total number of found records. Example: 10.
|
|
288
|
+
* @description Represents a response from the collections API containing a total count and an array of collection row objects.
|
|
289
|
+
*/
|
|
290
|
+
interface ICollectionRowsResponce {
|
|
291
|
+
items: ICollectionRow[];
|
|
292
|
+
total: number;
|
|
293
|
+
}
|
|
294
|
+
/**
|
|
295
|
+
* Collection is valid object
|
|
296
|
+
* @interface ICollectionIsValid
|
|
297
|
+
* @property {boolean} valid - Valid marker object. Example: true.
|
|
298
|
+
* @description Represents a response from the validateICollectionMarker.
|
|
299
|
+
*/
|
|
300
|
+
interface ICollectionIsValid {
|
|
301
|
+
valid: boolean;
|
|
302
|
+
}
|
|
303
|
+
/**
|
|
304
|
+
* Query parameters for collection requests.
|
|
305
|
+
* @interface ICollectionQuery
|
|
306
|
+
* @property {number} limit - Parameter for pagination. Default: 30.
|
|
307
|
+
* @property {number} offset - Parameter for pagination. Default: 0.
|
|
308
|
+
* @property {string} entityType - Entity type. Example: "orders".
|
|
309
|
+
* @property {number} entityId - Entity identifier. Example: 1.
|
|
310
|
+
*/
|
|
311
|
+
interface ICollectionQuery {
|
|
312
|
+
limit: number;
|
|
313
|
+
offset: number;
|
|
314
|
+
entityType: string;
|
|
315
|
+
entityId: number;
|
|
316
|
+
}
|
|
317
|
+
export type { ICollectionEntity, ICollectionFormObject, ICollectionIsValid, ICollectionQuery, ICollectionResponce, ICollectionRow, ICollectionRowsResponce, ICollectionsApi, };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Validation schemas for IntegrationCollections module
|
|
3
|
+
* @description Zod schemas for validating integration collections-related API responses
|
|
4
|
+
*/
|
|
5
|
+
import { z } from 'zod';
|
|
6
|
+
/**
|
|
7
|
+
* Collection entity schema
|
|
8
|
+
*/
|
|
9
|
+
export declare const CollectionEntitySchema: z.ZodObject<{
|
|
10
|
+
id: z.ZodNumber;
|
|
11
|
+
identifier: z.ZodNullable<z.ZodString>;
|
|
12
|
+
formId: z.ZodNullable<z.ZodNumber>;
|
|
13
|
+
localizeInfos: z.ZodRecord<z.ZodString, z.ZodAny>;
|
|
14
|
+
attributeSetId: z.ZodNullable<z.ZodNumber>;
|
|
15
|
+
selectedAttributeMarkers: z.ZodNullable<z.ZodString>;
|
|
16
|
+
}, z.core.$strip>;
|
|
17
|
+
/**
|
|
18
|
+
* Collections response schema (array of collections)
|
|
19
|
+
*/
|
|
20
|
+
export declare const CollectionsResponseSchema: z.ZodArray<z.ZodObject<{
|
|
21
|
+
id: z.ZodNumber;
|
|
22
|
+
identifier: z.ZodNullable<z.ZodString>;
|
|
23
|
+
formId: z.ZodNullable<z.ZodNumber>;
|
|
24
|
+
localizeInfos: z.ZodRecord<z.ZodString, z.ZodAny>;
|
|
25
|
+
attributeSetId: z.ZodNullable<z.ZodNumber>;
|
|
26
|
+
selectedAttributeMarkers: z.ZodNullable<z.ZodString>;
|
|
27
|
+
}, z.core.$strip>>;
|
|
28
|
+
/**
|
|
29
|
+
* Collection form data schema
|
|
30
|
+
*/
|
|
31
|
+
export declare const CollectionFormDataSchema: z.ZodObject<{
|
|
32
|
+
marker: z.ZodString;
|
|
33
|
+
type: z.ZodString;
|
|
34
|
+
value: z.ZodString;
|
|
35
|
+
}, z.core.$strip>;
|
|
36
|
+
/**
|
|
37
|
+
* Collection row schema
|
|
38
|
+
*/
|
|
39
|
+
export declare const CollectionRowSchema: z.ZodObject<{
|
|
40
|
+
id: z.ZodNumber;
|
|
41
|
+
createdDate: z.ZodString;
|
|
42
|
+
updatedDate: z.ZodString;
|
|
43
|
+
collectionId: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
44
|
+
formData: z.ZodUnion<readonly [z.ZodArray<z.ZodObject<{
|
|
45
|
+
marker: z.ZodString;
|
|
46
|
+
type: z.ZodString;
|
|
47
|
+
value: z.ZodString;
|
|
48
|
+
}, z.core.$strip>>, z.ZodRecord<z.ZodString, z.ZodAny>]>;
|
|
49
|
+
entityType: z.ZodNullable<z.ZodString>;
|
|
50
|
+
entityId: z.ZodNullable<z.ZodNumber>;
|
|
51
|
+
attributeSetIdentifier: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
52
|
+
langCode: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
53
|
+
formIdentifier: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
54
|
+
total: z.ZodOptional<z.ZodString>;
|
|
55
|
+
}, z.core.$strip>;
|
|
56
|
+
/**
|
|
57
|
+
* Collection rows response schema
|
|
58
|
+
*/
|
|
59
|
+
export declare const CollectionRowsResponseSchema: z.ZodObject<{
|
|
60
|
+
items: z.ZodArray<z.ZodObject<{
|
|
61
|
+
id: z.ZodNumber;
|
|
62
|
+
createdDate: z.ZodString;
|
|
63
|
+
updatedDate: z.ZodString;
|
|
64
|
+
collectionId: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
65
|
+
formData: z.ZodUnion<readonly [z.ZodArray<z.ZodObject<{
|
|
66
|
+
marker: z.ZodString;
|
|
67
|
+
type: z.ZodString;
|
|
68
|
+
value: z.ZodString;
|
|
69
|
+
}, z.core.$strip>>, z.ZodRecord<z.ZodString, z.ZodAny>]>;
|
|
70
|
+
entityType: z.ZodNullable<z.ZodString>;
|
|
71
|
+
entityId: z.ZodNullable<z.ZodNumber>;
|
|
72
|
+
attributeSetIdentifier: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
73
|
+
langCode: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
74
|
+
formIdentifier: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
75
|
+
total: z.ZodOptional<z.ZodString>;
|
|
76
|
+
}, z.core.$strip>>;
|
|
77
|
+
total: z.ZodNumber;
|
|
78
|
+
}, z.core.$strip>;
|
|
79
|
+
/**
|
|
80
|
+
* Collection is valid schema
|
|
81
|
+
*/
|
|
82
|
+
export declare const CollectionIsValidSchema: z.ZodObject<{
|
|
83
|
+
valid: z.ZodBoolean;
|
|
84
|
+
}, z.core.$strip>;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Validation schemas for IntegrationCollections module
|
|
3
|
+
* @description Zod schemas for validating integration collections-related API responses
|
|
4
|
+
*/
|
|
5
|
+
import { z } from 'zod';
|
|
6
|
+
/**
|
|
7
|
+
* Collection entity schema
|
|
8
|
+
*/
|
|
9
|
+
export const CollectionEntitySchema = z.object({
|
|
10
|
+
id: z.number(),
|
|
11
|
+
identifier: z.string().nullable(),
|
|
12
|
+
formId: z.number().nullable(),
|
|
13
|
+
localizeInfos: z.record(z.string(), z.any()),
|
|
14
|
+
attributeSetId: z.number().nullable(),
|
|
15
|
+
selectedAttributeMarkers: z.string().nullable(),
|
|
16
|
+
});
|
|
17
|
+
/**
|
|
18
|
+
* Collections response schema (array of collections)
|
|
19
|
+
*/
|
|
20
|
+
export const CollectionsResponseSchema = z.array(CollectionEntitySchema);
|
|
21
|
+
/**
|
|
22
|
+
* Collection form data schema
|
|
23
|
+
*/
|
|
24
|
+
export const CollectionFormDataSchema = z.object({
|
|
25
|
+
marker: z.string(),
|
|
26
|
+
type: z.string(),
|
|
27
|
+
value: z.string(),
|
|
28
|
+
});
|
|
29
|
+
/**
|
|
30
|
+
* Collection row schema
|
|
31
|
+
*/
|
|
32
|
+
export const CollectionRowSchema = z.object({
|
|
33
|
+
id: z.number(),
|
|
34
|
+
createdDate: z.string(),
|
|
35
|
+
updatedDate: z.string(),
|
|
36
|
+
collectionId: z.number().nullable().optional(),
|
|
37
|
+
formData: z.union([
|
|
38
|
+
z.array(CollectionFormDataSchema),
|
|
39
|
+
z.record(z.string(), z.any()),
|
|
40
|
+
]),
|
|
41
|
+
entityType: z.string().nullable(),
|
|
42
|
+
entityId: z.number().nullable(),
|
|
43
|
+
attributeSetIdentifier: z.string().nullable().optional(),
|
|
44
|
+
langCode: z.string().nullable().optional(),
|
|
45
|
+
formIdentifier: z.string().nullable().optional(),
|
|
46
|
+
total: z.string().optional(),
|
|
47
|
+
});
|
|
48
|
+
/**
|
|
49
|
+
* Collection rows response schema
|
|
50
|
+
*/
|
|
51
|
+
export const CollectionRowsResponseSchema = z.object({
|
|
52
|
+
items: z.array(CollectionRowSchema),
|
|
53
|
+
total: z.number(),
|
|
54
|
+
});
|
|
55
|
+
/**
|
|
56
|
+
* Collection is valid schema
|
|
57
|
+
*/
|
|
58
|
+
export const CollectionIsValidSchema = z.object({
|
|
59
|
+
valid: z.boolean(),
|
|
60
|
+
});
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import AsyncModules from '../base/asyncModules.js';
|
|
2
|
+
import type StateModule from '../base/stateModule.js';
|
|
3
|
+
import type { IError } from '../base/utils.js';
|
|
4
|
+
import type { ILocalEntity, ILocales } from './localesInterfaces.js';
|
|
5
|
+
/**
|
|
6
|
+
* Controllers for working with localizations (content language)
|
|
7
|
+
* @handle /api/content/locales
|
|
8
|
+
* @description Controllers for working with localizations (content language)
|
|
9
|
+
*/
|
|
10
|
+
export default class LocalesApi extends AsyncModules implements ILocales {
|
|
11
|
+
protected state: StateModule;
|
|
12
|
+
protected _url: string;
|
|
13
|
+
/**
|
|
14
|
+
* Constructor
|
|
15
|
+
* @param {StateModule} state - StateModule instance
|
|
16
|
+
* @description Constructor initializes the LocalesApi with a given state.
|
|
17
|
+
*/
|
|
18
|
+
constructor(state: StateModule);
|
|
19
|
+
/**
|
|
20
|
+
* Find all active language localization objects.
|
|
21
|
+
* @handleName getLocales
|
|
22
|
+
* @returns {Promise<ILocalEntity[] | IError>} Returns an array of LocaleEntity objects.
|
|
23
|
+
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
24
|
+
* @description Find all active language localization objects.
|
|
25
|
+
* @see {@link https://js-sdk.oneentry.cloud/docs/locales/getLocales getLocales} documentation.
|
|
26
|
+
*/
|
|
27
|
+
getLocales(): Promise<Array<ILocalEntity> | IError>;
|
|
28
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import AsyncModules from '../base/asyncModules.js';
|
|
2
|
+
import createSchemaLoader from '../base/lazySchema.js';
|
|
3
|
+
const schema = createSchemaLoader(() => import('./localesSchemas.js'));
|
|
4
|
+
/**
|
|
5
|
+
* Controllers for working with localizations (content language)
|
|
6
|
+
* @handle /api/content/locales
|
|
7
|
+
* @description Controllers for working with localizations (content language)
|
|
8
|
+
*/
|
|
9
|
+
export default class LocalesApi extends AsyncModules {
|
|
10
|
+
/**
|
|
11
|
+
* Constructor
|
|
12
|
+
* @param {StateModule} state - StateModule instance
|
|
13
|
+
* @description Constructor initializes the LocalesApi with a given state.
|
|
14
|
+
*/
|
|
15
|
+
constructor(state) {
|
|
16
|
+
super(state);
|
|
17
|
+
this._url = state.url + '/api/content/locales';
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Find all active language localization objects.
|
|
21
|
+
* @handleName getLocales
|
|
22
|
+
* @returns {Promise<ILocalEntity[] | IError>} Returns an array of LocaleEntity objects.
|
|
23
|
+
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
24
|
+
* @description Find all active language localization objects.
|
|
25
|
+
* @see {@link https://js-sdk.oneentry.cloud/docs/locales/getLocales getLocales} documentation.
|
|
26
|
+
*/
|
|
27
|
+
async getLocales() {
|
|
28
|
+
const result = await this._fetchGet('/active/all');
|
|
29
|
+
// Validate response if validation is enabled
|
|
30
|
+
const validated = await this._validateResponse(result, schema('LocalesResponseSchema'));
|
|
31
|
+
return validated;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { IError } from '../base/utils.js';
|
|
2
|
+
/**
|
|
3
|
+
* The `ILocales` interface defines methods for working with language localization objects in the system.
|
|
4
|
+
* @interface ILocales
|
|
5
|
+
* @description This interface defines a method for retrieving all active language localization objects in the system.
|
|
6
|
+
*/
|
|
7
|
+
interface ILocales {
|
|
8
|
+
/**
|
|
9
|
+
* Find all active language localization objects.
|
|
10
|
+
* @handleName getLocales
|
|
11
|
+
* @returns {ILocalEntity[]} Returns an array of LocaleEntity objects.
|
|
12
|
+
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
13
|
+
* @description This method finds all active language localization objects.
|
|
14
|
+
*/
|
|
15
|
+
getLocales(): Promise<ILocalEntity[] | IError>;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* The `ILocalEntity` interface defines the structure of a locales entity, including its identifiers, name, and other properties.
|
|
19
|
+
* @interface ILocalEntity
|
|
20
|
+
* @property {number} id - The unique identifier of the locales. Example: 1.
|
|
21
|
+
* @property {string} shortCode - The shortCode of locales. Example: "en".
|
|
22
|
+
* @property {string} code - The full language code. Example: "en_US".
|
|
23
|
+
* @property {string} name - The language name. Example: "English".
|
|
24
|
+
* @property {string} nativeName - The native language name. Example: "English".
|
|
25
|
+
* @property {boolean} isActive - Active language flag. Example: true.
|
|
26
|
+
* @property {string | null} image - The language image. Example: "https://example.com/images/en.png".
|
|
27
|
+
* @property {number} position - The language position. Example: 1.
|
|
28
|
+
* @description This interface defines the structure of a locales entity, including its identifiers, name, and other properties.
|
|
29
|
+
*/
|
|
30
|
+
interface ILocalEntity {
|
|
31
|
+
id: number;
|
|
32
|
+
shortCode: string;
|
|
33
|
+
code: string;
|
|
34
|
+
name: string;
|
|
35
|
+
nativeName: string;
|
|
36
|
+
isActive: boolean;
|
|
37
|
+
image: string | null;
|
|
38
|
+
position: number;
|
|
39
|
+
}
|
|
40
|
+
export type { ILocalEntity, ILocales };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Validation schemas for Locales module
|
|
3
|
+
* @description Zod schemas for validating locales-related API responses
|
|
4
|
+
*/
|
|
5
|
+
import { z } from 'zod';
|
|
6
|
+
/**
|
|
7
|
+
* Locale entity schema
|
|
8
|
+
* Includes all fields returned by the API
|
|
9
|
+
*/
|
|
10
|
+
export declare const LocaleEntitySchema: z.ZodObject<{
|
|
11
|
+
id: z.ZodNumber;
|
|
12
|
+
shortCode: z.ZodString;
|
|
13
|
+
code: z.ZodString;
|
|
14
|
+
name: z.ZodString;
|
|
15
|
+
nativeName: z.ZodString;
|
|
16
|
+
isActive: z.ZodBoolean;
|
|
17
|
+
image: z.ZodNullable<z.ZodString>;
|
|
18
|
+
position: z.ZodNumber;
|
|
19
|
+
}, z.core.$strip>;
|
|
20
|
+
/**
|
|
21
|
+
* Locales response schema (array of locales)
|
|
22
|
+
*/
|
|
23
|
+
export declare const LocalesResponseSchema: z.ZodArray<z.ZodObject<{
|
|
24
|
+
id: z.ZodNumber;
|
|
25
|
+
shortCode: z.ZodString;
|
|
26
|
+
code: z.ZodString;
|
|
27
|
+
name: z.ZodString;
|
|
28
|
+
nativeName: z.ZodString;
|
|
29
|
+
isActive: z.ZodBoolean;
|
|
30
|
+
image: z.ZodNullable<z.ZodString>;
|
|
31
|
+
position: z.ZodNumber;
|
|
32
|
+
}, z.core.$strip>>;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Validation schemas for Locales module
|
|
3
|
+
* @description Zod schemas for validating locales-related API responses
|
|
4
|
+
*/
|
|
5
|
+
import { z } from 'zod';
|
|
6
|
+
/**
|
|
7
|
+
* Locale entity schema
|
|
8
|
+
* Includes all fields returned by the API
|
|
9
|
+
*/
|
|
10
|
+
export const LocaleEntitySchema = z.object({
|
|
11
|
+
id: z.number(),
|
|
12
|
+
shortCode: z.string(),
|
|
13
|
+
code: z.string(),
|
|
14
|
+
name: z.string(),
|
|
15
|
+
nativeName: z.string(),
|
|
16
|
+
isActive: z.boolean(),
|
|
17
|
+
image: z.string().nullable(),
|
|
18
|
+
position: z.number(),
|
|
19
|
+
});
|
|
20
|
+
/**
|
|
21
|
+
* Locales response schema (array of locales)
|
|
22
|
+
*/
|
|
23
|
+
export const LocalesResponseSchema = z.array(LocaleEntitySchema);
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import AsyncModules from '../base/asyncModules.js';
|
|
2
|
+
import type StateModule from '../base/stateModule.js';
|
|
3
|
+
import type { IError } from '../base/utils.js';
|
|
4
|
+
import type { IMenus, IMenusEntity } from './menusInterfaces.js';
|
|
5
|
+
/**
|
|
6
|
+
* Controllers for working with menu objects
|
|
7
|
+
* @handle /api/content/menus
|
|
8
|
+
* @description Controllers for working with menu objects
|
|
9
|
+
*/
|
|
10
|
+
export default class MenusApi extends AsyncModules implements IMenus {
|
|
11
|
+
protected state: StateModule;
|
|
12
|
+
protected _url: string;
|
|
13
|
+
/**
|
|
14
|
+
* Constructor initializes the MenusApi with a given state.
|
|
15
|
+
* @param {StateModule} state - The state module.
|
|
16
|
+
* @description Constructor initializes the MenusApi with a given state.
|
|
17
|
+
*/
|
|
18
|
+
constructor(state: StateModule);
|
|
19
|
+
/**
|
|
20
|
+
* Get pages includes in menu by marker.
|
|
21
|
+
* @handleName getMenusByMarker
|
|
22
|
+
* @param {string} marker - Menu marker. Example: "main_menu".
|
|
23
|
+
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
24
|
+
* @returns {Promise<IMenusEntity | IError>} Returns a single menu object as a ContentMenu object with included pages.
|
|
25
|
+
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
26
|
+
* @description Get pages includes in menu by marker.
|
|
27
|
+
* @see {@link https://js-sdk.oneentry.cloud/docs/menus/getMenusByMarker getMenusByMarker} documentation.
|
|
28
|
+
*/
|
|
29
|
+
getMenusByMarker(marker: string, langCode?: string): Promise<IMenusEntity | IError>;
|
|
30
|
+
}
|