oneentry 1.0.138 → 1.0.140
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 +16 -1
- package/configure.js +40 -21
- package/package.json +15 -12
- package/dist/admins/adminsApi.d.ts +0 -50
- package/dist/admins/adminsApi.js +0 -65
- package/dist/admins/adminsInterfaces.d.ts +0 -99
- package/dist/admins/adminsInterfaces.js +0 -2
- package/dist/admins/adminsSchemas.d.ts +0 -30
- package/dist/admins/adminsSchemas.js +0 -27
- package/dist/attribute-sets/attributeSetsApi.d.ts +0 -63
- package/dist/attribute-sets/attributeSetsApi.js +0 -98
- package/dist/attribute-sets/attributeSetsInterfaces.d.ts +0 -187
- package/dist/attribute-sets/attributeSetsInterfaces.js +0 -2
- package/dist/attribute-sets/attributeSetsSchemas.d.ts +0 -90
- package/dist/attribute-sets/attributeSetsSchemas.js +0 -74
- package/dist/auth-provider/authProviderApi.d.ts +0 -249
- package/dist/auth-provider/authProviderApi.js +0 -351
- package/dist/auth-provider/authProviderSchemas.d.ts +0 -137
- package/dist/auth-provider/authProviderSchemas.js +0 -85
- package/dist/auth-provider/authProvidersInterfaces.d.ts +0 -417
- package/dist/auth-provider/authProvidersInterfaces.js +0 -2
- package/dist/base/asyncModules.d.ts +0 -80
- package/dist/base/asyncModules.js +0 -440
- package/dist/base/result.d.ts +0 -39
- package/dist/base/result.js +0 -154
- package/dist/base/stateModule.d.ts +0 -41
- package/dist/base/stateModule.js +0 -128
- package/dist/base/syncModules.d.ts +0 -148
- package/dist/base/syncModules.js +0 -530
- package/dist/base/utils.d.ts +0 -197
- package/dist/base/utils.js +0 -2
- package/dist/base/validation.d.ts +0 -118
- package/dist/base/validation.js +0 -132
- package/dist/blocks/blocksApi.d.ts +0 -74
- package/dist/blocks/blocksApi.js +0 -184
- package/dist/blocks/blocksInterfaces.d.ts +0 -173
- package/dist/blocks/blocksInterfaces.js +0 -2
- package/dist/blocks/blocksSchemas.d.ts +0 -187
- package/dist/blocks/blocksSchemas.js +0 -43
- package/dist/events/eventsApi.d.ts +0 -60
- package/dist/events/eventsApi.js +0 -97
- package/dist/events/eventsInterfaces.d.ts +0 -87
- package/dist/events/eventsInterfaces.js +0 -2
- package/dist/file-uploading/fileUploadingApi.d.ts +0 -88
- package/dist/file-uploading/fileUploadingApi.js +0 -132
- package/dist/file-uploading/fileUploadingInterfaces.d.ts +0 -117
- package/dist/file-uploading/fileUploadingInterfaces.js +0 -2
- package/dist/file-uploading/fileUploadingSchemas.d.ts +0 -22
- package/dist/file-uploading/fileUploadingSchemas.js +0 -21
- package/dist/forms/formsApi.d.ts +0 -42
- package/dist/forms/formsApi.js +0 -57
- package/dist/forms/formsInterfaces.d.ts +0 -132
- package/dist/forms/formsInterfaces.js +0 -2
- package/dist/forms/formsSchemas.d.ts +0 -65
- package/dist/forms/formsSchemas.js +0 -36
- package/dist/forms-data/formsDataApi.d.ts +0 -106
- package/dist/forms-data/formsDataApi.js +0 -189
- package/dist/forms-data/formsDataInterfaces.d.ts +0 -525
- package/dist/forms-data/formsDataInterfaces.js +0 -2
- package/dist/forms-data/formsDataSchemas.d.ts +0 -115
- package/dist/forms-data/formsDataSchemas.js +0 -86
- package/dist/general-types/generalTypesApi.d.ts +0 -28
- package/dist/general-types/generalTypesApi.js +0 -38
- package/dist/general-types/generalTypesInterfaces.d.ts +0 -30
- package/dist/general-types/generalTypesInterfaces.js +0 -2
- package/dist/general-types/generalTypesSchemas.d.ts +0 -50
- package/dist/general-types/generalTypesSchemas.js +0 -35
- package/dist/index.d.ts +0 -94
- package/dist/index.js +0 -97
- package/dist/integration-collections/integrationCollectionsApi.d.ts +0 -173
- package/dist/integration-collections/integrationCollectionsApi.js +0 -220
- package/dist/integration-collections/integrationCollectionsInterfaces.d.ts +0 -313
- package/dist/integration-collections/integrationCollectionsInterfaces.js +0 -2
- package/dist/integration-collections/integrationCollectionsSchemas.d.ts +0 -84
- package/dist/integration-collections/integrationCollectionsSchemas.js +0 -63
- package/dist/locales/localesApi.d.ts +0 -27
- package/dist/locales/localesApi.js +0 -37
- package/dist/locales/localesInterfaces.d.ts +0 -41
- package/dist/locales/localesInterfaces.js +0 -2
- package/dist/locales/localesSchemas.d.ts +0 -32
- package/dist/locales/localesSchemas.js +0 -26
- package/dist/menus/menusApi.d.ts +0 -29
- package/dist/menus/menusApi.js +0 -39
- package/dist/menus/menusInterfaces.d.ts +0 -88
- package/dist/menus/menusInterfaces.js +0 -4
- package/dist/menus/menusSchemas.d.ts +0 -16
- package/dist/menus/menusSchemas.js +0 -28
- package/dist/orders/ordersApi.d.ts +0 -126
- package/dist/orders/ordersApi.js +0 -169
- package/dist/orders/ordersInterfaces.d.ts +0 -427
- package/dist/orders/ordersInterfaces.js +0 -2
- package/dist/orders/ordersSchemas.d.ts +0 -158
- package/dist/orders/ordersSchemas.js +0 -120
- package/dist/pages/pagesApi.d.ts +0 -151
- package/dist/pages/pagesApi.js +0 -390
- package/dist/pages/pagesInterfaces.d.ts +0 -292
- package/dist/pages/pagesInterfaces.js +0 -2
- package/dist/pages/pagesSchemas.d.ts +0 -85
- package/dist/pages/pagesSchemas.js +0 -46
- package/dist/payments/paymentsApi.d.ts +0 -82
- package/dist/payments/paymentsApi.js +0 -121
- package/dist/payments/paymentsInterfaces.d.ts +0 -206
- package/dist/payments/paymentsInterfaces.js +0 -2
- package/dist/payments/paymentsSchemas.d.ts +0 -137
- package/dist/payments/paymentsSchemas.js +0 -78
- package/dist/product-statuses/productStatusesApi.d.ts +0 -47
- package/dist/product-statuses/productStatusesApi.js +0 -70
- package/dist/product-statuses/productStatusesInterfaces.d.ts +0 -66
- package/dist/product-statuses/productStatusesInterfaces.js +0 -2
- package/dist/product-statuses/productStatusesSchemas.d.ts +0 -34
- package/dist/product-statuses/productStatusesSchemas.js +0 -30
- package/dist/products/productsApi.d.ts +0 -365
- package/dist/products/productsApi.js +0 -464
- package/dist/products/productsInterfaces.d.ts +0 -583
- package/dist/products/productsInterfaces.js +0 -2
- package/dist/products/productsSchemas.d.ts +0 -212
- package/dist/products/productsSchemas.js +0 -85
- package/dist/system/systemApi.d.ts +0 -65
- package/dist/system/systemApi.js +0 -82
- package/dist/system/systemInterfaces.d.ts +0 -23
- package/dist/system/systemInterfaces.js +0 -2
- package/dist/templates/templatesApi.d.ts +0 -49
- package/dist/templates/templatesApi.js +0 -75
- package/dist/templates/templatesInterfaces.d.ts +0 -70
- package/dist/templates/templatesInterfaces.js +0 -2
- package/dist/templates/templatesSchemas.d.ts +0 -48
- package/dist/templates/templatesSchemas.js +0 -31
- package/dist/templates-preview/templatesPreviewApi.d.ts +0 -38
- package/dist/templates-preview/templatesPreviewApi.js +0 -53
- package/dist/templates-preview/templatesPreviewInterfaces.d.ts +0 -121
- package/dist/templates-preview/templatesPreviewInterfaces.js +0 -2
- package/dist/templates-preview/templatesPreviewSchemas.d.ts +0 -83
- package/dist/templates-preview/templatesPreviewSchemas.js +0 -48
- package/dist/users/usersApi.d.ts +0 -143
- package/dist/users/usersApi.js +0 -174
- package/dist/users/usersInterfaces.d.ts +0 -235
- package/dist/users/usersInterfaces.js +0 -2
- package/dist/users/usersSchemas.d.ts +0 -38
- package/dist/users/usersSchemas.js +0 -28
- package/dist/web-socket/wsApi.d.ts +0 -25
- package/dist/web-socket/wsApi.js +0 -45
- package/dist/web-socket/wsInterfaces.d.ts +0 -17
- package/dist/web-socket/wsInterfaces.js +0 -2
|
@@ -1,212 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Validation schemas for Products module
|
|
3
|
-
* @description Zod schemas for validating products-related API responses
|
|
4
|
-
*/
|
|
5
|
-
import { z } from 'zod';
|
|
6
|
-
/**
|
|
7
|
-
* Product price schema
|
|
8
|
-
*/
|
|
9
|
-
export declare const ProductPriceSchema: z.ZodObject<{
|
|
10
|
-
value: z.ZodNumber;
|
|
11
|
-
currency: z.ZodString;
|
|
12
|
-
compareValue: z.ZodOptional<z.ZodNumber>;
|
|
13
|
-
}, z.core.$strip>;
|
|
14
|
-
/**
|
|
15
|
-
* Product image schema
|
|
16
|
-
*/
|
|
17
|
-
export declare const ProductImageSchema: z.ZodObject<{
|
|
18
|
-
id: z.ZodNumber;
|
|
19
|
-
filename: z.ZodString;
|
|
20
|
-
url: z.ZodString;
|
|
21
|
-
size: z.ZodOptional<z.ZodNumber>;
|
|
22
|
-
type: z.ZodOptional<z.ZodString>;
|
|
23
|
-
}, z.core.$strip>;
|
|
24
|
-
/**
|
|
25
|
-
* Product entity schema
|
|
26
|
-
* Includes all fields returned by the API
|
|
27
|
-
*/
|
|
28
|
-
export declare const ProductEntitySchema: z.ZodObject<{
|
|
29
|
-
id: z.ZodNumber;
|
|
30
|
-
identifier: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
31
|
-
attributeSetIdentifier: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
32
|
-
localizeInfos: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
33
|
-
statusLocalizeInfos: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
34
|
-
isVisible: z.ZodOptional<z.ZodBoolean>;
|
|
35
|
-
statusIdentifier: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
36
|
-
position: z.ZodOptional<z.ZodNumber>;
|
|
37
|
-
isPositionLocked: z.ZodOptional<z.ZodBoolean>;
|
|
38
|
-
templateIdentifier: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
39
|
-
shortDescTemplateIdentifier: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
40
|
-
price: z.ZodNullable<z.ZodNumber>;
|
|
41
|
-
additional: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
42
|
-
sku: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
43
|
-
isSync: z.ZodOptional<z.ZodBoolean>;
|
|
44
|
-
categories: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
45
|
-
attributeValues: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
46
|
-
productPages: z.ZodOptional<z.ZodArray<z.ZodAny>>;
|
|
47
|
-
blocks: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
48
|
-
moduleFormConfigs: z.ZodOptional<z.ZodArray<z.ZodAny>>;
|
|
49
|
-
currency: z.ZodOptional<z.ZodString>;
|
|
50
|
-
images: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
51
|
-
id: z.ZodNumber;
|
|
52
|
-
filename: z.ZodString;
|
|
53
|
-
url: z.ZodString;
|
|
54
|
-
size: z.ZodOptional<z.ZodNumber>;
|
|
55
|
-
type: z.ZodOptional<z.ZodString>;
|
|
56
|
-
}, z.core.$strip>>>;
|
|
57
|
-
relatedProducts: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
|
|
58
|
-
pageId: z.ZodOptional<z.ZodNumber>;
|
|
59
|
-
}, z.core.$strip>;
|
|
60
|
-
/**
|
|
61
|
-
* Products response schema
|
|
62
|
-
*/
|
|
63
|
-
export declare const ProductsResponseSchema: z.ZodObject<{
|
|
64
|
-
items: z.ZodArray<z.ZodObject<{
|
|
65
|
-
id: z.ZodNumber;
|
|
66
|
-
identifier: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
67
|
-
attributeSetIdentifier: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
68
|
-
localizeInfos: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
69
|
-
statusLocalizeInfos: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
70
|
-
isVisible: z.ZodOptional<z.ZodBoolean>;
|
|
71
|
-
statusIdentifier: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
72
|
-
position: z.ZodOptional<z.ZodNumber>;
|
|
73
|
-
isPositionLocked: z.ZodOptional<z.ZodBoolean>;
|
|
74
|
-
templateIdentifier: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
75
|
-
shortDescTemplateIdentifier: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
76
|
-
price: z.ZodNullable<z.ZodNumber>;
|
|
77
|
-
additional: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
78
|
-
sku: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
79
|
-
isSync: z.ZodOptional<z.ZodBoolean>;
|
|
80
|
-
categories: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
81
|
-
attributeValues: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
82
|
-
productPages: z.ZodOptional<z.ZodArray<z.ZodAny>>;
|
|
83
|
-
blocks: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
84
|
-
moduleFormConfigs: z.ZodOptional<z.ZodArray<z.ZodAny>>;
|
|
85
|
-
currency: z.ZodOptional<z.ZodString>;
|
|
86
|
-
images: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
87
|
-
id: z.ZodNumber;
|
|
88
|
-
filename: z.ZodString;
|
|
89
|
-
url: z.ZodString;
|
|
90
|
-
size: z.ZodOptional<z.ZodNumber>;
|
|
91
|
-
type: z.ZodOptional<z.ZodString>;
|
|
92
|
-
}, z.core.$strip>>>;
|
|
93
|
-
relatedProducts: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
|
|
94
|
-
pageId: z.ZodOptional<z.ZodNumber>;
|
|
95
|
-
}, z.core.$strip>>;
|
|
96
|
-
total: z.ZodNumber;
|
|
97
|
-
}, z.core.$strip>;
|
|
98
|
-
/**
|
|
99
|
-
* Single product response schema
|
|
100
|
-
*/
|
|
101
|
-
export declare const SingleProductSchema: z.ZodObject<{
|
|
102
|
-
id: z.ZodNumber;
|
|
103
|
-
identifier: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
104
|
-
attributeSetIdentifier: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
105
|
-
localizeInfos: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
106
|
-
statusLocalizeInfos: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
107
|
-
isVisible: z.ZodOptional<z.ZodBoolean>;
|
|
108
|
-
statusIdentifier: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
109
|
-
position: z.ZodOptional<z.ZodNumber>;
|
|
110
|
-
isPositionLocked: z.ZodOptional<z.ZodBoolean>;
|
|
111
|
-
templateIdentifier: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
112
|
-
shortDescTemplateIdentifier: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
113
|
-
price: z.ZodNullable<z.ZodNumber>;
|
|
114
|
-
additional: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
115
|
-
sku: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
116
|
-
isSync: z.ZodOptional<z.ZodBoolean>;
|
|
117
|
-
categories: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
118
|
-
attributeValues: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
119
|
-
productPages: z.ZodOptional<z.ZodArray<z.ZodAny>>;
|
|
120
|
-
blocks: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
121
|
-
moduleFormConfigs: z.ZodOptional<z.ZodArray<z.ZodAny>>;
|
|
122
|
-
currency: z.ZodOptional<z.ZodString>;
|
|
123
|
-
images: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
124
|
-
id: z.ZodNumber;
|
|
125
|
-
filename: z.ZodString;
|
|
126
|
-
url: z.ZodString;
|
|
127
|
-
size: z.ZodOptional<z.ZodNumber>;
|
|
128
|
-
type: z.ZodOptional<z.ZodString>;
|
|
129
|
-
}, z.core.$strip>>>;
|
|
130
|
-
relatedProducts: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
|
|
131
|
-
pageId: z.ZodOptional<z.ZodNumber>;
|
|
132
|
-
}, z.core.$strip>;
|
|
133
|
-
/**
|
|
134
|
-
* Products count schema
|
|
135
|
-
*/
|
|
136
|
-
export declare const ProductsCountSchema: z.ZodObject<{
|
|
137
|
-
total: z.ZodNumber;
|
|
138
|
-
}, z.core.$strip>;
|
|
139
|
-
/**
|
|
140
|
-
* Product block schema
|
|
141
|
-
*/
|
|
142
|
-
export declare const ProductBlockSchema: z.ZodObject<{
|
|
143
|
-
id: z.ZodNumber;
|
|
144
|
-
marker: z.ZodString;
|
|
145
|
-
products: z.ZodArray<z.ZodObject<{
|
|
146
|
-
id: z.ZodNumber;
|
|
147
|
-
identifier: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
148
|
-
attributeSetIdentifier: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
149
|
-
localizeInfos: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
150
|
-
statusLocalizeInfos: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
151
|
-
isVisible: z.ZodOptional<z.ZodBoolean>;
|
|
152
|
-
statusIdentifier: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
153
|
-
position: z.ZodOptional<z.ZodNumber>;
|
|
154
|
-
isPositionLocked: z.ZodOptional<z.ZodBoolean>;
|
|
155
|
-
templateIdentifier: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
156
|
-
shortDescTemplateIdentifier: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
157
|
-
price: z.ZodNullable<z.ZodNumber>;
|
|
158
|
-
additional: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
159
|
-
sku: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
160
|
-
isSync: z.ZodOptional<z.ZodBoolean>;
|
|
161
|
-
categories: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
162
|
-
attributeValues: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
163
|
-
productPages: z.ZodOptional<z.ZodArray<z.ZodAny>>;
|
|
164
|
-
blocks: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
165
|
-
moduleFormConfigs: z.ZodOptional<z.ZodArray<z.ZodAny>>;
|
|
166
|
-
currency: z.ZodOptional<z.ZodString>;
|
|
167
|
-
images: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
168
|
-
id: z.ZodNumber;
|
|
169
|
-
filename: z.ZodString;
|
|
170
|
-
url: z.ZodString;
|
|
171
|
-
size: z.ZodOptional<z.ZodNumber>;
|
|
172
|
-
type: z.ZodOptional<z.ZodString>;
|
|
173
|
-
}, z.core.$strip>>>;
|
|
174
|
-
relatedProducts: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
|
|
175
|
-
pageId: z.ZodOptional<z.ZodNumber>;
|
|
176
|
-
}, z.core.$strip>>;
|
|
177
|
-
}, z.core.$strip>;
|
|
178
|
-
/**
|
|
179
|
-
* Related products schema
|
|
180
|
-
*/
|
|
181
|
-
export declare const RelatedProductsSchema: z.ZodArray<z.ZodObject<{
|
|
182
|
-
id: z.ZodNumber;
|
|
183
|
-
identifier: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
184
|
-
attributeSetIdentifier: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
185
|
-
localizeInfos: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
186
|
-
statusLocalizeInfos: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
187
|
-
isVisible: z.ZodOptional<z.ZodBoolean>;
|
|
188
|
-
statusIdentifier: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
189
|
-
position: z.ZodOptional<z.ZodNumber>;
|
|
190
|
-
isPositionLocked: z.ZodOptional<z.ZodBoolean>;
|
|
191
|
-
templateIdentifier: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
192
|
-
shortDescTemplateIdentifier: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
193
|
-
price: z.ZodNullable<z.ZodNumber>;
|
|
194
|
-
additional: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
195
|
-
sku: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
196
|
-
isSync: z.ZodOptional<z.ZodBoolean>;
|
|
197
|
-
categories: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
198
|
-
attributeValues: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
199
|
-
productPages: z.ZodOptional<z.ZodArray<z.ZodAny>>;
|
|
200
|
-
blocks: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
201
|
-
moduleFormConfigs: z.ZodOptional<z.ZodArray<z.ZodAny>>;
|
|
202
|
-
currency: z.ZodOptional<z.ZodString>;
|
|
203
|
-
images: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
204
|
-
id: z.ZodNumber;
|
|
205
|
-
filename: z.ZodString;
|
|
206
|
-
url: z.ZodString;
|
|
207
|
-
size: z.ZodOptional<z.ZodNumber>;
|
|
208
|
-
type: z.ZodOptional<z.ZodString>;
|
|
209
|
-
}, z.core.$strip>>>;
|
|
210
|
-
relatedProducts: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
|
|
211
|
-
pageId: z.ZodOptional<z.ZodNumber>;
|
|
212
|
-
}, z.core.$strip>>;
|
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.RelatedProductsSchema = exports.ProductBlockSchema = exports.ProductsCountSchema = exports.SingleProductSchema = exports.ProductsResponseSchema = exports.ProductEntitySchema = exports.ProductImageSchema = exports.ProductPriceSchema = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* Validation schemas for Products module
|
|
6
|
-
* @description Zod schemas for validating products-related API responses
|
|
7
|
-
*/
|
|
8
|
-
const zod_1 = require("zod");
|
|
9
|
-
/**
|
|
10
|
-
* Product price schema
|
|
11
|
-
*/
|
|
12
|
-
exports.ProductPriceSchema = zod_1.z.object({
|
|
13
|
-
value: zod_1.z.number(),
|
|
14
|
-
currency: zod_1.z.string(),
|
|
15
|
-
compareValue: zod_1.z.number().optional(),
|
|
16
|
-
});
|
|
17
|
-
/**
|
|
18
|
-
* Product image schema
|
|
19
|
-
*/
|
|
20
|
-
exports.ProductImageSchema = zod_1.z.object({
|
|
21
|
-
id: zod_1.z.number(),
|
|
22
|
-
filename: zod_1.z.string(),
|
|
23
|
-
url: zod_1.z.string(),
|
|
24
|
-
size: zod_1.z.number().optional(),
|
|
25
|
-
type: zod_1.z.string().optional(),
|
|
26
|
-
});
|
|
27
|
-
/**
|
|
28
|
-
* Product entity schema
|
|
29
|
-
* Includes all fields returned by the API
|
|
30
|
-
*/
|
|
31
|
-
exports.ProductEntitySchema = zod_1.z.object({
|
|
32
|
-
id: zod_1.z.number(),
|
|
33
|
-
identifier: zod_1.z.string().optional().nullable(),
|
|
34
|
-
attributeSetIdentifier: zod_1.z.string().optional().nullable(),
|
|
35
|
-
localizeInfos: zod_1.z.record(zod_1.z.string(), zod_1.z.any()).optional(),
|
|
36
|
-
statusLocalizeInfos: zod_1.z.record(zod_1.z.string(), zod_1.z.any()).optional(),
|
|
37
|
-
isVisible: zod_1.z.boolean().optional(),
|
|
38
|
-
statusIdentifier: zod_1.z.string().optional().nullable(),
|
|
39
|
-
position: zod_1.z.number().optional(),
|
|
40
|
-
isPositionLocked: zod_1.z.boolean().optional(),
|
|
41
|
-
templateIdentifier: zod_1.z.string().optional().nullable(),
|
|
42
|
-
shortDescTemplateIdentifier: zod_1.z.string().optional().nullable(),
|
|
43
|
-
price: zod_1.z.number().nullable(),
|
|
44
|
-
additional: zod_1.z.record(zod_1.z.string(), zod_1.z.any()).optional(),
|
|
45
|
-
sku: zod_1.z.string().optional().nullable(),
|
|
46
|
-
isSync: zod_1.z.boolean().optional(),
|
|
47
|
-
categories: zod_1.z.array(zod_1.z.string()).optional(),
|
|
48
|
-
attributeValues: zod_1.z.record(zod_1.z.string(), zod_1.z.any()).optional(),
|
|
49
|
-
productPages: zod_1.z.array(zod_1.z.any()).optional(),
|
|
50
|
-
blocks: zod_1.z.array(zod_1.z.string()).optional(),
|
|
51
|
-
moduleFormConfigs: zod_1.z.array(zod_1.z.any()).optional(),
|
|
52
|
-
currency: zod_1.z.string().optional(),
|
|
53
|
-
images: zod_1.z.array(exports.ProductImageSchema).optional(),
|
|
54
|
-
relatedProducts: zod_1.z.array(zod_1.z.number()).optional(),
|
|
55
|
-
pageId: zod_1.z.number().optional(),
|
|
56
|
-
});
|
|
57
|
-
/**
|
|
58
|
-
* Products response schema
|
|
59
|
-
*/
|
|
60
|
-
exports.ProductsResponseSchema = zod_1.z.object({
|
|
61
|
-
items: zod_1.z.array(exports.ProductEntitySchema),
|
|
62
|
-
total: zod_1.z.number(),
|
|
63
|
-
});
|
|
64
|
-
/**
|
|
65
|
-
* Single product response schema
|
|
66
|
-
*/
|
|
67
|
-
exports.SingleProductSchema = exports.ProductEntitySchema;
|
|
68
|
-
/**
|
|
69
|
-
* Products count schema
|
|
70
|
-
*/
|
|
71
|
-
exports.ProductsCountSchema = zod_1.z.object({
|
|
72
|
-
total: zod_1.z.number(),
|
|
73
|
-
});
|
|
74
|
-
/**
|
|
75
|
-
* Product block schema
|
|
76
|
-
*/
|
|
77
|
-
exports.ProductBlockSchema = zod_1.z.object({
|
|
78
|
-
id: zod_1.z.number(),
|
|
79
|
-
marker: zod_1.z.string(),
|
|
80
|
-
products: zod_1.z.array(exports.ProductEntitySchema),
|
|
81
|
-
});
|
|
82
|
-
/**
|
|
83
|
-
* Related products schema
|
|
84
|
-
*/
|
|
85
|
-
exports.RelatedProductsSchema = zod_1.z.array(exports.ProductEntitySchema);
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
import AsyncModules from '../base/asyncModules';
|
|
2
|
-
import type StateModule from '../base/stateModule';
|
|
3
|
-
import type { IError } from '../base/utils';
|
|
4
|
-
import type { ISystem } from './systemInterfaces';
|
|
5
|
-
/**
|
|
6
|
-
* Controllers for working with system - system
|
|
7
|
-
* @handle /api/content/system
|
|
8
|
-
* @description Controllers for working with system - system
|
|
9
|
-
*/
|
|
10
|
-
export default class SystemApi extends AsyncModules implements ISystem {
|
|
11
|
-
protected state: StateModule;
|
|
12
|
-
protected _url: string;
|
|
13
|
-
/**
|
|
14
|
-
* Constructor
|
|
15
|
-
* @param {StateModule} state - The state module.
|
|
16
|
-
* @description Constructor initializes the SystemApi with a given state.
|
|
17
|
-
*/
|
|
18
|
-
constructor(state: StateModule);
|
|
19
|
-
/**
|
|
20
|
-
* Sends a GET request to the '/test404' endpoint and returns the result.
|
|
21
|
-
* @handleName test404
|
|
22
|
-
* @returns {Promise<any | IError>} The response from the server after fetching data from the '/test404' endpoint.
|
|
23
|
-
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
24
|
-
* @description This method is used to test the 404 error handling by sending a GET request to a specific endpoint.
|
|
25
|
-
*/
|
|
26
|
-
test404(): Promise<any | IError>;
|
|
27
|
-
/**
|
|
28
|
-
* Sends a GET request to the '/test500' endpoint and returns the result.
|
|
29
|
-
* @handleName test500
|
|
30
|
-
* @returns {Promise<any | IError>} The response from the server after fetching data from the '/test500' endpoint.
|
|
31
|
-
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
32
|
-
* @description This method is used to test the 500 error handling by sending a GET request to a specific endpoint.
|
|
33
|
-
*/
|
|
34
|
-
test500(): Promise<any | IError>;
|
|
35
|
-
/**
|
|
36
|
-
* Validates a CAPTCHA token by sending it to the server for verification.
|
|
37
|
-
* @handleName validateCaptcha
|
|
38
|
-
* @param {object} event - The event object containing CAPTCHA data.
|
|
39
|
-
* @example
|
|
40
|
-
{
|
|
41
|
-
"token": "03AGdBq24...",
|
|
42
|
-
"expectedAction": "login",
|
|
43
|
-
"siteKey": "6Lc_aCMTAAAAAB..."
|
|
44
|
-
}
|
|
45
|
-
* @param {string} event.token - The CAPTCHA token to be validated. Example: "03AGdBq24...".
|
|
46
|
-
* @param {string} event.expectedAction - The expected action associated with the CAPTCHA. Example: "login".
|
|
47
|
-
* @param {string} event.siteKey - The site key used for the CAPTCHA. Example: "6Lc_aCMTAAAAAB...".
|
|
48
|
-
* @returns {Promise<any | IError>} The response from the server after validating the CAPTCHA, or an error object if validation fails.
|
|
49
|
-
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
50
|
-
* @description This method sends the CAPTCHA token and related information to the server endpoint '/captcha/validate' to verify its validity.
|
|
51
|
-
*/
|
|
52
|
-
validateCaptcha(event: {
|
|
53
|
-
token: string;
|
|
54
|
-
expectedAction: string;
|
|
55
|
-
siteKey: string;
|
|
56
|
-
}): Promise<any | IError>;
|
|
57
|
-
/**
|
|
58
|
-
* Getting the number of requests to API.
|
|
59
|
-
* @handleName getApiStat
|
|
60
|
-
* @returns {Promise<any | IError>} Return object with date and count.
|
|
61
|
-
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
62
|
-
* @description Getting the number of requests to API.
|
|
63
|
-
*/
|
|
64
|
-
getApiStat(): Promise<any | IError>;
|
|
65
|
-
}
|
package/dist/system/systemApi.js
DELETED
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
/* eslint-disable jsdoc/reject-any-type */
|
|
7
|
-
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
8
|
-
const asyncModules_1 = __importDefault(require("../base/asyncModules"));
|
|
9
|
-
/**
|
|
10
|
-
* Controllers for working with system - system
|
|
11
|
-
* @handle /api/content/system
|
|
12
|
-
* @description Controllers for working with system - system
|
|
13
|
-
*/
|
|
14
|
-
class SystemApi extends asyncModules_1.default {
|
|
15
|
-
/**
|
|
16
|
-
* Constructor
|
|
17
|
-
* @param {StateModule} state - The state module.
|
|
18
|
-
* @description Constructor initializes the SystemApi with a given state.
|
|
19
|
-
*/
|
|
20
|
-
constructor(state) {
|
|
21
|
-
super(state);
|
|
22
|
-
this._url = state.url + '/api/content/system';
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* Sends a GET request to the '/test404' endpoint and returns the result.
|
|
26
|
-
* @handleName test404
|
|
27
|
-
* @returns {Promise<any | IError>} The response from the server after fetching data from the '/test404' endpoint.
|
|
28
|
-
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
29
|
-
* @description This method is used to test the 404 error handling by sending a GET request to a specific endpoint.
|
|
30
|
-
*/
|
|
31
|
-
async test404() {
|
|
32
|
-
const result = await this._fetchGet('/test404');
|
|
33
|
-
return result;
|
|
34
|
-
}
|
|
35
|
-
/**
|
|
36
|
-
* Sends a GET request to the '/test500' endpoint and returns the result.
|
|
37
|
-
* @handleName test500
|
|
38
|
-
* @returns {Promise<any | IError>} The response from the server after fetching data from the '/test500' endpoint.
|
|
39
|
-
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
40
|
-
* @description This method is used to test the 500 error handling by sending a GET request to a specific endpoint.
|
|
41
|
-
*/
|
|
42
|
-
async test500() {
|
|
43
|
-
const result = await this._fetchGet('/test500');
|
|
44
|
-
return result;
|
|
45
|
-
}
|
|
46
|
-
/**
|
|
47
|
-
* Validates a CAPTCHA token by sending it to the server for verification.
|
|
48
|
-
* @handleName validateCaptcha
|
|
49
|
-
* @param {object} event - The event object containing CAPTCHA data.
|
|
50
|
-
* @example
|
|
51
|
-
{
|
|
52
|
-
"token": "03AGdBq24...",
|
|
53
|
-
"expectedAction": "login",
|
|
54
|
-
"siteKey": "6Lc_aCMTAAAAAB..."
|
|
55
|
-
}
|
|
56
|
-
* @param {string} event.token - The CAPTCHA token to be validated. Example: "03AGdBq24...".
|
|
57
|
-
* @param {string} event.expectedAction - The expected action associated with the CAPTCHA. Example: "login".
|
|
58
|
-
* @param {string} event.siteKey - The site key used for the CAPTCHA. Example: "6Lc_aCMTAAAAAB...".
|
|
59
|
-
* @returns {Promise<any | IError>} The response from the server after validating the CAPTCHA, or an error object if validation fails.
|
|
60
|
-
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
61
|
-
* @description This method sends the CAPTCHA token and related information to the server endpoint '/captcha/validate' to verify its validity.
|
|
62
|
-
*/
|
|
63
|
-
async validateCaptcha(event) {
|
|
64
|
-
const data = {
|
|
65
|
-
event,
|
|
66
|
-
};
|
|
67
|
-
const result = await this._fetchPost('/captcha/validate', data);
|
|
68
|
-
return result;
|
|
69
|
-
}
|
|
70
|
-
/**
|
|
71
|
-
* Getting the number of requests to API.
|
|
72
|
-
* @handleName getApiStat
|
|
73
|
-
* @returns {Promise<any | IError>} Return object with date and count.
|
|
74
|
-
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
75
|
-
* @description Getting the number of requests to API.
|
|
76
|
-
*/
|
|
77
|
-
async getApiStat() {
|
|
78
|
-
const result = await this._fetchGet('/api-stat');
|
|
79
|
-
return result;
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
exports.default = SystemApi;
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @interface ISystem
|
|
3
|
-
* @property {Function} test404 - Test 404 error.
|
|
4
|
-
* @property {Function} test500 - Test 500 error.
|
|
5
|
-
* @description Represents a interface object of System Api.
|
|
6
|
-
*/
|
|
7
|
-
interface ISystem {
|
|
8
|
-
/**
|
|
9
|
-
* Test 404 error.
|
|
10
|
-
* @handleName test404
|
|
11
|
-
* @returns {any} Returns a Promise that resolves with any data.
|
|
12
|
-
* @description This method tests 404 error.
|
|
13
|
-
*/
|
|
14
|
-
test404(): Promise<any>;
|
|
15
|
-
/**
|
|
16
|
-
* Test 500 error.
|
|
17
|
-
* @handleName test500
|
|
18
|
-
* @returns {any} Returns a Promise that resolves with any data.
|
|
19
|
-
* @description This method tests 500 error.
|
|
20
|
-
*/
|
|
21
|
-
test500(): Promise<any>;
|
|
22
|
-
}
|
|
23
|
-
export type { ISystem };
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import AsyncModules from '../base/asyncModules';
|
|
2
|
-
import type StateModule from '../base/stateModule';
|
|
3
|
-
import type { IError, Types } from '../base/utils';
|
|
4
|
-
import type { ITemplateEntity, ITemplatesApi } from './templatesInterfaces';
|
|
5
|
-
/**
|
|
6
|
-
* Controllers for working with template objects
|
|
7
|
-
* @module TemplateController
|
|
8
|
-
* @handle /api/content/templates
|
|
9
|
-
* @description This module provides a set of controllers for handling operations related to template objects.
|
|
10
|
-
*/
|
|
11
|
-
export default class TemplatesPreviewApi extends AsyncModules implements ITemplatesApi {
|
|
12
|
-
protected state: StateModule;
|
|
13
|
-
protected _url: string;
|
|
14
|
-
/**
|
|
15
|
-
* Constructor for TemplatesApi class.
|
|
16
|
-
* @param {StateModule} state - The state module instance.
|
|
17
|
-
* @description Initializes the TemplatesApi class with the provided state module instance.
|
|
18
|
-
*/
|
|
19
|
-
constructor(state: StateModule);
|
|
20
|
-
/**
|
|
21
|
-
* Get all template objects grouped by types.
|
|
22
|
-
* @handleName getAllTemplates
|
|
23
|
-
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
24
|
-
* @returns {Promise<Record<Types, ITemplateEntity[]> | IError>} Returns an object GroupedTemplatesObject, which contains an array of template objects TemplateEntity
|
|
25
|
-
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
26
|
-
* @description This function is designed to fetch organized template objects in groups based on their types.
|
|
27
|
-
*/
|
|
28
|
-
getAllTemplates(langCode?: string): Promise<Record<Types, ITemplateEntity[]> | IError>;
|
|
29
|
-
/**
|
|
30
|
-
* Get template objects by type.
|
|
31
|
-
* @handleName getTemplateByType
|
|
32
|
-
* @param {Types} type - The type of templates to retrieve. This parameter specifies the category or classification of templates being requested. Example: "product".
|
|
33
|
-
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
34
|
-
* @returns {Promise<ITemplateEntity[] | IError>} Returns a TemplateEntity object.
|
|
35
|
-
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
36
|
-
* @description Fetch template objects that belong to a specific type, with an optional filter by language.
|
|
37
|
-
*/
|
|
38
|
-
getTemplateByType(type: Types, langCode?: string): Promise<ITemplateEntity[] | IError>;
|
|
39
|
-
/**
|
|
40
|
-
* Get one template object by marker.
|
|
41
|
-
* @handleName getTemplateByMarker
|
|
42
|
-
* @param {string} marker - The unique marker of the template to retrieve. Example: "template_12345".
|
|
43
|
-
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
44
|
-
* @returns {Promise<ITemplateEntity | IError>} Returns a TemplateEntity object
|
|
45
|
-
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
46
|
-
* @description Fetch a specific template object based on its unique marker.
|
|
47
|
-
*/
|
|
48
|
-
getTemplateByMarker(marker: string, langCode?: string): Promise<ITemplateEntity | IError>;
|
|
49
|
-
}
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
7
|
-
const asyncModules_1 = __importDefault(require("../base/asyncModules"));
|
|
8
|
-
const templatesSchemas_1 = require("./templatesSchemas");
|
|
9
|
-
/**
|
|
10
|
-
* Controllers for working with template objects
|
|
11
|
-
* @module TemplateController
|
|
12
|
-
* @handle /api/content/templates
|
|
13
|
-
* @description This module provides a set of controllers for handling operations related to template objects.
|
|
14
|
-
*/
|
|
15
|
-
class TemplatesPreviewApi extends asyncModules_1.default {
|
|
16
|
-
/**
|
|
17
|
-
* Constructor for TemplatesApi class.
|
|
18
|
-
* @param {StateModule} state - The state module instance.
|
|
19
|
-
* @description Initializes the TemplatesApi class with the provided state module instance.
|
|
20
|
-
*/
|
|
21
|
-
constructor(state) {
|
|
22
|
-
super(state);
|
|
23
|
-
this._url = state.url + '/api/content/templates';
|
|
24
|
-
}
|
|
25
|
-
/**
|
|
26
|
-
* Get all template objects grouped by types.
|
|
27
|
-
* @handleName getAllTemplates
|
|
28
|
-
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
29
|
-
* @returns {Promise<Record<Types, ITemplateEntity[]> | IError>} Returns an object GroupedTemplatesObject, which contains an array of template objects TemplateEntity
|
|
30
|
-
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
31
|
-
* @description This function is designed to fetch organized template objects in groups based on their types.
|
|
32
|
-
*/
|
|
33
|
-
async getAllTemplates(langCode = this.state.lang) {
|
|
34
|
-
const response = await this._fetchGet(`/all?langCode=${langCode}`);
|
|
35
|
-
// Validate response if validation is enabled
|
|
36
|
-
const validated = this._validateResponse(response, templatesSchemas_1.GroupedTemplatesResponseSchema);
|
|
37
|
-
const result = {};
|
|
38
|
-
// eslint-disable-next-line no-restricted-syntax
|
|
39
|
-
for (const item in validated) {
|
|
40
|
-
result[item] = this._normalizeData(validated[item], langCode);
|
|
41
|
-
}
|
|
42
|
-
return result;
|
|
43
|
-
}
|
|
44
|
-
/**
|
|
45
|
-
* Get template objects by type.
|
|
46
|
-
* @handleName getTemplateByType
|
|
47
|
-
* @param {Types} type - The type of templates to retrieve. This parameter specifies the category or classification of templates being requested. Example: "product".
|
|
48
|
-
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
49
|
-
* @returns {Promise<ITemplateEntity[] | IError>} Returns a TemplateEntity object.
|
|
50
|
-
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
51
|
-
* @description Fetch template objects that belong to a specific type, with an optional filter by language.
|
|
52
|
-
*/
|
|
53
|
-
async getTemplateByType(type, langCode = this.state.lang) {
|
|
54
|
-
const result = await this._fetchGet(`?type=${type}&langCode=${langCode}`);
|
|
55
|
-
// Validate response if validation is enabled
|
|
56
|
-
const validated = this._validateResponse(result, templatesSchemas_1.TemplatesResponseSchema);
|
|
57
|
-
return this._normalizeData(validated);
|
|
58
|
-
}
|
|
59
|
-
/**
|
|
60
|
-
* Get one template object by marker.
|
|
61
|
-
* @handleName getTemplateByMarker
|
|
62
|
-
* @param {string} marker - The unique marker of the template to retrieve. Example: "template_12345".
|
|
63
|
-
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
64
|
-
* @returns {Promise<ITemplateEntity | IError>} Returns a TemplateEntity object
|
|
65
|
-
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
66
|
-
* @description Fetch a specific template object based on its unique marker.
|
|
67
|
-
*/
|
|
68
|
-
async getTemplateByMarker(marker, langCode = this.state.lang) {
|
|
69
|
-
const result = await this._fetchGet(`/marker/${marker}?langCode=${langCode}`);
|
|
70
|
-
// Validate response if validation is enabled
|
|
71
|
-
const validated = this._validateResponse(result, templatesSchemas_1.TemplateEntitySchema);
|
|
72
|
-
return this._normalizeData(validated);
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
exports.default = TemplatesPreviewApi;
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
import type { AttributeType, IError, Types } from '../base/utils';
|
|
2
|
-
/**
|
|
3
|
-
* @interface ITemplatesApi
|
|
4
|
-
* @property {Function} getAllTemplates - Get all template objects grouped by types.
|
|
5
|
-
* @property {Function} getTemplateByType - Get template objects by type.
|
|
6
|
-
* @property {Function} getTemplateByMarker - Getting a single template object.
|
|
7
|
-
* @description This interface defines methods for retrieving templates in the system, including fetching all templates, specific templates by type or ID, and by marker.
|
|
8
|
-
*/
|
|
9
|
-
interface ITemplatesApi {
|
|
10
|
-
/**
|
|
11
|
-
* Get all template objects grouped by types.
|
|
12
|
-
* @handleName getAllTemplates
|
|
13
|
-
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
14
|
-
* @returns {Record<Types, ITemplateEntity[]>} Returns an object GroupedTemplatesObject, which contains an array of template objects TemplateEntity
|
|
15
|
-
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
16
|
-
* @description This method gets all template objects grouped by types.
|
|
17
|
-
*/
|
|
18
|
-
getAllTemplates(langCode?: string): Promise<Record<Types, ITemplateEntity[]> | IError>;
|
|
19
|
-
/**
|
|
20
|
-
* Get template objects by type.
|
|
21
|
-
* @handleName getTemplateByType
|
|
22
|
-
* @param {Types} type - The type of templates to retrieve. This parameter specifies the category or classification of templates being requested. Example: "product".
|
|
23
|
-
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
24
|
-
* @returns {ITemplateEntity[]} Returns a TemplateEntity object.
|
|
25
|
-
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
26
|
-
* @description This method gets template objects by type.
|
|
27
|
-
*/
|
|
28
|
-
getTemplateByType(type: Types, langCode: string): Promise<ITemplateEntity[] | IError>;
|
|
29
|
-
/**
|
|
30
|
-
* Get one template object by id.
|
|
31
|
-
* @handleName getTemplateByMarker
|
|
32
|
-
* @param {string} marker - The unique marker of the template to retrieve. Example: "template_12345".
|
|
33
|
-
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
34
|
-
* @returns {ITemplateEntity} Returns a TemplateEntity object
|
|
35
|
-
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
36
|
-
* @description This method gets one template object by id.
|
|
37
|
-
*/
|
|
38
|
-
getTemplateByMarker(marker: string, langCode?: string): Promise<ITemplateEntity | IError>;
|
|
39
|
-
}
|
|
40
|
-
/**
|
|
41
|
-
* The template entity interface
|
|
42
|
-
* @interface ITemplateEntity
|
|
43
|
-
* @property {number} id - The unique identifier of the position. Example: 12345.
|
|
44
|
-
* @property {string | null} attributeSetIdentifier - Set of attributes id. Example: "attribute_set_1".
|
|
45
|
-
* @property {string} title - The name of the template. Example: "Product Template".
|
|
46
|
-
* @property {number} generalTypeId - General type Entity id. Example: 67890.
|
|
47
|
-
* @property {string} identifier - The textual identifier for the record field. Example: "template_12345".
|
|
48
|
-
* @property {number} version - The version number of the object. Example: 1.
|
|
49
|
-
* @property {Types} generalTypeName - General type name. Example: "product".
|
|
50
|
-
* @property {AttributeType} attributeValues - Attribute values from the index (represented as a pair of user attribute id: attribute value).
|
|
51
|
-
* @example
|
|
52
|
-
{
|
|
53
|
-
"id": 1,
|
|
54
|
-
"value": "some"
|
|
55
|
-
}
|
|
56
|
-
* @property {number} position - The position of the object. Example: 1.
|
|
57
|
-
* @description This interface defines the structure of a template entity, including its identifiers, attributes, and general type information.
|
|
58
|
-
*/
|
|
59
|
-
interface ITemplateEntity {
|
|
60
|
-
id: number;
|
|
61
|
-
attributeSetIdentifier: string | null;
|
|
62
|
-
title: string;
|
|
63
|
-
generalTypeId: number;
|
|
64
|
-
identifier: string;
|
|
65
|
-
version: number;
|
|
66
|
-
generalTypeName: Types;
|
|
67
|
-
attributeValues: AttributeType;
|
|
68
|
-
position: number;
|
|
69
|
-
}
|
|
70
|
-
export type { ITemplateEntity, ITemplatesApi };
|