oneentry 1.0.172 → 1.0.173

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 (48) hide show
  1. package/changelog.md +25 -0
  2. package/dist/auth-provider/authProviderApi.d.ts +2 -2
  3. package/dist/auth-provider/authProviderApi.js +2 -2
  4. package/dist/auth-provider/authProvidersInterfaces.d.ts +3 -3
  5. package/dist/base/utils.d.ts +1 -1
  6. package/dist/file-uploading/fileUploadingApi.d.ts +10 -10
  7. package/dist/file-uploading/fileUploadingApi.js +8 -11
  8. package/dist/file-uploading/fileUploadingInterfaces.d.ts +14 -14
  9. package/dist/index.d.ts +1 -1
  10. package/dist/index.js +1 -1
  11. package/dist/integration-collections/integrationCollectionsApi.d.ts +12 -16
  12. package/dist/integration-collections/integrationCollectionsApi.js +10 -14
  13. package/dist/integration-collections/integrationCollectionsInterfaces.d.ts +24 -23
  14. package/dist/orders/ordersInterfaces.d.ts +2 -2
  15. package/dist/product-statuses/productStatusesApi.d.ts +2 -2
  16. package/dist/product-statuses/productStatusesApi.js +2 -2
  17. package/dist/product-statuses/productStatusesInterfaces.d.ts +2 -2
  18. package/dist/products/productsInterfaces.d.ts +4 -4
  19. package/dist/system/systemApi.d.ts +4 -4
  20. package/dist/system/systemApi.js +2 -2
  21. package/dist/system/systemInterfaces.d.ts +11 -5
  22. package/dist/templates/templatesApi.d.ts +3 -3
  23. package/dist/templates/templatesApi.js +3 -3
  24. package/dist/templates/templatesInterfaces.d.ts +3 -3
  25. package/esm/auth-provider/authProviderApi.d.ts +2 -2
  26. package/esm/auth-provider/authProviderApi.js +2 -2
  27. package/esm/auth-provider/authProvidersInterfaces.d.ts +3 -3
  28. package/esm/base/utils.d.ts +1 -1
  29. package/esm/file-uploading/fileUploadingApi.d.ts +10 -10
  30. package/esm/file-uploading/fileUploadingApi.js +8 -11
  31. package/esm/file-uploading/fileUploadingInterfaces.d.ts +14 -14
  32. package/esm/index.d.ts +1 -1
  33. package/esm/index.js +1 -1
  34. package/esm/integration-collections/integrationCollectionsApi.d.ts +12 -16
  35. package/esm/integration-collections/integrationCollectionsApi.js +10 -14
  36. package/esm/integration-collections/integrationCollectionsInterfaces.d.ts +24 -23
  37. package/esm/orders/ordersInterfaces.d.ts +2 -2
  38. package/esm/product-statuses/productStatusesApi.d.ts +2 -2
  39. package/esm/product-statuses/productStatusesApi.js +2 -2
  40. package/esm/product-statuses/productStatusesInterfaces.d.ts +2 -2
  41. package/esm/products/productsInterfaces.d.ts +4 -4
  42. package/esm/system/systemApi.d.ts +4 -4
  43. package/esm/system/systemApi.js +2 -2
  44. package/esm/system/systemInterfaces.d.ts +11 -5
  45. package/esm/templates/templatesApi.d.ts +3 -3
  46. package/esm/templates/templatesApi.js +3 -3
  47. package/esm/templates/templatesInterfaces.d.ts +3 -3
  48. package/package.json +2 -2
@@ -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 { ISystemApi } from './systemInterfaces';
4
+ import type { IApiStatEntry, ISystemApi } from './systemInterfaces';
5
5
  /**
6
6
  * Controllers for working with system components
7
7
  * @handle /api/content/system
@@ -37,10 +37,10 @@ export default class SystemApi extends AsyncModules implements ISystemApi {
37
37
  /**
38
38
  * Getting the number of requests to API.
39
39
  * @handleName getApiStat
40
- * @returns {Promise<unknown | IError>} Return object with date and count.
40
+ * @returns {Promise<IApiStatEntry[] | IError>} Array of one-key objects `{ [YYYY-MM-DD]: count }`, one per day. Example: `[{ "2026-10-25": 17280 }, { "2026-10-26": 13671 }]`.
41
41
  * @throws {IError} When isShell=false and an error occurs during the fetch
42
- * @description Getting the number of requests to API.
42
+ * @description Getting the number of requests to API, per day.
43
43
  * @see {@link https://js-sdk.oneentry.cloud/docs/system/getApiStat getApiStat} documentation.
44
44
  */
45
- getApiStat(): Promise<unknown>;
45
+ getApiStat(): Promise<IApiStatEntry[] | IError>;
46
46
  }
@@ -46,9 +46,9 @@ class SystemApi extends asyncModules_1.default {
46
46
  /**
47
47
  * Getting the number of requests to API.
48
48
  * @handleName getApiStat
49
- * @returns {Promise<unknown | IError>} Return object with date and count.
49
+ * @returns {Promise<IApiStatEntry[] | IError>} Array of one-key objects `{ [YYYY-MM-DD]: count }`, one per day. Example: `[{ "2026-10-25": 17280 }, { "2026-10-26": 13671 }]`.
50
50
  * @throws {IError} When isShell=false and an error occurs during the fetch
51
- * @description Getting the number of requests to API.
51
+ * @description Getting the number of requests to API, per day.
52
52
  * @see {@link https://js-sdk.oneentry.cloud/docs/system/getApiStat getApiStat} documentation.
53
53
  */
54
54
  async getApiStat() {
@@ -19,11 +19,17 @@ interface ISystemApi {
19
19
  */
20
20
  test500(): Promise<unknown | IError>;
21
21
  /**
22
- * getApiStat
22
+ * Getting the number of requests to API.
23
23
  * @handleName getApiStat
24
- * @returns {unknown} Returns a Promise that resolves with any data.
25
- * @description This method getApiStat.
24
+ * @returns {Promise<IApiStatEntry[] | IError>} Array of one-key objects `{ [YYYY-MM-DD]: count }`, one per day. Example: `[{ "2026-10-25": 17280 }, { "2026-10-26": 13671 }]`.
25
+ * @description Getting the number of requests to API, per day.
26
26
  */
27
- getApiStat(): Promise<unknown>;
27
+ getApiStat(): Promise<IApiStatEntry[] | IError>;
28
28
  }
29
- export type { ISystemApi };
29
+ /**
30
+ * One day of API request statistics: a single key — the date `YYYY-MM-DD` — holding the number of requests.
31
+ * @typedef {Record<string, number>} IApiStatEntry
32
+ * @description Element of the array returned by getApiStat. Example: `{ "2026-10-26": 13671 }`.
33
+ */
34
+ type IApiStatEntry = Record<string, number>;
35
+ export type { IApiStatEntry, ISystemApi };
@@ -22,7 +22,7 @@ export default class TemplatesPreviewApi extends AsyncModules implements ITempla
22
22
  * Get all template objects grouped by types.
23
23
  * @handleName getAllTemplates
24
24
  * @param {string} [langCode] - Language code. Default: "en_US".
25
- * @returns {Promise<Record<BlockType, ITemplateEntity[]> | IError>} Returns an object GroupedTemplatesObject, which contains an array of template objects TemplateEntity
25
+ * @returns {Promise<Record<BlockType, ITemplateEntity[]> | IError>} Object keyed by `BlockType`; each value is an array of `ITemplateEntity` of that type.
26
26
  * @throws {IError} When isShell=false and an error occurs during the fetch
27
27
  * @description This function is designed to fetch organized template objects in groups based on their types.
28
28
  * @see {@link https://js-sdk.oneentry.cloud/docs/templates/getAllTemplates getAllTemplates} documentation.
@@ -33,7 +33,7 @@ export default class TemplatesPreviewApi extends AsyncModules implements ITempla
33
33
  * @handleName getTemplateByType
34
34
  * @param {BlockType} type - The type of templates to retrieve. This parameter specifies the category or classification of templates being requested. Example: "product".
35
35
  * @param {string} [langCode] - Language code. Default: "en_US".
36
- * @returns {Promise<ITemplateEntity[] | IError>} Returns a TemplateEntity object.
36
+ * @returns {Promise<ITemplateEntity[] | IError>} Array of `ITemplateEntity` objects of the given type.
37
37
  * @throws {IError} When isShell=false and an error occurs during the fetch
38
38
  * @description Fetch template objects that belong to a specific type, with an optional filter by language.
39
39
  * @see {@link https://js-sdk.oneentry.cloud/docs/templates/getTemplateByType getTemplateByType} documentation.
@@ -44,7 +44,7 @@ export default class TemplatesPreviewApi extends AsyncModules implements ITempla
44
44
  * @handleName getTemplateByMarker
45
45
  * @param {string} marker - The unique marker of the template to retrieve. Example: "template_12345".
46
46
  * @param {string} [langCode] - Language code. Default: "en_US".
47
- * @returns {Promise<ITemplateEntity | IError>} Returns a TemplateEntity object
47
+ * @returns {Promise<ITemplateEntity | IError>} Returns an `ITemplateEntity` object
48
48
  * @throws {IError} When isShell=false and an error occurs during the fetch
49
49
  * @description Fetch a specific template object based on its unique marker.
50
50
  * @see {@link https://js-sdk.oneentry.cloud/docs/templates/getTemplateByMarker getTemplateByMarker} documentation.
@@ -60,7 +60,7 @@ class TemplatesPreviewApi extends asyncModules_1.default {
60
60
  * Get all template objects grouped by types.
61
61
  * @handleName getAllTemplates
62
62
  * @param {string} [langCode] - Language code. Default: "en_US".
63
- * @returns {Promise<Record<BlockType, ITemplateEntity[]> | IError>} Returns an object GroupedTemplatesObject, which contains an array of template objects TemplateEntity
63
+ * @returns {Promise<Record<BlockType, ITemplateEntity[]> | IError>} Object keyed by `BlockType`; each value is an array of `ITemplateEntity` of that type.
64
64
  * @throws {IError} When isShell=false and an error occurs during the fetch
65
65
  * @description This function is designed to fetch organized template objects in groups based on their types.
66
66
  * @see {@link https://js-sdk.oneentry.cloud/docs/templates/getAllTemplates getAllTemplates} documentation.
@@ -86,7 +86,7 @@ class TemplatesPreviewApi extends asyncModules_1.default {
86
86
  * @handleName getTemplateByType
87
87
  * @param {BlockType} type - The type of templates to retrieve. This parameter specifies the category or classification of templates being requested. Example: "product".
88
88
  * @param {string} [langCode] - Language code. Default: "en_US".
89
- * @returns {Promise<ITemplateEntity[] | IError>} Returns a TemplateEntity object.
89
+ * @returns {Promise<ITemplateEntity[] | IError>} Array of `ITemplateEntity` objects of the given type.
90
90
  * @throws {IError} When isShell=false and an error occurs during the fetch
91
91
  * @description Fetch template objects that belong to a specific type, with an optional filter by language.
92
92
  * @see {@link https://js-sdk.oneentry.cloud/docs/templates/getTemplateByType getTemplateByType} documentation.
@@ -102,7 +102,7 @@ class TemplatesPreviewApi extends asyncModules_1.default {
102
102
  * @handleName getTemplateByMarker
103
103
  * @param {string} marker - The unique marker of the template to retrieve. Example: "template_12345".
104
104
  * @param {string} [langCode] - Language code. Default: "en_US".
105
- * @returns {Promise<ITemplateEntity | IError>} Returns a TemplateEntity object
105
+ * @returns {Promise<ITemplateEntity | IError>} Returns an `ITemplateEntity` object
106
106
  * @throws {IError} When isShell=false and an error occurs during the fetch
107
107
  * @description Fetch a specific template object based on its unique marker.
108
108
  * @see {@link https://js-sdk.oneentry.cloud/docs/templates/getTemplateByMarker getTemplateByMarker} documentation.
@@ -9,7 +9,7 @@ interface ITemplatesApi {
9
9
  * Get all template objects grouped by types.
10
10
  * @handleName getAllTemplates
11
11
  * @param {string} [langCode] - Language code. Default: "en_US".
12
- * @returns {Record<BlockType, ITemplateEntity[]>} Returns an object GroupedTemplatesObject, which contains an array of template objects TemplateEntity
12
+ * @returns {Record<BlockType, ITemplateEntity[]>} Object keyed by `BlockType`; each value is an array of `ITemplateEntity` of that type.
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 all template objects grouped by types.
15
15
  */
@@ -19,7 +19,7 @@ interface ITemplatesApi {
19
19
  * @handleName getTemplateByType
20
20
  * @param {BlockType} type - The type of templates to retrieve. This parameter specifies the category or classification of templates being requested. Example: "product".
21
21
  * @param {string} [langCode] - Language code. Default: "en_US".
22
- * @returns {ITemplateEntity[]} Returns a TemplateEntity object.
22
+ * @returns {ITemplateEntity[]} Array of `ITemplateEntity` objects of the given type.
23
23
  * @throws {IError} - If there is an error during the fetch operation, it will return an error object.
24
24
  * @description This method gets template objects by type.
25
25
  */
@@ -29,7 +29,7 @@ interface ITemplatesApi {
29
29
  * @handleName getTemplateByMarker
30
30
  * @param {string} marker - The unique marker of the template to retrieve. Example: "template_12345".
31
31
  * @param {string} [langCode] - Language code. Default: "en_US".
32
- * @returns {ITemplateEntity} Returns a TemplateEntity object
32
+ * @returns {ITemplateEntity} Returns an `ITemplateEntity` object
33
33
  * @throws {IError} - If there is an error during the fetch operation, it will return an error object.
34
34
  * @description This method gets one template object by id.
35
35
  */
@@ -233,9 +233,9 @@ export default class AuthProviderApi extends AsyncModules implements IAuthProvid
233
233
  * Getting active user sessions data.
234
234
  * @handleName getActiveSessionsByMarker
235
235
  * @param {string} marker - The text identifier of the authorization provider. Example: "email".
236
- * @returns {Promise<IActiveSession[] | IError>} Returns an auth provider object.
236
+ * @returns {Promise<IActiveSession[] | IError>} Array of the authenticated user's active sessions for this provider, one per device (`deviceInfo`).
237
237
  * @throws {IError} When isShell=false and an error occurs during the fetch
238
- * @description Getting a single authorization provider object by marker.
238
+ * @description Getting the authenticated user's active sessions for the authorization provider. This method requires user authorization.
239
239
  * @see {@link https://js-sdk.oneentry.cloud/docs/auth-provider/getActiveSessionsByMarker getActiveSessionsByMarker} documentation.
240
240
  */
241
241
  getActiveSessionsByMarker(marker: string): Promise<IActiveSession[] | IError>;
@@ -328,9 +328,9 @@ export default class AuthProviderApi extends AsyncModules {
328
328
  * Getting active user sessions data.
329
329
  * @handleName getActiveSessionsByMarker
330
330
  * @param {string} marker - The text identifier of the authorization provider. Example: "email".
331
- * @returns {Promise<IActiveSession[] | IError>} Returns an auth provider object.
331
+ * @returns {Promise<IActiveSession[] | IError>} Array of the authenticated user's active sessions for this provider, one per device (`deviceInfo`).
332
332
  * @throws {IError} When isShell=false and an error occurs during the fetch
333
- * @description Getting a single authorization provider object by marker.
333
+ * @description Getting the authenticated user's active sessions for the authorization provider. This method requires user authorization.
334
334
  * @see {@link https://js-sdk.oneentry.cloud/docs/auth-provider/getActiveSessionsByMarker getActiveSessionsByMarker} documentation.
335
335
  */
336
336
  async getActiveSessionsByMarker(marker) {
@@ -405,11 +405,11 @@ interface IAuthPostBody {
405
405
  {
406
406
  "os": "Win32",
407
407
  "browser": "Node.js/22",
408
- "location": "ru-RU"
408
+ "location": "en-US"
409
409
  }
410
410
  * @property {string} deviceInfo.os - The operating system of the active session. Example: "Win32".
411
411
  * @property {string} deviceInfo.browser - The browser used in the active session. Example: "Node.js/22".
412
- * @property {string} deviceInfo.location - The location of the active session. Example: "ru-RU".
412
+ * @property {string} deviceInfo.location - The location of the active session. Example: "en-US".
413
413
  * @description This interface defines the structure of the body used in authentication requests, containing an array of authentication data.
414
414
  */
415
415
  interface IActiveSession {
@@ -419,7 +419,7 @@ interface IActiveSession {
419
419
  * @interface IDeviceInfo
420
420
  * @property {string} os - The operating system of the active session. Example: "Win32".
421
421
  * @property {string} browser - The browser used in the active session. Example: "Node.js/22".
422
- * @property {string} location - The locale of the active session. Example: "ru-RU".
422
+ * @property {string} location - The locale of the active session. Example: "en-US".
423
423
  * @description Information about the device tied to an active authentication session.
424
424
  */
425
425
  interface IDeviceInfo {
@@ -4,7 +4,7 @@
4
4
  * @property {string} [guestId] - Guest identifier sent as the `x-guest-id` header on unauthenticated requests. Lets cart/wishlist/activity endpoints work for a guest. In the browser a stable id is auto-generated (localStorage) when omitted; on the server pass a per-visitor id. Can also be set later via `setGuestId`.
5
5
  * @property {string} [deviceMetadata] - Device-metadata string sent as the `x-device-metadata` header on POST requests and token refresh, overriding the environment-derived fingerprint. The API binds refresh tokens to this header, so server-side flows that issue tokens on behalf of a browser (e.g. an OAuth code exchange) must pass the browser's string here — otherwise the token is bound to the server's fingerprint and cannot be refreshed from the browser. Obtain the string in the browser via `getDeviceMetadata()`. Can also be set later via `setDeviceMetadata`.
6
6
  * @property {string} [langCode] - specify the default language to avoid specifying it in every request.
7
- * @property {boolean} [traficLimit] - Some methods use multiple queries to make it easier to work with the API. Set this parameter to "false" to save traffic and decide for yourself what data you need.
7
+ * @property {boolean} [traficLimit] - Some methods use multiple queries to make it easier to work with the API. Set it to `true` to save traffic and decide for yourself what data you need: the SDK then skips its follow-up requests (full pages behind quick search results, products of page blocks), and some results change shape — e.g. `searchPage` returns short `{ id, title }` cards. Default: false.
8
8
  * @property {boolean} [rawData] - Set to true to keep an attribute's nested `additionalFields` as the
9
9
  * array the API sends, instead of the marker-keyed map the SDK builds by default. It turns off only that
10
10
  * transformation — locale unwrapping, sorting by `position`, single-file unwrapping and number casting
@@ -23,7 +23,7 @@ export default class FileUploadingApi extends AsyncModules implements IFileUploa
23
23
  * Upload file function.
24
24
  * @handleName upload
25
25
  * @param {File | Blob} file - File to upload. Example: `new File(["content"], "file.png", {"type": "image/png"})`
26
- * @param {IUploadingQuery} [fileQuery] - Optional set query parameters.
26
+ * @param {IUploadingQuery} fileQuery - Where the file lives in the storage. Required: without `type`, `entity` and `id` the endpoint answers `400 … should not be empty`.
27
27
  * @example
28
28
  {
29
29
  "type": "page",
@@ -34,9 +34,9 @@ export default class FileUploadingApi extends AsyncModules implements IFileUploa
34
34
  "compress": true,
35
35
  "template": 1
36
36
  }
37
- * @param {string} [fileQuery.type] - Type, determines the folder name in the storage. Example: "page".
38
- * @param {string} [fileQuery.entity] - Entity name from which the file is uploaded, determines the folder name in the storage. Example: "editor".
39
- * @param {number} [fileQuery.id] - Identifier of the object from which the file is uploaded, determines the folder name in the storage. Example: 3787.
37
+ * @param {string} fileQuery.type - Type, determines the folder name in the storage. Example: "page".
38
+ * @param {string} fileQuery.entity - Entity name from which the file is uploaded, determines the folder name in the storage. Example: "editor".
39
+ * @param {number} fileQuery.id - Identifier of the object from which the file is uploaded, determines the folder name in the storage. Example: 3787.
40
40
  * @param {number} [fileQuery.width] - Optional width parameter. Example: 0.
41
41
  * @param {number} [fileQuery.height] - Optional height parameter. Example: 0.
42
42
  * @param {boolean} [fileQuery.compress] - Optional flag of optimization (compression) for images. Example: true.
@@ -45,12 +45,12 @@ export default class FileUploadingApi extends AsyncModules implements IFileUploa
45
45
  * @throws {IError} When isShell=false and an error occurs during the fetch
46
46
  * @see {@link https://js-sdk.oneentry.cloud/docs/file-uploading/upload upload} documentation.
47
47
  */
48
- upload(file: File | Blob, fileQuery?: IUploadingQuery): Promise<IUploadingReturn[] | IError>;
48
+ upload(file: File | Blob, fileQuery: IUploadingQuery): Promise<IUploadingReturn[] | IError>;
49
49
  /**
50
50
  * Deletes a file from the cloud file storage.
51
51
  * @handleName delete
52
52
  * @param {string} filename - File name. Example: "file.png".
53
- * @param {IUploadingQuery} [fileQuery] - Optional set query parameters.
53
+ * @param {IUploadingQuery} fileQuery - Where the file lives in the storage. Required: without `type`, `entity` and `id` the endpoint answers `400 … should not be empty`.
54
54
  * @example
55
55
  {
56
56
  "type": "page",
@@ -58,15 +58,15 @@ export default class FileUploadingApi extends AsyncModules implements IFileUploa
58
58
  "id": 3787,
59
59
  "template": 1
60
60
  }
61
- * @param {string} [fileQuery.type] - Type, determines the folder name in the storage. Example: "page".
62
- * @param {string} [fileQuery.entity] - Entity name from which the file is uploaded, determines the folder name in the storage. Example: "editor".
63
- * @param {number} [fileQuery.id] - Identifier of the object from which the file is uploaded, determines the folder name in the storage. Example: 3787.
61
+ * @param {string} fileQuery.type - Type, determines the folder name in the storage. Example: "page".
62
+ * @param {string} fileQuery.entity - Entity name from which the file is uploaded, determines the folder name in the storage. Example: "editor".
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
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
  */
69
- delete(filename: string, fileQuery?: IUploadingQuery): Promise<boolean | IError>;
69
+ delete(filename: string, fileQuery: IUploadingQuery): Promise<boolean | IError>;
70
70
  /**
71
71
  * Public search across the content of files attached to records.
72
72
  * @handleName searchFileContent
@@ -18,9 +18,6 @@ export default class FileUploadingApi extends AsyncModules {
18
18
  super(state);
19
19
  /** FileUploadingApi class */
20
20
  this._defaultQuery = {
21
- type: null,
22
- entity: null,
23
- id: null,
24
21
  width: null,
25
22
  height: null,
26
23
  compress: null,
@@ -31,7 +28,7 @@ export default class FileUploadingApi extends AsyncModules {
31
28
  * Upload file function.
32
29
  * @handleName upload
33
30
  * @param {File | Blob} file - File to upload. Example: `new File(["content"], "file.png", {"type": "image/png"})`
34
- * @param {IUploadingQuery} [fileQuery] - Optional set query parameters.
31
+ * @param {IUploadingQuery} fileQuery - Where the file lives in the storage. Required: without `type`, `entity` and `id` the endpoint answers `400 … should not be empty`.
35
32
  * @example
36
33
  {
37
34
  "type": "page",
@@ -42,9 +39,9 @@ export default class FileUploadingApi extends AsyncModules {
42
39
  "compress": true,
43
40
  "template": 1
44
41
  }
45
- * @param {string} [fileQuery.type] - Type, determines the folder name in the storage. Example: "page".
46
- * @param {string} [fileQuery.entity] - Entity name from which the file is uploaded, determines the folder name in the storage. Example: "editor".
47
- * @param {number} [fileQuery.id] - Identifier of the object from which the file is uploaded, determines the folder name in the storage. Example: 3787.
42
+ * @param {string} fileQuery.type - Type, determines the folder name in the storage. Example: "page".
43
+ * @param {string} fileQuery.entity - Entity name from which the file is uploaded, determines the folder name in the storage. Example: "editor".
44
+ * @param {number} fileQuery.id - Identifier of the object from which the file is uploaded, determines the folder name in the storage. Example: 3787.
48
45
  * @param {number} [fileQuery.width] - Optional width parameter. Example: 0.
49
46
  * @param {number} [fileQuery.height] - Optional height parameter. Example: 0.
50
47
  * @param {boolean} [fileQuery.compress] - Optional flag of optimization (compression) for images. Example: true.
@@ -66,7 +63,7 @@ export default class FileUploadingApi extends AsyncModules {
66
63
  * Deletes a file from the cloud file storage.
67
64
  * @handleName delete
68
65
  * @param {string} filename - File name. Example: "file.png".
69
- * @param {IUploadingQuery} [fileQuery] - Optional set query parameters.
66
+ * @param {IUploadingQuery} fileQuery - Where the file lives in the storage. Required: without `type`, `entity` and `id` the endpoint answers `400 … should not be empty`.
70
67
  * @example
71
68
  {
72
69
  "type": "page",
@@ -74,9 +71,9 @@ export default class FileUploadingApi extends AsyncModules {
74
71
  "id": 3787,
75
72
  "template": 1
76
73
  }
77
- * @param {string} [fileQuery.type] - Type, determines the folder name in the storage. Example: "page".
78
- * @param {string} [fileQuery.entity] - Entity name from which the file is uploaded, determines the folder name in the storage. Example: "editor".
79
- * @param {number} [fileQuery.id] - Identifier of the object from which the file is uploaded, determines the folder name in the storage. Example: 3787.
74
+ * @param {string} fileQuery.type - Type, determines the folder name in the storage. Example: "page".
75
+ * @param {string} fileQuery.entity - Entity name from which the file is uploaded, determines the folder name in the storage. Example: "editor".
76
+ * @param {number} fileQuery.id - Identifier of the object from which the file is uploaded, determines the folder name in the storage. Example: 3787.
80
77
  * @param {number} [fileQuery.template] - preview template identifier. Example: 1.
81
78
  * @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.
82
79
  * @throws {IError} When isShell=false and an error occurs during the fetch
@@ -17,7 +17,7 @@ interface IFileUploading {
17
17
  * Upload file function.
18
18
  * @handleName upload
19
19
  * @param {File | Blob} file - File to upload. Example: `new File(["content"], "file.png", {"type": "image/png"})`
20
- * @param {IUploadingQuery} [fileQuery] - Optional set query parameters.
20
+ * @param {IUploadingQuery} fileQuery - Where the file lives in the storage. Required: without `type`, `entity` and `id` the endpoint answers `400 … should not be empty`.
21
21
  * @example
22
22
  {
23
23
  "type": "page",
@@ -28,9 +28,9 @@ interface IFileUploading {
28
28
  "compress": true,
29
29
  "template": 1
30
30
  }
31
- * @param {string} [fileQuery.type] - Type, determines the folder name in the storage. Example: "page".
32
- * @param {string} [fileQuery.entity] - Entity name from which the file is uploaded, determines the folder name in the storage. Example: "editor".
33
- * @param {number} [fileQuery.id] - Identifier of the object from which the file is uploaded, determines the folder name in the storage. Example: 3787.
31
+ * @param {string} fileQuery.type - Type, determines the folder name in the storage. Example: "page".
32
+ * @param {string} fileQuery.entity - Entity name from which the file is uploaded, determines the folder name in the storage. Example: "editor".
33
+ * @param {number} fileQuery.id - Identifier of the object from which the file is uploaded, determines the folder name in the storage. Example: 3787.
34
34
  * @param {number} [fileQuery.width] - Optional width parameter. Example: 0.
35
35
  * @param {number} [fileQuery.height] - Optional height parameter. Example: 0.
36
36
  * @param {boolean} [fileQuery.compress] - Optional flag of optimization (compression) for images. Example: true.
@@ -38,12 +38,12 @@ interface IFileUploading {
38
38
  * @returns {IUploadingReturn[]} Uploads a file to an Amazon S3-compatible cloud file storage.
39
39
  * @throws {IError} - If there is an error during the fetch operation, it will return an error object.
40
40
  */
41
- upload(file: File | Blob, fileQuery?: IUploadingQuery): Promise<IUploadingReturn[] | IError>;
41
+ upload(file: File | Blob, fileQuery: IUploadingQuery): Promise<IUploadingReturn[] | IError>;
42
42
  /**
43
43
  * Deletes a file from the cloud file storage.
44
44
  * @handleName delete
45
45
  * @param {string} [filename] - File name. Example: "file.png".
46
- * @param {IUploadingQuery} [fileQuery] - Optional set query parameters.
46
+ * @param {IUploadingQuery} fileQuery - Where the file lives in the storage. Required: without `type`, `entity` and `id` the endpoint answers `400 … should not be empty`.
47
47
  * @example
48
48
  {
49
49
  "type": "page",
@@ -51,14 +51,14 @@ interface IFileUploading {
51
51
  "id": 3787,
52
52
  "template": 1
53
53
  }
54
- * @param {string} [fileQuery.type] - Type, determines the folder name in the storage. Example: "page".
55
- * @param {string} [fileQuery.entity] - Entity name from which the file is uploaded, determines the folder name in the storage. Example: "editor".
56
- * @param {number} [fileQuery.id] - Identifier of the object from which the file is uploaded, determines the folder name in the storage. Example: 3787.
54
+ * @param {string} fileQuery.type - Type, determines the folder name in the storage. Example: "page".
55
+ * @param {string} fileQuery.entity - Entity name from which the file is uploaded, determines the folder name in the storage. Example: "editor".
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
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
- delete(filename: string, fileQuery?: IUploadingQuery): Promise<boolean | IError>;
61
+ delete(filename: string, fileQuery: IUploadingQuery): Promise<boolean | IError>;
62
62
  /**
63
63
  * Get file by parameters.
64
64
  * @handleName getFile
@@ -106,12 +106,12 @@ interface IFileEntity {
106
106
  * @property {number} [width] - Width parameter. Example: 0.
107
107
  * @property {number} [height] - Height parameter. Example: 0.
108
108
  * @property {boolean} [compress] - Flag of optimization (compression) for images. Example: true.
109
- * @description Represents a query for uploading files, including type, entity, and optional parameters like width, height, and compression.
109
+ * @description Represents a query for uploading files, including type, entity, and optional parameters like width, height, and compression. `type`, `entity` and `id` are required by the endpoint: it answers `400 … should not be empty` without any of them (CMS-1085).
110
110
  */
111
111
  interface IUploadingQuery {
112
- type: string | null;
113
- entity: string | null;
114
- id: number | null;
112
+ type: string;
113
+ entity: string;
114
+ id: number;
115
115
  [key: string]: string | number | boolean | null;
116
116
  }
117
117
  /**
package/esm/index.d.ts CHANGED
@@ -136,7 +136,7 @@ interface IDefineApi {
136
136
  * @param {string} [config.guestId] - Optional guest identifier sent as the `x-guest-id` header for guest cart/wishlist/activity flows (only while unauthenticated). In the browser, if omitted, a stable per-device id is generated and persisted in localStorage. On the server you MUST pass a per-visitor `guestId` (or call `setGuestId`): the SDK never auto-generates a server id, to avoid sharing one guest across visitors.
137
137
  * @param {string} [config.deviceMetadata] - Optional device-metadata string sent as the `x-device-metadata` header instead of the environment-derived fingerprint. Refresh tokens are bound to this header, so a server issuing tokens for a browser (OAuth code exchange) must pass the browser's string (from `getDeviceMetadata()`), or the token will not be refreshable from that browser.
138
138
  * @param {string} [config.langCode] - Optional langCode parameter
139
- * @param {boolean} [config.traficLimit] - Some methods use multiple queries to make it easier to work with the API. Set this parameter to "false" to save traffic and decide for yourself what data you need.
139
+ * @param {boolean} [config.traficLimit] - Some methods use multiple queries to make it easier to work with the API. Set it to `true` to save traffic and decide for yourself what data you need: the SDK then skips its follow-up requests, and some results change shape (e.g. `searchPage` returns short `{ id, title }` cards). Default: false.
140
140
  * @param {string} [config.auth] - An object with authorization settings.
141
141
  * @param {boolean} [config.auth.customAuth] - Set this flag to true if you want to configure the authorization process yourself. Set the flag to false, or do not pass it at all to have automatic authorization and token renewal.
142
142
  * @param {string} [config.auth.refreshToken] - Transfer the refresh token here, for example from the local storage, to resume the user's session. Otherwise, the user will need to log in every time a new session is created.
package/esm/index.js CHANGED
@@ -42,7 +42,7 @@ export { expandAttributeTimeIntervals, expandTimeIntervals, isTimeIntervalAttrib
42
42
  * @param {string} [config.guestId] - Optional guest identifier sent as the `x-guest-id` header for guest cart/wishlist/activity flows (only while unauthenticated). In the browser, if omitted, a stable per-device id is generated and persisted in localStorage. On the server you MUST pass a per-visitor `guestId` (or call `setGuestId`): the SDK never auto-generates a server id, to avoid sharing one guest across visitors.
43
43
  * @param {string} [config.deviceMetadata] - Optional device-metadata string sent as the `x-device-metadata` header instead of the environment-derived fingerprint. Refresh tokens are bound to this header, so a server issuing tokens for a browser (OAuth code exchange) must pass the browser's string (from `getDeviceMetadata()`), or the token will not be refreshable from that browser.
44
44
  * @param {string} [config.langCode] - Optional langCode parameter
45
- * @param {boolean} [config.traficLimit] - Some methods use multiple queries to make it easier to work with the API. Set this parameter to "false" to save traffic and decide for yourself what data you need.
45
+ * @param {boolean} [config.traficLimit] - Some methods use multiple queries to make it easier to work with the API. Set it to `true` to save traffic and decide for yourself what data you need: the SDK then skips its follow-up requests, and some results change shape (e.g. `searchPage` returns short `{ id, title }` cards). Default: false.
46
46
  * @param {string} [config.auth] - An object with authorization settings.
47
47
  * @param {boolean} [config.auth.customAuth] - Set this flag to true if you want to configure the authorization process yourself. Set the flag to false, or do not pass it at all to have automatic authorization and token renewal.
48
48
  * @param {string} [config.auth.refreshToken] - Transfer the refresh token here, for example from the local storage, to resume the user's session. Otherwise, the user will need to log in every time a new session is created.
@@ -1,7 +1,7 @@
1
1
  import AsyncModules from '../base/asyncModules.js';
2
2
  import type StateModule from '../base/stateModule.js';
3
3
  import type { IError } from '../base/utils.js';
4
- import type { ICollectionEntity, ICollectionFormObject, ICollectionIsValid, ICollectionQuery, ICollectionRow, ICollectionRowsResponce, ICollectionsApi } from './integrationCollectionsInterfaces.js';
4
+ import type { ICollectionEntity, ICollectionFormObject, ICollectionIsValid, ICollectionQuery, ICollectionRow, ICollectionRowsResponce, ICollectionsApi, ICollectionsListQuery } from './integrationCollectionsInterfaces.js';
5
5
  /**
6
6
  * Controllers for working with attributes.
7
7
  * @handle /api/content/integration-collections
@@ -22,22 +22,18 @@ export default class IntegrationCollectionsApi extends AsyncModules implements I
22
22
  * Get all collections.
23
23
  * @handleName getICollections
24
24
  * @param {string} [langCode] - Language code. Default: "en_US".
25
- * @param {object} [userQuery] - Optional set query parameters.
25
+ * @param {ICollectionsListQuery} [userQuery] - Optional set query parameters.
26
26
  * @example
27
27
  {
28
- "limit": 0,
29
- "offset": 30,
30
- "entityType": "orders",
31
- "entityId": 1
28
+ "limit": 30,
29
+ "offset": 0
32
30
  }
33
- * @param {number} [userQuery.limit] - Optional parameter for pagination. Default: 0.
34
- * @param {number} [userQuery.offset] - Optional parameter for pagination. Default: 30.
35
- * @param {string} [userQuery.entityType] - Entity type. Example: "orders".
36
- * @param {number} [userQuery.entityId] - Entity identifier. Example: 1.
31
+ * @param {number} [userQuery.limit] - Optional parameter for pagination. Default: 30.
32
+ * @param {number} [userQuery.offset] - Optional parameter for pagination. Default: 0.
37
33
  * @returns {Promise<ICollectionEntity[] | IError>} Returns an array of ICollection objects or an error object if there was an issue.
38
34
  * @see {@link https://js-sdk.oneentry.cloud/docs/integration-collections/getICollections getICollections} documentation.
39
35
  */
40
- getICollections(langCode?: string, userQuery?: ICollectionQuery): Promise<ICollectionEntity[] | IError>;
36
+ getICollections(langCode?: string, userQuery?: ICollectionsListQuery): Promise<ICollectionEntity[] | IError>;
41
37
  /**
42
38
  * Get a single collection object by id.
43
39
  * @handleName getICollectionById
@@ -53,16 +49,16 @@ export default class IntegrationCollectionsApi extends AsyncModules implements I
53
49
  * @handleName getICollectionRowsById
54
50
  * @param {number} id - Collection id. Example: 1.
55
51
  * @param {string} [langCode] - Language code. Default: "en_US".
56
- * @param {any} [userQuery] - Optional set query parameters.
52
+ * @param {ICollectionQuery} [userQuery] - Optional set query parameters.
57
53
  * @example
58
54
  {
59
- "limit": 0,
60
- "offset": 30,
55
+ "limit": 30,
56
+ "offset": 0,
61
57
  "entityType": "orders",
62
58
  "entityId": 1
63
59
  }
64
- * @param {number} [userQuery.limit] - Optional parameter for pagination. Default: 0.
65
- * @param {number} [userQuery.offset] - Optional parameter for pagination. Default: 30.
60
+ * @param {number} [userQuery.limit] - Optional parameter for pagination. Default: 30.
61
+ * @param {number} [userQuery.offset] - Optional parameter for pagination. Default: 0.
66
62
  * @param {string} [userQuery.entityType] - Entity type. Example: "orders".
67
63
  * @param {number} [userQuery.entityId] - Entity identifier. Example: 1.
68
64
  * @returns {Promise<ICollectionRowsResponce | IError>} Returns object ItemsWithTotal, where items is an array of requested objects.
@@ -27,18 +27,14 @@ export default class IntegrationCollectionsApi extends AsyncModules {
27
27
  * Get all collections.
28
28
  * @handleName getICollections
29
29
  * @param {string} [langCode] - Language code. Default: "en_US".
30
- * @param {object} [userQuery] - Optional set query parameters.
30
+ * @param {ICollectionsListQuery} [userQuery] - Optional set query parameters.
31
31
  * @example
32
32
  {
33
- "limit": 0,
34
- "offset": 30,
35
- "entityType": "orders",
36
- "entityId": 1
33
+ "limit": 30,
34
+ "offset": 0
37
35
  }
38
- * @param {number} [userQuery.limit] - Optional parameter for pagination. Default: 0.
39
- * @param {number} [userQuery.offset] - Optional parameter for pagination. Default: 30.
40
- * @param {string} [userQuery.entityType] - Entity type. Example: "orders".
41
- * @param {number} [userQuery.entityId] - Entity identifier. Example: 1.
36
+ * @param {number} [userQuery.limit] - Optional parameter for pagination. Default: 30.
37
+ * @param {number} [userQuery.offset] - Optional parameter for pagination. Default: 0.
42
38
  * @returns {Promise<ICollectionEntity[] | IError>} Returns an array of ICollection objects or an error object if there was an issue.
43
39
  * @see {@link https://js-sdk.oneentry.cloud/docs/integration-collections/getICollections getICollections} documentation.
44
40
  */
@@ -70,16 +66,16 @@ export default class IntegrationCollectionsApi extends AsyncModules {
70
66
  * @handleName getICollectionRowsById
71
67
  * @param {number} id - Collection id. Example: 1.
72
68
  * @param {string} [langCode] - Language code. Default: "en_US".
73
- * @param {any} [userQuery] - Optional set query parameters.
69
+ * @param {ICollectionQuery} [userQuery] - Optional set query parameters.
74
70
  * @example
75
71
  {
76
- "limit": 0,
77
- "offset": 30,
72
+ "limit": 30,
73
+ "offset": 0,
78
74
  "entityType": "orders",
79
75
  "entityId": 1
80
76
  }
81
- * @param {number} [userQuery.limit] - Optional parameter for pagination. Default: 0.
82
- * @param {number} [userQuery.offset] - Optional parameter for pagination. Default: 30.
77
+ * @param {number} [userQuery.limit] - Optional parameter for pagination. Default: 30.
78
+ * @param {number} [userQuery.offset] - Optional parameter for pagination. Default: 0.
83
79
  * @param {string} [userQuery.entityType] - Entity type. Example: "orders".
84
80
  * @param {number} [userQuery.entityId] - Entity identifier. Example: 1.
85
81
  * @returns {Promise<ICollectionRowsResponce | IError>} Returns object ItemsWithTotal, where items is an array of requested objects.
@@ -8,23 +8,19 @@ interface ICollectionsApi {
8
8
  * Get all collections.
9
9
  * @handleName getICollections
10
10
  * @param {string} [langCode] - Language code. Default: "en_US".
11
- * @param {ICollectionQuery} [userQuery] - Query parameters.
11
+ * @param {ICollectionsListQuery} [userQuery] - Query parameters.
12
12
  * @example
13
13
  {
14
14
  "limit": 30,
15
- "offset": 0,
16
- "entityType": "orders",
17
- "entityId": 1
15
+ "offset": 0
18
16
  }
19
- * @param {number} [userQuery.limit] - Parameter for pagination. Default: 0.
20
- * @param {number} [userQuery.offset] - Parameter for pagination. Default: 30.
21
- * @param {string} [userQuery.entityType] - Entity type. Example: "orders".
22
- * @param {number} [userQuery.entityId] - Entity identifier. Example: 1.
17
+ * @param {number} [userQuery.limit] - Parameter for pagination. Default: 30.
18
+ * @param {number} [userQuery.offset] - Parameter for pagination. Default: 0.
23
19
  * @returns {ICollectionEntity[]} Returns an array of ICollection objects or an error object if there was an issue.
24
20
  * @throws {IError} - If there is an error during the fetch operation, it will return an error object.
25
21
  * @description This method gets all collections.
26
22
  */
27
- getICollections(langCode?: string, userQuery?: ICollectionQuery): Promise<ICollectionEntity[] | IError>;
23
+ getICollections(langCode?: string, userQuery?: ICollectionsListQuery): Promise<ICollectionEntity[] | IError>;
28
24
  /**
29
25
  * Get a single collection object by id.
30
26
  * @handleName getICollectionById
@@ -205,7 +201,7 @@ interface ICollectionFormData {
205
201
  * Collection form object
206
202
  * @interface ICollectionFormObject
207
203
  * @property {string} formIdentifier - Text identifier (marker) of the form. Example: "collection-form".
208
- * @property {Record<string, ICollectionFormData>} formData - An object where keys are form field markers and values are arrays of ICollectionFormData objects.
204
+ * @property {ICollectionFormData[] | Record<string, ICollectionFormData[]>} formData - Field values: a flat array `[{ marker, type, value }]` (as in the example), or the same array wrapped in a language code — `{ "en_US": [...] }`. The platform stores both; the SDK sends the value as is.
209
205
  * @example
210
206
  [
211
207
  {
@@ -221,9 +217,7 @@ interface ICollectionFormData {
221
217
  */
222
218
  interface ICollectionFormObject {
223
219
  formIdentifier: string;
224
- formData: {
225
- [key: string]: ICollectionFormData[];
226
- };
220
+ formData: ICollectionFormData[] | Record<string, ICollectionFormData[]>;
227
221
  }
228
222
  /**
229
223
  * Collection row object
@@ -301,17 +295,24 @@ interface ICollectionIsValid {
301
295
  valid: boolean;
302
296
  }
303
297
  /**
304
- * Query parameters for collection requests.
298
+ * Query parameters for collection row requests. All of them are optional.
305
299
  * @interface ICollectionQuery
306
- * @property {number} limit - Parameter for pagination. Default: 30.
307
- * @property {number} offset - Parameter for pagination. Default: 0.
308
- * @property {string} entityType - Entity type. Example: "orders".
309
- * @property {number} entityId - Entity identifier. Example: 1.
300
+ * @property {number} [limit] - Parameter for pagination. Default: 30.
301
+ * @property {number} [offset] - Parameter for pagination. Default: 0.
302
+ * @property {string} [entityType] - Entity type. Example: "orders".
303
+ * @property {number} [entityId] - Entity identifier. Example: 1.
310
304
  */
311
305
  interface ICollectionQuery {
312
- limit: number;
313
- offset: number;
314
- entityType: string;
315
- entityId: number;
306
+ limit?: number;
307
+ offset?: number;
308
+ entityType?: string;
309
+ entityId?: number;
316
310
  }
317
- export type { ICollectionEntity, ICollectionFormObject, ICollectionIsValid, ICollectionQuery, ICollectionResponce, ICollectionRow, ICollectionRowsResponce, ICollectionsApi, };
311
+ /**
312
+ * Query parameters for getICollections: pagination only — the collection list takes no entity filter.
313
+ * @typedef {object} ICollectionsListQuery
314
+ * @property {number} [limit] - Parameter for pagination. Default: 30.
315
+ * @property {number} [offset] - Parameter for pagination. Default: 0.
316
+ */
317
+ type ICollectionsListQuery = Pick<ICollectionQuery, 'limit' | 'offset'>;
318
+ export type { ICollectionEntity, ICollectionFormObject, ICollectionIsValid, ICollectionQuery, ICollectionResponce, ICollectionRow, ICollectionRowsResponce, ICollectionsApi, ICollectionsListQuery, };