oneentry 1.0.161 → 1.0.163
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 +18 -0
- package/changelog.md +80 -3
- package/dist/admins/adminsInterfaces.d.ts +2 -0
- package/dist/admins/adminsSchemas.d.ts +8 -22
- package/dist/admins/adminsSchemas.js +3 -9
- package/dist/attribute-sets/attributeSetsInterfaces.d.ts +8 -6
- package/dist/auth-provider/authProviderSchemas.d.ts +1 -0
- package/dist/auth-provider/authProvidersInterfaces.d.ts +4 -4
- package/dist/base/attributes.d.ts +105 -0
- package/dist/base/attributes.js +172 -0
- package/dist/base/utils.d.ts +95 -2
- package/dist/base/validation.d.ts +30 -0
- package/dist/base/validation.js +94 -1
- package/dist/blocks/blocksApi.d.ts +16 -8
- package/dist/blocks/blocksApi.js +24 -15
- package/dist/blocks/blocksInterfaces.d.ts +17 -9
- package/dist/blocks/blocksSchemas.d.ts +6 -6
- package/dist/blocks/blocksSchemas.js +2 -1
- package/dist/discounts/discountsInterfaces.d.ts +3 -1
- package/dist/forms-data/formsDataApi.d.ts +16 -6
- package/dist/forms-data/formsDataApi.js +14 -4
- package/dist/forms-data/formsDataInterfaces.d.ts +57 -20
- package/dist/index.d.ts +1 -0
- package/dist/index.js +9 -1
- package/dist/integration-collections/integrationCollectionsInterfaces.d.ts +6 -6
- package/dist/menus/menusInterfaces.d.ts +5 -1
- package/dist/menus/menusSchemas.js +4 -1
- package/dist/orders/ordersInterfaces.d.ts +3 -1
- package/dist/orders/ordersSchemas.d.ts +2 -0
- package/dist/orders/ordersSchemas.js +1 -0
- package/dist/pages/pagesApi.d.ts +1 -11
- package/dist/pages/pagesApi.js +0 -17
- package/dist/pages/pagesInterfaces.d.ts +3 -20
- package/dist/pages/pagesSchemas.d.ts +6 -10
- package/dist/pages/pagesSchemas.js +4 -9
- package/dist/product-statuses/productStatusesInterfaces.d.ts +2 -2
- package/dist/products/productsSchemas.d.ts +5 -5
- package/dist/products/productsSchemas.js +3 -2
- package/dist/templates/templatesInterfaces.d.ts +1 -1
- package/dist/templates/templatesSchemas.d.ts +3 -3
- package/dist/templates/templatesSchemas.js +2 -1
- package/dist/templates-preview/templatesPreviewInterfaces.d.ts +2 -2
- package/dist/users/usersInterfaces.d.ts +2 -0
- package/dist/users/usersSchemas.d.ts +1 -0
- package/esm/admins/adminsInterfaces.d.ts +2 -0
- package/esm/admins/adminsSchemas.d.ts +8 -22
- package/esm/admins/adminsSchemas.js +3 -9
- package/esm/attribute-sets/attributeSetsInterfaces.d.ts +8 -6
- package/esm/auth-provider/authProviderSchemas.d.ts +1 -0
- package/esm/auth-provider/authProvidersInterfaces.d.ts +4 -4
- package/esm/base/attributes.d.ts +105 -0
- package/esm/base/attributes.js +163 -0
- package/esm/base/utils.d.ts +95 -2
- package/esm/base/validation.d.ts +30 -0
- package/esm/base/validation.js +93 -0
- package/esm/blocks/blocksApi.d.ts +16 -8
- package/esm/blocks/blocksApi.js +24 -15
- package/esm/blocks/blocksInterfaces.d.ts +17 -9
- package/esm/blocks/blocksSchemas.d.ts +6 -6
- package/esm/blocks/blocksSchemas.js +2 -1
- package/esm/discounts/discountsInterfaces.d.ts +3 -1
- package/esm/forms-data/formsDataApi.d.ts +16 -6
- package/esm/forms-data/formsDataApi.js +14 -4
- package/esm/forms-data/formsDataInterfaces.d.ts +57 -20
- package/esm/index.d.ts +1 -0
- package/esm/index.js +1 -0
- package/esm/integration-collections/integrationCollectionsInterfaces.d.ts +6 -6
- package/esm/menus/menusInterfaces.d.ts +5 -1
- package/esm/menus/menusSchemas.js +4 -1
- package/esm/orders/ordersInterfaces.d.ts +3 -1
- package/esm/orders/ordersSchemas.d.ts +2 -0
- package/esm/orders/ordersSchemas.js +1 -0
- package/esm/pages/pagesApi.d.ts +1 -11
- package/esm/pages/pagesApi.js +0 -17
- package/esm/pages/pagesInterfaces.d.ts +3 -20
- package/esm/pages/pagesSchemas.d.ts +6 -10
- package/esm/pages/pagesSchemas.js +3 -8
- package/esm/product-statuses/productStatusesInterfaces.d.ts +2 -2
- package/esm/products/productsSchemas.d.ts +5 -5
- package/esm/products/productsSchemas.js +3 -2
- package/esm/templates/templatesInterfaces.d.ts +1 -1
- package/esm/templates/templatesSchemas.d.ts +3 -3
- package/esm/templates/templatesSchemas.js +2 -1
- package/esm/templates-preview/templatesPreviewInterfaces.d.ts +2 -2
- package/esm/users/usersInterfaces.d.ts +2 -0
- package/esm/users/usersSchemas.d.ts +1 -0
- package/package.json +2 -2
|
@@ -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
|
|
@@ -124,16 +115,6 @@ interface IPagesResponse {
|
|
|
124
115
|
items: IPagesEntity[];
|
|
125
116
|
total: number;
|
|
126
117
|
}
|
|
127
|
-
/**
|
|
128
|
-
* @interface IPageConfig
|
|
129
|
-
* @property {number | null} rowsPerPage - Number of lines per page. Example: 1.
|
|
130
|
-
* @property {number | null} productsPerRow - Number of products per page. Example: 1.
|
|
131
|
-
* @description This interface defines the configuration for pagination in pages, including the number of rows and products displayed per page.
|
|
132
|
-
*/
|
|
133
|
-
interface IPageConfig {
|
|
134
|
-
rowsPerPage: number | null;
|
|
135
|
-
productsPerRow: number | null;
|
|
136
|
-
}
|
|
137
118
|
/**
|
|
138
119
|
* @interface IPositionForm
|
|
139
120
|
* @property {number} id - The identifier of the object. Example: 1764.
|
|
@@ -306,6 +287,7 @@ type PageType = 'catalog_page' | 'common_page' | 'error_page' | 'external_page';
|
|
|
306
287
|
* @property {IRating} [rating] - Rating data.
|
|
307
288
|
* @property {string} [total] - Total number of products linked to the page. Example: "10".
|
|
308
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.
|
|
309
291
|
* @description This interface defines the structure of a page entity, including its identifiers, attributes, and hierarchical relationships.
|
|
310
292
|
*/
|
|
311
293
|
interface IPagesEntity {
|
|
@@ -330,6 +312,7 @@ interface IPagesEntity {
|
|
|
330
312
|
childrenCount?: number;
|
|
331
313
|
total?: string;
|
|
332
314
|
categoryPath?: string | null;
|
|
315
|
+
distance?: number;
|
|
333
316
|
}
|
|
334
317
|
/**
|
|
335
318
|
* @interface IPageSearchResult
|
|
@@ -341,4 +324,4 @@ interface IPageSearchResult {
|
|
|
341
324
|
id: number;
|
|
342
325
|
title: string;
|
|
343
326
|
}
|
|
344
|
-
export type {
|
|
327
|
+
export type { IPagesApi, IPageSearchResult, IPagesEntity, IPagesResponse, IPagesVectorSearch, IPositionBlock, IPositionForm, PageType, };
|
|
@@ -22,7 +22,7 @@ export declare const PageEntitySchema: z.ZodObject<{
|
|
|
22
22
|
}>;
|
|
23
23
|
templateIdentifier: z.ZodNullable<z.ZodString>;
|
|
24
24
|
attributeSetIdentifier: z.ZodNullable<z.ZodString>;
|
|
25
|
-
attributeValues: z.ZodRecord<z.ZodString, z.
|
|
25
|
+
attributeValues: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
26
26
|
moduleFormConfigs: z.ZodOptional<z.ZodArray<z.ZodAny>>;
|
|
27
27
|
rating: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
28
28
|
isSync: z.ZodBoolean;
|
|
@@ -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)
|
|
@@ -53,7 +54,7 @@ export declare const PagesResponseSchema: z.ZodArray<z.ZodObject<{
|
|
|
53
54
|
}>;
|
|
54
55
|
templateIdentifier: z.ZodNullable<z.ZodString>;
|
|
55
56
|
attributeSetIdentifier: z.ZodNullable<z.ZodString>;
|
|
56
|
-
attributeValues: z.ZodRecord<z.ZodString, z.
|
|
57
|
+
attributeValues: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
57
58
|
moduleFormConfigs: z.ZodOptional<z.ZodArray<z.ZodAny>>;
|
|
58
59
|
rating: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
59
60
|
isSync: z.ZodBoolean;
|
|
@@ -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
|
|
@@ -99,7 +101,7 @@ export declare const SinglePageSchema: z.ZodObject<{
|
|
|
99
101
|
}>;
|
|
100
102
|
templateIdentifier: z.ZodNullable<z.ZodString>;
|
|
101
103
|
attributeSetIdentifier: z.ZodNullable<z.ZodString>;
|
|
102
|
-
attributeValues: z.ZodRecord<z.ZodString, z.
|
|
104
|
+
attributeValues: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
103
105
|
moduleFormConfigs: z.ZodOptional<z.ZodArray<z.ZodAny>>;
|
|
104
106
|
rating: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
105
107
|
isSync: z.ZodBoolean;
|
|
@@ -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,11 +1,12 @@
|
|
|
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
|
|
7
7
|
*/
|
|
8
8
|
const zod_1 = require("zod");
|
|
9
|
+
const validation_1 = require("../base/validation");
|
|
9
10
|
/**
|
|
10
11
|
* Page entity schema
|
|
11
12
|
* Includes all fields returned by the API
|
|
@@ -21,7 +22,7 @@ exports.PageEntitySchema = zod_1.z.object({
|
|
|
21
22
|
type: zod_1.z.enum(['catalog_page', 'common_page', 'error_page', 'external_page']),
|
|
22
23
|
templateIdentifier: zod_1.z.string().nullable(),
|
|
23
24
|
attributeSetIdentifier: zod_1.z.string().nullable(),
|
|
24
|
-
attributeValues:
|
|
25
|
+
attributeValues: validation_1.AttributeValuesSchema,
|
|
25
26
|
moduleFormConfigs: zod_1.z.array(zod_1.z.any()).optional(),
|
|
26
27
|
rating: zod_1.z.record(zod_1.z.string(), zod_1.z.unknown()).optional(),
|
|
27
28
|
isSync: zod_1.z.boolean(),
|
|
@@ -33,6 +34,7 @@ exports.PageEntitySchema = zod_1.z.object({
|
|
|
33
34
|
childrenCount: zod_1.z.number().optional(),
|
|
34
35
|
total: zod_1.z.string().optional(),
|
|
35
36
|
categoryPath: zod_1.z.string().nullable().optional(),
|
|
37
|
+
distance: zod_1.z.number().optional(),
|
|
36
38
|
});
|
|
37
39
|
/**
|
|
38
40
|
* Pages response schema (array of pages)
|
|
@@ -54,10 +56,3 @@ exports.PageSearchResponseSchema = zod_1.z.array(exports.PageSearchResultSchema)
|
|
|
54
56
|
* Single page response schema
|
|
55
57
|
*/
|
|
56
58
|
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
|
-
});
|
|
@@ -12,7 +12,7 @@ interface IProductStatusesApi {
|
|
|
12
12
|
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
13
13
|
* @description This method searches for all product status objects.
|
|
14
14
|
*/
|
|
15
|
-
getProductStatuses(langCode
|
|
15
|
+
getProductStatuses(langCode?: string): Promise<IProductStatusEntity[] | IError>;
|
|
16
16
|
/**
|
|
17
17
|
* Search for a product status object by its textual identifier (marker).
|
|
18
18
|
* @handleName getProductsByStatusMarker
|
|
@@ -22,7 +22,7 @@ interface IProductStatusesApi {
|
|
|
22
22
|
* @throws {IError} If there is an error during the fetch operation, it will return an error object.
|
|
23
23
|
* @description This method searches for a product status object by its textual identifier (marker).
|
|
24
24
|
*/
|
|
25
|
-
getProductsByStatusMarker(marker: string, langCode
|
|
25
|
+
getProductsByStatusMarker(marker: string, langCode?: string): Promise<IProductStatusEntity | IError>;
|
|
26
26
|
/**
|
|
27
27
|
* Check the existence of a textual identifier.
|
|
28
28
|
* @handleName validateMarker
|
|
@@ -41,7 +41,7 @@ export declare const ProductEntitySchema: z.ZodObject<{
|
|
|
41
41
|
}, z.core.$strip>;
|
|
42
42
|
sku: z.ZodNullable<z.ZodString>;
|
|
43
43
|
isSync: z.ZodBoolean;
|
|
44
|
-
attributeValues: z.ZodRecord<z.ZodString, z.
|
|
44
|
+
attributeValues: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
45
45
|
categories: z.ZodArray<z.ZodString>;
|
|
46
46
|
isVisible: z.ZodBoolean;
|
|
47
47
|
moduleFormConfigs: z.ZodOptional<z.ZodArray<z.ZodAny>>;
|
|
@@ -83,7 +83,7 @@ export declare const ProductsResponseSchema: z.ZodObject<{
|
|
|
83
83
|
}, z.core.$strip>;
|
|
84
84
|
sku: z.ZodNullable<z.ZodString>;
|
|
85
85
|
isSync: z.ZodBoolean;
|
|
86
|
-
attributeValues: z.ZodRecord<z.ZodString, z.
|
|
86
|
+
attributeValues: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
87
87
|
categories: z.ZodArray<z.ZodString>;
|
|
88
88
|
isVisible: z.ZodBoolean;
|
|
89
89
|
moduleFormConfigs: z.ZodOptional<z.ZodArray<z.ZodAny>>;
|
|
@@ -127,7 +127,7 @@ export declare const SingleProductSchema: z.ZodObject<{
|
|
|
127
127
|
}, z.core.$strip>;
|
|
128
128
|
sku: z.ZodNullable<z.ZodString>;
|
|
129
129
|
isSync: z.ZodBoolean;
|
|
130
|
-
attributeValues: z.ZodRecord<z.ZodString, z.
|
|
130
|
+
attributeValues: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
131
131
|
categories: z.ZodArray<z.ZodString>;
|
|
132
132
|
isVisible: z.ZodBoolean;
|
|
133
133
|
moduleFormConfigs: z.ZodOptional<z.ZodArray<z.ZodAny>>;
|
|
@@ -189,7 +189,7 @@ export declare const ProductBlockSchema: z.ZodObject<{
|
|
|
189
189
|
templateIdentifier: z.ZodNullable<z.ZodString>;
|
|
190
190
|
isVisible: z.ZodBoolean;
|
|
191
191
|
isSync: z.ZodBoolean;
|
|
192
|
-
attributeValues: z.ZodRecord<z.ZodString, z.
|
|
192
|
+
attributeValues: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
193
193
|
}, z.core.$strip>;
|
|
194
194
|
/**
|
|
195
195
|
* Related products schema
|
|
@@ -210,7 +210,7 @@ export declare const RelatedProductsSchema: z.ZodArray<z.ZodObject<{
|
|
|
210
210
|
}, z.core.$strip>;
|
|
211
211
|
sku: z.ZodNullable<z.ZodString>;
|
|
212
212
|
isSync: z.ZodBoolean;
|
|
213
|
-
attributeValues: z.ZodRecord<z.ZodString, z.
|
|
213
|
+
attributeValues: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
214
214
|
categories: z.ZodArray<z.ZodString>;
|
|
215
215
|
isVisible: z.ZodBoolean;
|
|
216
216
|
moduleFormConfigs: z.ZodOptional<z.ZodArray<z.ZodAny>>;
|
|
@@ -6,6 +6,7 @@ exports.RelatedProductsSchema = exports.ProductBlockSchema = exports.ProductsCou
|
|
|
6
6
|
* @description Zod schemas for validating products-related API responses
|
|
7
7
|
*/
|
|
8
8
|
const zod_1 = require("zod");
|
|
9
|
+
const validation_1 = require("../base/validation");
|
|
9
10
|
/**
|
|
10
11
|
* Product price schema
|
|
11
12
|
*/
|
|
@@ -44,7 +45,7 @@ exports.ProductEntitySchema = zod_1.z.object({
|
|
|
44
45
|
}),
|
|
45
46
|
sku: zod_1.z.string().nullable(),
|
|
46
47
|
isSync: zod_1.z.boolean(),
|
|
47
|
-
attributeValues:
|
|
48
|
+
attributeValues: validation_1.AttributeValuesSchema,
|
|
48
49
|
categories: zod_1.z.array(zod_1.z.string()),
|
|
49
50
|
isVisible: zod_1.z.boolean(),
|
|
50
51
|
moduleFormConfigs: zod_1.z.array(zod_1.z.any()).optional(),
|
|
@@ -116,7 +117,7 @@ exports.ProductBlockSchema = zod_1.z.object({
|
|
|
116
117
|
templateIdentifier: zod_1.z.string().nullable(),
|
|
117
118
|
isVisible: zod_1.z.boolean(),
|
|
118
119
|
isSync: zod_1.z.boolean(),
|
|
119
|
-
attributeValues:
|
|
120
|
+
attributeValues: validation_1.AttributeValuesSchema,
|
|
120
121
|
});
|
|
121
122
|
/**
|
|
122
123
|
* Related products schema
|
|
@@ -23,7 +23,7 @@ interface ITemplatesApi {
|
|
|
23
23
|
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
24
24
|
* @description This method gets template objects by type.
|
|
25
25
|
*/
|
|
26
|
-
getTemplateByType(type: BlockType, langCode
|
|
26
|
+
getTemplateByType(type: BlockType, langCode?: string): Promise<ITemplateEntity[] | IError>;
|
|
27
27
|
/**
|
|
28
28
|
* Get one template object by id.
|
|
29
29
|
* @handleName getTemplateByMarker
|
|
@@ -15,7 +15,7 @@ export declare const TemplateEntitySchema: z.ZodObject<{
|
|
|
15
15
|
identifier: z.ZodString;
|
|
16
16
|
version: z.ZodNumber;
|
|
17
17
|
generalTypeName: z.ZodString;
|
|
18
|
-
attributeValues: z.ZodRecord<z.ZodString, z.
|
|
18
|
+
attributeValues: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
19
19
|
position: z.ZodNumber;
|
|
20
20
|
}, z.core.$strip>;
|
|
21
21
|
/**
|
|
@@ -29,7 +29,7 @@ export declare const TemplatesResponseSchema: z.ZodArray<z.ZodObject<{
|
|
|
29
29
|
identifier: z.ZodString;
|
|
30
30
|
version: z.ZodNumber;
|
|
31
31
|
generalTypeName: z.ZodString;
|
|
32
|
-
attributeValues: z.ZodRecord<z.ZodString, z.
|
|
32
|
+
attributeValues: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
33
33
|
position: z.ZodNumber;
|
|
34
34
|
}, z.core.$strip>>;
|
|
35
35
|
/**
|
|
@@ -43,6 +43,6 @@ export declare const GroupedTemplatesResponseSchema: z.ZodRecord<z.ZodString, z.
|
|
|
43
43
|
identifier: z.ZodString;
|
|
44
44
|
version: z.ZodNumber;
|
|
45
45
|
generalTypeName: z.ZodString;
|
|
46
|
-
attributeValues: z.ZodRecord<z.ZodString, z.
|
|
46
|
+
attributeValues: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
47
47
|
position: z.ZodNumber;
|
|
48
48
|
}, z.core.$strip>>>;
|
|
@@ -6,6 +6,7 @@ exports.GroupedTemplatesResponseSchema = exports.TemplatesResponseSchema = expor
|
|
|
6
6
|
* @description Zod schemas for validating templates-related API responses
|
|
7
7
|
*/
|
|
8
8
|
const zod_1 = require("zod");
|
|
9
|
+
const validation_1 = require("../base/validation");
|
|
9
10
|
/**
|
|
10
11
|
* Template entity schema
|
|
11
12
|
* Includes all fields returned by the API
|
|
@@ -18,7 +19,7 @@ exports.TemplateEntitySchema = zod_1.z.object({
|
|
|
18
19
|
identifier: zod_1.z.string(),
|
|
19
20
|
version: zod_1.z.number(),
|
|
20
21
|
generalTypeName: zod_1.z.string(),
|
|
21
|
-
attributeValues:
|
|
22
|
+
attributeValues: validation_1.AttributeValuesSchema,
|
|
22
23
|
position: zod_1.z.number(),
|
|
23
24
|
});
|
|
24
25
|
/**
|
|
@@ -10,7 +10,7 @@ interface ITemplatesPreviewApi {
|
|
|
10
10
|
* @returns {ITemplatesPreviewEntity[]} A promise resolving to an array of template preview entities or an error.
|
|
11
11
|
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
12
12
|
*/
|
|
13
|
-
getTemplatePreviews(langCode
|
|
13
|
+
getTemplatePreviews(langCode?: string): Promise<ITemplatesPreviewEntity[] | IError>;
|
|
14
14
|
/**
|
|
15
15
|
* Retrieves a specific template preview object by its marker.
|
|
16
16
|
* @handleName getTemplatePreviewByMarker
|
|
@@ -20,7 +20,7 @@ interface ITemplatesPreviewApi {
|
|
|
20
20
|
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
21
21
|
* @description This method retrieves a specific template preview object by its marker.
|
|
22
22
|
*/
|
|
23
|
-
getTemplatePreviewByMarker(marker: string, langCode
|
|
23
|
+
getTemplatePreviewByMarker(marker: string, langCode?: string): Promise<ITemplatesPreviewEntity | IError>;
|
|
24
24
|
}
|
|
25
25
|
/**
|
|
26
26
|
* The `ITemplatesPreview` interface defines the structure of template preview entities.
|
|
@@ -278,6 +278,7 @@ interface IUsersResponse {
|
|
|
278
278
|
}
|
|
279
279
|
* @property {Array<IFormConfig>} [moduleFormConfigs] - Optional array of form configuration objects associated with the user.
|
|
280
280
|
* @property {IRating} [rating] - Rating data.
|
|
281
|
+
* @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.
|
|
281
282
|
* @description Represents a user entity with various properties, including identifiers, form data, and user groups.
|
|
282
283
|
*/
|
|
283
284
|
interface IUserEntity {
|
|
@@ -291,6 +292,7 @@ interface IUserEntity {
|
|
|
291
292
|
state: Record<string, unknown>;
|
|
292
293
|
moduleFormConfigs?: Array<IFormConfig>;
|
|
293
294
|
rating?: IRating;
|
|
295
|
+
distance?: number;
|
|
294
296
|
}
|
|
295
297
|
/**
|
|
296
298
|
* @interface IUserBody
|
|
@@ -18,6 +18,7 @@ export declare const UserResponseSchema: z.ZodObject<{
|
|
|
18
18
|
state: z.ZodRecord<z.ZodString, z.ZodAny>;
|
|
19
19
|
moduleFormConfigs: z.ZodOptional<z.ZodArray<z.ZodAny>>;
|
|
20
20
|
rating: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
21
|
+
distance: z.ZodOptional<z.ZodNumber>;
|
|
21
22
|
}, z.core.$strip>;
|
|
22
23
|
/**
|
|
23
24
|
* Update user response schema (returns true on success)
|
|
@@ -109,6 +109,7 @@ interface IPosition {
|
|
|
109
109
|
}
|
|
110
110
|
]
|
|
111
111
|
* @property {IFormConfig[]} [moduleFormConfigs] - Array of module form configurations associated with the admin.
|
|
112
|
+
* @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.
|
|
112
113
|
* @description This interface captures the essential details and additional attributes of an admin entity.
|
|
113
114
|
*/
|
|
114
115
|
interface IAdminEntity {
|
|
@@ -120,6 +121,7 @@ interface IAdminEntity {
|
|
|
120
121
|
isSync: boolean;
|
|
121
122
|
attributeValues: IAttributeValues;
|
|
122
123
|
moduleFormConfigs?: IFormConfig[];
|
|
124
|
+
distance?: number;
|
|
123
125
|
}
|
|
124
126
|
/**
|
|
125
127
|
* Interface representing a query for fetching admin data.
|
|
@@ -3,6 +3,10 @@
|
|
|
3
3
|
* @description Zod schemas for validating admins-related API responses
|
|
4
4
|
*/
|
|
5
5
|
import { z } from 'zod';
|
|
6
|
+
/**
|
|
7
|
+
* Admin entity schema
|
|
8
|
+
* Includes all fields returned by the API
|
|
9
|
+
*/
|
|
6
10
|
export declare const AdminEntitySchema: z.ZodObject<{
|
|
7
11
|
id: z.ZodNumber;
|
|
8
12
|
attributeSetId: z.ZodNullable<z.ZodNumber>;
|
|
@@ -10,18 +14,9 @@ export declare const AdminEntitySchema: z.ZodObject<{
|
|
|
10
14
|
attributeSetIdentifier: z.ZodNullable<z.ZodString>;
|
|
11
15
|
position: z.ZodNullable<z.ZodNumber>;
|
|
12
16
|
isSync: z.ZodBoolean;
|
|
13
|
-
attributeValues: z.ZodRecord<z.ZodString, z.
|
|
14
|
-
type: string;
|
|
15
|
-
value: unknown;
|
|
16
|
-
position?: number;
|
|
17
|
-
additionalFields?: Record<string, unknown> | unknown[];
|
|
18
|
-
}, unknown, z.core.$ZodTypeInternals<{
|
|
19
|
-
type: string;
|
|
20
|
-
value: unknown;
|
|
21
|
-
position?: number;
|
|
22
|
-
additionalFields?: Record<string, unknown> | unknown[];
|
|
23
|
-
}, unknown>>>>;
|
|
17
|
+
attributeValues: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
24
18
|
moduleFormConfigs: z.ZodOptional<z.ZodArray<z.ZodAny>>;
|
|
19
|
+
distance: z.ZodOptional<z.ZodNumber>;
|
|
25
20
|
}, z.core.$strip>;
|
|
26
21
|
/**
|
|
27
22
|
* Admins response schema (array of admin entities)
|
|
@@ -33,16 +28,7 @@ export declare const AdminsResponseSchema: z.ZodArray<z.ZodObject<{
|
|
|
33
28
|
attributeSetIdentifier: z.ZodNullable<z.ZodString>;
|
|
34
29
|
position: z.ZodNullable<z.ZodNumber>;
|
|
35
30
|
isSync: z.ZodBoolean;
|
|
36
|
-
attributeValues: z.ZodRecord<z.ZodString, z.
|
|
37
|
-
type: string;
|
|
38
|
-
value: unknown;
|
|
39
|
-
position?: number;
|
|
40
|
-
additionalFields?: Record<string, unknown> | unknown[];
|
|
41
|
-
}, unknown, z.core.$ZodTypeInternals<{
|
|
42
|
-
type: string;
|
|
43
|
-
value: unknown;
|
|
44
|
-
position?: number;
|
|
45
|
-
additionalFields?: Record<string, unknown> | unknown[];
|
|
46
|
-
}, unknown>>>>;
|
|
31
|
+
attributeValues: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
47
32
|
moduleFormConfigs: z.ZodOptional<z.ZodArray<z.ZodAny>>;
|
|
33
|
+
distance: z.ZodOptional<z.ZodNumber>;
|
|
48
34
|
}, z.core.$strip>>;
|
|
@@ -3,18 +3,11 @@
|
|
|
3
3
|
* @description Zod schemas for validating admins-related API responses
|
|
4
4
|
*/
|
|
5
5
|
import { z } from 'zod';
|
|
6
|
+
import { AttributeValuesSchema } from '../base/validation.js';
|
|
6
7
|
/**
|
|
7
8
|
* Admin entity schema
|
|
8
9
|
* Includes all fields returned by the API
|
|
9
10
|
*/
|
|
10
|
-
const AttributeValueSchema = z.object({
|
|
11
|
-
type: z.string(),
|
|
12
|
-
value: z.unknown(),
|
|
13
|
-
position: z.number().optional(),
|
|
14
|
-
additionalFields: z
|
|
15
|
-
.union([z.record(z.string(), z.unknown()), z.array(z.unknown())])
|
|
16
|
-
.optional(),
|
|
17
|
-
});
|
|
18
11
|
export const AdminEntitySchema = z.object({
|
|
19
12
|
id: z.number(),
|
|
20
13
|
attributeSetId: z.number().nullable(),
|
|
@@ -22,8 +15,9 @@ export const AdminEntitySchema = z.object({
|
|
|
22
15
|
attributeSetIdentifier: z.string().nullable(),
|
|
23
16
|
position: z.number().nullable(),
|
|
24
17
|
isSync: z.boolean(),
|
|
25
|
-
attributeValues:
|
|
18
|
+
attributeValues: AttributeValuesSchema,
|
|
26
19
|
moduleFormConfigs: z.array(z.any()).optional(),
|
|
20
|
+
distance: z.number().optional(),
|
|
27
21
|
});
|
|
28
22
|
/**
|
|
29
23
|
* Admins response schema (array of admin entities)
|
|
@@ -14,18 +14,18 @@ interface IAttributesSets {
|
|
|
14
14
|
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
15
15
|
* @description This method fetches attributes by a specific marker.
|
|
16
16
|
*/
|
|
17
|
-
getAttributesByMarker(marker: string, langCode
|
|
17
|
+
getAttributesByMarker(marker: string, langCode?: string): Promise<IAttributesSetsEntity[] | IError>;
|
|
18
18
|
/**
|
|
19
|
-
* Fetches a single attribute by
|
|
19
|
+
* Fetches a single attribute by the set marker and the attribute marker.
|
|
20
20
|
* @handleName getSingleAttributeByMarkerSet
|
|
21
|
-
* @param {string}
|
|
22
|
-
* @param {string}
|
|
21
|
+
* @param {string} setMarker - The marker identifying the attribute set — the first path segment. Example: "productAttributes".
|
|
22
|
+
* @param {string} attributeMarker - The marker identifying the attribute inside that set. Example: "color".
|
|
23
23
|
* @param {string} [langCode] - The language code for localization purposes. Default: "en_US".
|
|
24
24
|
* @returns {IAttributesSetsEntity} A promise that resolves to an attribute set entity or an error.
|
|
25
25
|
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
26
|
-
* @description This method fetches a single attribute
|
|
26
|
+
* @description This method fetches a single attribute of an attribute set. The order matches the request path `/{setMarker}/attributes/{attributeMarker}`: the set comes first. Both parameters are strings, so swapping them type-checks and answers `404 Attribute not found`.
|
|
27
27
|
*/
|
|
28
|
-
getSingleAttributeByMarkerSet(
|
|
28
|
+
getSingleAttributeByMarkerSet(setMarker: string, attributeMarker: string, langCode?: string): Promise<IAttributesSetsEntity | IError>;
|
|
29
29
|
}
|
|
30
30
|
/**
|
|
31
31
|
* Represents the structure of a list item.
|
|
@@ -146,6 +146,7 @@ interface IAttributesSetsEntity {
|
|
|
146
146
|
* @property {number} [position] - Sort position of the field inside the set. Optional. Example: 1.
|
|
147
147
|
* @property {IListTitle[]} [listTitles] - Options for `list`/`radioButton`/`entity` fields (with extended data or linked-entity values). Optional.
|
|
148
148
|
* @property {string} [listType] - For `entity` fields — how the option list is organized. Optional. Example: "nested".
|
|
149
|
+
* @property {boolean} [multiselect] - For `list` fields — whether several options from `listTitles` may be selected. Optional. Example: false.
|
|
149
150
|
* @property {string} [moduleIdentifier] - For `entity` fields — identifier of the module the linked entities are taken from. Optional. Example: "catalog".
|
|
150
151
|
* @property {number | null} [parentId] - Identifier of the parent field, `null` for top-level. Optional, seen on `groupOfImages` fields.
|
|
151
152
|
* @property {Record<string, IAttributeSchemaItem>} [additionalFields] - Nested sub-fields keyed by marker. Optional.
|
|
@@ -171,6 +172,7 @@ interface IAttributeSchemaItem {
|
|
|
171
172
|
type: AttributeType;
|
|
172
173
|
position?: number;
|
|
173
174
|
listTitles?: IListTitle[];
|
|
175
|
+
multiselect?: boolean;
|
|
174
176
|
listType?: string;
|
|
175
177
|
moduleIdentifier?: string;
|
|
176
178
|
parentId?: number | null;
|
|
@@ -54,6 +54,7 @@ export declare const UserResponseSchema: z.ZodObject<{
|
|
|
54
54
|
state: z.ZodRecord<z.ZodString, z.ZodAny>;
|
|
55
55
|
moduleFormConfigs: z.ZodOptional<z.ZodArray<z.ZodAny>>;
|
|
56
56
|
rating: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
57
|
+
distance: z.ZodOptional<z.ZodNumber>;
|
|
57
58
|
}, z.core.$strip>;
|
|
58
59
|
/**
|
|
59
60
|
* Auth provider entity schema
|
|
@@ -8,7 +8,7 @@ interface IAuthProvider {
|
|
|
8
8
|
* Registers a new user.
|
|
9
9
|
* @handleName signUp
|
|
10
10
|
* @param {string} marker - The marker identifying the auth provider. Example: "email".
|
|
11
|
-
* @param {ISignUpData}
|
|
11
|
+
* @param {ISignUpData} body - The data required for user registration.
|
|
12
12
|
* @example
|
|
13
13
|
{
|
|
14
14
|
"formIdentifier": "reg",
|
|
@@ -40,7 +40,7 @@ interface IAuthProvider {
|
|
|
40
40
|
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
41
41
|
* @description This method registers a new user.
|
|
42
42
|
*/
|
|
43
|
-
signUp(marker: string,
|
|
43
|
+
signUp(marker: string, body: ISignUpData, langCode?: string): Promise<ISignUpEntity | IError>;
|
|
44
44
|
/**
|
|
45
45
|
* Generates an activation code for a user.
|
|
46
46
|
* @handleName generateCode
|
|
@@ -79,12 +79,12 @@ interface IAuthProvider {
|
|
|
79
79
|
* Authorizes a user.
|
|
80
80
|
* @handleName auth
|
|
81
81
|
* @param {string} marker - The marker identifying the auth provider. Example: "email".
|
|
82
|
-
* @param {IAuthPostBody}
|
|
82
|
+
* @param {IAuthPostBody} body - The data required for user authorization. Example: .
|
|
83
83
|
* @returns {IAuthEntity} A promise that resolves to an auth entity or an error.
|
|
84
84
|
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
85
85
|
* @description This method authorizes a user.
|
|
86
86
|
*/
|
|
87
|
-
auth(marker: string,
|
|
87
|
+
auth(marker: string, body: IAuthPostBody): Promise<IAuthEntity | IError>;
|
|
88
88
|
/**
|
|
89
89
|
* Refreshes a user's access token.
|
|
90
90
|
* @handleName refresh
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import type { IAttributeFile, IAttributeValue, IFileAttributeValue, IListAttributeValue, INumberAttributeValue, IStringAttributeValue } from './utils.js';
|
|
2
|
+
/**
|
|
3
|
+
* Narrows an attribute value to a file-bearing attribute.
|
|
4
|
+
*
|
|
5
|
+
* `IAttributeValue.value` is `unknown` — its shape depends on `type` — so this
|
|
6
|
+
* guard is what lets you reach the files without a cast. It accepts both shapes
|
|
7
|
+
* the SDK produces: a single file object for an `image`/`file` attribute holding
|
|
8
|
+
* exactly one file, an array for several and for every `groupOfImages`.
|
|
9
|
+
* @param {IAttributeValue | undefined} attr - The attribute value to test.
|
|
10
|
+
* @returns {boolean} True when the attribute is an `image`, `file` or `groupOfImages` carrying files (or nothing).
|
|
11
|
+
* @example
|
|
12
|
+
* ```ts
|
|
13
|
+
* const attr = page.attributeValues.cover;
|
|
14
|
+
* if (isFileAttribute(attr)) {
|
|
15
|
+
* // attr.value is IAttributeFile | IAttributeFile[] | null — no cast
|
|
16
|
+
* }
|
|
17
|
+
* ```
|
|
18
|
+
*/
|
|
19
|
+
export declare function isFileAttribute(attr: IAttributeValue | undefined): attr is IFileAttributeValue;
|
|
20
|
+
/**
|
|
21
|
+
* Reads every file of an attribute as an array.
|
|
22
|
+
*
|
|
23
|
+
* The one-call path for the common case. An `image`/`file` attribute holding a
|
|
24
|
+
* single file has it unwrapped to the object itself, while several files and
|
|
25
|
+
* every `groupOfImages` stay an array — a rule that is easy to get wrong in a
|
|
26
|
+
* way the compiler cannot catch, since `value` is `unknown`: reading `value[0]`
|
|
27
|
+
* off a single file yields `undefined` and nothing anywhere reports an error.
|
|
28
|
+
* This helper collapses both shapes to a list.
|
|
29
|
+
*
|
|
30
|
+
* Anything that is not a file-bearing attribute yields an empty array, so it is
|
|
31
|
+
* safe to call on an arbitrary attribute without checking `type` first.
|
|
32
|
+
* @param {IAttributeValue | undefined} attr - An attribute value, e.g. `page.attributeValues.cover`.
|
|
33
|
+
* @returns {IAttributeFile[]} The files, in the order the API returned them; empty when the attribute holds none or is not file-bearing.
|
|
34
|
+
* @example
|
|
35
|
+
* ```ts
|
|
36
|
+
* import { getAttributeFiles } from 'oneentry';
|
|
37
|
+
*
|
|
38
|
+
* // Works the same for one image and for a gallery.
|
|
39
|
+
* const images = getAttributeFiles(page.attributeValues.cover);
|
|
40
|
+
* images.map((file) => file.downloadLink);
|
|
41
|
+
* ```
|
|
42
|
+
*/
|
|
43
|
+
export declare function getAttributeFiles(attr: IAttributeValue | undefined): IAttributeFile[];
|
|
44
|
+
/**
|
|
45
|
+
* Reads the first file of an attribute.
|
|
46
|
+
*
|
|
47
|
+
* The single-image counterpart of {@link getAttributeFiles} — same shape
|
|
48
|
+
* handling, but returns the file itself instead of a list. For a gallery it
|
|
49
|
+
* returns the first entry, which is what a preview or a cover usually needs.
|
|
50
|
+
* @param {IAttributeValue | undefined} attr - An attribute value, e.g. `product.attributeValues.img`.
|
|
51
|
+
* @returns {IAttributeFile | null} The first file, or null when the attribute holds none.
|
|
52
|
+
* @example
|
|
53
|
+
* ```ts
|
|
54
|
+
* import { getAttributeFile } from 'oneentry';
|
|
55
|
+
*
|
|
56
|
+
* const cover = getAttributeFile(product.attributeValues.img);
|
|
57
|
+
* const blurDataURL = cover?.previewLink?.default?.[0];
|
|
58
|
+
* ```
|
|
59
|
+
*/
|
|
60
|
+
export declare function getAttributeFile(attr: IAttributeValue | undefined): IAttributeFile | null;
|
|
61
|
+
/**
|
|
62
|
+
* Narrows an attribute value to a text attribute.
|
|
63
|
+
* @param {IAttributeValue | undefined} attr - The attribute value to test.
|
|
64
|
+
* @returns {boolean} True when the attribute is a `string`, `text` or `textEditor` carrying a string (or nothing).
|
|
65
|
+
*/
|
|
66
|
+
export declare function isStringAttribute(attr: IAttributeValue | undefined): attr is IStringAttributeValue;
|
|
67
|
+
/**
|
|
68
|
+
* Narrows an attribute value to a numeric attribute.
|
|
69
|
+
*
|
|
70
|
+
* The SDK casts `integer`, `float` and `real` values to a JS number, so the
|
|
71
|
+
* guard checks for one — a value that failed to cast is `null`.
|
|
72
|
+
* @param {IAttributeValue | undefined} attr - The attribute value to test.
|
|
73
|
+
* @returns {boolean} True when the attribute is an `integer`, `float` or `real` carrying a number (or nothing).
|
|
74
|
+
*/
|
|
75
|
+
export declare function isNumberAttribute(attr: IAttributeValue | undefined): attr is INumberAttributeValue;
|
|
76
|
+
/**
|
|
77
|
+
* Narrows an attribute value to a `list` attribute.
|
|
78
|
+
*
|
|
79
|
+
* The option shape is defined by the attribute set, so the entries stay
|
|
80
|
+
* `unknown` — the guard only promises the array container.
|
|
81
|
+
* @param {IAttributeValue | undefined} attr - The attribute value to test.
|
|
82
|
+
* @returns {boolean} True when the attribute is a `list` carrying an array.
|
|
83
|
+
*/
|
|
84
|
+
export declare function isListAttribute(attr: IAttributeValue | undefined): attr is IListAttributeValue;
|
|
85
|
+
/**
|
|
86
|
+
* Reads the nested fields of an attribute as a marker map.
|
|
87
|
+
*
|
|
88
|
+
* `additionalFields` is typed `Record<string, IAttributeValue> | unknown[]`
|
|
89
|
+
* because the API returns an empty **array** when an attribute has no nested
|
|
90
|
+
* fields — the union makes every read of a field a type error. This helper
|
|
91
|
+
* collapses that case to an empty map, so the result is always keyed by marker.
|
|
92
|
+
*
|
|
93
|
+
* With `rawData: true` in the config the SDK keeps the API's original array of
|
|
94
|
+
* fields; it is converted here by `marker` as well, so the helper returns the
|
|
95
|
+
* same map in both modes.
|
|
96
|
+
* @param {IAttributeValue | undefined} attr - An attribute value whose nested fields to read.
|
|
97
|
+
* @returns {Record<string, IAttributeValue>} Nested attribute values keyed by marker; empty when there are none.
|
|
98
|
+
* @example
|
|
99
|
+
* ```ts
|
|
100
|
+
* import { getAdditionalFields } from 'oneentry';
|
|
101
|
+
*
|
|
102
|
+
* const alt = getAdditionalFields(page.attributeValues.cover).alt?.value;
|
|
103
|
+
* ```
|
|
104
|
+
*/
|
|
105
|
+
export declare function getAdditionalFields(attr: IAttributeValue | undefined): Record<string, IAttributeValue>;
|