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 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,234 @@
|
|
|
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
|
+
localizeInfos: z.ZodRecord<z.ZodString, z.ZodAny>;
|
|
31
|
+
statusIdentifier: z.ZodNullable<z.ZodString>;
|
|
32
|
+
statusLocalizeInfos: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
33
|
+
attributeSetIdentifier: z.ZodNullable<z.ZodString>;
|
|
34
|
+
position: z.ZodNumber;
|
|
35
|
+
price: z.ZodNullable<z.ZodNumber>;
|
|
36
|
+
additional: z.ZodObject<{
|
|
37
|
+
prices: z.ZodObject<{
|
|
38
|
+
min: z.ZodNumber;
|
|
39
|
+
max: z.ZodNumber;
|
|
40
|
+
}, z.core.$strip>;
|
|
41
|
+
}, z.core.$strip>;
|
|
42
|
+
sku: z.ZodNullable<z.ZodString>;
|
|
43
|
+
isSync: z.ZodBoolean;
|
|
44
|
+
attributeValues: z.ZodRecord<z.ZodString, z.ZodAny>;
|
|
45
|
+
categories: z.ZodArray<z.ZodString>;
|
|
46
|
+
isVisible: z.ZodBoolean;
|
|
47
|
+
moduleFormConfigs: z.ZodOptional<z.ZodArray<z.ZodAny>>;
|
|
48
|
+
rating: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
49
|
+
templateIdentifier: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
50
|
+
shortDescTemplateIdentifier: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
51
|
+
signedPrice: z.ZodOptional<z.ZodString>;
|
|
52
|
+
productPages: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
53
|
+
id: z.ZodNumber;
|
|
54
|
+
pageId: z.ZodNumber;
|
|
55
|
+
productId: z.ZodNumber;
|
|
56
|
+
positionId: z.ZodNumber;
|
|
57
|
+
categoryPath: z.ZodString;
|
|
58
|
+
}, z.core.$strip>>>;
|
|
59
|
+
blocks: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
60
|
+
isPositionLocked: z.ZodOptional<z.ZodBoolean>;
|
|
61
|
+
relatedIds: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
|
|
62
|
+
paymentStages: z.ZodNullable<z.ZodOptional<z.ZodAny>>;
|
|
63
|
+
distance: z.ZodOptional<z.ZodNumber>;
|
|
64
|
+
discountConfig: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
65
|
+
}, z.core.$strip>;
|
|
66
|
+
/**
|
|
67
|
+
* Products response schema
|
|
68
|
+
*/
|
|
69
|
+
export declare const ProductsResponseSchema: z.ZodObject<{
|
|
70
|
+
items: z.ZodArray<z.ZodObject<{
|
|
71
|
+
id: z.ZodNumber;
|
|
72
|
+
localizeInfos: z.ZodRecord<z.ZodString, z.ZodAny>;
|
|
73
|
+
statusIdentifier: z.ZodNullable<z.ZodString>;
|
|
74
|
+
statusLocalizeInfos: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
75
|
+
attributeSetIdentifier: z.ZodNullable<z.ZodString>;
|
|
76
|
+
position: z.ZodNumber;
|
|
77
|
+
price: z.ZodNullable<z.ZodNumber>;
|
|
78
|
+
additional: z.ZodObject<{
|
|
79
|
+
prices: z.ZodObject<{
|
|
80
|
+
min: z.ZodNumber;
|
|
81
|
+
max: z.ZodNumber;
|
|
82
|
+
}, z.core.$strip>;
|
|
83
|
+
}, z.core.$strip>;
|
|
84
|
+
sku: z.ZodNullable<z.ZodString>;
|
|
85
|
+
isSync: z.ZodBoolean;
|
|
86
|
+
attributeValues: z.ZodRecord<z.ZodString, z.ZodAny>;
|
|
87
|
+
categories: z.ZodArray<z.ZodString>;
|
|
88
|
+
isVisible: z.ZodBoolean;
|
|
89
|
+
moduleFormConfigs: z.ZodOptional<z.ZodArray<z.ZodAny>>;
|
|
90
|
+
rating: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
91
|
+
templateIdentifier: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
92
|
+
shortDescTemplateIdentifier: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
93
|
+
signedPrice: z.ZodOptional<z.ZodString>;
|
|
94
|
+
productPages: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
95
|
+
id: z.ZodNumber;
|
|
96
|
+
pageId: z.ZodNumber;
|
|
97
|
+
productId: z.ZodNumber;
|
|
98
|
+
positionId: z.ZodNumber;
|
|
99
|
+
categoryPath: z.ZodString;
|
|
100
|
+
}, z.core.$strip>>>;
|
|
101
|
+
blocks: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
102
|
+
isPositionLocked: z.ZodOptional<z.ZodBoolean>;
|
|
103
|
+
relatedIds: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
|
|
104
|
+
paymentStages: z.ZodNullable<z.ZodOptional<z.ZodAny>>;
|
|
105
|
+
distance: z.ZodOptional<z.ZodNumber>;
|
|
106
|
+
discountConfig: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
107
|
+
}, z.core.$strip>>;
|
|
108
|
+
total: z.ZodNumber;
|
|
109
|
+
totalFound: z.ZodOptional<z.ZodNumber>;
|
|
110
|
+
}, z.core.$strip>;
|
|
111
|
+
/**
|
|
112
|
+
* Single product response schema
|
|
113
|
+
*/
|
|
114
|
+
export declare const SingleProductSchema: z.ZodObject<{
|
|
115
|
+
id: z.ZodNumber;
|
|
116
|
+
localizeInfos: z.ZodRecord<z.ZodString, z.ZodAny>;
|
|
117
|
+
statusIdentifier: z.ZodNullable<z.ZodString>;
|
|
118
|
+
statusLocalizeInfos: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
119
|
+
attributeSetIdentifier: z.ZodNullable<z.ZodString>;
|
|
120
|
+
position: z.ZodNumber;
|
|
121
|
+
price: z.ZodNullable<z.ZodNumber>;
|
|
122
|
+
additional: z.ZodObject<{
|
|
123
|
+
prices: z.ZodObject<{
|
|
124
|
+
min: z.ZodNumber;
|
|
125
|
+
max: z.ZodNumber;
|
|
126
|
+
}, z.core.$strip>;
|
|
127
|
+
}, z.core.$strip>;
|
|
128
|
+
sku: z.ZodNullable<z.ZodString>;
|
|
129
|
+
isSync: z.ZodBoolean;
|
|
130
|
+
attributeValues: z.ZodRecord<z.ZodString, z.ZodAny>;
|
|
131
|
+
categories: z.ZodArray<z.ZodString>;
|
|
132
|
+
isVisible: z.ZodBoolean;
|
|
133
|
+
moduleFormConfigs: z.ZodOptional<z.ZodArray<z.ZodAny>>;
|
|
134
|
+
rating: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
135
|
+
templateIdentifier: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
136
|
+
shortDescTemplateIdentifier: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
137
|
+
signedPrice: z.ZodOptional<z.ZodString>;
|
|
138
|
+
productPages: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
139
|
+
id: z.ZodNumber;
|
|
140
|
+
pageId: z.ZodNumber;
|
|
141
|
+
productId: z.ZodNumber;
|
|
142
|
+
positionId: z.ZodNumber;
|
|
143
|
+
categoryPath: z.ZodString;
|
|
144
|
+
}, z.core.$strip>>>;
|
|
145
|
+
blocks: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
146
|
+
isPositionLocked: z.ZodOptional<z.ZodBoolean>;
|
|
147
|
+
relatedIds: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
|
|
148
|
+
paymentStages: z.ZodNullable<z.ZodOptional<z.ZodAny>>;
|
|
149
|
+
distance: z.ZodOptional<z.ZodNumber>;
|
|
150
|
+
discountConfig: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
151
|
+
}, z.core.$strip>;
|
|
152
|
+
/**
|
|
153
|
+
* Product search result schema
|
|
154
|
+
* Short card returned by the quick search endpoint
|
|
155
|
+
*/
|
|
156
|
+
export declare const ProductSearchResultSchema: z.ZodObject<{
|
|
157
|
+
id: z.ZodNumber;
|
|
158
|
+
title: z.ZodString;
|
|
159
|
+
pageId: z.ZodNumber;
|
|
160
|
+
}, z.core.$strip>;
|
|
161
|
+
/**
|
|
162
|
+
* Product search response schema (array of short cards)
|
|
163
|
+
*/
|
|
164
|
+
export declare const ProductSearchResponseSchema: z.ZodArray<z.ZodObject<{
|
|
165
|
+
id: z.ZodNumber;
|
|
166
|
+
title: z.ZodString;
|
|
167
|
+
pageId: z.ZodNumber;
|
|
168
|
+
}, z.core.$strip>>;
|
|
169
|
+
/**
|
|
170
|
+
* Products count schema
|
|
171
|
+
*/
|
|
172
|
+
export declare const ProductsCountSchema: z.ZodObject<{
|
|
173
|
+
totalAll: z.ZodNumber;
|
|
174
|
+
totalInCategory: z.ZodNumber;
|
|
175
|
+
totalInCategoryWithNested: z.ZodNumber;
|
|
176
|
+
}, z.core.$strip>;
|
|
177
|
+
/**
|
|
178
|
+
* Product block schema
|
|
179
|
+
*/
|
|
180
|
+
export declare const ProductBlockSchema: z.ZodObject<{
|
|
181
|
+
id: z.ZodNumber;
|
|
182
|
+
attributeSetIdentifier: z.ZodNullable<z.ZodString>;
|
|
183
|
+
localizeInfos: z.ZodRecord<z.ZodString, z.ZodAny>;
|
|
184
|
+
version: z.ZodNumber;
|
|
185
|
+
position: z.ZodNumber;
|
|
186
|
+
identifier: z.ZodString;
|
|
187
|
+
type: z.ZodString;
|
|
188
|
+
customSettings: z.ZodRecord<z.ZodString, z.ZodAny>;
|
|
189
|
+
templateIdentifier: z.ZodNullable<z.ZodString>;
|
|
190
|
+
isVisible: z.ZodBoolean;
|
|
191
|
+
isSync: z.ZodBoolean;
|
|
192
|
+
attributeValues: z.ZodRecord<z.ZodString, z.ZodAny>;
|
|
193
|
+
}, z.core.$strip>;
|
|
194
|
+
/**
|
|
195
|
+
* Related products schema
|
|
196
|
+
*/
|
|
197
|
+
export declare const RelatedProductsSchema: z.ZodArray<z.ZodObject<{
|
|
198
|
+
id: z.ZodNumber;
|
|
199
|
+
localizeInfos: z.ZodRecord<z.ZodString, z.ZodAny>;
|
|
200
|
+
statusIdentifier: z.ZodNullable<z.ZodString>;
|
|
201
|
+
statusLocalizeInfos: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
202
|
+
attributeSetIdentifier: z.ZodNullable<z.ZodString>;
|
|
203
|
+
position: z.ZodNumber;
|
|
204
|
+
price: z.ZodNullable<z.ZodNumber>;
|
|
205
|
+
additional: z.ZodObject<{
|
|
206
|
+
prices: z.ZodObject<{
|
|
207
|
+
min: z.ZodNumber;
|
|
208
|
+
max: z.ZodNumber;
|
|
209
|
+
}, z.core.$strip>;
|
|
210
|
+
}, z.core.$strip>;
|
|
211
|
+
sku: z.ZodNullable<z.ZodString>;
|
|
212
|
+
isSync: z.ZodBoolean;
|
|
213
|
+
attributeValues: z.ZodRecord<z.ZodString, z.ZodAny>;
|
|
214
|
+
categories: z.ZodArray<z.ZodString>;
|
|
215
|
+
isVisible: z.ZodBoolean;
|
|
216
|
+
moduleFormConfigs: z.ZodOptional<z.ZodArray<z.ZodAny>>;
|
|
217
|
+
rating: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
218
|
+
templateIdentifier: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
219
|
+
shortDescTemplateIdentifier: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
220
|
+
signedPrice: z.ZodOptional<z.ZodString>;
|
|
221
|
+
productPages: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
222
|
+
id: z.ZodNumber;
|
|
223
|
+
pageId: z.ZodNumber;
|
|
224
|
+
productId: z.ZodNumber;
|
|
225
|
+
positionId: z.ZodNumber;
|
|
226
|
+
categoryPath: z.ZodString;
|
|
227
|
+
}, z.core.$strip>>>;
|
|
228
|
+
blocks: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
229
|
+
isPositionLocked: z.ZodOptional<z.ZodBoolean>;
|
|
230
|
+
relatedIds: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
|
|
231
|
+
paymentStages: z.ZodNullable<z.ZodOptional<z.ZodAny>>;
|
|
232
|
+
distance: z.ZodOptional<z.ZodNumber>;
|
|
233
|
+
discountConfig: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
234
|
+
}, z.core.$strip>>;
|
|
@@ -0,0 +1,121 @@
|
|
|
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 const ProductPriceSchema = z.object({
|
|
10
|
+
value: z.number(),
|
|
11
|
+
currency: z.string(),
|
|
12
|
+
compareValue: z.number().optional(),
|
|
13
|
+
});
|
|
14
|
+
/**
|
|
15
|
+
* Product image schema
|
|
16
|
+
*/
|
|
17
|
+
export const ProductImageSchema = z.object({
|
|
18
|
+
id: z.number(),
|
|
19
|
+
filename: z.string(),
|
|
20
|
+
url: z.string(),
|
|
21
|
+
size: z.number().optional(),
|
|
22
|
+
type: z.string().optional(),
|
|
23
|
+
});
|
|
24
|
+
/**
|
|
25
|
+
* Product entity schema
|
|
26
|
+
* Includes all fields returned by the API
|
|
27
|
+
*/
|
|
28
|
+
export const ProductEntitySchema = z.object({
|
|
29
|
+
id: z.number(),
|
|
30
|
+
localizeInfos: z.record(z.string(), z.any()),
|
|
31
|
+
statusIdentifier: z.string().nullable(),
|
|
32
|
+
statusLocalizeInfos: z.record(z.string(), z.unknown()),
|
|
33
|
+
attributeSetIdentifier: z.string().nullable(),
|
|
34
|
+
position: z.number(),
|
|
35
|
+
price: z.number().nullable(),
|
|
36
|
+
additional: z.object({
|
|
37
|
+
prices: z.object({
|
|
38
|
+
min: z.number(),
|
|
39
|
+
max: z.number(),
|
|
40
|
+
}),
|
|
41
|
+
}),
|
|
42
|
+
sku: z.string().nullable(),
|
|
43
|
+
isSync: z.boolean(),
|
|
44
|
+
attributeValues: z.record(z.string(), z.any()),
|
|
45
|
+
categories: z.array(z.string()),
|
|
46
|
+
isVisible: z.boolean(),
|
|
47
|
+
moduleFormConfigs: z.array(z.any()).optional(),
|
|
48
|
+
rating: z.record(z.string(), z.unknown()).optional(),
|
|
49
|
+
templateIdentifier: z.string().optional().nullable(),
|
|
50
|
+
shortDescTemplateIdentifier: z.string().optional().nullable(),
|
|
51
|
+
signedPrice: z.string().optional(),
|
|
52
|
+
productPages: z
|
|
53
|
+
.array(z.object({
|
|
54
|
+
id: z.number(),
|
|
55
|
+
pageId: z.number(),
|
|
56
|
+
productId: z.number(),
|
|
57
|
+
positionId: z.number(),
|
|
58
|
+
categoryPath: z.string(),
|
|
59
|
+
}))
|
|
60
|
+
.optional(),
|
|
61
|
+
blocks: z.array(z.string()).optional(),
|
|
62
|
+
isPositionLocked: z.boolean().optional(),
|
|
63
|
+
relatedIds: z.array(z.number()).optional(),
|
|
64
|
+
paymentStages: z.any().optional().nullable(),
|
|
65
|
+
distance: z.number().optional(),
|
|
66
|
+
discountConfig: z.record(z.string(), z.any()).optional(),
|
|
67
|
+
});
|
|
68
|
+
/**
|
|
69
|
+
* Products response schema
|
|
70
|
+
*/
|
|
71
|
+
export const ProductsResponseSchema = z.object({
|
|
72
|
+
items: z.array(ProductEntitySchema),
|
|
73
|
+
total: z.number(),
|
|
74
|
+
totalFound: z.number().optional(),
|
|
75
|
+
});
|
|
76
|
+
/**
|
|
77
|
+
* Single product response schema
|
|
78
|
+
*/
|
|
79
|
+
export const SingleProductSchema = ProductEntitySchema;
|
|
80
|
+
/**
|
|
81
|
+
* Product search result schema
|
|
82
|
+
* Short card returned by the quick search endpoint
|
|
83
|
+
*/
|
|
84
|
+
export const ProductSearchResultSchema = z.object({
|
|
85
|
+
id: z.number(),
|
|
86
|
+
title: z.string(),
|
|
87
|
+
pageId: z.number(),
|
|
88
|
+
});
|
|
89
|
+
/**
|
|
90
|
+
* Product search response schema (array of short cards)
|
|
91
|
+
*/
|
|
92
|
+
export const ProductSearchResponseSchema = z.array(ProductSearchResultSchema);
|
|
93
|
+
/**
|
|
94
|
+
* Products count schema
|
|
95
|
+
*/
|
|
96
|
+
export const ProductsCountSchema = z.object({
|
|
97
|
+
totalAll: z.number(),
|
|
98
|
+
totalInCategory: z.number(),
|
|
99
|
+
totalInCategoryWithNested: z.number(),
|
|
100
|
+
});
|
|
101
|
+
/**
|
|
102
|
+
* Product block schema
|
|
103
|
+
*/
|
|
104
|
+
export const ProductBlockSchema = z.object({
|
|
105
|
+
id: z.number(),
|
|
106
|
+
attributeSetIdentifier: z.string().nullable(),
|
|
107
|
+
localizeInfos: z.record(z.string(), z.any()),
|
|
108
|
+
version: z.number(),
|
|
109
|
+
position: z.number(),
|
|
110
|
+
identifier: z.string(),
|
|
111
|
+
type: z.string(),
|
|
112
|
+
customSettings: z.record(z.string(), z.any()),
|
|
113
|
+
templateIdentifier: z.string().nullable(),
|
|
114
|
+
isVisible: z.boolean(),
|
|
115
|
+
isSync: z.boolean(),
|
|
116
|
+
attributeValues: z.record(z.string(), z.any()),
|
|
117
|
+
});
|
|
118
|
+
/**
|
|
119
|
+
* Related products schema
|
|
120
|
+
*/
|
|
121
|
+
export const RelatedProductsSchema = z.array(ProductEntitySchema);
|
|
@@ -0,0 +1,35 @@
|
|
|
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 { IGlobalSearchResponse, ISearchApi, TGlobalSearchEntityType } from './searchInterfaces.js';
|
|
5
|
+
/**
|
|
6
|
+
* Controllers for the public cross-entity search.
|
|
7
|
+
* @handle /api/content/search
|
|
8
|
+
* @class SearchApi
|
|
9
|
+
* @augments AsyncModules
|
|
10
|
+
* @implements {ISearchApi}
|
|
11
|
+
* @description This class provides a public search over names and attribute values of visible records.
|
|
12
|
+
*/
|
|
13
|
+
export default class SearchApi extends AsyncModules implements ISearchApi {
|
|
14
|
+
protected state: StateModule;
|
|
15
|
+
protected _url: string;
|
|
16
|
+
/**
|
|
17
|
+
* Constructor for SearchApi class.
|
|
18
|
+
* @param {StateModule} state - The state module.
|
|
19
|
+
*/
|
|
20
|
+
constructor(state: StateModule);
|
|
21
|
+
/**
|
|
22
|
+
* Public search across titles and attribute values of visible records.
|
|
23
|
+
* @handleName globalSearch
|
|
24
|
+
* @param {string} query - Search query. Example: "winter".
|
|
25
|
+
* @param {TGlobalSearchEntityType[]} [types] - Entity types to search in, sent comma-separated. Searches every type when omitted.
|
|
26
|
+
* @param {'all' | 'visible' | 'hidden'} [visibility] - Visibility filter of the searched records. Default: "all".
|
|
27
|
+
* @param {number} [offset] - Drilldown mode offset. Pass it only together with a single accessible type in `types`.
|
|
28
|
+
* @param {number} [limit] - Drilldown mode page size. Pass it only together with a single accessible type in `types`, otherwise the API answers 400 "Drilldown mode (limit/offset) requires exactly one accessible type in `types`". Without it every group is returned in full.
|
|
29
|
+
* @returns {Promise<IGlobalSearchResponse | IError>} Returns the query and the found records grouped by entity type.
|
|
30
|
+
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
31
|
+
* @description Searches names and attribute values of visible records across entity types.
|
|
32
|
+
* @see {@link https://js-sdk.oneentry.cloud/docs/search/globalSearch globalSearch} documentation.
|
|
33
|
+
*/
|
|
34
|
+
globalSearch(query: string, types?: TGlobalSearchEntityType[], visibility?: 'all' | 'visible' | 'hidden', offset?: number, limit?: number): Promise<IGlobalSearchResponse | IError>;
|
|
35
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import AsyncModules from '../base/asyncModules.js';
|
|
2
|
+
import createSchemaLoader from '../base/lazySchema.js';
|
|
3
|
+
const schema = createSchemaLoader(() => import('./searchSchemas.js'));
|
|
4
|
+
/**
|
|
5
|
+
* Controllers for the public cross-entity search.
|
|
6
|
+
* @handle /api/content/search
|
|
7
|
+
* @class SearchApi
|
|
8
|
+
* @augments AsyncModules
|
|
9
|
+
* @implements {ISearchApi}
|
|
10
|
+
* @description This class provides a public search over names and attribute values of visible records.
|
|
11
|
+
*/
|
|
12
|
+
export default class SearchApi extends AsyncModules {
|
|
13
|
+
/**
|
|
14
|
+
* Constructor for SearchApi class.
|
|
15
|
+
* @param {StateModule} state - The state module.
|
|
16
|
+
*/
|
|
17
|
+
constructor(state) {
|
|
18
|
+
super(state);
|
|
19
|
+
this._url = state.url + '/api/content/search';
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Public search across titles and attribute values of visible records.
|
|
23
|
+
* @handleName globalSearch
|
|
24
|
+
* @param {string} query - Search query. Example: "winter".
|
|
25
|
+
* @param {TGlobalSearchEntityType[]} [types] - Entity types to search in, sent comma-separated. Searches every type when omitted.
|
|
26
|
+
* @param {'all' | 'visible' | 'hidden'} [visibility] - Visibility filter of the searched records. Default: "all".
|
|
27
|
+
* @param {number} [offset] - Drilldown mode offset. Pass it only together with a single accessible type in `types`.
|
|
28
|
+
* @param {number} [limit] - Drilldown mode page size. Pass it only together with a single accessible type in `types`, otherwise the API answers 400 "Drilldown mode (limit/offset) requires exactly one accessible type in `types`". Without it every group is returned in full.
|
|
29
|
+
* @returns {Promise<IGlobalSearchResponse | IError>} Returns the query and the found records grouped by entity type.
|
|
30
|
+
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
31
|
+
* @description Searches names and attribute values of visible records across entity types.
|
|
32
|
+
* @see {@link https://js-sdk.oneentry.cloud/docs/search/globalSearch globalSearch} documentation.
|
|
33
|
+
*/
|
|
34
|
+
async globalSearch(query, types, visibility, offset, limit) {
|
|
35
|
+
// `types` is sent comma-separated — the array stringifies to exactly that.
|
|
36
|
+
const params = {
|
|
37
|
+
q: query,
|
|
38
|
+
types,
|
|
39
|
+
visibility,
|
|
40
|
+
offset,
|
|
41
|
+
limit,
|
|
42
|
+
};
|
|
43
|
+
const data = await this._fetchGet(`?` + this._queryParamsToString(params));
|
|
44
|
+
const validated = await this._validateResponse(data, schema('GlobalSearchResponseSchema'));
|
|
45
|
+
return this._normalizeData(validated);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import type { IError } from '../base/utils.js';
|
|
2
|
+
/**
|
|
3
|
+
* Interface for the Search API module.
|
|
4
|
+
* @interface ISearchApi
|
|
5
|
+
* @description This interface defines methods for the public cross-entity search.
|
|
6
|
+
*/
|
|
7
|
+
interface ISearchApi {
|
|
8
|
+
/**
|
|
9
|
+
* Public search across titles and attribute values of visible records.
|
|
10
|
+
* @handleName globalSearch
|
|
11
|
+
* @param {string} query - Search query. Example: "winter".
|
|
12
|
+
* @param {TGlobalSearchEntityType[]} [types] - Entity types to search in, sent comma-separated. Searches every type when omitted.
|
|
13
|
+
* @param {'all' | 'visible' | 'hidden'} [visibility] - Visibility filter of the searched records. Default: "all".
|
|
14
|
+
* @param {number} [offset] - Drilldown mode offset. Pass it only together with a single accessible type in `types`.
|
|
15
|
+
* @param {number} [limit] - Drilldown mode page size. Pass it only together with a single accessible type in `types`, otherwise the API answers 400 "Drilldown mode (limit/offset) requires exactly one accessible type in `types`". Without it every group is returned in full.
|
|
16
|
+
* @returns {Promise<IGlobalSearchResponse | IError>} Returns the query and the found records grouped by entity type.
|
|
17
|
+
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
18
|
+
* @description Searches names and attribute values of visible records across entity types.
|
|
19
|
+
*/
|
|
20
|
+
globalSearch(query: string, types?: TGlobalSearchEntityType[], visibility?: 'all' | 'visible' | 'hidden', offset?: number, limit?: number): Promise<IGlobalSearchResponse | IError>;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Entity type a global search group or item belongs to.
|
|
24
|
+
* @description Entity type a global search group or item belongs to.
|
|
25
|
+
*/
|
|
26
|
+
type TGlobalSearchEntityType = 'products' | 'pages' | 'blocks' | 'slides' | 'templates' | 'discounts' | 'user_groups' | 'users' | 'admins' | 'menus' | 'forms' | 'attributes_sets' | 'attributes' | 'orders' | 'workflows' | 'events' | 'subscriptions' | 'collections';
|
|
27
|
+
/**
|
|
28
|
+
* How a global search item matched the query.
|
|
29
|
+
* @description Ranking kind of the match: exact value, title, attribute name or attribute value.
|
|
30
|
+
*/
|
|
31
|
+
type TGlobalSearchMatchKind = 'exact' | 'title' | 'attributeName' | 'attributeValue';
|
|
32
|
+
/**
|
|
33
|
+
* Concrete field a global search item matched on.
|
|
34
|
+
* @description Field that produced the match; independent from the matchKind ranking.
|
|
35
|
+
*/
|
|
36
|
+
type TGlobalSearchMatchedField = 'id' | 'title' | 'identifier' | 'url' | 'attributeName' | 'attributeValue' | 'importId' | 'nodeName';
|
|
37
|
+
/**
|
|
38
|
+
* A single record found by the global search.
|
|
39
|
+
* @interface IGlobalSearchItem
|
|
40
|
+
* @property {TGlobalSearchEntityType} type - Entity type of the found record. Example: "products".
|
|
41
|
+
* @property {number | string} id - Entity id; a string for workflows and attributes. Example: 12345.
|
|
42
|
+
* @property {string} [title] - Display title; absent when the record has no own name (orders, users without login). Example: "Winter jacket".
|
|
43
|
+
* @property {string} [identifier] - Machine identifier (marker) of the record. Example: "winter_jacket".
|
|
44
|
+
* @property {string} [subtitle] - Secondary line (url, storage, node). Example: "catalog/winter".
|
|
45
|
+
* @property {TGlobalSearchMatchKind} matchKind - How the record matched the query. Example: "title".
|
|
46
|
+
* @property {TGlobalSearchMatchedField} matchedField - Concrete field that matched the query. Example: "title".
|
|
47
|
+
* @property {Record<string, unknown>} [matchedAttribute] - Attribute the match occurred in.
|
|
48
|
+
* @property {string} [fragment] - Plain-text context around the match, no markup. Example: "warm winter jacket".
|
|
49
|
+
* @property {string} [langCode] - Language code of the matched value. Example: "en_US".
|
|
50
|
+
* @property {boolean} [isVisible] - Visibility of the found record. Example: true.
|
|
51
|
+
* @property {Record<string, unknown>} [parent] - Owning record for entities without their own page (slides to block, orders to storage).
|
|
52
|
+
* @property {number} [attributeSetId] - Owning attribute set id; only for type=attributes. Example: 12.
|
|
53
|
+
* @description A single record found by the global search, with the context of how it matched.
|
|
54
|
+
*/
|
|
55
|
+
interface IGlobalSearchItem {
|
|
56
|
+
type: TGlobalSearchEntityType;
|
|
57
|
+
id: number | string;
|
|
58
|
+
title?: string;
|
|
59
|
+
identifier?: string;
|
|
60
|
+
subtitle?: string;
|
|
61
|
+
matchKind: TGlobalSearchMatchKind;
|
|
62
|
+
matchedField: TGlobalSearchMatchedField;
|
|
63
|
+
matchedAttribute?: Record<string, unknown>;
|
|
64
|
+
fragment?: string;
|
|
65
|
+
langCode?: string;
|
|
66
|
+
isVisible?: boolean;
|
|
67
|
+
parent?: Record<string, unknown>;
|
|
68
|
+
attributeSetId?: number;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Global search results of a single entity type.
|
|
72
|
+
* @interface IGlobalSearchGroup
|
|
73
|
+
* @property {TGlobalSearchEntityType} type - Entity type of the group. Example: "products".
|
|
74
|
+
* @property {IGlobalSearchItem[]} items - Records found within this entity type.
|
|
75
|
+
* @property {boolean} hasMore - Whether more records of this type are available beyond the requested page. Example: false.
|
|
76
|
+
* @description Global search results of a single entity type.
|
|
77
|
+
*/
|
|
78
|
+
interface IGlobalSearchGroup {
|
|
79
|
+
type: TGlobalSearchEntityType;
|
|
80
|
+
items: IGlobalSearchItem[];
|
|
81
|
+
hasMore: boolean;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Response of the global search endpoint.
|
|
85
|
+
* @interface IGlobalSearchResponse
|
|
86
|
+
* @property {string} query - The query the results were produced for. Example: "winter".
|
|
87
|
+
* @property {IGlobalSearchGroup[]} groups - Found records grouped by entity type.
|
|
88
|
+
* @description Response of the global search endpoint: the query and the found records grouped by entity type.
|
|
89
|
+
*/
|
|
90
|
+
interface IGlobalSearchResponse {
|
|
91
|
+
query: string;
|
|
92
|
+
groups: IGlobalSearchGroup[];
|
|
93
|
+
}
|
|
94
|
+
export type { IGlobalSearchGroup, IGlobalSearchItem, IGlobalSearchResponse, ISearchApi, TGlobalSearchEntityType, TGlobalSearchMatchedField, TGlobalSearchMatchKind, };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Validation schemas for Search module
|
|
3
|
+
* @description Zod schemas for validating search-related API responses (raw API data, before normalization)
|
|
4
|
+
*/
|
|
5
|
+
import { z } from 'zod';
|
|
6
|
+
/**
|
|
7
|
+
* Global search item schema
|
|
8
|
+
* @description Schema for a single record found by the global search
|
|
9
|
+
*/
|
|
10
|
+
export declare const GlobalSearchItemSchema: z.ZodObject<{
|
|
11
|
+
type: z.ZodString;
|
|
12
|
+
id: z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>;
|
|
13
|
+
title: z.ZodOptional<z.ZodString>;
|
|
14
|
+
identifier: z.ZodOptional<z.ZodString>;
|
|
15
|
+
subtitle: z.ZodOptional<z.ZodString>;
|
|
16
|
+
matchKind: z.ZodString;
|
|
17
|
+
matchedField: z.ZodString;
|
|
18
|
+
matchedAttribute: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
19
|
+
fragment: z.ZodOptional<z.ZodString>;
|
|
20
|
+
langCode: z.ZodOptional<z.ZodString>;
|
|
21
|
+
isVisible: z.ZodOptional<z.ZodBoolean>;
|
|
22
|
+
parent: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
23
|
+
attributeSetId: z.ZodOptional<z.ZodNumber>;
|
|
24
|
+
}, z.core.$strip>;
|
|
25
|
+
/**
|
|
26
|
+
* Global search group schema
|
|
27
|
+
* @description Schema for the results of a single entity type
|
|
28
|
+
*/
|
|
29
|
+
export declare const GlobalSearchGroupSchema: z.ZodObject<{
|
|
30
|
+
type: z.ZodString;
|
|
31
|
+
items: z.ZodArray<z.ZodObject<{
|
|
32
|
+
type: z.ZodString;
|
|
33
|
+
id: z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>;
|
|
34
|
+
title: z.ZodOptional<z.ZodString>;
|
|
35
|
+
identifier: z.ZodOptional<z.ZodString>;
|
|
36
|
+
subtitle: z.ZodOptional<z.ZodString>;
|
|
37
|
+
matchKind: z.ZodString;
|
|
38
|
+
matchedField: z.ZodString;
|
|
39
|
+
matchedAttribute: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
40
|
+
fragment: z.ZodOptional<z.ZodString>;
|
|
41
|
+
langCode: z.ZodOptional<z.ZodString>;
|
|
42
|
+
isVisible: z.ZodOptional<z.ZodBoolean>;
|
|
43
|
+
parent: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
44
|
+
attributeSetId: z.ZodOptional<z.ZodNumber>;
|
|
45
|
+
}, z.core.$strip>>;
|
|
46
|
+
hasMore: z.ZodBoolean;
|
|
47
|
+
}, z.core.$strip>;
|
|
48
|
+
/**
|
|
49
|
+
* Global search response schema
|
|
50
|
+
* @description Schema for the response returned by globalSearch
|
|
51
|
+
*/
|
|
52
|
+
export declare const GlobalSearchResponseSchema: z.ZodObject<{
|
|
53
|
+
query: z.ZodString;
|
|
54
|
+
groups: z.ZodArray<z.ZodObject<{
|
|
55
|
+
type: z.ZodString;
|
|
56
|
+
items: z.ZodArray<z.ZodObject<{
|
|
57
|
+
type: z.ZodString;
|
|
58
|
+
id: z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>;
|
|
59
|
+
title: z.ZodOptional<z.ZodString>;
|
|
60
|
+
identifier: z.ZodOptional<z.ZodString>;
|
|
61
|
+
subtitle: z.ZodOptional<z.ZodString>;
|
|
62
|
+
matchKind: z.ZodString;
|
|
63
|
+
matchedField: z.ZodString;
|
|
64
|
+
matchedAttribute: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
65
|
+
fragment: z.ZodOptional<z.ZodString>;
|
|
66
|
+
langCode: z.ZodOptional<z.ZodString>;
|
|
67
|
+
isVisible: z.ZodOptional<z.ZodBoolean>;
|
|
68
|
+
parent: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
69
|
+
attributeSetId: z.ZodOptional<z.ZodNumber>;
|
|
70
|
+
}, z.core.$strip>>;
|
|
71
|
+
hasMore: z.ZodBoolean;
|
|
72
|
+
}, z.core.$strip>>;
|
|
73
|
+
}, z.core.$strip>;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Validation schemas for Search module
|
|
3
|
+
* @description Zod schemas for validating search-related API responses (raw API data, before normalization)
|
|
4
|
+
*/
|
|
5
|
+
import { z } from 'zod';
|
|
6
|
+
/**
|
|
7
|
+
* Global search item schema
|
|
8
|
+
* @description Schema for a single record found by the global search
|
|
9
|
+
*/
|
|
10
|
+
export const GlobalSearchItemSchema = z.object({
|
|
11
|
+
type: z.string(),
|
|
12
|
+
id: z.union([z.number(), z.string()]),
|
|
13
|
+
title: z.string().optional(),
|
|
14
|
+
identifier: z.string().optional(),
|
|
15
|
+
subtitle: z.string().optional(),
|
|
16
|
+
matchKind: z.string(),
|
|
17
|
+
matchedField: z.string(),
|
|
18
|
+
matchedAttribute: z.record(z.string(), z.unknown()).optional(),
|
|
19
|
+
fragment: z.string().optional(),
|
|
20
|
+
langCode: z.string().optional(),
|
|
21
|
+
isVisible: z.boolean().optional(),
|
|
22
|
+
parent: z.record(z.string(), z.unknown()).optional(),
|
|
23
|
+
attributeSetId: z.number().optional(),
|
|
24
|
+
});
|
|
25
|
+
/**
|
|
26
|
+
* Global search group schema
|
|
27
|
+
* @description Schema for the results of a single entity type
|
|
28
|
+
*/
|
|
29
|
+
export const GlobalSearchGroupSchema = z.object({
|
|
30
|
+
type: z.string(),
|
|
31
|
+
items: z.array(GlobalSearchItemSchema),
|
|
32
|
+
hasMore: z.boolean(),
|
|
33
|
+
});
|
|
34
|
+
/**
|
|
35
|
+
* Global search response schema
|
|
36
|
+
* @description Schema for the response returned by globalSearch
|
|
37
|
+
*/
|
|
38
|
+
export const GlobalSearchResponseSchema = z.object({
|
|
39
|
+
query: z.string(),
|
|
40
|
+
groups: z.array(GlobalSearchGroupSchema),
|
|
41
|
+
});
|