oneentry 1.0.160 → 1.0.162
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 +61 -0
- package/dist/admins/adminsApi.d.ts +15 -1
- package/dist/admins/adminsApi.js +29 -0
- package/dist/admins/adminsInterfaces.d.ts +39 -1
- package/dist/admins/adminsSchemas.d.ts +2 -0
- package/dist/admins/adminsSchemas.js +1 -0
- package/dist/attribute-sets/attributeSetsInterfaces.d.ts +2 -0
- package/dist/auth-provider/authProviderSchemas.d.ts +1 -0
- package/dist/base/lazySchema.d.ts +15 -0
- package/dist/base/lazySchema.js +20 -0
- package/dist/base/validation.d.ts +1 -0
- package/dist/base/validation.js +1 -0
- package/dist/blocks/blocksApi.d.ts +16 -8
- package/dist/blocks/blocksApi.js +24 -15
- package/dist/blocks/blocksInterfaces.d.ts +16 -8
- package/dist/discounts/discountsApi.d.ts +14 -1
- package/dist/discounts/discountsApi.js +21 -0
- package/dist/discounts/discountsInterfaces.d.ts +29 -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 +78 -1
- package/dist/index.d.ts +4 -0
- package/dist/index.js +3 -0
- package/dist/menus/menusInterfaces.d.ts +4 -0
- package/dist/menus/menusSchemas.js +2 -0
- package/dist/orders/ordersApi.d.ts +15 -1
- package/dist/orders/ordersApi.js +22 -0
- package/dist/orders/ordersInterfaces.d.ts +29 -1
- package/dist/orders/ordersSchemas.d.ts +2 -0
- package/dist/orders/ordersSchemas.js +1 -0
- package/dist/pages/pagesApi.d.ts +14 -11
- package/dist/pages/pagesApi.js +21 -17
- package/dist/pages/pagesInterfaces.d.ts +37 -17
- package/dist/pages/pagesSchemas.d.ts +3 -7
- package/dist/pages/pagesSchemas.js +2 -8
- 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 +41 -1
- package/dist/users/usersSchemas.d.ts +1 -0
- 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 +139 -0
- package/esm/admins/adminsInterfaces.js +1 -0
- package/esm/admins/adminsSchemas.d.ts +50 -0
- package/esm/admins/adminsSchemas.js +32 -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 +287 -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 +125 -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 +99 -0
- package/esm/base/validation.js +119 -0
- package/esm/blocks/blocksApi.d.ts +260 -0
- package/esm/blocks/blocksApi.js +403 -0
- package/esm/blocks/blocksInterfaces.d.ts +369 -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 +295 -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 +674 -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 +91 -0
- package/esm/menus/menusInterfaces.js +2 -0
- package/esm/menus/menusSchemas.d.ts +16 -0
- package/esm/menus/menusSchemas.js +27 -0
- package/esm/orders/ordersApi.d.ts +213 -0
- package/esm/orders/ordersApi.js +288 -0
- package/esm/orders/ordersInterfaces.d.ts +765 -0
- package/esm/orders/ordersInterfaces.js +1 -0
- package/esm/orders/ordersSchemas.d.ts +314 -0
- package/esm/orders/ordersSchemas.js +172 -0
- package/esm/package.json +4 -0
- package/esm/pages/pagesApi.d.ts +163 -0
- package/esm/pages/pagesApi.js +397 -0
- package/esm/pages/pagesInterfaces.d.ts +327 -0
- package/esm/pages/pagesInterfaces.js +1 -0
- package/esm/pages/pagesSchemas.d.ts +117 -0
- package/esm/pages/pagesSchemas.js +54 -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 +421 -0
- package/esm/users/usersInterfaces.js +1 -0
- package/esm/users/usersSchemas.d.ts +73 -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 +5 -1
- package/types.d.ts +1 -0
- package/types.js +1 -0
package/dist/pages/pagesApi.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import AsyncModules from '../base/asyncModules';
|
|
2
2
|
import type StateModule from '../base/stateModule';
|
|
3
3
|
import type { IError } from '../base/utils';
|
|
4
|
-
import type {
|
|
4
|
+
import type { IPagesApi, IPageSearchResult, IPagesEntity, IPagesResponse, IPagesVectorSearch, IPositionBlock } from './pagesInterfaces';
|
|
5
5
|
/**
|
|
6
6
|
* Controllers for working with page objects, including catalog pages
|
|
7
7
|
* @handle /api/content/pages
|
|
@@ -80,16 +80,6 @@ export default class PagesApi extends AsyncModules implements IPagesApi {
|
|
|
80
80
|
* @see {@link https://js-sdk.oneentry.cloud/docs/pages/getBlocksByPageUrl getBlocksByPageUrl} documentation.
|
|
81
81
|
*/
|
|
82
82
|
getBlocksByPageUrl(url: string, langCode?: string): Promise<IPositionBlock[] | IError>;
|
|
83
|
-
/**
|
|
84
|
-
* Get settings for the page.
|
|
85
|
-
* @handleName getConfigPageByUrl
|
|
86
|
-
* @param {string} url - Page URL. Example: "about".
|
|
87
|
-
* @returns {Promise<IPageConfig | IError>} Returns a ConfigPage object with page display settings
|
|
88
|
-
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
89
|
-
* @description Get settings for the page.
|
|
90
|
-
* @see {@link https://js-sdk.oneentry.cloud/docs/pages/getConfigPageByUrl getConfigPageByUrl} documentation.
|
|
91
|
-
*/
|
|
92
|
-
getConfigPageByUrl(url: string): Promise<IPageConfig | IError>;
|
|
93
83
|
/**
|
|
94
84
|
* Quick search for page objects with limited output.
|
|
95
85
|
* @handleName searchPage
|
|
@@ -102,6 +92,19 @@ export default class PagesApi extends AsyncModules implements IPagesApi {
|
|
|
102
92
|
* @see {@link https://js-sdk.oneentry.cloud/docs/pages/searchPage searchPage} documentation.
|
|
103
93
|
*/
|
|
104
94
|
searchPage(name: string, url?: string, langCode?: string): Promise<IPagesEntity[] | IPageSearchResult[] | IError>;
|
|
95
|
+
/**
|
|
96
|
+
* Semantic (vector) search for pages.
|
|
97
|
+
* @handleName getPagesByVectorSearch
|
|
98
|
+
* @param {IPagesVectorSearch} body - Vector search body. Example: `{ queryText: "winter sale" }`.
|
|
99
|
+
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
100
|
+
* @param {number} [offset] - Parameter for pagination. Default: 0.
|
|
101
|
+
* @param {number} [limit] - Parameter for pagination. Default: 30.
|
|
102
|
+
* @returns {Promise<IPagesResponse | IError>} Returns an object with an array of found pages and total count.
|
|
103
|
+
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
104
|
+
* @description This method performs a semantic (vector) search for pages.
|
|
105
|
+
* @see {@link https://js-sdk.oneentry.cloud/docs/pages/getPagesByVectorSearch getPagesByVectorSearch} documentation.
|
|
106
|
+
*/
|
|
107
|
+
getPagesByVectorSearch(body: IPagesVectorSearch, langCode?: string, offset?: number, limit?: number): Promise<IPagesResponse | IError>;
|
|
105
108
|
/**
|
|
106
109
|
* Add template data to pages
|
|
107
110
|
* @handleName addTemplateToPages
|
package/dist/pages/pagesApi.js
CHANGED
|
@@ -212,23 +212,6 @@ class PagesApi extends asyncModules_1.default {
|
|
|
212
212
|
}));
|
|
213
213
|
return normalizeResponse;
|
|
214
214
|
}
|
|
215
|
-
/**
|
|
216
|
-
* Get settings for the page.
|
|
217
|
-
* @handleName getConfigPageByUrl
|
|
218
|
-
* @param {string} url - Page URL. Example: "about".
|
|
219
|
-
* @returns {Promise<IPageConfig | IError>} Returns a ConfigPage object with page display settings
|
|
220
|
-
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
221
|
-
* @description Get settings for the page.
|
|
222
|
-
* @see {@link https://js-sdk.oneentry.cloud/docs/pages/getConfigPageByUrl getConfigPageByUrl} documentation.
|
|
223
|
-
*/
|
|
224
|
-
async getConfigPageByUrl(url) {
|
|
225
|
-
// Fetch data from the server using a GET request to retrieve forms for the specified page URL and language code
|
|
226
|
-
const result = await this._fetchGet(`/${url}/config`);
|
|
227
|
-
// Validate response if validation is enabled
|
|
228
|
-
const validated = await this._validateResponse(result, schema('PageConfigSchema'));
|
|
229
|
-
// return fetched data
|
|
230
|
-
return validated;
|
|
231
|
-
}
|
|
232
215
|
/**
|
|
233
216
|
* Quick search for page objects with limited output.
|
|
234
217
|
* @handleName searchPage
|
|
@@ -267,6 +250,27 @@ class PagesApi extends asyncModules_1.default {
|
|
|
267
250
|
// short cards carry no templateIdentifier, so there is nothing to attach a template to
|
|
268
251
|
return this._normalizeData(data, langCode);
|
|
269
252
|
}
|
|
253
|
+
/**
|
|
254
|
+
* Semantic (vector) search for pages.
|
|
255
|
+
* @handleName getPagesByVectorSearch
|
|
256
|
+
* @param {IPagesVectorSearch} body - Vector search body. Example: `{ queryText: "winter sale" }`.
|
|
257
|
+
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
258
|
+
* @param {number} [offset] - Parameter for pagination. Default: 0.
|
|
259
|
+
* @param {number} [limit] - Parameter for pagination. Default: 30.
|
|
260
|
+
* @returns {Promise<IPagesResponse | IError>} Returns an object with an array of found pages and total count.
|
|
261
|
+
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
262
|
+
* @description This method performs a semantic (vector) search for pages.
|
|
263
|
+
* @see {@link https://js-sdk.oneentry.cloud/docs/pages/getPagesByVectorSearch getPagesByVectorSearch} documentation.
|
|
264
|
+
*/
|
|
265
|
+
async getPagesByVectorSearch(body, langCode = this.state.lang, offset = 0, limit = 30) {
|
|
266
|
+
const query = {
|
|
267
|
+
langCode,
|
|
268
|
+
offset,
|
|
269
|
+
limit,
|
|
270
|
+
};
|
|
271
|
+
const result = await this._fetchPost(`/vector/search?` + this._queryParamsToString(query), body);
|
|
272
|
+
return this._normalizeData(result, langCode);
|
|
273
|
+
}
|
|
270
274
|
/**
|
|
271
275
|
* Add template data to pages
|
|
272
276
|
* @handleName addTemplateToPages
|
|
@@ -66,15 +66,6 @@ interface IPagesApi {
|
|
|
66
66
|
* @description This method gets all blocks by page url.
|
|
67
67
|
*/
|
|
68
68
|
getBlocksByPageUrl(url: string, langCode?: LangType): Promise<IPositionBlock[] | IError>;
|
|
69
|
-
/**
|
|
70
|
-
* Get settings for the page.
|
|
71
|
-
* @handleName getConfigPageByUrl
|
|
72
|
-
* @param {string} url - Page URL. Example: "about".
|
|
73
|
-
* @returns {IPageConfig} Returns a ConfigPage object with page display settings
|
|
74
|
-
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
75
|
-
* @description This method gets settings for the page.
|
|
76
|
-
*/
|
|
77
|
-
getConfigPageByUrl(url: string): Promise<IPageConfig | IError>;
|
|
78
69
|
/**
|
|
79
70
|
* Quick search for page objects with limited output.
|
|
80
71
|
* @handleName searchPage
|
|
@@ -86,16 +77,43 @@ interface IPagesApi {
|
|
|
86
77
|
* @description This method performs a quick search for page objects with limited output. With traficLimit enabled the raw quick search response is returned as short cards; otherwise full page entities are fetched for the found ids.
|
|
87
78
|
*/
|
|
88
79
|
searchPage(name: string, url?: string, langCode?: LangType): Promise<IPagesEntity[] | IPageSearchResult[] | IError>;
|
|
80
|
+
/**
|
|
81
|
+
* Semantic (vector) search for pages.
|
|
82
|
+
* @handleName getPagesByVectorSearch
|
|
83
|
+
* @param {IPagesVectorSearch} body - Vector search body. Example: `{ queryText: "winter sale" }`.
|
|
84
|
+
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
85
|
+
* @param {number} [offset] - Parameter for pagination. Default: 0.
|
|
86
|
+
* @param {number} [limit] - Parameter for pagination. Default: 30.
|
|
87
|
+
* @returns {IPagesResponse} A promise that resolves to a pages response (items + total) or an error.
|
|
88
|
+
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
89
|
+
* @description This method performs a semantic (vector) search for pages.
|
|
90
|
+
*/
|
|
91
|
+
getPagesByVectorSearch(body: IPagesVectorSearch, langCode?: string, offset?: number, limit?: number): Promise<IPagesResponse | IError>;
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Body for semantic (vector) page search.
|
|
95
|
+
* @interface IPagesVectorSearch
|
|
96
|
+
* @property {string} queryText - Natural-language search query. Example: "winter sale".
|
|
97
|
+
* @property {number} [vectorDistanceThreshold] - Override of the cosine distance threshold (0..2). Example: 0.3.
|
|
98
|
+
* @property {number} [maxHits] - Top-K candidates fetched before pagination. Default: 100. Max: 500. Example: 10.
|
|
99
|
+
* @property {boolean} [debug] - When true, each returned item gets a `distance` field. Example: false.
|
|
100
|
+
* @description Body for the pages vector/search endpoint.
|
|
101
|
+
*/
|
|
102
|
+
interface IPagesVectorSearch {
|
|
103
|
+
queryText: string;
|
|
104
|
+
vectorDistanceThreshold?: number;
|
|
105
|
+
maxHits?: number;
|
|
106
|
+
debug?: boolean;
|
|
89
107
|
}
|
|
90
108
|
/**
|
|
91
|
-
* @interface
|
|
92
|
-
* @property {
|
|
93
|
-
* @property {number
|
|
94
|
-
* @description This interface defines the
|
|
109
|
+
* @interface IPagesResponse
|
|
110
|
+
* @property {IPagesEntity[]} items - Array of found page objects.
|
|
111
|
+
* @property {number} total - Total number of found records. Example: 100.
|
|
112
|
+
* @description This interface defines the structure of a response containing multiple page entities, including the total count and an array of page items.
|
|
95
113
|
*/
|
|
96
|
-
interface
|
|
97
|
-
|
|
98
|
-
|
|
114
|
+
interface IPagesResponse {
|
|
115
|
+
items: IPagesEntity[];
|
|
116
|
+
total: number;
|
|
99
117
|
}
|
|
100
118
|
/**
|
|
101
119
|
* @interface IPositionForm
|
|
@@ -269,6 +287,7 @@ type PageType = 'catalog_page' | 'common_page' | 'error_page' | 'external_page';
|
|
|
269
287
|
* @property {IRating} [rating] - Rating data.
|
|
270
288
|
* @property {string} [total] - Total number of products linked to the page. Example: "10".
|
|
271
289
|
* @property {string | null} [categoryPath] - Category path string; null for nested pages that have no own category path. Example: "catalog".
|
|
290
|
+
* @property {number} [distance] - Cosine distance to the query. Returned only by the semantic (vector) search endpoint when `debug: true` is passed in the search body. Example: 0.12.
|
|
272
291
|
* @description This interface defines the structure of a page entity, including its identifiers, attributes, and hierarchical relationships.
|
|
273
292
|
*/
|
|
274
293
|
interface IPagesEntity {
|
|
@@ -293,6 +312,7 @@ interface IPagesEntity {
|
|
|
293
312
|
childrenCount?: number;
|
|
294
313
|
total?: string;
|
|
295
314
|
categoryPath?: string | null;
|
|
315
|
+
distance?: number;
|
|
296
316
|
}
|
|
297
317
|
/**
|
|
298
318
|
* @interface IPageSearchResult
|
|
@@ -304,4 +324,4 @@ interface IPageSearchResult {
|
|
|
304
324
|
id: number;
|
|
305
325
|
title: string;
|
|
306
326
|
}
|
|
307
|
-
export type {
|
|
327
|
+
export type { IPagesApi, IPageSearchResult, IPagesEntity, IPagesResponse, IPagesVectorSearch, IPositionBlock, IPositionForm, PageType, };
|
|
@@ -34,6 +34,7 @@ export declare const PageEntitySchema: z.ZodObject<{
|
|
|
34
34
|
childrenCount: z.ZodOptional<z.ZodNumber>;
|
|
35
35
|
total: z.ZodOptional<z.ZodString>;
|
|
36
36
|
categoryPath: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
37
|
+
distance: z.ZodOptional<z.ZodNumber>;
|
|
37
38
|
}, z.core.$strip>;
|
|
38
39
|
/**
|
|
39
40
|
* Pages response schema (array of pages)
|
|
@@ -65,6 +66,7 @@ export declare const PagesResponseSchema: z.ZodArray<z.ZodObject<{
|
|
|
65
66
|
childrenCount: z.ZodOptional<z.ZodNumber>;
|
|
66
67
|
total: z.ZodOptional<z.ZodString>;
|
|
67
68
|
categoryPath: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
69
|
+
distance: z.ZodOptional<z.ZodNumber>;
|
|
68
70
|
}, z.core.$strip>>;
|
|
69
71
|
/**
|
|
70
72
|
* Page search result schema
|
|
@@ -111,11 +113,5 @@ export declare const SinglePageSchema: z.ZodObject<{
|
|
|
111
113
|
childrenCount: z.ZodOptional<z.ZodNumber>;
|
|
112
114
|
total: z.ZodOptional<z.ZodString>;
|
|
113
115
|
categoryPath: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
114
|
-
|
|
115
|
-
/**
|
|
116
|
-
* Page config schema
|
|
117
|
-
*/
|
|
118
|
-
export declare const PageConfigSchema: z.ZodObject<{
|
|
119
|
-
rowsPerPage: z.ZodNullable<z.ZodNumber>;
|
|
120
|
-
productsPerRow: z.ZodNullable<z.ZodNumber>;
|
|
116
|
+
distance: z.ZodOptional<z.ZodNumber>;
|
|
121
117
|
}, z.core.$strip>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.SinglePageSchema = exports.PageSearchResponseSchema = exports.PageSearchResultSchema = exports.PagesResponseSchema = exports.PageEntitySchema = void 0;
|
|
4
4
|
/**
|
|
5
5
|
* Validation schemas for Pages module
|
|
6
6
|
* @description Zod schemas for validating pages-related API responses
|
|
@@ -33,6 +33,7 @@ exports.PageEntitySchema = zod_1.z.object({
|
|
|
33
33
|
childrenCount: zod_1.z.number().optional(),
|
|
34
34
|
total: zod_1.z.string().optional(),
|
|
35
35
|
categoryPath: zod_1.z.string().nullable().optional(),
|
|
36
|
+
distance: zod_1.z.number().optional(),
|
|
36
37
|
});
|
|
37
38
|
/**
|
|
38
39
|
* Pages response schema (array of pages)
|
|
@@ -54,10 +55,3 @@ exports.PageSearchResponseSchema = zod_1.z.array(exports.PageSearchResultSchema)
|
|
|
54
55
|
* Single page response schema
|
|
55
56
|
*/
|
|
56
57
|
exports.SinglePageSchema = exports.PageEntitySchema;
|
|
57
|
-
/**
|
|
58
|
-
* Page config schema
|
|
59
|
-
*/
|
|
60
|
-
exports.PageConfigSchema = zod_1.z.object({
|
|
61
|
-
rowsPerPage: zod_1.z.number().nullable(),
|
|
62
|
-
productsPerRow: zod_1.z.number().nullable(),
|
|
63
|
-
});
|
|
@@ -131,7 +131,7 @@ interface IIntent {
|
|
|
131
131
|
* @property {number} id - Object identifier. Example: 12345.
|
|
132
132
|
* @property {ILocalizeInfo} localizeInfos - Json description of the payment account object.
|
|
133
133
|
* @property {string} identifier - Text identifier for the recording field. Example: "payment_12345".
|
|
134
|
-
* @property {'stripe' | '
|
|
134
|
+
* @property {'stripe' | 'yookassa' | 'midtrans' | 'xendit' | 'custom'} type - Payment provider type. Example: 'stripe'.
|
|
135
135
|
* @property {boolean} isVisible - Visibility indicator of the payment account. Example: true.
|
|
136
136
|
* @property {boolean} isUsed - Usage indicator of the payment account. Example: false.
|
|
137
137
|
* @property {boolean} testMode - Indicates whether the payment account is in test mode. Example: true.
|
|
@@ -144,7 +144,7 @@ interface IAccountsEntity {
|
|
|
144
144
|
id: number;
|
|
145
145
|
localizeInfos: ILocalizeInfo;
|
|
146
146
|
identifier: string;
|
|
147
|
-
type: 'stripe' | 'custom';
|
|
147
|
+
type: 'stripe' | 'yookassa' | 'midtrans' | 'xendit' | 'custom';
|
|
148
148
|
isVisible: boolean;
|
|
149
149
|
isUsed: boolean;
|
|
150
150
|
testMode: boolean;
|
|
@@ -377,7 +377,7 @@ type IProductsQuery = IProductsQueryBase;
|
|
|
377
377
|
*/
|
|
378
378
|
interface IFilterParams {
|
|
379
379
|
attributeMarker: string;
|
|
380
|
-
conditionMarker?: 'in' /** 'in' - Contains */ | 'nin' /** 'nin' - Does not contain */ | 'eq' /** 'eq' - Equal */ | 'neq' /** 'neq' - Not equal */ | 'mth' /** 'mth' - Greater than */ | 'lth' /** 'lth' - Less than */ | 'exs' /** 'exs' - Exists */ | 'nexs' /** 'nexs' - Does not exist */ | null;
|
|
380
|
+
conditionMarker?: 'in' /** 'in' - Contains */ | 'nin' /** 'nin' - Does not contain */ | 'eq' /** 'eq' - Equal */ | 'neq' /** 'neq' - Not equal */ | 'mth' /** 'mth' - Greater than */ | 'lth' /** 'lth' - Less than */ | 'exs' /** 'exs' - Exists */ | 'nexs' /** 'nexs' - Does not exist */ | 'pat' /** 'pat' - Matches pattern */ | 'same' /** 'same' - Matches the value exactly */ | 'same_part' /** 'same_part' - Matches a part of the value exactly */ | null;
|
|
381
381
|
conditionValue: number | string | null;
|
|
382
382
|
pageUrl?: string | null;
|
|
383
383
|
pageUrls?: string[] | null;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import AsyncModules from '../base/asyncModules';
|
|
2
|
+
import type StateModule from '../base/stateModule';
|
|
3
|
+
import type { IError } from '../base/utils';
|
|
4
|
+
import type { IGlobalSearchResponse, ISearchApi, TGlobalSearchEntityType } from './searchInterfaces';
|
|
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,86 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
36
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
const asyncModules_1 = __importDefault(require("../base/asyncModules"));
|
|
40
|
+
const lazySchema_1 = __importDefault(require("../base/lazySchema"));
|
|
41
|
+
const schema = (0, lazySchema_1.default)(() => Promise.resolve().then(() => __importStar(require('./searchSchemas'))));
|
|
42
|
+
/**
|
|
43
|
+
* Controllers for the public cross-entity search.
|
|
44
|
+
* @handle /api/content/search
|
|
45
|
+
* @class SearchApi
|
|
46
|
+
* @augments AsyncModules
|
|
47
|
+
* @implements {ISearchApi}
|
|
48
|
+
* @description This class provides a public search over names and attribute values of visible records.
|
|
49
|
+
*/
|
|
50
|
+
class SearchApi extends asyncModules_1.default {
|
|
51
|
+
/**
|
|
52
|
+
* Constructor for SearchApi class.
|
|
53
|
+
* @param {StateModule} state - The state module.
|
|
54
|
+
*/
|
|
55
|
+
constructor(state) {
|
|
56
|
+
super(state);
|
|
57
|
+
this._url = state.url + '/api/content/search';
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Public search across titles and attribute values of visible records.
|
|
61
|
+
* @handleName globalSearch
|
|
62
|
+
* @param {string} query - Search query. Example: "winter".
|
|
63
|
+
* @param {TGlobalSearchEntityType[]} [types] - Entity types to search in, sent comma-separated. Searches every type when omitted.
|
|
64
|
+
* @param {'all' | 'visible' | 'hidden'} [visibility] - Visibility filter of the searched records. Default: "all".
|
|
65
|
+
* @param {number} [offset] - Drilldown mode offset. Pass it only together with a single accessible type in `types`.
|
|
66
|
+
* @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.
|
|
67
|
+
* @returns {Promise<IGlobalSearchResponse | IError>} Returns the query and the found records grouped by entity type.
|
|
68
|
+
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
69
|
+
* @description Searches names and attribute values of visible records across entity types.
|
|
70
|
+
* @see {@link https://js-sdk.oneentry.cloud/docs/search/globalSearch globalSearch} documentation.
|
|
71
|
+
*/
|
|
72
|
+
async globalSearch(query, types, visibility, offset, limit) {
|
|
73
|
+
// `types` is sent comma-separated — the array stringifies to exactly that.
|
|
74
|
+
const params = {
|
|
75
|
+
q: query,
|
|
76
|
+
types,
|
|
77
|
+
visibility,
|
|
78
|
+
offset,
|
|
79
|
+
limit,
|
|
80
|
+
};
|
|
81
|
+
const data = await this._fetchGet(`?` + this._queryParamsToString(params));
|
|
82
|
+
const validated = await this._validateResponse(data, schema('GlobalSearchResponseSchema'));
|
|
83
|
+
return this._normalizeData(validated);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
exports.default = SearchApi;
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import type { IError } from '../base/utils';
|
|
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,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,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GlobalSearchResponseSchema = exports.GlobalSearchGroupSchema = exports.GlobalSearchItemSchema = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Validation schemas for Search module
|
|
6
|
+
* @description Zod schemas for validating search-related API responses (raw API data, before normalization)
|
|
7
|
+
*/
|
|
8
|
+
const zod_1 = require("zod");
|
|
9
|
+
/**
|
|
10
|
+
* Global search item schema
|
|
11
|
+
* @description Schema for a single record found by the global search
|
|
12
|
+
*/
|
|
13
|
+
exports.GlobalSearchItemSchema = zod_1.z.object({
|
|
14
|
+
type: zod_1.z.string(),
|
|
15
|
+
id: zod_1.z.union([zod_1.z.number(), zod_1.z.string()]),
|
|
16
|
+
title: zod_1.z.string().optional(),
|
|
17
|
+
identifier: zod_1.z.string().optional(),
|
|
18
|
+
subtitle: zod_1.z.string().optional(),
|
|
19
|
+
matchKind: zod_1.z.string(),
|
|
20
|
+
matchedField: zod_1.z.string(),
|
|
21
|
+
matchedAttribute: zod_1.z.record(zod_1.z.string(), zod_1.z.unknown()).optional(),
|
|
22
|
+
fragment: zod_1.z.string().optional(),
|
|
23
|
+
langCode: zod_1.z.string().optional(),
|
|
24
|
+
isVisible: zod_1.z.boolean().optional(),
|
|
25
|
+
parent: zod_1.z.record(zod_1.z.string(), zod_1.z.unknown()).optional(),
|
|
26
|
+
attributeSetId: zod_1.z.number().optional(),
|
|
27
|
+
});
|
|
28
|
+
/**
|
|
29
|
+
* Global search group schema
|
|
30
|
+
* @description Schema for the results of a single entity type
|
|
31
|
+
*/
|
|
32
|
+
exports.GlobalSearchGroupSchema = zod_1.z.object({
|
|
33
|
+
type: zod_1.z.string(),
|
|
34
|
+
items: zod_1.z.array(exports.GlobalSearchItemSchema),
|
|
35
|
+
hasMore: zod_1.z.boolean(),
|
|
36
|
+
});
|
|
37
|
+
/**
|
|
38
|
+
* Global search response schema
|
|
39
|
+
* @description Schema for the response returned by globalSearch
|
|
40
|
+
*/
|
|
41
|
+
exports.GlobalSearchResponseSchema = zod_1.z.object({
|
|
42
|
+
query: zod_1.z.string(),
|
|
43
|
+
groups: zod_1.z.array(exports.GlobalSearchGroupSchema),
|
|
44
|
+
});
|
|
@@ -71,7 +71,6 @@ interface ITemplatesPreviewApi {
|
|
|
71
71
|
* @property {number} version - The version number of the object. Example: 1.
|
|
72
72
|
* @property {number} position - The position of the object. Example: 1.
|
|
73
73
|
* @property {boolean} isUsed - Indicates whether the template preview is used. Example: true.
|
|
74
|
-
* @property {string | null} [attributeSetIdentifier] - Text identifier used for a set of attributes. Example: "attribute_set_1".
|
|
75
74
|
* @description This interface defines the structure of a template preview entity, including its identifiers, attributes, proportions, and title.
|
|
76
75
|
*/
|
|
77
76
|
interface ITemplatesPreviewEntity {
|
|
@@ -82,7 +81,6 @@ interface ITemplatesPreviewEntity {
|
|
|
82
81
|
version: number;
|
|
83
82
|
position: number;
|
|
84
83
|
isUsed: boolean;
|
|
85
|
-
attributeSetIdentifier?: string | null;
|
|
86
84
|
}
|
|
87
85
|
/**
|
|
88
86
|
* @interface ITemplatesPreviewProportions
|
|
@@ -47,7 +47,6 @@ export declare const TemplatePreviewEntitySchema: z.ZodObject<{
|
|
|
47
47
|
version: z.ZodNumber;
|
|
48
48
|
position: z.ZodNumber;
|
|
49
49
|
isUsed: z.ZodBoolean;
|
|
50
|
-
attributeSetIdentifier: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
51
50
|
}, z.core.$strip>;
|
|
52
51
|
/**
|
|
53
52
|
* Template previews response schema (array of template previews)
|
|
@@ -77,5 +76,4 @@ export declare const TemplatePreviewsResponseSchema: z.ZodArray<z.ZodObject<{
|
|
|
77
76
|
version: z.ZodNumber;
|
|
78
77
|
position: z.ZodNumber;
|
|
79
78
|
isUsed: z.ZodBoolean;
|
|
80
|
-
attributeSetIdentifier: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
81
79
|
}, z.core.$strip>>;
|
|
@@ -39,7 +39,6 @@ exports.TemplatePreviewEntitySchema = zod_1.z.object({
|
|
|
39
39
|
version: zod_1.z.number(),
|
|
40
40
|
position: zod_1.z.number(),
|
|
41
41
|
isUsed: zod_1.z.boolean(),
|
|
42
|
-
attributeSetIdentifier: zod_1.z.string().nullable().optional(),
|
|
43
42
|
});
|
|
44
43
|
/**
|
|
45
44
|
* Template previews response schema (array of template previews)
|