oneentry 1.0.170 → 1.0.172

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.
Files changed (72) hide show
  1. package/changelog.md +40 -0
  2. package/dist/admins/adminsApi.d.ts +3 -3
  3. package/dist/admins/adminsApi.js +1 -1
  4. package/dist/admins/adminsInterfaces.d.ts +3 -3
  5. package/dist/base/asyncModules.d.ts +6 -1
  6. package/dist/base/asyncModules.js +9 -1
  7. package/dist/base/utils.d.ts +11 -1
  8. package/dist/blocks/blocksApi.d.ts +1 -1
  9. package/dist/blocks/blocksApi.js +1 -1
  10. package/dist/blocks/blocksInterfaces.d.ts +4 -2
  11. package/dist/discounts/discountsApi.d.ts +3 -3
  12. package/dist/discounts/discountsApi.js +1 -1
  13. package/dist/discounts/discountsInterfaces.d.ts +3 -3
  14. package/dist/events/eventsApi.d.ts +1 -1
  15. package/dist/events/eventsApi.js +1 -2
  16. package/dist/file-uploading/fileUploadingApi.d.ts +1 -1
  17. package/dist/file-uploading/fileUploadingApi.js +4 -3
  18. package/dist/file-uploading/fileUploadingInterfaces.d.ts +1 -1
  19. package/dist/forms-data/formsDataApi.d.ts +28 -4
  20. package/dist/forms-data/formsDataApi.js +66 -15
  21. package/dist/forms-data/formsDataInterfaces.d.ts +13 -9
  22. package/dist/general-types/generalTypesSchemas.d.ts +0 -2
  23. package/dist/general-types/generalTypesSchemas.js +0 -1
  24. package/dist/orders/ordersApi.d.ts +16 -3
  25. package/dist/orders/ordersApi.js +25 -15
  26. package/dist/orders/ordersInterfaces.d.ts +3 -3
  27. package/dist/pages/pagesApi.d.ts +4 -4
  28. package/dist/pages/pagesApi.js +9 -13
  29. package/dist/pages/pagesInterfaces.d.ts +3 -3
  30. package/dist/products/productsApi.d.ts +7 -6
  31. package/dist/products/productsApi.js +6 -3
  32. package/dist/products/productsInterfaces.d.ts +14 -9
  33. package/dist/user-activity/userActivityApi.js +4 -7
  34. package/dist/users/usersApi.d.ts +3 -3
  35. package/dist/users/usersApi.js +1 -1
  36. package/dist/users/usersInterfaces.d.ts +3 -3
  37. package/esm/admins/adminsApi.d.ts +3 -3
  38. package/esm/admins/adminsApi.js +1 -1
  39. package/esm/admins/adminsInterfaces.d.ts +3 -3
  40. package/esm/base/asyncModules.d.ts +6 -1
  41. package/esm/base/asyncModules.js +9 -1
  42. package/esm/base/utils.d.ts +11 -1
  43. package/esm/blocks/blocksApi.d.ts +1 -1
  44. package/esm/blocks/blocksApi.js +1 -1
  45. package/esm/blocks/blocksInterfaces.d.ts +4 -2
  46. package/esm/discounts/discountsApi.d.ts +3 -3
  47. package/esm/discounts/discountsApi.js +1 -1
  48. package/esm/discounts/discountsInterfaces.d.ts +3 -3
  49. package/esm/events/eventsApi.d.ts +1 -1
  50. package/esm/events/eventsApi.js +1 -2
  51. package/esm/file-uploading/fileUploadingApi.d.ts +1 -1
  52. package/esm/file-uploading/fileUploadingApi.js +4 -3
  53. package/esm/file-uploading/fileUploadingInterfaces.d.ts +1 -1
  54. package/esm/forms-data/formsDataApi.d.ts +28 -4
  55. package/esm/forms-data/formsDataApi.js +66 -15
  56. package/esm/forms-data/formsDataInterfaces.d.ts +13 -9
  57. package/esm/general-types/generalTypesSchemas.d.ts +0 -2
  58. package/esm/general-types/generalTypesSchemas.js +0 -1
  59. package/esm/orders/ordersApi.d.ts +16 -3
  60. package/esm/orders/ordersApi.js +25 -15
  61. package/esm/orders/ordersInterfaces.d.ts +3 -3
  62. package/esm/pages/pagesApi.d.ts +4 -4
  63. package/esm/pages/pagesApi.js +9 -13
  64. package/esm/pages/pagesInterfaces.d.ts +3 -3
  65. package/esm/products/productsApi.d.ts +7 -6
  66. package/esm/products/productsApi.js +6 -3
  67. package/esm/products/productsInterfaces.d.ts +14 -9
  68. package/esm/user-activity/userActivityApi.js +4 -7
  69. package/esm/users/usersApi.d.ts +3 -3
  70. package/esm/users/usersApi.js +1 -1
  71. package/esm/users/usersInterfaces.d.ts +3 -3
  72. package/package.json +2 -2
package/changelog.md CHANGED
@@ -1,5 +1,45 @@
1
1
  # SDK Change Log
2
2
 
3
+ ## v.1.0.172
4
+
5
+ ### What's Fixed
6
+
7
+ - **`Orders.createOrder`, `Orders.updateOrderByMarkerAndId` and `FormData.postFormsData` no longer modify the body they are given.** All three wrapped `formData` into `{ [langCode]: [...] }` and wrote the result back into the caller's object (`body.formData = formData`) — the same class of defect 1.0.168 fixed in `_normalizePostBody`, in three methods that wrap on their own. A reused body (a retry, a shared template, form state passed by reference) was wrapped a second time: `createOrder` and `postFormsData` answered `400 formData's marker '#0' marker is required`, and `updateOrderByMarkerAndId` answered **`200` and stored the broken `formData` in the order**. The wrapped value now goes into a new body. `postFormsData` also processed file fields in place — it replaced the caller's `File` with the upload result, deleted `fileQuery` and stripped `contentType` from a descriptor passed through — and now works on copies of those fields too (CMS-1063, CMS-1071).
8
+
9
+ - **`UserActivity.trackUserActivity` returned `true` for a refused event.** With `isShell` on — the default — the API error came back as a value nobody inspected, so a `400 type must be a valid enum value` read as "recorded"; with `isShell` off the thrown error was caught and returned, while the JSDoc promises a throw. The method now goes through `_fetchBoolean`: `true` on the `204`, the `IError` otherwise, thrown when `isShell` is off (CMS-1064).
10
+
11
+ - **Methods built on `_fetchBoolean` threw nothing when `isShell` was off.** `Events.subscribeByMarker`, `unsubscribeByMarker`, `subscribeToForm`, `unsubscribeFromForm`, `Subscriptions.cancelSubscription` and `recoverSubscriptions` caught the error `browserResponse` throws in that mode and returned it, so a `try/catch` around them never fired and `if (result)` took the error object for success. The helper now rethrows when `isShell` is off, as every other method does. The JSDoc of `unsubscribeByMarker` said `Promise<any | IError>` and now matches the signature (CMS-1067).
12
+
13
+ - **`Pages.searchPage` searched only the default language.** The method sent `lang=` where the endpoint reads `langCode`, and the endpoint treats an unknown parameter as no language at all. On a bilingual stand `searchPage('Блог', undefined, 'ru_RU')` came back empty, while `searchPage('Blog', undefined, 'ru_RU')` found the English titles and then loaded them in `ru_RU`: the pages missing in that locale answered `404`, and those errors were returned as elements of the `IPagesEntity[]` array. The parameter is `langCode` now, a found page that cannot be loaded is left out of the result, and the result keeps the order of the search instead of the order the requests finished in (CMS-1068).
14
+
15
+ - **`FileUploading.delete` resolved to `{}` on success, not to the declared `boolean`.** The endpoint answers `200` with an empty body, which the parser reads as `{}`. The method now returns `true`, so `=== true` and `typeof result === 'boolean'` work as the type says (CMS-1072).
16
+
17
+ ### What's Changed
18
+
19
+ - **`Products.getProductsEmptyPage` returns `IProductsResponse`.** It was declared as `IAggregatedProductGroup[]`, but the endpoint answers `{ items, total }` — the same container as `getProducts` — and the SDK never converted it, so `result.map(...)` compiled and failed at run time. The response is now validated with the same schema as `getProducts` when validation is on. `IAggregatedProductGroup` is kept for existing imports and marked deprecated: no method returns it (CMS-1065).
20
+
21
+ - **`indexReady` is declared on all seven vector search responses.** The platform answers every `…/vector/search` with `indexReady`: `false` means the index for that entity and language is not built yet and empty `items` do not mean "nothing matched". The SDK passed the field through but no type declared it. The new `IVectorSearchResponse<T>` adds it to the module's own container, and `getUsersByVectorSearch`, `getProductsByVectorSearch`, `getPagesByVectorSearch`, `getOrdersByVectorSearch`, `getDiscountsByVectorSearch`, `getAdminsByVectorSearch` and `getFormsDataByVectorSearch` return it. It is assignable to the container they declared before, so existing code compiles unchanged (CMS-1074).
22
+
23
+ - **Products query types follow what the endpoint accepts.** `IProductsQueryBase.sortKey` takes `'status'`, which the endpoint sorts by and the type refused; `IProductsRelatedQuery` declares `relationMode: 'global' | 'local'` of `GET /products/{id}/related`; the JSDoc example of `IFilterParams.conditionMarker` was `"equals"`, which answers `400 filter.0.conditionMarker must be a valid enum value`, and is `"eq"` now (CMS-1066).
24
+
25
+ - **`BlockType` no longer includes `'none'`.** The platform has no such type — `GET /general-types` does not return it — and a filter by it answers `400 type must be a valid enum value`. The `general-types` response schema drops it as well. The JSDoc of `getBlocks` listed 12 of the types and lists all 22 now. `'service'` stays: it is the platform's own name for the type, and the `400` the `type` filter of `getBlocks` and `getTemplateByType` currently gives it is a platform defect, reported as CMS-1073 (CMS-1062).
26
+
27
+ ### Tests
28
+
29
+ - **`src/base/tests/callercontracts.spec.ts` pins these contracts** with a stubbed `fetch`, no stand required: a reused order and form body sent identically twice and left untouched, a file descriptor passed through without losing `contentType` on the caller's side, `trackUserActivity` on `204` / `400` with `isShell` on and off, `subscribeByMarker` throwing when `isShell` is off, `searchPage` sending `langCode` and dropping a page it could not load, and `FileUploading.delete` returning `true`. Against 1.0.171 ten of its thirteen cases fail.
30
+
31
+ ## v.1.0.171
32
+
33
+ ### What's Fixed
34
+
35
+ - **`postFormsData` threw `fd.value.map is not a function` on the value its own uploader returns.** For a `file`, `image` or `groupOfImages` field the method converted the value — an array was uploaded file by file, a lone `File`/`Blob` into a single object — and then called `fd.value.map(...)` **unconditionally**, to strip `contentType`. A value the package had not converted reached `.map` as a non-array and the call died inside the library, before any request was made. That value is not an exotic one: it is exactly what `FileUploading.upload` returns, the natural thing to pass when the file is already in storage. The other plausible reading — an array of those descriptors — was re-uploaded as if the descriptors were files, and the platform refused the result with `formData's marker 'resume' value[0].filename is required`, naming the field the SDK itself had replaced. It cost a shipped pilot its application form: every visitor who attached a document got a generic refusal while the submission counter stayed at 0, and the only trace was the `TypeError` in the site log. Now only a `File` or a `Blob` is uploaded, an entry already in storage is passed through untouched — the two may be mixed in one array — and `contentType` is stripped from an array of values and from a lone value object alike. A value of any other shape is sent as it came, so the endpoint names the field it cannot read instead of the library throwing (CMS-990).
36
+
37
+ - **The accepted shapes of a file value were not declared.** `IBodyTypeFile.value` and `IBodyTypeImageGroupOfImages.value` described a hand-built `IFileValue` / `IImageValue` only — neither a raw `File`/`Blob`, which the SDK has always uploaded on the caller's behalf, nor the descriptor the uploader returns for a file already in storage. Both are in the types now, mixable in one array, and the JSDoc states what the endpoint does with them: a submission wants an **array**, so a lone descriptor or `IFileValue` answers `400 formData's marker '<marker>' value must be an array` while a lone `File`/`Blob` works because the upload result is already one. `fileQuery` is also declared where the SDK actually reads it — on the field; `IBodyPostFormData.fileQuery` is kept for compatibility, but setting it there changes nothing. Measured on js-sdk-tests.oneentry.cloud, 2026-10-08.
38
+
39
+ ### Tests
40
+
41
+ - **`formsdata` pins the file already in storage.** The new case uploads a probe with `FileUploading.upload`, submits the descriptor it returns as a one-element array — which used to be re-uploaded and refused — and then submits the same descriptor alone, which must come back as the endpoint's own `400 … value must be an array`, not as a `TypeError` from inside the package.
42
+
3
43
  ## v.1.0.170
4
44
 
5
45
  ### What's Changed
@@ -1,6 +1,6 @@
1
1
  import AsyncModules from '../base/asyncModules';
2
2
  import type StateModule from '../base/stateModule';
3
- import type { IError } from '../base/utils';
3
+ import type { IError, IVectorSearchResponse } from '../base/utils';
4
4
  import type { IFilterParams } from '../products/productsInterfaces';
5
5
  import type { IAdminEntity, IAdmins, IAdminsResponse, IAdminsVectorSearch } from './adminsInterfaces';
6
6
  /**
@@ -57,10 +57,10 @@ export default class AdminsApi extends AsyncModules implements IAdmins {
57
57
  * @param {string} [langCode] - Language code. Default: "en_US".
58
58
  * @param {number} [offset] - Parameter for pagination. Default: 0.
59
59
  * @param {number} [limit] - Parameter for pagination. Default: 30.
60
- * @returns {Promise<IAdminsResponse | IError>} Returns an object with an array of found admins and total count.
60
+ * @returns {Promise<IVectorSearchResponse<IAdminsResponse> | IError>} Returns an object with an array of found admins and total count.
61
61
  * @throws {IError} When isShell=false and an error occurs during the fetch
62
62
  * @description This method performs a semantic (vector) search for admins.
63
63
  * @see {@link https://js-sdk.oneentry.cloud/docs/admins/getAdminsByVectorSearch getAdminsByVectorSearch} documentation.
64
64
  */
65
- getAdminsByVectorSearch(body: IAdminsVectorSearch, langCode?: string, offset?: number, limit?: number): Promise<IAdminsResponse | IError>;
65
+ getAdminsByVectorSearch(body: IAdminsVectorSearch, langCode?: string, offset?: number, limit?: number): Promise<IVectorSearchResponse<IAdminsResponse> | IError>;
66
66
  }
@@ -104,7 +104,7 @@ class AdminsApi extends asyncModules_1.default {
104
104
  * @param {string} [langCode] - Language code. Default: "en_US".
105
105
  * @param {number} [offset] - Parameter for pagination. Default: 0.
106
106
  * @param {number} [limit] - Parameter for pagination. Default: 30.
107
- * @returns {Promise<IAdminsResponse | IError>} Returns an object with an array of found admins and total count.
107
+ * @returns {Promise<IVectorSearchResponse<IAdminsResponse> | IError>} Returns an object with an array of found admins and total count.
108
108
  * @throws {IError} When isShell=false and an error occurs during the fetch
109
109
  * @description This method performs a semantic (vector) search for admins.
110
110
  * @see {@link https://js-sdk.oneentry.cloud/docs/admins/getAdminsByVectorSearch getAdminsByVectorSearch} documentation.
@@ -1,4 +1,4 @@
1
- import type { IAttributeValues, IError } from '../base/utils';
1
+ import type { IAttributeValues, IError, IVectorSearchResponse } from '../base/utils';
2
2
  import type { IFormConfig } from '../forms/formsInterfaces';
3
3
  import type { IFilterParams } from '../products/productsInterfaces';
4
4
  /**
@@ -40,10 +40,10 @@ interface IAdmins {
40
40
  * @param {string} [langCode] - Language code. Default: "en_US".
41
41
  * @param {number} [offset] - Parameter for pagination. Default: 0.
42
42
  * @param {number} [limit] - Parameter for pagination. Default: 30.
43
- * @returns {IAdminsResponse} Returns an object with an array of found admins and total count.
43
+ * @returns {IVectorSearchResponse<IAdminsResponse>} Returns an object with an array of found admins, total count and indexReady.
44
44
  * @throws {IError} - If there is an error during the fetch operation, it will return an error object.
45
45
  */
46
- getAdminsByVectorSearch(body: IAdminsVectorSearch, langCode?: string, offset?: number, limit?: number): Promise<IAdminsResponse | IError>;
46
+ getAdminsByVectorSearch(body: IAdminsVectorSearch, langCode?: string, offset?: number, limit?: number): Promise<IVectorSearchResponse<IAdminsResponse> | IError>;
47
47
  }
48
48
  /**
49
49
  * Body for semantic (vector) admin search.
@@ -79,8 +79,13 @@ export default abstract class AsyncModules extends SyncModules {
79
79
  * (the default) browserResponse returns the API error instead of throwing
80
80
  * it, so relying on the catch alone would report every failed call — a 404
81
81
  * from cancelSubscription, a 403 from recoverSubscriptions — as a success.
82
+ *
83
+ * With `isShell` disabled browserResponse throws, and the error is thrown on
84
+ * from here too: returning it would break the `@throws` contract every caller
85
+ * documents, and a `try/catch` around the call would never fire (CMS-1067).
82
86
  * @param {() => Promise<unknown>} request - Thunk performing the fetch call.
83
- * @returns {Promise<boolean | IError>} `true` on success, IError on failure.
87
+ * @returns {Promise<boolean | IError>} `true` on success, IError on failure when isShell=true.
88
+ * @throws {IError} When isShell=false and the request fails.
84
89
  */
85
90
  protected _fetchBoolean(request: () => Promise<unknown>): Promise<boolean | IError>;
86
91
  /**
@@ -168,8 +168,13 @@ class AsyncModules extends syncModules_1.default {
168
168
  * (the default) browserResponse returns the API error instead of throwing
169
169
  * it, so relying on the catch alone would report every failed call — a 404
170
170
  * from cancelSubscription, a 403 from recoverSubscriptions — as a success.
171
+ *
172
+ * With `isShell` disabled browserResponse throws, and the error is thrown on
173
+ * from here too: returning it would break the `@throws` contract every caller
174
+ * documents, and a `try/catch` around the call would never fire (CMS-1067).
171
175
  * @param {() => Promise<unknown>} request - Thunk performing the fetch call.
172
- * @returns {Promise<boolean | IError>} `true` on success, IError on failure.
176
+ * @returns {Promise<boolean | IError>} `true` on success, IError on failure when isShell=true.
177
+ * @throws {IError} When isShell=false and the request fails.
173
178
  */
174
179
  async _fetchBoolean(request) {
175
180
  try {
@@ -180,6 +185,9 @@ class AsyncModules extends syncModules_1.default {
180
185
  return true;
181
186
  }
182
187
  catch (e) {
188
+ if (!this.state.isShell) {
189
+ throw e;
190
+ }
183
191
  return e;
184
192
  }
185
193
  }
@@ -439,6 +439,16 @@ interface IHttpOptions {
439
439
  headers: IHttpHeaders;
440
440
  body?: string | FormData | Blob;
441
441
  }
442
+ /**
443
+ * Response of a semantic (vector) search: the module's own list container plus `indexReady`.
444
+ * @typedef {object} IVectorSearchResponse
445
+ * @template T
446
+ * @property {boolean} indexReady - `false` when no vectors are built yet for this entity and language: the query was not embedded, and empty `items` do not mean "nothing matched". `true` — an honest search result.
447
+ * @description Every `…/vector/search` endpoint answers with `indexReady` next to its list (CMS-1074).
448
+ */
449
+ type IVectorSearchResponse<T> = T & {
450
+ indexReady: boolean;
451
+ };
442
452
  /**
443
453
  * LangType
444
454
  */
@@ -447,4 +457,4 @@ type LangType = string | Array<string>;
447
457
  * LocalizeType
448
458
  */
449
459
  type LocalizeType = ILocalizeInfo;
450
- export type { IAttributeFile, IAttributeLocalizeInfo, IAttributes, IAttributeValue, IAttributeValues, IConfig, IError, IFileAttributeValue, IHttpHeaders, IHttpOptions, IListAttributeValue, ILocalizeInfo, INumberAttributeValue, IRating, IStringAttributeValue, ITimeIntervalAttributeValue, ITimeIntervalEntitySchedule, ITimeIntervalGroup, ITimeIntervalPoint, ITimeIntervalRange, ITimeIntervalSchedule, ITimeIntervalWindow, ITypedAttributeValue, LangType, LocalizeType, TimeIntervalPair, };
460
+ export type { IAttributeFile, IAttributeLocalizeInfo, IAttributes, IAttributeValue, IAttributeValues, IConfig, IError, IFileAttributeValue, IHttpHeaders, IHttpOptions, IListAttributeValue, ILocalizeInfo, INumberAttributeValue, IRating, IStringAttributeValue, ITimeIntervalAttributeValue, ITimeIntervalEntitySchedule, ITimeIntervalGroup, ITimeIntervalPoint, ITimeIntervalRange, ITimeIntervalSchedule, ITimeIntervalWindow, ITypedAttributeValue, IVectorSearchResponse, LangType, LocalizeType, TimeIntervalPair, };
@@ -21,7 +21,7 @@ export default class BlocksApi extends AsyncModules implements IBlocks {
21
21
  /**
22
22
  * Get blocks by parameters.
23
23
  * @handleName getBlocks
24
- * @param {BlockType} [type] - Optional block type to filter by. Available values: "product" | "error_page" | "catalog_page" | "product_preview" | "similar_products_block" | "product_block" | "form" | "common_page" | "common_block" | "order" | "service" | "none". When omitted, blocks of all types are returned. Example: 'product'.
24
+ * @param {BlockType} [type] - Optional block type to filter by. Available values: "product" | "error_page" | "catalog_page" | "product_preview" | "similar_products_block" | "product_block" | "frequently_ordered_block" | "trending_block" | "recently_viewed_block" | "repeat_purchase_block" | "slider_block" | "personal_recommendations_block" | "cart_complement_block" | "cart_similar_block" | "wishlist_similar_block" | "form" | "common_page" | "common_block" | "order" | "service" | "external_page" | "discount" (see BlockType). When omitted, blocks of all types are returned. Example: 'product'.
25
25
  * @param {string} [langCode] - Language code. Default: "en_US".
26
26
  * @param {number} [offset] - Parameter for pagination. Default: 0.
27
27
  * @param {number} [limit] - Parameter for pagination. Default: 30.
@@ -60,7 +60,7 @@ class BlocksApi extends asyncModules_1.default {
60
60
  /**
61
61
  * Get blocks by parameters.
62
62
  * @handleName getBlocks
63
- * @param {BlockType} [type] - Optional block type to filter by. Available values: "product" | "error_page" | "catalog_page" | "product_preview" | "similar_products_block" | "product_block" | "form" | "common_page" | "common_block" | "order" | "service" | "none". When omitted, blocks of all types are returned. Example: 'product'.
63
+ * @param {BlockType} [type] - Optional block type to filter by. Available values: "product" | "error_page" | "catalog_page" | "product_preview" | "similar_products_block" | "product_block" | "frequently_ordered_block" | "trending_block" | "recently_viewed_block" | "repeat_purchase_block" | "slider_block" | "personal_recommendations_block" | "cart_complement_block" | "cart_similar_block" | "wishlist_similar_block" | "form" | "common_page" | "common_block" | "order" | "service" | "external_page" | "discount" (see BlockType). When omitted, blocks of all types are returned. Example: 'product'.
64
64
  * @param {string} [langCode] - Language code. Default: "en_US".
65
65
  * @param {number} [offset] - Parameter for pagination. Default: 0.
66
66
  * @param {number} [limit] - Parameter for pagination. Default: 30.
@@ -309,9 +309,11 @@ interface ISearchBlock {
309
309
  /**
310
310
  * BlockType
311
311
  * @type {BlockType}
312
- * @description This type defines the possible values for block types used in the system.
312
+ * @description This type defines the possible values for block types used in the system: the types `GET /api/content/general-types` returns.
313
+ * `'none'` was dropped — the platform has no such type and a filter by it answers `400 type must be a valid enum value` (CMS-1062).
314
+ * `'service'` is the platform's own name for the type, but the `type` filter of getBlocks and getTemplateByType currently refuses it with the same `400`; that is a platform defect (CMS-1073).
313
315
  */
314
- type BlockType = 'product' | 'error_page' | 'catalog_page' | 'product_preview' | 'similar_products_block' | 'product_block' | 'frequently_ordered_block' | 'trending_block' | 'recently_viewed_block' | 'repeat_purchase_block' | 'slider_block' | 'personal_recommendations_block' | 'cart_complement_block' | 'cart_similar_block' | 'wishlist_similar_block' | 'form' | 'common_page' | 'common_block' | 'order' | 'service' | 'external_page' | 'discount' | 'none';
316
+ type BlockType = 'product' | 'error_page' | 'catalog_page' | 'product_preview' | 'similar_products_block' | 'product_block' | 'frequently_ordered_block' | 'trending_block' | 'recently_viewed_block' | 'repeat_purchase_block' | 'slider_block' | 'personal_recommendations_block' | 'cart_complement_block' | 'cart_similar_block' | 'wishlist_similar_block' | 'form' | 'common_page' | 'common_block' | 'order' | 'service' | 'external_page' | 'discount';
315
317
  /**
316
318
  * Lookup body for block product endpoints by explicit productIds.
317
319
  * @interface IBlockProductsLookup
@@ -1,6 +1,6 @@
1
1
  import AsyncModules from '../base/asyncModules';
2
2
  import type StateModule from '../base/stateModule';
3
- import type { IError } from '../base/utils';
3
+ import type { IError, IVectorSearchResponse } from '../base/utils';
4
4
  import type { IBonusBalanceEntity, IBonusHistoryResponse, IBonusTransactionType, ICouponValidationResult, IDiscountsApi, IDiscountsEntity, IDiscountsResponse, IDiscountsVectorSearch, IDiscountType } from './discountsInterfaces';
5
5
  /**
6
6
  * Controllers for working with events
@@ -85,10 +85,10 @@ export default class DiscountsApi extends AsyncModules implements IDiscountsApi
85
85
  * @param {string} [langCode] - Language code. Default: "en_US".
86
86
  * @param {number} [offset] - Parameter for pagination. Default: 0.
87
87
  * @param {number} [limit] - Parameter for pagination. Default: 30.
88
- * @returns {Promise<IDiscountsResponse | IError>} Returns an object with an array of found discounts and total count.
88
+ * @returns {Promise<IVectorSearchResponse<IDiscountsResponse> | IError>} Returns an object with an array of found discounts and total count.
89
89
  * @throws {IError} When isShell=false and an error occurs during the fetch
90
90
  * @description This method performs a semantic (vector) search for discounts.
91
91
  * @see {@link https://js-sdk.oneentry.cloud/docs/discounts/getDiscountsByVectorSearch getDiscountsByVectorSearch} documentation.
92
92
  */
93
- getDiscountsByVectorSearch(body: IDiscountsVectorSearch, langCode?: string, offset?: number, limit?: number): Promise<IDiscountsResponse | IError>;
93
+ getDiscountsByVectorSearch(body: IDiscountsVectorSearch, langCode?: string, offset?: number, limit?: number): Promise<IVectorSearchResponse<IDiscountsResponse> | IError>;
94
94
  }
@@ -124,7 +124,7 @@ class DiscountsApi extends asyncModules_1.default {
124
124
  * @param {string} [langCode] - Language code. Default: "en_US".
125
125
  * @param {number} [offset] - Parameter for pagination. Default: 0.
126
126
  * @param {number} [limit] - Parameter for pagination. Default: 30.
127
- * @returns {Promise<IDiscountsResponse | IError>} Returns an object with an array of found discounts and total count.
127
+ * @returns {Promise<IVectorSearchResponse<IDiscountsResponse> | IError>} Returns an object with an array of found discounts and total count.
128
128
  * @throws {IError} When isShell=false and an error occurs during the fetch
129
129
  * @description This method performs a semantic (vector) search for discounts.
130
130
  * @see {@link https://js-sdk.oneentry.cloud/docs/discounts/getDiscountsByVectorSearch getDiscountsByVectorSearch} documentation.
@@ -1,4 +1,4 @@
1
- import type { IAttributeValues, IError, ILocalizeInfo } from '../base/utils';
1
+ import type { IAttributeValues, IError, ILocalizeInfo, IVectorSearchResponse } from '../base/utils';
2
2
  /**
3
3
  * Discount type.
4
4
  */
@@ -66,10 +66,10 @@ interface IDiscountsApi {
66
66
  * @param {string} [langCode] - Language code. Default: "en_US".
67
67
  * @param {number} [offset] - Parameter for pagination. Default: 0.
68
68
  * @param {number} [limit] - Parameter for pagination. Default: 30.
69
- * @returns {Promise<IDiscountsResponse | IError>} Returns an object with an array of found discounts and total count.
69
+ * @returns {Promise<IVectorSearchResponse<IDiscountsResponse> | IError>} Returns an object with an array of found discounts and total count.
70
70
  * @throws {IError} When isShell=false and an error occurs during the fetch
71
71
  */
72
- getDiscountsByVectorSearch(body: IDiscountsVectorSearch, langCode?: string, offset?: number, limit?: number): Promise<IDiscountsResponse | IError>;
72
+ getDiscountsByVectorSearch(body: IDiscountsVectorSearch, langCode?: string, offset?: number, limit?: number): Promise<IVectorSearchResponse<IDiscountsResponse> | IError>;
73
73
  }
74
74
  /**
75
75
  * Body for semantic (vector) discount search.
@@ -53,7 +53,7 @@ export default class EventsApi extends AsyncModules implements IEvents {
53
53
  * @param {string} marker - The marker of the event to unsubscribe from. Example: "product_price_change".
54
54
  * @param {number} productId - The ID of the product to unsubscribe from. Example: 12345.
55
55
  * @param {string} [langCode] - Language code. Default: "en_US".
56
- * @returns {Promise<any | IError>} - Returns a promise that resolves to the result of the unsubscription operation or an error object if there was an issue.
56
+ * @returns {Promise<boolean | IError>} - Returns true if the unsubscription succeeded, or an error object if there was an issue.
57
57
  * @throws {IError} When isShell=false and an error occurs during the fetch
58
58
  * @description This method requires user authorization.
59
59
  * @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}.
@@ -3,7 +3,6 @@ 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
- /* eslint-disable jsdoc/reject-any-type */
7
6
  /* eslint-disable @typescript-eslint/no-explicit-any */
8
7
  const asyncModules_1 = __importDefault(require("../base/asyncModules"));
9
8
  /**
@@ -71,7 +70,7 @@ class EventsApi extends asyncModules_1.default {
71
70
  * @param {string} marker - The marker of the event to unsubscribe from. Example: "product_price_change".
72
71
  * @param {number} productId - The ID of the product to unsubscribe from. Example: 12345.
73
72
  * @param {string} [langCode] - Language code. Default: "en_US".
74
- * @returns {Promise<any | IError>} - Returns a promise that resolves to the result of the unsubscription operation or an error object if there was an issue.
73
+ * @returns {Promise<boolean | IError>} - Returns true if the unsubscription succeeded, or an error object if there was an issue.
75
74
  * @throws {IError} When isShell=false and an error occurs during the fetch
76
75
  * @description This method requires user authorization.
77
76
  * @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}.
@@ -62,7 +62,7 @@ export default class FileUploadingApi extends AsyncModules implements IFileUploa
62
62
  * @param {string} [fileQuery.entity] - Entity name from which the file is uploaded, determines the folder name in the storage. Example: "editor".
63
63
  * @param {number} [fileQuery.id] - Identifier of the object from which the file is uploaded, determines the folder name in the storage. Example: 3787.
64
64
  * @param {number} [fileQuery.template] - preview template identifier. Example: 1.
65
- * @returns {Promise<boolean | IError>} Returns a promise that resolves to the result of the deletion operation or an error object if there was an issue.
65
+ * @returns {Promise<boolean | IError>} Returns a promise that resolves to true when the file was deleted or an error object if there was an issue.
66
66
  * @throws {IError} When isShell=false and an error occurs during the fetch
67
67
  * @see {@link https://js-sdk.oneentry.cloud/docs/file-uploading/delete delete} documentation.
68
68
  */
@@ -116,14 +116,15 @@ class FileUploadingApi extends asyncModules_1.default {
116
116
  * @param {string} [fileQuery.entity] - Entity name from which the file is uploaded, determines the folder name in the storage. Example: "editor".
117
117
  * @param {number} [fileQuery.id] - Identifier of the object from which the file is uploaded, determines the folder name in the storage. Example: 3787.
118
118
  * @param {number} [fileQuery.template] - preview template identifier. Example: 1.
119
- * @returns {Promise<boolean | IError>} Returns a promise that resolves to the result of the deletion operation or an error object if there was an issue.
119
+ * @returns {Promise<boolean | IError>} Returns a promise that resolves to true when the file was deleted or an error object if there was an issue.
120
120
  * @throws {IError} When isShell=false and an error occurs during the fetch
121
121
  * @see {@link https://js-sdk.oneentry.cloud/docs/file-uploading/delete delete} documentation.
122
122
  */
123
123
  async delete(filename, fileQuery) {
124
124
  const query = { ...this._defaultQuery, ...fileQuery };
125
- const result = await this._fetchDelete(`?filename=${filename}&` + this._queryParamsToString(query));
126
- return result;
125
+ // The endpoint answers 200 with an empty body, which _parseJson reads as `{}`;
126
+ // _fetchBoolean turns that into the declared `true` (CMS-1072)
127
+ return this._fetchBoolean(() => this._fetchDelete(`?filename=${filename}&` + this._queryParamsToString(query)));
127
128
  }
128
129
  /**
129
130
  * Public search across the content of files attached to records.
@@ -55,7 +55,7 @@ interface IFileUploading {
55
55
  * @param {string} [fileQuery.entity] - Entity name from which the file is uploaded, determines the folder name in the storage. Example: "editor".
56
56
  * @param {number} [fileQuery.id] - Identifier of the object from which the file is uploaded, determines the folder name in the storage. Example: 3787.
57
57
  * @param {number} [fileQuery.template] - preview template identifier. Example: 1.
58
- * @returns {boolean | IError} Returns a promise that resolves to the result of the deletion operation or an error object if there was an issue.
58
+ * @returns {boolean | IError} Returns a promise that resolves to true when the file was deleted or an error object if there was an issue.
59
59
  * @throws {IError} - If there is an error during the fetch operation, it will return an error object.
60
60
  */
61
61
  delete(filename: string, fileQuery?: IUploadingQuery): Promise<boolean | IError>;
@@ -1,6 +1,6 @@
1
1
  import AsyncModules from '../base/asyncModules';
2
2
  import type StateModule from '../base/stateModule';
3
- import type { IError } from '../base/utils';
3
+ import type { IError, IVectorSearchResponse } from '../base/utils';
4
4
  import type { IBodyPostFormData, IFormsByMarkerDataEntity, IFormsData, IFormsDataFilter, IFormsDataSearchResponse, IFormsDataVectorSearch, IPostFormResponse, IUpdateFormsData } from './formsDataInterfaces';
5
5
  /**
6
6
  * Controllers for working with form data
@@ -56,10 +56,34 @@ 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
+ * @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.
60
+ *
61
+ * A file value may be a `File`/`Blob` (a `FileList` too), which the SDK uploads first; the descriptor `FileUploading.upload` returns for a file **already in storage**, which the SDK passes through untouched; or a hand-built {@link IFileValue} / {@link IImageValue}. The three may be mixed in one array. `contentType` is stripped from all of them, and a value of none of these shapes is sent as it came — the endpoint then names the field it cannot read, instead of the SDK throwing before the request.
62
+ *
63
+ * The endpoint wants file values in an **array**: a lone descriptor or `IFileValue` answers `400 formData's marker '<marker>' value must be an array`, while a lone `File`/`Blob` works because the upload result is already one.
60
64
  * @see {@link https://js-sdk.oneentry.cloud/docs/forms-data/postFormsData postFormsData} documentation.
61
65
  */
62
66
  postFormsData(body: IBodyPostFormData, langCode?: string): Promise<IPostFormResponse | IError>;
67
+ /**
68
+ * Tells a file the SDK still has to upload from one already in storage.
69
+ * @param {unknown} value - One value of a `file` / `image` / `groupOfImages` field.
70
+ * @returns {boolean} True when the value is a `File` or a `Blob`, which has to be uploaded first.
71
+ * @description Only a `File` or a `Blob` is uploaded. Anything else — above all the
72
+ * descriptor `FileUploading.upload` returns for a file already in storage — is sent
73
+ * as it came: re-uploading it would send the descriptor as the file itself.
74
+ */
75
+ private _isUploadable;
76
+ /**
77
+ * Removes `contentType` from a file value, which the endpoint does not accept.
78
+ * @param {T} value - Value of a `file` / `image` / `groupOfImages` field, after the uploads.
79
+ * @returns {T} The value without `contentType`; entries that carried it are copies, the caller's objects are not modified.
80
+ * @description `FileUploading.upload` returns `contentType` and form data rejects it,
81
+ * so it is stripped from an array of values and from a lone value object alike. A value
82
+ * of any other shape is returned untouched and the endpoint names the field it cannot
83
+ * read — instead of the library dying on `value.map is not a function` before the
84
+ * request is made (CMS-990).
85
+ */
86
+ private _stripContentType;
63
87
  /**
64
88
  * Drops the date bounds the endpoint refuses to parse.
65
89
  *
@@ -142,10 +166,10 @@ export default class FormsDataApi extends AsyncModules implements IFormsData {
142
166
  * @param {string} [langCode] - Language code. Default: "en_US".
143
167
  * @param {number} [offset] - Parameter for pagination. Default: 0.
144
168
  * @param {number} [limit] - Parameter for pagination. Default: 30.
145
- * @returns {Promise<IFormsDataSearchResponse | IError>} Returns an object with an array of found form data records and total count.
169
+ * @returns {Promise<IVectorSearchResponse<IFormsDataSearchResponse> | IError>} Returns an object with an array of found form data records and total count.
146
170
  * @throws {IError} When isShell=false and an error occurs during the fetch
147
171
  * @description This method performs a semantic (vector) search for form data.
148
172
  * @see {@link https://js-sdk.oneentry.cloud/docs/forms-data/getFormsDataByVectorSearch getFormsDataByVectorSearch} documentation.
149
173
  */
150
- getFormsDataByVectorSearch(body: IFormsDataVectorSearch, langCode?: string, offset?: number, limit?: number): Promise<IFormsDataSearchResponse | IError>;
174
+ getFormsDataByVectorSearch(body: IFormsDataVectorSearch, langCode?: string, offset?: number, limit?: number): Promise<IVectorSearchResponse<IFormsDataSearchResponse> | IError>;
151
175
  }
@@ -96,7 +96,11 @@ 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
+ * @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.
100
+ *
101
+ * A file value may be a `File`/`Blob` (a `FileList` too), which the SDK uploads first; the descriptor `FileUploading.upload` returns for a file **already in storage**, which the SDK passes through untouched; or a hand-built {@link IFileValue} / {@link IImageValue}. The three may be mixed in one array. `contentType` is stripped from all of them, and a value of none of these shapes is sent as it came — the endpoint then names the field it cannot read, instead of the SDK throwing before the request.
102
+ *
103
+ * The endpoint wants file values in an **array**: a lone descriptor or `IFileValue` answers `400 formData's marker '<marker>' value must be an array`, while a lone `File`/`Blob` works because the upload result is already one.
100
104
  * @see {@link https://js-sdk.oneentry.cloud/docs/forms-data/postFormsData postFormsData} documentation.
101
105
  */
102
106
  async postFormsData(body, langCode = this.state.lang) {
@@ -113,9 +117,12 @@ class FormsDataApi extends asyncModules_1.default {
113
117
  // Create an instance of FileUploadingApi with the current state
114
118
  const fileUploader = new fileUploadingApi_1.default(this.state);
115
119
  // Process each element in formData[langCode] asynchronously
116
- formData[langCode] = await Promise.all(formData[langCode].map(async (fd) => {
120
+ formData[langCode] = await Promise.all(formData[langCode].map(async (field) => {
117
121
  // Check if the type is one of the specified types
118
- if (['file', 'image', 'groupOfImages'].includes(fd.type)) {
122
+ if (['file', 'image', 'groupOfImages'].includes(field.type)) {
123
+ // Work on a copy: the caller's field keeps its File and its fileQuery,
124
+ // so a reused body sends the same form again (CMS-1071)
125
+ const fd = { ...field };
119
126
  // If fileQuery does not exist, we create it and assign it to an object with the following properties:
120
127
  if (!fd.fileQuery) {
121
128
  const fileQuery = {
@@ -132,34 +139,78 @@ class FormsDataApi extends asyncModules_1.default {
132
139
  const filesArray = typeof FileList !== 'undefined' && fd.value instanceof FileList
133
140
  ? Array.from(fd.value)
134
141
  : fd.value;
135
- // If filesArray is an array, upload each file asynchronously
142
+ // If filesArray is an array, upload the files it holds asynchronously
136
143
  if (Array.isArray(filesArray)) {
137
- const uploadPromises = filesArray.map((file) => fileUploader.upload(file, fd.fileQuery).catch((e) => e));
144
+ const uploadPromises = filesArray.map((file) =>
145
+ // An entry that is already in storage is passed through: a
146
+ // second upload would send the descriptor itself as the file
147
+ // and the endpoint answers `value[0].filename is required`.
148
+ this._isUploadable(file)
149
+ ? fileUploader.upload(file, fd.fileQuery).catch((e) => e)
150
+ : file);
138
151
  fd.value = (await Promise.all(uploadPromises)).flat();
139
152
  }
140
153
  // If fd.value is a single File or Blob, upload it
141
- else if (fd.value instanceof File || fd.value instanceof Blob) {
154
+ else if (this._isUploadable(fd.value)) {
142
155
  fd.value = await fileUploader
143
156
  .upload(fd.value, fd.fileQuery)
144
157
  .catch((e) => e); // Catch any errors during upload
145
158
  }
146
159
  // Remove the 'fileQuery' property from the object after processing
147
160
  delete fd.fileQuery;
148
- // Remove the 'contentType' property from the file object because it is not needed and not valid
149
- fd.value.map((file) => {
150
- delete file.contentType;
151
- });
161
+ // Remove the 'contentType' property from the file object because it is not needed and not valid
162
+ fd.value = this._stripContentType(fd.value);
163
+ return fd;
152
164
  }
153
- // Return the processed form data element
154
- return fd;
165
+ // Return the form data element untouched
166
+ return field;
155
167
  }));
156
168
  }
157
- body.formData = formData;
158
- const result = await this._fetchPost(``, body);
169
+ // The wrapped formData goes into a new body: written back into the caller's
170
+ // object, a second call with it wrapped the wrapper and answered `400` (CMS-1071)
171
+ const result = await this._fetchPost(``, { ...body, formData });
159
172
  // Validate response if validation is enabled
160
173
  const validated = await this._validateResponse(result, schema('PostFormResponseSchema'));
161
174
  return this._normalizeData(validated);
162
175
  }
176
+ /**
177
+ * Tells a file the SDK still has to upload from one already in storage.
178
+ * @param {unknown} value - One value of a `file` / `image` / `groupOfImages` field.
179
+ * @returns {boolean} True when the value is a `File` or a `Blob`, which has to be uploaded first.
180
+ * @description Only a `File` or a `Blob` is uploaded. Anything else — above all the
181
+ * descriptor `FileUploading.upload` returns for a file already in storage — is sent
182
+ * as it came: re-uploading it would send the descriptor as the file itself.
183
+ */
184
+ _isUploadable(value) {
185
+ return ((typeof File !== 'undefined' && value instanceof File) ||
186
+ (typeof Blob !== 'undefined' && value instanceof Blob));
187
+ }
188
+ /**
189
+ * Removes `contentType` from a file value, which the endpoint does not accept.
190
+ * @param {T} value - Value of a `file` / `image` / `groupOfImages` field, after the uploads.
191
+ * @returns {T} The value without `contentType`; entries that carried it are copies, the caller's objects are not modified.
192
+ * @description `FileUploading.upload` returns `contentType` and form data rejects it,
193
+ * so it is stripped from an array of values and from a lone value object alike. A value
194
+ * of any other shape is returned untouched and the endpoint names the field it cannot
195
+ * read — instead of the library dying on `value.map is not a function` before the
196
+ * request is made (CMS-990).
197
+ */
198
+ _stripContentType(value) {
199
+ // An entry carrying `contentType` is copied without it rather than edited:
200
+ // a descriptor passed through untouched belongs to the caller (CMS-1071)
201
+ const strip = (item) => {
202
+ if (item &&
203
+ typeof item === 'object' &&
204
+ !Array.isArray(item) &&
205
+ 'contentType' in item) {
206
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
207
+ const { contentType, ...rest } = item;
208
+ return rest;
209
+ }
210
+ return item;
211
+ };
212
+ return (Array.isArray(value) ? value.map(strip) : strip(value));
213
+ }
163
214
  /**
164
215
  * Drops the date bounds the endpoint refuses to parse.
165
216
  *
@@ -265,7 +316,7 @@ class FormsDataApi extends asyncModules_1.default {
265
316
  * @param {string} [langCode] - Language code. Default: "en_US".
266
317
  * @param {number} [offset] - Parameter for pagination. Default: 0.
267
318
  * @param {number} [limit] - Parameter for pagination. Default: 30.
268
- * @returns {Promise<IFormsDataSearchResponse | IError>} Returns an object with an array of found form data records and total count.
319
+ * @returns {Promise<IVectorSearchResponse<IFormsDataSearchResponse> | IError>} Returns an object with an array of found form data records and total count.
269
320
  * @throws {IError} When isShell=false and an error occurs during the fetch
270
321
  * @description This method performs a semantic (vector) search for form data.
271
322
  * @see {@link https://js-sdk.oneentry.cloud/docs/forms-data/getFormsDataByVectorSearch getFormsDataByVectorSearch} documentation.
@@ -1,5 +1,5 @@
1
- import type { IError } from '../base/utils';
2
- import type { IUploadingQuery } from '../file-uploading/fileUploadingInterfaces';
1
+ import type { IError, IVectorSearchResponse } from '../base/utils';
2
+ import type { IUploadingQuery, IUploadingReturn } from '../file-uploading/fileUploadingInterfaces';
3
3
  /**
4
4
  * Interface for retrieving and posting form data in the system.
5
5
  * @interface IFormsData
@@ -77,10 +77,10 @@ interface IFormsData {
77
77
  * @param {string} [langCode] - Language code. Default: "en_US".
78
78
  * @param {number} [offset] - Parameter for pagination. Default: 0.
79
79
  * @param {number} [limit] - Parameter for pagination. Default: 30.
80
- * @returns {Promise<IFormsDataSearchResponse | IError>} Returns an object with an array of found form data records and total count.
80
+ * @returns {Promise<IVectorSearchResponse<IFormsDataSearchResponse> | IError>} Returns an object with an array of found form data records and total count.
81
81
  * @throws {IError} When isShell=false and an error occurs during the fetch
82
82
  */
83
- getFormsDataByVectorSearch(body: IFormsDataVectorSearch, langCode?: string, offset?: number, limit?: number): Promise<IFormsDataSearchResponse | IError>;
83
+ getFormsDataByVectorSearch(body: IFormsDataVectorSearch, langCode?: string, offset?: number, limit?: number): Promise<IVectorSearchResponse<IFormsDataSearchResponse> | IError>;
84
84
  }
85
85
  /**
86
86
  * Body for semantic (vector) form data search.
@@ -567,7 +567,7 @@ interface ICaptchaValue {
567
567
  * @property {string} formData[].marker - The marker identifying the form field. Example: "name".
568
568
  * @property {string} formData[].type - The type of the form field. Example: "string".
569
569
  * @property {string} formData[].value - The value of the form field. Example: "name".
570
- * @property {IUploadingQuery} [fileQuery] - Optional file query for uploading files.
570
+ * @property {IUploadingQuery} [fileQuery] - Optional file query for uploading files. Kept for compatibility: the SDK reads `fileQuery` from the **file field itself** (see IBodyTypeFile), not from the body, so one set here does not change where a file is uploaded.
571
571
  * @example
572
572
  {
573
573
  "type": "page",
@@ -715,7 +715,7 @@ interface ITextWithHeaderValue {
715
715
  * @interface IBodyTypeImageGroupOfImages
716
716
  * @property {string} marker - marker name. Example: "avatar".
717
717
  * @property {'image' | 'groupOfImages'} type - Type value — must match the attribute type in the set, note the plural in "groupOfImages". Example: "image".
718
- * @property {object} value - Image Object. Contains image information.
718
+ * @property {object} value - The attached image. The same three shapes as a `file` field accepts, mixable in one array: a `File`/`Blob` (also a `FileList`), which the SDK uploads first; the descriptor `FileUploading.upload` returns for an image **already in storage**, passed through as it is; or a hand-built {@link IImageValue}. In a SUBMISSION the value must be an **array**, as for `file` — a lone object answers `400 formData's marker '<marker>' value must be an array`. Measured on js-sdk-tests.oneentry.cloud, 2026-10-08 (CMS-990).
719
719
  * @example
720
720
  [
721
721
  {
@@ -728,12 +728,14 @@ interface ITextWithHeaderValue {
728
728
  }
729
729
  }
730
730
  ]
731
+ * @property {IUploadingQuery} [fileQuery] - Where the SDK uploads a `File`/`Blob` value to. Read **per field**, not from the body; omitted, the SDK uploads to `page`/`editor` under a random id. Ignored for an image already in storage. Example: `{ "type": "page", "entity": "editor", "id": 3787 }`.
731
732
  * @description Represents an image or a group of images with their details, including filename, download link, size, preview link, and parameters for image compression.
732
733
  */
733
734
  interface IBodyTypeImageGroupOfImages {
734
735
  marker: string;
735
736
  type: 'image' | 'groupOfImages';
736
- value: IImageValue | IImageValue[];
737
+ value: IImageValue | IUploadingReturn | File | Blob | (IImageValue | IUploadingReturn | File | Blob)[];
738
+ fileQuery?: IUploadingQuery;
737
739
  }
738
740
  /**
739
741
  * @interface IImageValueParams
@@ -764,7 +766,7 @@ interface IImageValue {
764
766
  * @interface IBodyTypeFile
765
767
  * @property {string} marker - marker name. Example: "picture".
766
768
  * @property {'file'} type - Type value. Example: "file".
767
- * @property {object} value - File Object. Contains file information. A single attached file is returned as the object itself, several files as an array.
769
+ * @property {object} value - The attached file. Three shapes are accepted and may be mixed in one array: a `File`/`Blob` (also a `FileList`), which the SDK uploads first; the descriptor `FileUploading.upload` returns for a file **already in storage**, which is passed through as it is; or a hand-built {@link IFileValue}. In a SUBMISSION the value must be an **array** — a lone descriptor or {@link IFileValue} answers `400 formData's marker '<marker>' value must be an array`, while a lone `File`/`Blob` is fine because the SDK wraps the upload result. A READ returns a single attached file as the object itself. Measured on js-sdk-tests.oneentry.cloud, 2026-10-08 (CMS-990).
768
770
  * @example
769
771
  [
770
772
  {
@@ -773,12 +775,14 @@ interface IImageValue {
773
775
  "size": 392585
774
776
  }
775
777
  ]
778
+ * @property {IUploadingQuery} [fileQuery] - Where the SDK uploads a `File`/`Blob` value to. Read **per field**, not from the body; omitted, the SDK uploads to `page`/`editor` under a random id. Ignored for a file already in storage. Example: `{ "type": "page", "entity": "editor", "id": 3787 }`.
776
779
  * @description Represents a file with its details, including filename, download link, and size.
777
780
  */
778
781
  interface IBodyTypeFile {
779
782
  marker: string;
780
783
  type: 'file';
781
- value: IFileValue | IFileValue[];
784
+ value: IFileValue | IUploadingReturn | File | Blob | (IFileValue | IUploadingReturn | File | Blob)[];
785
+ fileQuery?: IUploadingQuery;
782
786
  }
783
787
  /**
784
788
  * @interface IFileValue