oneentry 1.0.162 → 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 +59 -0
- package/dist/admins/adminsSchemas.d.ts +6 -22
- package/dist/admins/adminsSchemas.js +2 -9
- package/dist/attribute-sets/attributeSetsInterfaces.d.ts +6 -6
- 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 +29 -0
- package/dist/base/validation.js +93 -1
- package/dist/blocks/blocksInterfaces.d.ts +1 -1
- package/dist/blocks/blocksSchemas.d.ts +6 -6
- package/dist/blocks/blocksSchemas.js +2 -1
- package/dist/discounts/discountsInterfaces.d.ts +1 -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 +48 -15
- 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 +1 -1
- package/dist/menus/menusSchemas.js +2 -1
- package/dist/orders/ordersInterfaces.d.ts +1 -1
- package/dist/pages/pagesSchemas.d.ts +3 -3
- package/dist/pages/pagesSchemas.js +2 -1
- 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/esm/admins/adminsSchemas.d.ts +6 -22
- package/esm/admins/adminsSchemas.js +2 -9
- package/esm/attribute-sets/attributeSetsInterfaces.d.ts +6 -6
- 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 +29 -0
- package/esm/base/validation.js +92 -0
- package/esm/blocks/blocksInterfaces.d.ts +1 -1
- package/esm/blocks/blocksSchemas.d.ts +6 -6
- package/esm/blocks/blocksSchemas.js +2 -1
- package/esm/discounts/discountsInterfaces.d.ts +1 -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 +48 -15
- 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 +1 -1
- package/esm/menus/menusSchemas.js +2 -1
- package/esm/orders/ordersInterfaces.d.ts +1 -1
- package/esm/pages/pagesSchemas.d.ts +3 -3
- package/esm/pages/pagesSchemas.js +2 -1
- 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/package.json +2 -2
|
@@ -36,6 +36,35 @@ export declare const AttributeSchema: z.ZodObject<{
|
|
|
36
36
|
}, z.core.$strip>>>;
|
|
37
37
|
value: z.ZodOptional<z.ZodAny>;
|
|
38
38
|
}, z.core.$strip>;
|
|
39
|
+
/**
|
|
40
|
+
* Attribute file schema
|
|
41
|
+
*
|
|
42
|
+
* One file of an `image`, `file` or `groupOfImages` attribute value, as the API
|
|
43
|
+
* returns it — mirrors `IAttributeFile`. Loose: the API may add fields, and a
|
|
44
|
+
* new one is not a reason to report a broken response.
|
|
45
|
+
*/
|
|
46
|
+
export declare const AttributeFileSchema: z.ZodObject<{
|
|
47
|
+
filename: z.ZodString;
|
|
48
|
+
downloadLink: z.ZodString;
|
|
49
|
+
size: z.ZodNumber;
|
|
50
|
+
contentType: z.ZodString;
|
|
51
|
+
previewLink: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodArray<z.ZodString>>>;
|
|
52
|
+
defaultPreview: z.ZodOptional<z.ZodString>;
|
|
53
|
+
}, z.core.$loose>;
|
|
54
|
+
/**
|
|
55
|
+
* Attribute values schema
|
|
56
|
+
*
|
|
57
|
+
* The container the API returns under `attributeValues`. Both nestings are
|
|
58
|
+
* accepted, since the raw response wraps the marker map in a locale
|
|
59
|
+
* (`{ en_US: { marker: attr } }`) while some endpoints return it flat.
|
|
60
|
+
*
|
|
61
|
+
* Attribute values are open by design — what `value` holds is decided by the
|
|
62
|
+
* project's attribute set — so the schema validates the one part the API fixes
|
|
63
|
+
* and the SDK relies on: the shape of files. If a future API release renames or
|
|
64
|
+
* drops a file field, `getAttributeFiles` would silently return nothing;
|
|
65
|
+
* validation (`config.validation.enabled`) reports it instead.
|
|
66
|
+
*/
|
|
67
|
+
export declare const AttributeValuesSchema: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
39
68
|
/**
|
|
40
69
|
* User entity schema
|
|
41
70
|
*/
|
package/dist/base/validation.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.AuthEntitySchema = exports.UserEntitySchema = exports.AttributeSchema = exports.LocalizeInfoSchema = exports.ErrorSchema = void 0;
|
|
3
|
+
exports.AuthEntitySchema = exports.UserEntitySchema = exports.AttributeValuesSchema = exports.AttributeFileSchema = exports.AttributeSchema = exports.LocalizeInfoSchema = exports.ErrorSchema = void 0;
|
|
4
4
|
exports.createPaginatedSchema = createPaginatedSchema;
|
|
5
5
|
exports.validateResponse = validateResponse;
|
|
6
6
|
exports.validateResponseSafe = validateResponseSafe;
|
|
@@ -39,6 +39,98 @@ exports.AttributeSchema = zod_1.z.object({
|
|
|
39
39
|
localizeInfos: zod_1.z.record(zod_1.z.string(), exports.LocalizeInfoSchema).optional(),
|
|
40
40
|
value: zod_1.z.any().optional(),
|
|
41
41
|
});
|
|
42
|
+
/**
|
|
43
|
+
* Attribute file schema
|
|
44
|
+
*
|
|
45
|
+
* One file of an `image`, `file` or `groupOfImages` attribute value, as the API
|
|
46
|
+
* returns it — mirrors `IAttributeFile`. Loose: the API may add fields, and a
|
|
47
|
+
* new one is not a reason to report a broken response.
|
|
48
|
+
*/
|
|
49
|
+
exports.AttributeFileSchema = zod_1.z.looseObject({
|
|
50
|
+
filename: zod_1.z.string(),
|
|
51
|
+
downloadLink: zod_1.z.string(),
|
|
52
|
+
size: zod_1.z.number(),
|
|
53
|
+
contentType: zod_1.z.string(),
|
|
54
|
+
previewLink: zod_1.z.record(zod_1.z.string(), zod_1.z.array(zod_1.z.string())).optional(),
|
|
55
|
+
defaultPreview: zod_1.z.string().optional(),
|
|
56
|
+
});
|
|
57
|
+
/**
|
|
58
|
+
* Attribute types whose value carries files.
|
|
59
|
+
*/
|
|
60
|
+
const FILE_ATTRIBUTE_TYPES = ['image', 'file', 'groupOfImages'];
|
|
61
|
+
/**
|
|
62
|
+
* Reports whether a value is the empty localization map the API sends for an
|
|
63
|
+
* attribute with no value set.
|
|
64
|
+
* @param {unknown} value - The value to test.
|
|
65
|
+
* @returns {boolean} True when the value carries nothing.
|
|
66
|
+
*/
|
|
67
|
+
function isEmptyValue(value) {
|
|
68
|
+
if (value === null || value === undefined)
|
|
69
|
+
return true;
|
|
70
|
+
return (typeof value === 'object' &&
|
|
71
|
+
!Array.isArray(value) &&
|
|
72
|
+
Object.keys(value).length === 0);
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Validates the files of one attribute value, recursing into nested fields.
|
|
76
|
+
*
|
|
77
|
+
* Only file-bearing attributes are inspected. Everything else is left alone:
|
|
78
|
+
* the shape of `value` is defined per attribute type by the project's own
|
|
79
|
+
* attribute set, so a schema cannot describe it — but the file shape is fixed
|
|
80
|
+
* by the API, and the SDK's own helpers (`getAttributeFiles`) depend on it.
|
|
81
|
+
* @param {unknown} node - An attribute value, or a container of them.
|
|
82
|
+
* @param {string[]} path - Path to the node, for issue reporting.
|
|
83
|
+
* @param {z.RefinementCtx} ctx - Zod refinement context issues are added to.
|
|
84
|
+
*/
|
|
85
|
+
function validateAttributeFiles(node, path, ctx) {
|
|
86
|
+
if (!node || typeof node !== 'object')
|
|
87
|
+
return;
|
|
88
|
+
if (Array.isArray(node)) {
|
|
89
|
+
node.forEach((item, index) => validateAttributeFiles(item, [...path, String(index)], ctx));
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
const attr = node;
|
|
93
|
+
const isAttribute = typeof attr.type === 'string' && 'value' in attr;
|
|
94
|
+
if (isAttribute && FILE_ATTRIBUTE_TYPES.includes(attr.type)) {
|
|
95
|
+
if (!isEmptyValue(attr.value)) {
|
|
96
|
+
// The API always sends files as an array; the SDK unwraps a single one
|
|
97
|
+
// afterwards, so both shapes are accepted here.
|
|
98
|
+
const files = Array.isArray(attr.value) ? attr.value : [attr.value];
|
|
99
|
+
files.forEach((file, index) => {
|
|
100
|
+
const result = exports.AttributeFileSchema.safeParse(file);
|
|
101
|
+
if (result.success)
|
|
102
|
+
return;
|
|
103
|
+
result.error.issues.forEach((issue) => ctx.addIssue({
|
|
104
|
+
code: 'custom',
|
|
105
|
+
path: [...path, 'value', index, ...issue.path],
|
|
106
|
+
message: `Attribute of type "${attr.type}" carries an unexpected file shape: ${issue.message}`,
|
|
107
|
+
}));
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
// Nested fields carry attribute values of their own, files included.
|
|
112
|
+
if (isAttribute) {
|
|
113
|
+
validateAttributeFiles(attr.additionalFields, [...path, 'additionalFields'], ctx);
|
|
114
|
+
return;
|
|
115
|
+
}
|
|
116
|
+
Object.entries(attr).forEach(([key, value]) => validateAttributeFiles(value, [...path, key], ctx));
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Attribute values schema
|
|
120
|
+
*
|
|
121
|
+
* The container the API returns under `attributeValues`. Both nestings are
|
|
122
|
+
* accepted, since the raw response wraps the marker map in a locale
|
|
123
|
+
* (`{ en_US: { marker: attr } }`) while some endpoints return it flat.
|
|
124
|
+
*
|
|
125
|
+
* Attribute values are open by design — what `value` holds is decided by the
|
|
126
|
+
* project's attribute set — so the schema validates the one part the API fixes
|
|
127
|
+
* and the SDK relies on: the shape of files. If a future API release renames or
|
|
128
|
+
* drops a file field, `getAttributeFiles` would silently return nothing;
|
|
129
|
+
* validation (`config.validation.enabled`) reports it instead.
|
|
130
|
+
*/
|
|
131
|
+
exports.AttributeValuesSchema = zod_1.z
|
|
132
|
+
.record(zod_1.z.string(), zod_1.z.unknown())
|
|
133
|
+
.superRefine((values, ctx) => validateAttributeFiles(values, [], ctx));
|
|
42
134
|
/**
|
|
43
135
|
* User entity schema
|
|
44
136
|
*/
|
|
@@ -29,7 +29,7 @@ interface IBlocks {
|
|
|
29
29
|
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
30
30
|
* @description This method retrieves a block object by its marker.
|
|
31
31
|
*/
|
|
32
|
-
getBlockByMarker(marker: string, langCode
|
|
32
|
+
getBlockByMarker(marker: string, langCode?: string, offset?: number, limit?: number): Promise<IBlockEntity | IError>;
|
|
33
33
|
/**
|
|
34
34
|
* Performs a quick search for block objects with limited output.
|
|
35
35
|
* @handleName searchBlock
|
|
@@ -12,7 +12,7 @@ export declare const BlockEntitySchema: z.ZodObject<{
|
|
|
12
12
|
type: z.ZodString;
|
|
13
13
|
templateIdentifier: z.ZodNullable<z.ZodString>;
|
|
14
14
|
isVisible: z.ZodBoolean;
|
|
15
|
-
attributeValues: z.ZodRecord<z.ZodString, z.
|
|
15
|
+
attributeValues: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
16
16
|
similarProducts: z.ZodOptional<z.ZodObject<{
|
|
17
17
|
items: z.ZodArray<z.ZodObject<{
|
|
18
18
|
id: z.ZodNumber;
|
|
@@ -30,7 +30,7 @@ export declare const BlockEntitySchema: z.ZodObject<{
|
|
|
30
30
|
}, z.core.$strip>;
|
|
31
31
|
sku: z.ZodNullable<z.ZodString>;
|
|
32
32
|
isSync: z.ZodBoolean;
|
|
33
|
-
attributeValues: z.ZodRecord<z.ZodString, z.
|
|
33
|
+
attributeValues: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
34
34
|
categories: z.ZodArray<z.ZodString>;
|
|
35
35
|
isVisible: z.ZodBoolean;
|
|
36
36
|
moduleFormConfigs: z.ZodOptional<z.ZodArray<z.ZodAny>>;
|
|
@@ -73,7 +73,7 @@ export declare const BlockEntitySchema: z.ZodObject<{
|
|
|
73
73
|
}, z.core.$strip>;
|
|
74
74
|
sku: z.ZodNullable<z.ZodString>;
|
|
75
75
|
isSync: z.ZodBoolean;
|
|
76
|
-
attributeValues: z.ZodRecord<z.ZodString, z.
|
|
76
|
+
attributeValues: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
77
77
|
categories: z.ZodArray<z.ZodString>;
|
|
78
78
|
isVisible: z.ZodBoolean;
|
|
79
79
|
moduleFormConfigs: z.ZodOptional<z.ZodArray<z.ZodAny>>;
|
|
@@ -109,7 +109,7 @@ export declare const BlocksResponseSchema: z.ZodObject<{
|
|
|
109
109
|
type: z.ZodString;
|
|
110
110
|
templateIdentifier: z.ZodNullable<z.ZodString>;
|
|
111
111
|
isVisible: z.ZodBoolean;
|
|
112
|
-
attributeValues: z.ZodRecord<z.ZodString, z.
|
|
112
|
+
attributeValues: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
113
113
|
similarProducts: z.ZodOptional<z.ZodObject<{
|
|
114
114
|
items: z.ZodArray<z.ZodObject<{
|
|
115
115
|
id: z.ZodNumber;
|
|
@@ -127,7 +127,7 @@ export declare const BlocksResponseSchema: 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>>;
|
|
@@ -170,7 +170,7 @@ export declare const BlocksResponseSchema: z.ZodObject<{
|
|
|
170
170
|
}, z.core.$strip>;
|
|
171
171
|
sku: z.ZodNullable<z.ZodString>;
|
|
172
172
|
isSync: z.ZodBoolean;
|
|
173
|
-
attributeValues: z.ZodRecord<z.ZodString, z.
|
|
173
|
+
attributeValues: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
174
174
|
categories: z.ZodArray<z.ZodString>;
|
|
175
175
|
isVisible: z.ZodBoolean;
|
|
176
176
|
moduleFormConfigs: z.ZodOptional<z.ZodArray<z.ZodAny>>;
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.SearchBlocksResponseSchema = exports.SearchBlockSchema = exports.BlocksResponseSchema = exports.BlockEntitySchema = void 0;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
|
+
const validation_1 = require("../base/validation");
|
|
5
6
|
const productsSchemas_1 = require("../products/productsSchemas");
|
|
6
7
|
/**
|
|
7
8
|
* Block entity schema
|
|
@@ -16,7 +17,7 @@ exports.BlockEntitySchema = zod_1.z.object({
|
|
|
16
17
|
type: zod_1.z.string(),
|
|
17
18
|
templateIdentifier: zod_1.z.string().nullable(),
|
|
18
19
|
isVisible: zod_1.z.boolean(),
|
|
19
|
-
attributeValues:
|
|
20
|
+
attributeValues: validation_1.AttributeValuesSchema,
|
|
20
21
|
similarProducts: productsSchemas_1.ProductsResponseSchema.optional(),
|
|
21
22
|
countElementsPerRow: zod_1.z.number().optional(),
|
|
22
23
|
quantity: zod_1.z.number().optional(),
|
|
@@ -29,7 +29,7 @@ interface IDiscountsApi {
|
|
|
29
29
|
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
30
30
|
* @description Fetches a discount by its marker.
|
|
31
31
|
*/
|
|
32
|
-
getDiscountByMarker(marker: string, langCode
|
|
32
|
+
getDiscountByMarker(marker: string, langCode?: string): Promise<IDiscountsEntity | IError>;
|
|
33
33
|
/**
|
|
34
34
|
* Validate discounts coupon
|
|
35
35
|
* @handleName validateDiscountsCoupon
|
|
@@ -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 { IBodyPostFormData, IFormsByMarkerDataEntity, IFormsData, IFormsDataSearchResponse, IFormsDataVectorSearch, IPostFormResponse, IUpdateFormsData } from './formsDataInterfaces';
|
|
4
|
+
import type { IBodyPostFormData, IFormsByMarkerDataEntity, IFormsData, IFormsDataFilter, IFormsDataSearchResponse, IFormsDataVectorSearch, IPostFormResponse, IUpdateFormsData } from './formsDataInterfaces';
|
|
5
5
|
/**
|
|
6
6
|
* Controllers for working with form data
|
|
7
7
|
* @handle /api/content/form-data
|
|
@@ -56,6 +56,7 @@ export default class FormsDataApi extends AsyncModules implements IFormsData {
|
|
|
56
56
|
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
57
57
|
* @returns {Promise<IPostFormResponse | IError>} Returns an object containing the created form data entry and message.
|
|
58
58
|
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
59
|
+
* @description Field values are typed per field type by {@link FormDataType}. For attached files see {@link IImageValue} (`image`, `groupOfImages`) and {@link IFileValue} (`file`) — the shape the endpoint expects, which is **not** what `FileUploading.upload` returns: that object carries `contentType`, which form data rejects. Passing a `File`/`FileList` as the value is also supported — the SDK uploads it first, then strips `contentType` from the resulting value.
|
|
59
60
|
* @see {@link https://js-sdk.oneentry.cloud/docs/forms-data/postFormsData postFormsData} documentation.
|
|
60
61
|
*/
|
|
61
62
|
postFormsData(body: IBodyPostFormData, langCode?: string): Promise<IPostFormResponse | IError>;
|
|
@@ -64,25 +65,34 @@ export default class FormsDataApi extends AsyncModules implements IFormsData {
|
|
|
64
65
|
* @handleName getFormsDataByMarker
|
|
65
66
|
* @param {string} marker - Marker of the form. Example: "contact_form".
|
|
66
67
|
* @param {number} formModuleConfigId - Form module configuration ID. Example: 4.
|
|
67
|
-
* @param {
|
|
68
|
+
* @param {IFormsDataFilter} [body] - Filter for the records to return. Every field is optional; an omitted or empty one is not applied.
|
|
68
69
|
* @example
|
|
69
70
|
{
|
|
70
|
-
"entityIdentifier":
|
|
71
|
-
"
|
|
71
|
+
"entityIdentifier": "blog",
|
|
72
|
+
"parentId": 10,
|
|
72
73
|
"userIdentifier": "",
|
|
73
|
-
"status": ["
|
|
74
|
+
"status": ["moderation", "approved"],
|
|
74
75
|
"dateFrom": "2025-01-01",
|
|
75
76
|
"dateTo": ""
|
|
76
77
|
}
|
|
78
|
+
* @param {string} [body.entityIdentifier] - Text identifier (marker) of the entity the records belong to. Example: "blog".
|
|
79
|
+
* @param {number} [body.parentId] - Identifier of the parent record, to fetch replies to one submission. Example: 10.
|
|
80
|
+
* @param {string} [body.userIdentifier] - Text identifier of the sender. Example: "admin".
|
|
81
|
+
* @param {FormDataStatus[]} [body.status] - Moderation statuses to keep: "sent", "moderation", "approved", "banned", "deleted". Must be an array; anything outside the set is rejected with `400 each value in status must be a valid enum value`. Example: ["approved"].
|
|
82
|
+
* @param {string} [body.dateFrom] - Lower bound of the submission date, `YYYY-MM-DD`. An unparsable value fails the request with a `500`. Example: "2025-01-01".
|
|
83
|
+
* @param {string} [body.dateTo] - Upper bound of the submission date, `YYYY-MM-DD`. Example: "2025-12-31".
|
|
77
84
|
* @param {number} [isExtended] - Flag for getting additional fields. Example: 1.
|
|
78
85
|
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
79
86
|
* @param {number} [offset] - Parameter for pagination. Default: 0.
|
|
80
87
|
* @param {number} [limit] - Parameter for pagination. Default: 30.
|
|
81
88
|
* @returns {Promise<IFormsByMarkerDataEntity | IError>} Returns an object containing the form data or an error object if there was an issue.
|
|
82
89
|
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
90
|
+
* @description Each record's `formData` comes back **already unwrapped from its locale**. The API sends `formData: { "en_US": [ … ] }`; the SDK normalizes the response and hands over the array for `langCode`, so read `record.formData` — `record.formData[langCode]` is `undefined` and yields an empty list with no error. This holds for both values of `isExtended`.
|
|
91
|
+
*
|
|
92
|
+
* The filter body is typed for a reason: the API silently ignores a field it does not know, so a misspelled `statuses` returns every record — unmoderated ones included — and the code looks like it works.
|
|
83
93
|
* @see {@link https://js-sdk.oneentry.cloud/docs/forms-data/getFormsDataByMarker getFormsDataByMarker} documentation.
|
|
84
94
|
*/
|
|
85
|
-
getFormsDataByMarker(marker: string, formModuleConfigId: number, body?:
|
|
95
|
+
getFormsDataByMarker(marker: string, formModuleConfigId: number, body?: IFormsDataFilter, isExtended?: number, langCode?: string, offset?: number, limit?: number): Promise<IFormsByMarkerDataEntity | IError>;
|
|
86
96
|
/**
|
|
87
97
|
* Update one object of form data by id. Requires user authentication.
|
|
88
98
|
* @handleName updateFormsDataByid
|
|
@@ -96,6 +96,7 @@ class FormsDataApi extends asyncModules_1.default {
|
|
|
96
96
|
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
97
97
|
* @returns {Promise<IPostFormResponse | IError>} Returns an object containing the created form data entry and message.
|
|
98
98
|
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
99
|
+
* @description Field values are typed per field type by {@link FormDataType}. For attached files see {@link IImageValue} (`image`, `groupOfImages`) and {@link IFileValue} (`file`) — the shape the endpoint expects, which is **not** what `FileUploading.upload` returns: that object carries `contentType`, which form data rejects. Passing a `File`/`FileList` as the value is also supported — the SDK uploads it first, then strips `contentType` from the resulting value.
|
|
99
100
|
* @see {@link https://js-sdk.oneentry.cloud/docs/forms-data/postFormsData postFormsData} documentation.
|
|
100
101
|
*/
|
|
101
102
|
async postFormsData(body, langCode = this.state.lang) {
|
|
@@ -164,22 +165,31 @@ class FormsDataApi extends asyncModules_1.default {
|
|
|
164
165
|
* @handleName getFormsDataByMarker
|
|
165
166
|
* @param {string} marker - Marker of the form. Example: "contact_form".
|
|
166
167
|
* @param {number} formModuleConfigId - Form module configuration ID. Example: 4.
|
|
167
|
-
* @param {
|
|
168
|
+
* @param {IFormsDataFilter} [body] - Filter for the records to return. Every field is optional; an omitted or empty one is not applied.
|
|
168
169
|
* @example
|
|
169
170
|
{
|
|
170
|
-
"entityIdentifier":
|
|
171
|
-
"
|
|
171
|
+
"entityIdentifier": "blog",
|
|
172
|
+
"parentId": 10,
|
|
172
173
|
"userIdentifier": "",
|
|
173
|
-
"status": ["
|
|
174
|
+
"status": ["moderation", "approved"],
|
|
174
175
|
"dateFrom": "2025-01-01",
|
|
175
176
|
"dateTo": ""
|
|
176
177
|
}
|
|
178
|
+
* @param {string} [body.entityIdentifier] - Text identifier (marker) of the entity the records belong to. Example: "blog".
|
|
179
|
+
* @param {number} [body.parentId] - Identifier of the parent record, to fetch replies to one submission. Example: 10.
|
|
180
|
+
* @param {string} [body.userIdentifier] - Text identifier of the sender. Example: "admin".
|
|
181
|
+
* @param {FormDataStatus[]} [body.status] - Moderation statuses to keep: "sent", "moderation", "approved", "banned", "deleted". Must be an array; anything outside the set is rejected with `400 each value in status must be a valid enum value`. Example: ["approved"].
|
|
182
|
+
* @param {string} [body.dateFrom] - Lower bound of the submission date, `YYYY-MM-DD`. An unparsable value fails the request with a `500`. Example: "2025-01-01".
|
|
183
|
+
* @param {string} [body.dateTo] - Upper bound of the submission date, `YYYY-MM-DD`. Example: "2025-12-31".
|
|
177
184
|
* @param {number} [isExtended] - Flag for getting additional fields. Example: 1.
|
|
178
185
|
* @param {string} [langCode] - Language code. Default: "en_US".
|
|
179
186
|
* @param {number} [offset] - Parameter for pagination. Default: 0.
|
|
180
187
|
* @param {number} [limit] - Parameter for pagination. Default: 30.
|
|
181
188
|
* @returns {Promise<IFormsByMarkerDataEntity | IError>} Returns an object containing the form data or an error object if there was an issue.
|
|
182
189
|
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
190
|
+
* @description Each record's `formData` comes back **already unwrapped from its locale**. The API sends `formData: { "en_US": [ … ] }`; the SDK normalizes the response and hands over the array for `langCode`, so read `record.formData` — `record.formData[langCode]` is `undefined` and yields an empty list with no error. This holds for both values of `isExtended`.
|
|
191
|
+
*
|
|
192
|
+
* The filter body is typed for a reason: the API silently ignores a field it does not know, so a misspelled `statuses` returns every record — unmoderated ones included — and the code looks like it works.
|
|
183
193
|
* @see {@link https://js-sdk.oneentry.cloud/docs/forms-data/getFormsDataByMarker getFormsDataByMarker} documentation.
|
|
184
194
|
*/
|
|
185
195
|
async getFormsDataByMarker(marker, formModuleConfigId, body = {}, isExtended = 0, langCode = this.state.lang, offset = 0, limit = 30) {
|
|
@@ -52,24 +52,24 @@ interface IFormsData {
|
|
|
52
52
|
* @handleName getFormsDataByMarker
|
|
53
53
|
* @param {string} marker - The marker identifying the form data. Example: "contact_form_data".
|
|
54
54
|
* @param {number} formModuleConfigId - The form module configuration ID. Example: 4.
|
|
55
|
-
* @param {
|
|
55
|
+
* @param {IFormsDataFilter} [body] - Filter for the records to return. Default: {}. Every field is optional; an omitted or empty one is not applied. Valid `status` values: "sent", "moderation", "approved", "banned", "deleted".
|
|
56
56
|
* @example
|
|
57
57
|
{
|
|
58
|
-
"entityIdentifier": "
|
|
58
|
+
"entityIdentifier": "blog",
|
|
59
59
|
"userIdentifier": "",
|
|
60
|
-
"status": "",
|
|
60
|
+
"status": ["approved"],
|
|
61
61
|
"dateFrom": "2025-08-11",
|
|
62
62
|
"dateTo": ""
|
|
63
63
|
}
|
|
64
|
-
* @param {number} [
|
|
64
|
+
* @param {number} [isExtended] - Flag for getting additional fields. Example: 1.
|
|
65
65
|
* @param {string} [langCode] - The language code for localization. Default: "en_US".
|
|
66
66
|
* @param {number} [offset] - Optional offset for pagination. Default: 0.
|
|
67
67
|
* @param {number} [limit] - Optional limit for pagination. Default: 30.
|
|
68
68
|
* @returns {IFormsByMarkerDataEntity} A promise that resolves to a form data entity or an error.
|
|
69
69
|
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
70
|
-
* @description This method retrieves form data by its marker.
|
|
70
|
+
* @description This method retrieves form data by its marker. Each record's `formData` is returned **already unwrapped from its locale**: the API sends `{ "en_US": [ … ] }`, the SDK hands over the array for `langCode` — read `record.formData`, not `record.formData[langCode]`.
|
|
71
71
|
*/
|
|
72
|
-
getFormsDataByMarker(marker: string, formModuleConfigId: number, body?:
|
|
72
|
+
getFormsDataByMarker(marker: string, formModuleConfigId: number, body?: IFormsDataFilter, isExtended?: number, langCode?: string, offset?: number, limit?: number): Promise<IFormsByMarkerDataEntity | IError>;
|
|
73
73
|
/**
|
|
74
74
|
* Semantic (vector) search for form data.
|
|
75
75
|
* @handleName getFormsDataByVectorSearch
|
|
@@ -97,6 +97,39 @@ interface IFormsDataVectorSearch {
|
|
|
97
97
|
maxHits?: number;
|
|
98
98
|
debug?: boolean;
|
|
99
99
|
}
|
|
100
|
+
/**
|
|
101
|
+
* FormDataStatus — moderation status of a form data record.
|
|
102
|
+
*
|
|
103
|
+
* The set the API accepts and returns: a submission arrives as `sent`, may be
|
|
104
|
+
* routed to `moderation`, and ends up `approved`, `banned` or `deleted`. Any
|
|
105
|
+
* other value is rejected with `400 each value in status must be a valid enum
|
|
106
|
+
* value` — an error that does not list the valid ones.
|
|
107
|
+
*/
|
|
108
|
+
type FormDataStatus = 'sent' | 'moderation' | 'approved' | 'banned' | 'deleted';
|
|
109
|
+
/**
|
|
110
|
+
* Represents the filter body of `getFormsDataByMarker`.
|
|
111
|
+
* @interface IFormsDataFilter
|
|
112
|
+
* @property {string} [entityIdentifier] - Text identifier (marker) of the entity the records belong to; an empty string means "no filter". Example: "blog".
|
|
113
|
+
* @property {number} [parentId] - Identifier of the parent record — the way to fetch replies to one comment. Example: 10.
|
|
114
|
+
* @property {string} [userIdentifier] - Text identifier of the sender; an empty string means "no filter". Example: "admin".
|
|
115
|
+
* @property {FormDataStatus[]} [status] - Moderation statuses to keep. Must be an array — a bare string is rejected with `400`. An empty array means "no filter". Example: ["approved"].
|
|
116
|
+
* @property {string} [dateFrom] - Lower bound of the submission date, `YYYY-MM-DD`; an empty string means "no bound". A value the API cannot parse fails the request with a `500`. Example: "2025-01-01".
|
|
117
|
+
* @property {string} [dateTo] - Upper bound of the submission date, `YYYY-MM-DD`; an empty string means "no bound". Example: "2025-12-31".
|
|
118
|
+
* @description Filter for reading form submissions. Every field is optional and an omitted one is simply not applied.
|
|
119
|
+
*
|
|
120
|
+
* Typed rather than left as `object` on purpose: the API **ignores** a field it
|
|
121
|
+
* does not know, so `statuses: ['approved']` (note the "s") is not an error —
|
|
122
|
+
* it returns every record, unmoderated ones included. That is premoderation
|
|
123
|
+
* leaking onto a public page, from one typo the compiler used to accept.
|
|
124
|
+
*/
|
|
125
|
+
interface IFormsDataFilter {
|
|
126
|
+
entityIdentifier?: string;
|
|
127
|
+
parentId?: number;
|
|
128
|
+
userIdentifier?: string;
|
|
129
|
+
status?: FormDataStatus[];
|
|
130
|
+
dateFrom?: string;
|
|
131
|
+
dateTo?: string;
|
|
132
|
+
}
|
|
100
133
|
/**
|
|
101
134
|
* Represents a form data record returned by the vector search endpoint.
|
|
102
135
|
* @interface IFormDataSearchEntity
|
|
@@ -118,7 +151,7 @@ interface IFormsDataVectorSearch {
|
|
|
118
151
|
* @property {string} [ip] - IP address the form was submitted from. Example: "127.0.0.1".
|
|
119
152
|
* @property {string} [fingerprint] - Device fingerprint of the sender. Example: "UQ_123456_abcdef".
|
|
120
153
|
* @property {boolean} [isUserAdmin] - Whether the record was submitted by an admin. Example: false.
|
|
121
|
-
* @property {
|
|
154
|
+
* @property {FormDataStatus} [status] - Moderation status of the record. Example: "sent".
|
|
122
155
|
* @property {number} [formModuleId] - Identifier of the form module the record belongs to. Example: 2.
|
|
123
156
|
* @property {number} [distance] - Cosine distance to the query. Returned only when `debug: true` is passed in the search body. Example: 0.12.
|
|
124
157
|
* @description This interface defines a form data record as returned by the semantic (vector) search endpoint. Unlike IFormDataEntity it carries the moderation and sender fields of the raw record.
|
|
@@ -134,7 +167,7 @@ interface IFormDataSearchEntity {
|
|
|
134
167
|
ip?: string;
|
|
135
168
|
fingerprint?: string;
|
|
136
169
|
isUserAdmin?: boolean;
|
|
137
|
-
status?:
|
|
170
|
+
status?: FormDataStatus;
|
|
138
171
|
formModuleId?: number;
|
|
139
172
|
distance?: number;
|
|
140
173
|
}
|
|
@@ -154,7 +187,7 @@ interface IFormsDataSearchResponse {
|
|
|
154
187
|
* @property {number} id - The unique identifier of the form page. Example: 12345.
|
|
155
188
|
* @property {string} formIdentifier - The identifier of the page. Example: "contact_form".
|
|
156
189
|
* @property {Date | string} time - The identifier of the form. Example: "2023-10-01T12:00:00Z".
|
|
157
|
-
* @property {FormDataType[]} formData -
|
|
190
|
+
* @property {FormDataType[]} formData - Submitted fields, **already unwrapped from the locale**: the API returns `{ "en_US": [ … ] }` and the SDK hands over the array for the requested `langCode`.
|
|
158
191
|
* @example
|
|
159
192
|
[
|
|
160
193
|
{
|
|
@@ -206,9 +239,9 @@ interface IFormsDataEntity {
|
|
|
206
239
|
* @property {number} depth - Example: 1.
|
|
207
240
|
* @property {string | null} ip - Ip. Example: '127.0.0.1'.
|
|
208
241
|
* @property {string | null} fingerprint - Fingerprint. Example: 'fingerprint'.
|
|
209
|
-
* @property {string | null} status -
|
|
242
|
+
* @property {string | null} status - Moderation status of the record: "sent", "moderation", "approved", "banned" or "deleted"; `null` when the form does not moderate. Example: 'approved'.
|
|
210
243
|
* @property {string | null} userIdentifier - Text identifier (marker) of the user. Example: "admin".
|
|
211
|
-
* @property {FormDataType[]} formData -
|
|
244
|
+
* @property {FormDataType[]} formData - Submitted fields, **already unwrapped from the locale**: the API returns `{ "en_US": [ … ] }` and the SDK hands over the array for the requested `langCode`. Read `formData` directly — `formData[langCode]` is `undefined`.
|
|
212
245
|
* @example
|
|
213
246
|
[
|
|
214
247
|
{
|
|
@@ -547,7 +580,7 @@ interface ITextWithHeaderValue {
|
|
|
547
580
|
* Represents an image or group of images form data entity.
|
|
548
581
|
* @interface IBodyTypeImageGroupOfImages
|
|
549
582
|
* @property {string} marker - marker name. Example: "avatar".
|
|
550
|
-
* @property {'image' | '
|
|
583
|
+
* @property {'image' | 'groupOfImages'} type - Type value — must match the attribute type in the set, note the plural in "groupOfImages". Example: "image".
|
|
551
584
|
* @property {object} value - Image Object. Contains image information.
|
|
552
585
|
* @example
|
|
553
586
|
[
|
|
@@ -565,7 +598,7 @@ interface ITextWithHeaderValue {
|
|
|
565
598
|
*/
|
|
566
599
|
interface IBodyTypeImageGroupOfImages {
|
|
567
600
|
marker: string;
|
|
568
|
-
type: 'image' | '
|
|
601
|
+
type: 'image' | 'groupOfImages';
|
|
569
602
|
value: IImageValue | IImageValue[];
|
|
570
603
|
}
|
|
571
604
|
/**
|
|
@@ -583,7 +616,7 @@ interface IImageValueParams {
|
|
|
583
616
|
* @property {number} size - File size in bytes. Example: 392585.
|
|
584
617
|
* @property {string} previewLink - URL to a preview-sized version (may be empty).
|
|
585
618
|
* @property {IImageValueParams} params - Image-specific parameters.
|
|
586
|
-
* @description Value payload for `image`/`
|
|
619
|
+
* @description Value payload for `image`/`groupOfImages` form fields. Note it is **not** the object `FileUploading.upload` returns: that one carries `contentType`, which the form-data endpoint rejects. Build the value from `filename`, `downloadLink`, `size` and `previewLink` (the SDK also strips `contentType` from an image value passed to `postFormsData`).
|
|
587
620
|
*/
|
|
588
621
|
interface IImageValue {
|
|
589
622
|
filename: string;
|
|
@@ -671,4 +704,4 @@ interface IListOptionValue {
|
|
|
671
704
|
value: string;
|
|
672
705
|
extended: IListOptionExtended;
|
|
673
706
|
}
|
|
674
|
-
export type { FormDataType, IBodyPostFormData, IBodyTypeFile, IBodyTypeImageGroupOfImages, IBodyTypeRadioButtonList, IBodyTypeStringNumberFloat, IBodyTypeText, IBodyTypeTextWithHeader, IBodyTypeTimeDate, IFileValue, IFormByMarkerDataEntity, IFormDataEntity, IFormDataSearchEntity, IFormsByMarkerDataEntity, IFormsData, IFormsDataEntity, IFormsDataSearchResponse, IFormsDataVectorSearch, IImageValue, IImageValueParams, IListOptionExtended, IListOptionValue, IPostFormResponse, IPostFormResponseData, ITextEditorParams, ITextValue, ITextWithHeaderValue, ITimeDateValue, IUpdateFormsData, };
|
|
707
|
+
export type { FormDataStatus, FormDataType, IBodyPostFormData, IBodyTypeFile, IBodyTypeImageGroupOfImages, IBodyTypeRadioButtonList, IBodyTypeStringNumberFloat, IBodyTypeText, IBodyTypeTextWithHeader, IBodyTypeTimeDate, IFileValue, IFormByMarkerDataEntity, IFormDataEntity, IFormDataSearchEntity, IFormsByMarkerDataEntity, IFormsData, IFormsDataEntity, IFormsDataFilter, IFormsDataSearchResponse, IFormsDataVectorSearch, IImageValue, IImageValueParams, IListOptionExtended, IListOptionValue, IPostFormResponse, IPostFormResponseData, ITextEditorParams, ITextValue, ITextWithHeaderValue, ITimeDateValue, IUpdateFormsData, };
|
package/dist/index.d.ts
CHANGED
|
@@ -30,6 +30,7 @@ import TemplatePreviewsApi from './templates-preview/templatesPreviewApi';
|
|
|
30
30
|
import UserActivityApi from './user-activity/userActivityApi';
|
|
31
31
|
import UsersApi from './users/usersApi';
|
|
32
32
|
import WsApi from './web-socket/wsApi';
|
|
33
|
+
export { getAdditionalFields, getAttributeFile, getAttributeFiles, isFileAttribute, isListAttribute, isNumberAttribute, isStringAttribute, } from './base/attributes';
|
|
33
34
|
export { expandAttributeTimeIntervals, expandTimeIntervals, isTimeIntervalAttribute, } from './base/timeIntervals';
|
|
34
35
|
export type * from './types';
|
|
35
36
|
/**
|
package/dist/index.js
CHANGED
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.isTimeIntervalAttribute = exports.expandTimeIntervals = exports.expandAttributeTimeIntervals = void 0;
|
|
6
|
+
exports.isTimeIntervalAttribute = exports.expandTimeIntervals = exports.expandAttributeTimeIntervals = exports.isStringAttribute = exports.isNumberAttribute = exports.isListAttribute = exports.isFileAttribute = exports.getAttributeFiles = exports.getAttributeFile = exports.getAdditionalFields = void 0;
|
|
7
7
|
exports.defineOneEntry = defineOneEntry;
|
|
8
8
|
/**
|
|
9
9
|
* OneEntry SDK
|
|
@@ -37,6 +37,14 @@ const templatesPreviewApi_1 = __importDefault(require("./templates-preview/templ
|
|
|
37
37
|
const userActivityApi_1 = __importDefault(require("./user-activity/userActivityApi"));
|
|
38
38
|
const usersApi_1 = __importDefault(require("./users/usersApi"));
|
|
39
39
|
const wsApi_1 = __importDefault(require("./web-socket/wsApi"));
|
|
40
|
+
var attributes_1 = require("./base/attributes");
|
|
41
|
+
Object.defineProperty(exports, "getAdditionalFields", { enumerable: true, get: function () { return attributes_1.getAdditionalFields; } });
|
|
42
|
+
Object.defineProperty(exports, "getAttributeFile", { enumerable: true, get: function () { return attributes_1.getAttributeFile; } });
|
|
43
|
+
Object.defineProperty(exports, "getAttributeFiles", { enumerable: true, get: function () { return attributes_1.getAttributeFiles; } });
|
|
44
|
+
Object.defineProperty(exports, "isFileAttribute", { enumerable: true, get: function () { return attributes_1.isFileAttribute; } });
|
|
45
|
+
Object.defineProperty(exports, "isListAttribute", { enumerable: true, get: function () { return attributes_1.isListAttribute; } });
|
|
46
|
+
Object.defineProperty(exports, "isNumberAttribute", { enumerable: true, get: function () { return attributes_1.isNumberAttribute; } });
|
|
47
|
+
Object.defineProperty(exports, "isStringAttribute", { enumerable: true, get: function () { return attributes_1.isStringAttribute; } });
|
|
40
48
|
var timeIntervals_1 = require("./base/timeIntervals");
|
|
41
49
|
Object.defineProperty(exports, "expandAttributeTimeIntervals", { enumerable: true, get: function () { return timeIntervals_1.expandAttributeTimeIntervals; } });
|
|
42
50
|
Object.defineProperty(exports, "expandTimeIntervals", { enumerable: true, get: function () { return timeIntervals_1.expandTimeIntervals; } });
|
|
@@ -24,7 +24,7 @@ interface ICollectionsApi {
|
|
|
24
24
|
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
25
25
|
* @description This method gets all collections.
|
|
26
26
|
*/
|
|
27
|
-
getICollections(langCode
|
|
27
|
+
getICollections(langCode?: string, userQuery?: ICollectionQuery): Promise<ICollectionEntity[] | IError>;
|
|
28
28
|
/**
|
|
29
29
|
* Get a single collection object by id.
|
|
30
30
|
* @handleName getICollectionById
|
|
@@ -34,7 +34,7 @@ interface ICollectionsApi {
|
|
|
34
34
|
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
35
35
|
* @description This method gets a single collection object by id.
|
|
36
36
|
*/
|
|
37
|
-
getICollectionById(id: number, langCode
|
|
37
|
+
getICollectionById(id: number, langCode?: string): Promise<ICollectionEntity | IError>;
|
|
38
38
|
/**
|
|
39
39
|
* Get all records belonging to the collection by collection id.
|
|
40
40
|
* @handleName getICollectionRowsById
|
|
@@ -56,7 +56,7 @@ interface ICollectionsApi {
|
|
|
56
56
|
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
57
57
|
* @description This method gets all records belonging to the collection by collection id.
|
|
58
58
|
*/
|
|
59
|
-
getICollectionRowsById(id: number, langCode
|
|
59
|
+
getICollectionRowsById(id: number, langCode?: string, userQuery?: ICollectionQuery): Promise<ICollectionRowsResponce | IError>;
|
|
60
60
|
/**
|
|
61
61
|
* Check for the existence of a text identifier (marker).
|
|
62
62
|
* @handleName validateICollectionMarker
|
|
@@ -90,7 +90,7 @@ interface ICollectionsApi {
|
|
|
90
90
|
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
91
91
|
* @description This method gets one record from the collection.
|
|
92
92
|
*/
|
|
93
|
-
getICollectionRowByMarkerAndId(marker: string, id: number, langCode
|
|
93
|
+
getICollectionRowByMarkerAndId(marker: string, id: number, langCode?: string): Promise<ICollectionRow | IError>;
|
|
94
94
|
/**
|
|
95
95
|
* Create a record in the collection.
|
|
96
96
|
* @handleName createICollectionRow
|
|
@@ -112,7 +112,7 @@ interface ICollectionsApi {
|
|
|
112
112
|
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
113
113
|
* @description This method creates a record in the collection.
|
|
114
114
|
*/
|
|
115
|
-
createICollectionRow(marker: string, body: ICollectionFormObject, langCode
|
|
115
|
+
createICollectionRow(marker: string, body: ICollectionFormObject, langCode?: string): Promise<ICollectionRow | IError>;
|
|
116
116
|
/**
|
|
117
117
|
* Edit a record in the collection.
|
|
118
118
|
* @handleName updateICollectionRow
|
|
@@ -135,7 +135,7 @@ interface ICollectionsApi {
|
|
|
135
135
|
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
136
136
|
* @description This method edits a record in the collection.
|
|
137
137
|
*/
|
|
138
|
-
updateICollectionRow(marker: string, id: number, body: ICollectionFormObject, langCode
|
|
138
|
+
updateICollectionRow(marker: string, id: number, body: ICollectionFormObject, langCode?: string): Promise<ICollectionRow | IError>;
|
|
139
139
|
/**
|
|
140
140
|
* Deletion of collection record object
|
|
141
141
|
* @handleName deleteICollectionRowByMarkerAndId
|
|
@@ -13,7 +13,7 @@ interface IMenus {
|
|
|
13
13
|
* @throws {IError} - If there is an error during the fetch operation, it will return an error object.
|
|
14
14
|
* @description This method gets pages includes in menu by marker.
|
|
15
15
|
*/
|
|
16
|
-
getMenusByMarker(marker: string, langCode
|
|
16
|
+
getMenusByMarker(marker: string, langCode?: string): Promise<IMenusEntity | IError>;
|
|
17
17
|
}
|
|
18
18
|
/**
|
|
19
19
|
* @interface IMenusPages
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.MenuEntitySchema = exports.MenusPagesSchema = void 0;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
|
+
const validation_1 = require("../base/validation");
|
|
5
6
|
/**
|
|
6
7
|
* Menu pages schema (recursive)
|
|
7
8
|
* Can have children that are also menu pages
|
|
@@ -12,7 +13,7 @@ exports.MenusPagesSchema = zod_1.z.lazy(() => zod_1.z.object({
|
|
|
12
13
|
id: zod_1.z.number().nullable(),
|
|
13
14
|
pageUrl: zod_1.z.string().nullable(),
|
|
14
15
|
localizeInfos: zod_1.z.record(zod_1.z.string(), zod_1.z.any()),
|
|
15
|
-
attributeValues:
|
|
16
|
+
attributeValues: validation_1.AttributeValuesSchema,
|
|
16
17
|
position: zod_1.z.number(),
|
|
17
18
|
parentId: zod_1.z.number().nullable(),
|
|
18
19
|
parentType: zod_1.z.enum(['page', 'custom']).nullable().optional(),
|
|
@@ -132,7 +132,7 @@ interface IOrdersApi {
|
|
|
132
132
|
* @throws {IError} When isShell=false and an error occurs during the fetch
|
|
133
133
|
* @see For more information about configuring the {@link https://js-sdk.oneentry.cloud/docs/category/authprovider authorization module}, see the documentation in the {@link https://js-sdk.oneentry.cloud/docs/category/authprovider configuration settings section of the SDK}.
|
|
134
134
|
*/
|
|
135
|
-
getAllStatusesByStorageMarker(marker: string, langCode
|
|
135
|
+
getAllStatusesByStorageMarker(marker: string, langCode?: string, offset?: number, limit?: number): Promise<IOrderStatus[] | IError>;
|
|
136
136
|
/**
|
|
137
137
|
* Get all refund requests for an order.
|
|
138
138
|
* @handleName getOrderRefunds
|
|
@@ -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;
|
|
@@ -54,7 +54,7 @@ export declare const PagesResponseSchema: z.ZodArray<z.ZodObject<{
|
|
|
54
54
|
}>;
|
|
55
55
|
templateIdentifier: z.ZodNullable<z.ZodString>;
|
|
56
56
|
attributeSetIdentifier: z.ZodNullable<z.ZodString>;
|
|
57
|
-
attributeValues: z.ZodRecord<z.ZodString, z.
|
|
57
|
+
attributeValues: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
58
58
|
moduleFormConfigs: z.ZodOptional<z.ZodArray<z.ZodAny>>;
|
|
59
59
|
rating: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
60
60
|
isSync: z.ZodBoolean;
|
|
@@ -101,7 +101,7 @@ export declare const SinglePageSchema: z.ZodObject<{
|
|
|
101
101
|
}>;
|
|
102
102
|
templateIdentifier: z.ZodNullable<z.ZodString>;
|
|
103
103
|
attributeSetIdentifier: z.ZodNullable<z.ZodString>;
|
|
104
|
-
attributeValues: z.ZodRecord<z.ZodString, z.
|
|
104
|
+
attributeValues: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
105
105
|
moduleFormConfigs: z.ZodOptional<z.ZodArray<z.ZodAny>>;
|
|
106
106
|
rating: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
107
107
|
isSync: z.ZodBoolean;
|