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
package/changelog.md CHANGED
@@ -1,5 +1,30 @@
1
1
  # SDK Change Log
2
2
 
3
+ ## v.1.0.173
4
+
5
+ ### What's Changed
6
+
7
+ - **⚠️ Breaking (types): `FileUploading.upload` and `FileUploading.delete` require `fileQuery`, and `IUploadingQuery` requires `type`, `entity` and `id`.** The signature and the JSDoc declared all of them optional, and the SDK filled the gaps with `null` — which the endpoint refuses: without any of the three both methods answer `400 type should not be empty; entity should not be empty; id should not be empty`, and a `delete` without `type` leaves the file in place. A call that compiled could never succeed. It is now a compile error instead of a `400` at run time; code that already passed a full `fileQuery` is unaffected. `width`, `height`, `compress` and `template` stay optional. The per-field `fileQuery` of `postFormsData` is unchanged — there the SDK still picks a folder when none is given (CMS-1085).
8
+
9
+ - **`IntegrationCollections` types accept the calls the API accepts.** `ICollectionFormObject.formData` was declared as a map keyed by language only, so the flat array `[{ marker, type, value }]` shown in the JSDoc example of `createICollectionRow` — and stored by the platform — did not compile; it is now `ICollectionFormData[] | Record<string, ICollectionFormData[]>`. All four fields of `ICollectionQuery` were required, so `{ limit, offset }` did not compile either; they are optional now. `getICollections` takes the new `ICollectionsListQuery` (`limit`, `offset`): the collection list has no entity filter. The JSDoc of both list methods gave the pagination defaults swapped (`limit` 0, `offset` 30); the code has always used `limit` 30, `offset` 0, and so does the JSDoc now (CMS-1078, CMS-1086).
10
+
11
+ - **`IFilterParams.attributeMarker` and `conditionValue` are optional.** A filter entry may select by `statusMarker` (or `pageUrls`, `title`) alone — `getProducts([{ statusMarker: 'sale' }])` is answered and filtered by the endpoint (an unknown status gives `total: 0`), but the type refused it without a cast (CMS-1086).
12
+
13
+ - **`System.getApiStat` is typed.** It returned `Promise<unknown>` and its JSDoc promised "object with date and count"; the endpoint answers an array of one-key day objects, `[{ "2026-10-25": 17280 }, { "2026-10-26": 13671 }]`. The return type is now `IApiStatEntry[] | IError`, with `IApiStatEntry = Record<string, number>` exported (CMS-1077).
14
+
15
+ ### What's Fixed
16
+
17
+ - **JSDoc that the documentation site is generated from.**
18
+ - `IConfig.traficLimit` and the `config.traficLimit` parameter of `defineOneEntry` said "set it to `false` to save traffic" — the opposite of the code: `true` makes the SDK skip its follow-up requests (one request instead of six for a quick page search) and shortens some results to `{ id, title }` cards (CMS-1084).
19
+ - `Templates.getAllTemplates`, `getTemplateByType` and `getTemplateByMarker` named `GroupedTemplatesObject` and `TemplateEntity`, which do not exist; they name `BlockType` and `ITemplateEntity` now, and `getTemplateByType` is described as the array it returns (CMS-1077).
20
+ - `AuthProvider.getActiveSessionsByMarker` carried the description of `getAuthProviderByMarker`; it describes the user's active sessions now (CMS-1086).
21
+ - `ProductStatuses.getProductsByStatusMarker` and `validateMarker` called their argument a product marker; it is a product status marker (CMS-1086).
22
+ - Examples carried Russian data into English documentation: `"Ivan"` in the order examples and `"ru-RU"` in `IActiveSession` are `"John"` and `"en-US"` (CMS-1086).
23
+
24
+ ### Tests
25
+
26
+ - **`callercontracts.spec.ts` checks the types against the API.** ts-jest type-checks the file, so a type that drifts back fails the run: a flat collection `formData`, `{ limit, offset }` as a collection query, a status-only product filter and the `getApiStat` array must compile, and `upload` / `delete` without `fileQuery` must not (`@ts-expect-error`). The test client is typed now — it was `any`, which would have let such checks pass silently. Against 1.0.172 the file does not compile, with six errors naming exactly these types.
27
+
3
28
  ## v.1.0.172
4
29
 
5
30
  ### What's Fixed
@@ -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>;
@@ -366,9 +366,9 @@ class AuthProviderApi extends asyncModules_1.default {
366
366
  * Getting active user sessions data.
367
367
  * @handleName getActiveSessionsByMarker
368
368
  * @param {string} marker - The text identifier of the authorization provider. Example: "email".
369
- * @returns {Promise<IActiveSession[] | IError>} Returns an auth provider object.
369
+ * @returns {Promise<IActiveSession[] | IError>} Array of the authenticated user's active sessions for this provider, one per device (`deviceInfo`).
370
370
  * @throws {IError} When isShell=false and an error occurs during the fetch
371
- * @description Getting a single authorization provider object by marker.
371
+ * @description Getting the authenticated user's active sessions for the authorization provider. This method requires user authorization.
372
372
  * @see {@link https://js-sdk.oneentry.cloud/docs/auth-provider/getActiveSessionsByMarker getActiveSessionsByMarker} documentation.
373
373
  */
374
374
  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
@@ -56,9 +56,6 @@ class FileUploadingApi extends asyncModules_1.default {
56
56
  super(state);
57
57
  /** FileUploadingApi class */
58
58
  this._defaultQuery = {
59
- type: null,
60
- entity: null,
61
- id: null,
62
59
  width: null,
63
60
  height: null,
64
61
  compress: null,
@@ -69,7 +66,7 @@ class FileUploadingApi extends asyncModules_1.default {
69
66
  * Upload file function.
70
67
  * @handleName upload
71
68
  * @param {File | Blob} file - File to upload. Example: `new File(["content"], "file.png", {"type": "image/png"})`
72
- * @param {IUploadingQuery} [fileQuery] - Optional set query parameters.
69
+ * @param {IUploadingQuery} fileQuery - Where the file lives in the storage. Required: without `type`, `entity` and `id` the endpoint answers `400 … should not be empty`.
73
70
  * @example
74
71
  {
75
72
  "type": "page",
@@ -80,9 +77,9 @@ class FileUploadingApi extends asyncModules_1.default {
80
77
  "compress": true,
81
78
  "template": 1
82
79
  }
83
- * @param {string} [fileQuery.type] - Type, determines the folder name in the storage. Example: "page".
84
- * @param {string} [fileQuery.entity] - Entity name from which the file is uploaded, determines the folder name in the storage. Example: "editor".
85
- * @param {number} [fileQuery.id] - Identifier of the object from which the file is uploaded, determines the folder name in the storage. Example: 3787.
80
+ * @param {string} fileQuery.type - Type, determines the folder name in the storage. Example: "page".
81
+ * @param {string} fileQuery.entity - Entity name from which the file is uploaded, determines the folder name in the storage. Example: "editor".
82
+ * @param {number} fileQuery.id - Identifier of the object from which the file is uploaded, determines the folder name in the storage. Example: 3787.
86
83
  * @param {number} [fileQuery.width] - Optional width parameter. Example: 0.
87
84
  * @param {number} [fileQuery.height] - Optional height parameter. Example: 0.
88
85
  * @param {boolean} [fileQuery.compress] - Optional flag of optimization (compression) for images. Example: true.
@@ -104,7 +101,7 @@ class FileUploadingApi extends asyncModules_1.default {
104
101
  * Deletes a file from the cloud file storage.
105
102
  * @handleName delete
106
103
  * @param {string} filename - File name. Example: "file.png".
107
- * @param {IUploadingQuery} [fileQuery] - Optional set query parameters.
104
+ * @param {IUploadingQuery} fileQuery - Where the file lives in the storage. Required: without `type`, `entity` and `id` the endpoint answers `400 … should not be empty`.
108
105
  * @example
109
106
  {
110
107
  "type": "page",
@@ -112,9 +109,9 @@ class FileUploadingApi extends asyncModules_1.default {
112
109
  "id": 3787,
113
110
  "template": 1
114
111
  }
115
- * @param {string} [fileQuery.type] - Type, determines the folder name in the storage. Example: "page".
116
- * @param {string} [fileQuery.entity] - Entity name from which the file is uploaded, determines the folder name in the storage. Example: "editor".
117
- * @param {number} [fileQuery.id] - Identifier of the object from which the file is uploaded, determines the folder name in the storage. Example: 3787.
112
+ * @param {string} fileQuery.type - Type, determines the folder name in the storage. Example: "page".
113
+ * @param {string} fileQuery.entity - Entity name from which the file is uploaded, determines the folder name in the storage. Example: "editor".
114
+ * @param {number} fileQuery.id - Identifier of the object from which the file is uploaded, determines the folder name in the storage. Example: 3787.
118
115
  * @param {number} [fileQuery.template] - preview template identifier. Example: 1.
119
116
  * @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
117
  * @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/dist/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/dist/index.js CHANGED
@@ -59,7 +59,7 @@ Object.defineProperty(exports, "isTimeIntervalAttribute", { enumerable: true, ge
59
59
  * @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.
60
60
  * @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.
61
61
  * @param {string} [config.langCode] - Optional langCode parameter
62
- * @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.
62
+ * @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.
63
63
  * @param {string} [config.auth] - An object with authorization settings.
64
64
  * @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.
65
65
  * @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';
2
2
  import type StateModule from '../base/stateModule';
3
3
  import type { IError } from '../base/utils';
4
- import type { ICollectionEntity, ICollectionFormObject, ICollectionIsValid, ICollectionQuery, ICollectionRow, ICollectionRowsResponce, ICollectionsApi } from './integrationCollectionsInterfaces';
4
+ import type { ICollectionEntity, ICollectionFormObject, ICollectionIsValid, ICollectionQuery, ICollectionRow, ICollectionRowsResponce, ICollectionsApi, ICollectionsListQuery } from './integrationCollectionsInterfaces';
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.
@@ -65,18 +65,14 @@ class IntegrationCollectionsApi extends asyncModules_1.default {
65
65
  * Get all collections.
66
66
  * @handleName getICollections
67
67
  * @param {string} [langCode] - Language code. Default: "en_US".
68
- * @param {object} [userQuery] - Optional set query parameters.
68
+ * @param {ICollectionsListQuery} [userQuery] - Optional set query parameters.
69
69
  * @example
70
70
  {
71
- "limit": 0,
72
- "offset": 30,
73
- "entityType": "orders",
74
- "entityId": 1
71
+ "limit": 30,
72
+ "offset": 0
75
73
  }
76
- * @param {number} [userQuery.limit] - Optional parameter for pagination. Default: 0.
77
- * @param {number} [userQuery.offset] - Optional parameter for pagination. Default: 30.
78
- * @param {string} [userQuery.entityType] - Entity type. Example: "orders".
79
- * @param {number} [userQuery.entityId] - Entity identifier. Example: 1.
74
+ * @param {number} [userQuery.limit] - Optional parameter for pagination. Default: 30.
75
+ * @param {number} [userQuery.offset] - Optional parameter for pagination. Default: 0.
80
76
  * @returns {Promise<ICollectionEntity[] | IError>} Returns an array of ICollection objects or an error object if there was an issue.
81
77
  * @see {@link https://js-sdk.oneentry.cloud/docs/integration-collections/getICollections getICollections} documentation.
82
78
  */
@@ -108,16 +104,16 @@ class IntegrationCollectionsApi extends asyncModules_1.default {
108
104
  * @handleName getICollectionRowsById
109
105
  * @param {number} id - Collection id. Example: 1.
110
106
  * @param {string} [langCode] - Language code. Default: "en_US".
111
- * @param {any} [userQuery] - Optional set query parameters.
107
+ * @param {ICollectionQuery} [userQuery] - Optional set query parameters.
112
108
  * @example
113
109
  {
114
- "limit": 0,
115
- "offset": 30,
110
+ "limit": 30,
111
+ "offset": 0,
116
112
  "entityType": "orders",
117
113
  "entityId": 1
118
114
  }
119
- * @param {number} [userQuery.limit] - Optional parameter for pagination. Default: 0.
120
- * @param {number} [userQuery.offset] - Optional parameter for pagination. Default: 30.
115
+ * @param {number} [userQuery.limit] - Optional parameter for pagination. Default: 30.
116
+ * @param {number} [userQuery.offset] - Optional parameter for pagination. Default: 0.
121
117
  * @param {string} [userQuery.entityType] - Entity type. Example: "orders".
122
118
  * @param {number} [userQuery.entityId] - Entity identifier. Example: 1.
123
119
  * @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, };
@@ -211,7 +211,7 @@ interface IOrdersVectorSearch {
211
211
  "formData": [
212
212
  {
213
213
  "marker": "order_name",
214
- "value": "Ivan",
214
+ "value": "John",
215
215
  "type": "string"
216
216
  }
217
217
  ],
@@ -578,7 +578,7 @@ interface IOrderSplit {
578
578
  [
579
579
  {
580
580
  "marker": "order_name",
581
- "value": "Ivan",
581
+ "value": "John",
582
582
  "type": "string"
583
583
  }
584
584
  ]
@@ -29,7 +29,7 @@ export default class ProductStatusesApi extends AsyncModules implements IProduct
29
29
  /**
30
30
  * Search for a product status object by its textual identifier (marker).
31
31
  * @handleName getProductsByStatusMarker
32
- * @param {string} marker - Product marker. Example: "in_stock".
32
+ * @param {string} marker - Product status marker. Example: "in_stock".
33
33
  * @param {string} [langCode] - Language code. Default: "en_US".
34
34
  * @returns {Promise<IProductStatusEntity | IError>} Returns a product status object.
35
35
  * @throws {IError} When isShell=false and an error occurs during the fetch
@@ -40,7 +40,7 @@ export default class ProductStatusesApi extends AsyncModules implements IProduct
40
40
  /**
41
41
  * Check the existence of a textual identifier.
42
42
  * @handleName validateMarker
43
- * @param {string} marker - Product marker. Example: "in_stock".
43
+ * @param {string} marker - Product status marker. Example: "in_stock".
44
44
  * @returns {Promise<boolean | IError>} Returns true if the textual identifier (marker) exists or false if it doesn't.
45
45
  * @throws {IError} When isShell=false and an error occurs during the fetch
46
46
  * @description Check the existence of a textual identifier.
@@ -72,7 +72,7 @@ class ProductStatusesApi extends asyncModules_1.default {
72
72
  /**
73
73
  * Search for a product status object by its textual identifier (marker).
74
74
  * @handleName getProductsByStatusMarker
75
- * @param {string} marker - Product marker. Example: "in_stock".
75
+ * @param {string} marker - Product status marker. Example: "in_stock".
76
76
  * @param {string} [langCode] - Language code. Default: "en_US".
77
77
  * @returns {Promise<IProductStatusEntity | IError>} Returns a product status object.
78
78
  * @throws {IError} When isShell=false and an error occurs during the fetch
@@ -88,7 +88,7 @@ class ProductStatusesApi extends asyncModules_1.default {
88
88
  /**
89
89
  * Check the existence of a textual identifier.
90
90
  * @handleName validateMarker
91
- * @param {string} marker - Product marker. Example: "in_stock".
91
+ * @param {string} marker - Product status marker. Example: "in_stock".
92
92
  * @returns {Promise<boolean | IError>} Returns true if the textual identifier (marker) exists or false if it doesn't.
93
93
  * @throws {IError} When isShell=false and an error occurs during the fetch
94
94
  * @description Check the existence of a textual identifier.
@@ -16,7 +16,7 @@ interface IProductStatusesApi {
16
16
  /**
17
17
  * Search for a product status object by its textual identifier (marker).
18
18
  * @handleName getProductsByStatusMarker
19
- * @param {string} marker - Product marker. Example: "in_stock".
19
+ * @param {string} marker - Product status marker. Example: "in_stock".
20
20
  * @param {string} [langCode] - Language code. Default: "en_US".
21
21
  * @returns {IProductStatusEntity} Returns a product status object.
22
22
  * @throws {IError} If there is an error during the fetch operation, it will return an error object.
@@ -26,7 +26,7 @@ interface IProductStatusesApi {
26
26
  /**
27
27
  * Check the existence of a textual identifier.
28
28
  * @handleName validateMarker
29
- * @param {string} marker - Product marker. Example: "in_stock".
29
+ * @param {string} marker - Product status marker. Example: "in_stock".
30
30
  * @returns {boolean} Returns true if the textual identifier (marker) exists or false if it doesn't.
31
31
  * @throws {IError} If there is an error during the fetch operation, it will return an error object.
32
32
  * @description This method checks the existence of a textual identifier.
@@ -367,9 +367,9 @@ type IProductsByIdsQuery = Pick<IProductsQueryBase, 'signPrice'>;
367
367
  type IProductsQuery = IProductsQueryBase;
368
368
  /**
369
369
  * @interface IFilterParams
370
- * @property {string | null} attributeMarker - The text identifier of the indexed attribute by which values are filtered. Default: null. Example: "color".
370
+ * @property {string} [attributeMarker] - The text identifier of the indexed attribute by which values are filtered. Example: "color". Optional: a filter entry may select by `statusMarker` (or `pageUrls`, `title`) alone, e.g. `{ statusMarker: "in_stock" }`.
371
371
  * @property {string | null} [conditionMarker] - Id of the filter condition by which the values are filtered. Default: null. Example: "eq".
372
- * @property {number | string | null} conditionValue - The value that is being searched for, default null. Example: "new".
372
+ * @property {number | string | null} [conditionValue] - The value that is being searched for, default null. Example: "new". Needed together with `attributeMarker`.
373
373
  * @property {string | null} [pageUrl] - Url of the category page object. Example: ["23-laminat-floorwood-maxima"].
374
374
  * @property {string[] | null} [pageUrls] - Url of the category page object. Example: ["23-laminat-floorwood-maxima"].
375
375
  * @property {string | null} [statusMarker] - Text identifier of the product page status (default not set). Example: "in_stock".
@@ -378,9 +378,9 @@ type IProductsQuery = IProductsQueryBase;
378
378
  * @description This interface defines the structure of filter parameters used for querying products, including conditions, attributes, and pagination.
379
379
  */
380
380
  interface IFilterParams {
381
- attributeMarker: string;
381
+ attributeMarker?: string;
382
382
  conditionMarker?: 'in' /** 'in' - Contains */ | 'nin' /** 'nin' - Does not contain */ | 'eq' /** 'eq' - Equal */ | 'neq' /** 'neq' - Not equal */ | 'mth' /** 'mth' - Greater than */ | 'lth' /** 'lth' - Less than */ | 'exs' /** 'exs' - Exists */ | 'nexs' /** 'nexs' - Does not exist */ | 'pat' /** 'pat' - Matches pattern */ | 'same' /** 'same' - Matches the value exactly */ | 'same_part' /** 'same_part' - Matches a part of the value exactly */ | null;
383
- conditionValue: number | string | null;
383
+ conditionValue?: number | string | null;
384
384
  pageUrl?: string | null;
385
385
  pageUrls?: string[] | null;
386
386
  statusMarker?: string;