oneentry 1.0.171 → 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 (106) hide show
  1. package/changelog.md +53 -0
  2. package/dist/admins/adminsApi.d.ts +3 -3
  3. package/dist/admins/adminsApi.js +1 -1
  4. package/dist/admins/adminsInterfaces.d.ts +3 -3
  5. package/dist/auth-provider/authProviderApi.d.ts +2 -2
  6. package/dist/auth-provider/authProviderApi.js +2 -2
  7. package/dist/auth-provider/authProvidersInterfaces.d.ts +3 -3
  8. package/dist/base/asyncModules.d.ts +6 -1
  9. package/dist/base/asyncModules.js +9 -1
  10. package/dist/base/utils.d.ts +12 -2
  11. package/dist/blocks/blocksApi.d.ts +1 -1
  12. package/dist/blocks/blocksApi.js +1 -1
  13. package/dist/blocks/blocksInterfaces.d.ts +4 -2
  14. package/dist/discounts/discountsApi.d.ts +3 -3
  15. package/dist/discounts/discountsApi.js +1 -1
  16. package/dist/discounts/discountsInterfaces.d.ts +3 -3
  17. package/dist/events/eventsApi.d.ts +1 -1
  18. package/dist/events/eventsApi.js +1 -2
  19. package/dist/file-uploading/fileUploadingApi.d.ts +11 -11
  20. package/dist/file-uploading/fileUploadingApi.js +12 -14
  21. package/dist/file-uploading/fileUploadingInterfaces.d.ts +15 -15
  22. package/dist/forms-data/formsDataApi.d.ts +4 -4
  23. package/dist/forms-data/formsDataApi.js +24 -17
  24. package/dist/forms-data/formsDataInterfaces.d.ts +3 -3
  25. package/dist/general-types/generalTypesSchemas.d.ts +0 -2
  26. package/dist/general-types/generalTypesSchemas.js +0 -1
  27. package/dist/index.d.ts +1 -1
  28. package/dist/index.js +1 -1
  29. package/dist/integration-collections/integrationCollectionsApi.d.ts +12 -16
  30. package/dist/integration-collections/integrationCollectionsApi.js +10 -14
  31. package/dist/integration-collections/integrationCollectionsInterfaces.d.ts +24 -23
  32. package/dist/orders/ordersApi.d.ts +16 -3
  33. package/dist/orders/ordersApi.js +25 -15
  34. package/dist/orders/ordersInterfaces.d.ts +5 -5
  35. package/dist/pages/pagesApi.d.ts +4 -4
  36. package/dist/pages/pagesApi.js +9 -13
  37. package/dist/pages/pagesInterfaces.d.ts +3 -3
  38. package/dist/product-statuses/productStatusesApi.d.ts +2 -2
  39. package/dist/product-statuses/productStatusesApi.js +2 -2
  40. package/dist/product-statuses/productStatusesInterfaces.d.ts +2 -2
  41. package/dist/products/productsApi.d.ts +7 -6
  42. package/dist/products/productsApi.js +6 -3
  43. package/dist/products/productsInterfaces.d.ts +18 -13
  44. package/dist/system/systemApi.d.ts +4 -4
  45. package/dist/system/systemApi.js +2 -2
  46. package/dist/system/systemInterfaces.d.ts +11 -5
  47. package/dist/templates/templatesApi.d.ts +3 -3
  48. package/dist/templates/templatesApi.js +3 -3
  49. package/dist/templates/templatesInterfaces.d.ts +3 -3
  50. package/dist/user-activity/userActivityApi.js +4 -7
  51. package/dist/users/usersApi.d.ts +3 -3
  52. package/dist/users/usersApi.js +1 -1
  53. package/dist/users/usersInterfaces.d.ts +3 -3
  54. package/esm/admins/adminsApi.d.ts +3 -3
  55. package/esm/admins/adminsApi.js +1 -1
  56. package/esm/admins/adminsInterfaces.d.ts +3 -3
  57. package/esm/auth-provider/authProviderApi.d.ts +2 -2
  58. package/esm/auth-provider/authProviderApi.js +2 -2
  59. package/esm/auth-provider/authProvidersInterfaces.d.ts +3 -3
  60. package/esm/base/asyncModules.d.ts +6 -1
  61. package/esm/base/asyncModules.js +9 -1
  62. package/esm/base/utils.d.ts +12 -2
  63. package/esm/blocks/blocksApi.d.ts +1 -1
  64. package/esm/blocks/blocksApi.js +1 -1
  65. package/esm/blocks/blocksInterfaces.d.ts +4 -2
  66. package/esm/discounts/discountsApi.d.ts +3 -3
  67. package/esm/discounts/discountsApi.js +1 -1
  68. package/esm/discounts/discountsInterfaces.d.ts +3 -3
  69. package/esm/events/eventsApi.d.ts +1 -1
  70. package/esm/events/eventsApi.js +1 -2
  71. package/esm/file-uploading/fileUploadingApi.d.ts +11 -11
  72. package/esm/file-uploading/fileUploadingApi.js +12 -14
  73. package/esm/file-uploading/fileUploadingInterfaces.d.ts +15 -15
  74. package/esm/forms-data/formsDataApi.d.ts +4 -4
  75. package/esm/forms-data/formsDataApi.js +24 -17
  76. package/esm/forms-data/formsDataInterfaces.d.ts +3 -3
  77. package/esm/general-types/generalTypesSchemas.d.ts +0 -2
  78. package/esm/general-types/generalTypesSchemas.js +0 -1
  79. package/esm/index.d.ts +1 -1
  80. package/esm/index.js +1 -1
  81. package/esm/integration-collections/integrationCollectionsApi.d.ts +12 -16
  82. package/esm/integration-collections/integrationCollectionsApi.js +10 -14
  83. package/esm/integration-collections/integrationCollectionsInterfaces.d.ts +24 -23
  84. package/esm/orders/ordersApi.d.ts +16 -3
  85. package/esm/orders/ordersApi.js +25 -15
  86. package/esm/orders/ordersInterfaces.d.ts +5 -5
  87. package/esm/pages/pagesApi.d.ts +4 -4
  88. package/esm/pages/pagesApi.js +9 -13
  89. package/esm/pages/pagesInterfaces.d.ts +3 -3
  90. package/esm/product-statuses/productStatusesApi.d.ts +2 -2
  91. package/esm/product-statuses/productStatusesApi.js +2 -2
  92. package/esm/product-statuses/productStatusesInterfaces.d.ts +2 -2
  93. package/esm/products/productsApi.d.ts +7 -6
  94. package/esm/products/productsApi.js +6 -3
  95. package/esm/products/productsInterfaces.d.ts +18 -13
  96. package/esm/system/systemApi.d.ts +4 -4
  97. package/esm/system/systemApi.js +2 -2
  98. package/esm/system/systemInterfaces.d.ts +11 -5
  99. package/esm/templates/templatesApi.d.ts +3 -3
  100. package/esm/templates/templatesApi.js +3 -3
  101. package/esm/templates/templatesInterfaces.d.ts +3 -3
  102. package/esm/user-activity/userActivityApi.js +4 -7
  103. package/esm/users/usersApi.d.ts +3 -3
  104. package/esm/users/usersApi.js +1 -1
  105. package/esm/users/usersInterfaces.d.ts +3 -3
  106. package/package.json +2 -2
@@ -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
@@ -439,6 +439,16 @@ interface IHttpOptions {
439
439
  headers: IHttpHeaders;
440
440
  body?: string | FormData | Blob;
441
441
  }
442
+ /**
443
+ * Response of a semantic (vector) search: the module's own list container plus `indexReady`.
444
+ * @typedef {object} IVectorSearchResponse
445
+ * @template T
446
+ * @property {boolean} indexReady - `false` when no vectors are built yet for this entity and language: the query was not embedded, and empty `items` do not mean "nothing matched". `true` — an honest search result.
447
+ * @description Every `…/vector/search` endpoint answers with `indexReady` next to its list (CMS-1074).
448
+ */
449
+ type IVectorSearchResponse<T> = T & {
450
+ indexReady: boolean;
451
+ };
442
452
  /**
443
453
  * LangType
444
454
  */
@@ -447,4 +457,4 @@ type LangType = string | Array<string>;
447
457
  * LocalizeType
448
458
  */
449
459
  type LocalizeType = ILocalizeInfo;
450
- export type { IAttributeFile, IAttributeLocalizeInfo, IAttributes, IAttributeValue, IAttributeValues, IConfig, IError, IFileAttributeValue, IHttpHeaders, IHttpOptions, IListAttributeValue, ILocalizeInfo, INumberAttributeValue, IRating, IStringAttributeValue, ITimeIntervalAttributeValue, ITimeIntervalEntitySchedule, ITimeIntervalGroup, ITimeIntervalPoint, ITimeIntervalRange, ITimeIntervalSchedule, ITimeIntervalWindow, ITypedAttributeValue, LangType, LocalizeType, TimeIntervalPair, };
460
+ export type { IAttributeFile, IAttributeLocalizeInfo, IAttributes, IAttributeValue, IAttributeValues, IConfig, IError, IFileAttributeValue, IHttpHeaders, IHttpOptions, IListAttributeValue, ILocalizeInfo, INumberAttributeValue, IRating, IStringAttributeValue, ITimeIntervalAttributeValue, ITimeIntervalEntitySchedule, ITimeIntervalGroup, ITimeIntervalPoint, ITimeIntervalRange, ITimeIntervalSchedule, ITimeIntervalWindow, ITypedAttributeValue, IVectorSearchResponse, LangType, LocalizeType, TimeIntervalPair, };
@@ -21,7 +21,7 @@ export default class BlocksApi extends AsyncModules implements IBlocks {
21
21
  /**
22
22
  * Get blocks by parameters.
23
23
  * @handleName getBlocks
24
- * @param {BlockType} [type] - Optional block type to filter by. Available values: "product" | "error_page" | "catalog_page" | "product_preview" | "similar_products_block" | "product_block" | "form" | "common_page" | "common_block" | "order" | "service" | "none". When omitted, blocks of all types are returned. Example: 'product'.
24
+ * @param {BlockType} [type] - Optional block type to filter by. Available values: "product" | "error_page" | "catalog_page" | "product_preview" | "similar_products_block" | "product_block" | "frequently_ordered_block" | "trending_block" | "recently_viewed_block" | "repeat_purchase_block" | "slider_block" | "personal_recommendations_block" | "cart_complement_block" | "cart_similar_block" | "wishlist_similar_block" | "form" | "common_page" | "common_block" | "order" | "service" | "external_page" | "discount" (see BlockType). When omitted, blocks of all types are returned. Example: 'product'.
25
25
  * @param {string} [langCode] - Language code. Default: "en_US".
26
26
  * @param {number} [offset] - Parameter for pagination. Default: 0.
27
27
  * @param {number} [limit] - Parameter for pagination. Default: 30.
@@ -22,7 +22,7 @@ export default class BlocksApi extends AsyncModules {
22
22
  /**
23
23
  * Get blocks by parameters.
24
24
  * @handleName getBlocks
25
- * @param {BlockType} [type] - Optional block type to filter by. Available values: "product" | "error_page" | "catalog_page" | "product_preview" | "similar_products_block" | "product_block" | "form" | "common_page" | "common_block" | "order" | "service" | "none". When omitted, blocks of all types are returned. Example: 'product'.
25
+ * @param {BlockType} [type] - Optional block type to filter by. Available values: "product" | "error_page" | "catalog_page" | "product_preview" | "similar_products_block" | "product_block" | "frequently_ordered_block" | "trending_block" | "recently_viewed_block" | "repeat_purchase_block" | "slider_block" | "personal_recommendations_block" | "cart_complement_block" | "cart_similar_block" | "wishlist_similar_block" | "form" | "common_page" | "common_block" | "order" | "service" | "external_page" | "discount" (see BlockType). When omitted, blocks of all types are returned. Example: 'product'.
26
26
  * @param {string} [langCode] - Language code. Default: "en_US".
27
27
  * @param {number} [offset] - Parameter for pagination. Default: 0.
28
28
  * @param {number} [limit] - Parameter for pagination. Default: 30.
@@ -309,9 +309,11 @@ interface ISearchBlock {
309
309
  /**
310
310
  * BlockType
311
311
  * @type {BlockType}
312
- * @description This type defines the possible values for block types used in the system.
312
+ * @description This type defines the possible values for block types used in the system: the types `GET /api/content/general-types` returns.
313
+ * `'none'` was dropped — the platform has no such type and a filter by it answers `400 type must be a valid enum value` (CMS-1062).
314
+ * `'service'` is the platform's own name for the type, but the `type` filter of getBlocks and getTemplateByType currently refuses it with the same `400`; that is a platform defect (CMS-1073).
313
315
  */
314
- type BlockType = 'product' | 'error_page' | 'catalog_page' | 'product_preview' | 'similar_products_block' | 'product_block' | 'frequently_ordered_block' | 'trending_block' | 'recently_viewed_block' | 'repeat_purchase_block' | 'slider_block' | 'personal_recommendations_block' | 'cart_complement_block' | 'cart_similar_block' | 'wishlist_similar_block' | 'form' | 'common_page' | 'common_block' | 'order' | 'service' | 'external_page' | 'discount' | 'none';
316
+ type BlockType = 'product' | 'error_page' | 'catalog_page' | 'product_preview' | 'similar_products_block' | 'product_block' | 'frequently_ordered_block' | 'trending_block' | 'recently_viewed_block' | 'repeat_purchase_block' | 'slider_block' | 'personal_recommendations_block' | 'cart_complement_block' | 'cart_similar_block' | 'wishlist_similar_block' | 'form' | 'common_page' | 'common_block' | 'order' | 'service' | 'external_page' | 'discount';
315
317
  /**
316
318
  * Lookup body for block product endpoints by explicit productIds.
317
319
  * @interface IBlockProductsLookup
@@ -1,6 +1,6 @@
1
1
  import AsyncModules from '../base/asyncModules.js';
2
2
  import type StateModule from '../base/stateModule.js';
3
- import type { IError } from '../base/utils.js';
3
+ import type { IError, IVectorSearchResponse } from '../base/utils.js';
4
4
  import type { IBonusBalanceEntity, IBonusHistoryResponse, IBonusTransactionType, ICouponValidationResult, IDiscountsApi, IDiscountsEntity, IDiscountsResponse, IDiscountsVectorSearch, IDiscountType } from './discountsInterfaces.js';
5
5
  /**
6
6
  * Controllers for working with events
@@ -85,10 +85,10 @@ export default class DiscountsApi extends AsyncModules implements IDiscountsApi
85
85
  * @param {string} [langCode] - Language code. Default: "en_US".
86
86
  * @param {number} [offset] - Parameter for pagination. Default: 0.
87
87
  * @param {number} [limit] - Parameter for pagination. Default: 30.
88
- * @returns {Promise<IDiscountsResponse | IError>} Returns an object with an array of found discounts and total count.
88
+ * @returns {Promise<IVectorSearchResponse<IDiscountsResponse> | IError>} Returns an object with an array of found discounts and total count.
89
89
  * @throws {IError} When isShell=false and an error occurs during the fetch
90
90
  * @description This method performs a semantic (vector) search for discounts.
91
91
  * @see {@link https://js-sdk.oneentry.cloud/docs/discounts/getDiscountsByVectorSearch getDiscountsByVectorSearch} documentation.
92
92
  */
93
- getDiscountsByVectorSearch(body: IDiscountsVectorSearch, langCode?: string, offset?: number, limit?: number): Promise<IDiscountsResponse | IError>;
93
+ getDiscountsByVectorSearch(body: IDiscountsVectorSearch, langCode?: string, offset?: number, limit?: number): Promise<IVectorSearchResponse<IDiscountsResponse> | IError>;
94
94
  }
@@ -119,7 +119,7 @@ export default class DiscountsApi extends AsyncModules {
119
119
  * @param {string} [langCode] - Language code. Default: "en_US".
120
120
  * @param {number} [offset] - Parameter for pagination. Default: 0.
121
121
  * @param {number} [limit] - Parameter for pagination. Default: 30.
122
- * @returns {Promise<IDiscountsResponse | IError>} Returns an object with an array of found discounts and total count.
122
+ * @returns {Promise<IVectorSearchResponse<IDiscountsResponse> | IError>} Returns an object with an array of found discounts and total count.
123
123
  * @throws {IError} When isShell=false and an error occurs during the fetch
124
124
  * @description This method performs a semantic (vector) search for discounts.
125
125
  * @see {@link https://js-sdk.oneentry.cloud/docs/discounts/getDiscountsByVectorSearch getDiscountsByVectorSearch} documentation.
@@ -1,4 +1,4 @@
1
- import type { IAttributeValues, IError, ILocalizeInfo } from '../base/utils.js';
1
+ import type { IAttributeValues, IError, ILocalizeInfo, IVectorSearchResponse } from '../base/utils.js';
2
2
  /**
3
3
  * Discount type.
4
4
  */
@@ -66,10 +66,10 @@ interface IDiscountsApi {
66
66
  * @param {string} [langCode] - Language code. Default: "en_US".
67
67
  * @param {number} [offset] - Parameter for pagination. Default: 0.
68
68
  * @param {number} [limit] - Parameter for pagination. Default: 30.
69
- * @returns {Promise<IDiscountsResponse | IError>} Returns an object with an array of found discounts and total count.
69
+ * @returns {Promise<IVectorSearchResponse<IDiscountsResponse> | IError>} Returns an object with an array of found discounts and total count.
70
70
  * @throws {IError} When isShell=false and an error occurs during the fetch
71
71
  */
72
- getDiscountsByVectorSearch(body: IDiscountsVectorSearch, langCode?: string, offset?: number, limit?: number): Promise<IDiscountsResponse | IError>;
72
+ getDiscountsByVectorSearch(body: IDiscountsVectorSearch, langCode?: string, offset?: number, limit?: number): Promise<IVectorSearchResponse<IDiscountsResponse> | IError>;
73
73
  }
74
74
  /**
75
75
  * Body for semantic (vector) discount search.
@@ -53,7 +53,7 @@ export default class EventsApi extends AsyncModules implements IEvents {
53
53
  * @param {string} marker - The marker of the event to unsubscribe from. Example: "product_price_change".
54
54
  * @param {number} productId - The ID of the product to unsubscribe from. Example: 12345.
55
55
  * @param {string} [langCode] - Language code. Default: "en_US".
56
- * @returns {Promise<any | IError>} - Returns a promise that resolves to the result of the unsubscription operation or an error object if there was an issue.
56
+ * @returns {Promise<boolean | IError>} - Returns true if the unsubscription succeeded, or an error object if there was an issue.
57
57
  * @throws {IError} When isShell=false and an error occurs during the fetch
58
58
  * @description This method requires user authorization.
59
59
  * @see For more information about configuring the {@link https://js-sdk.oneentry.cloud/docs/category/authprovider authorization module}, see the documentation in the {@link https://js-sdk.oneentry.cloud/docs/category/authprovider configuration settings section of the SDK}.
@@ -1,4 +1,3 @@
1
- /* eslint-disable jsdoc/reject-any-type */
2
1
  /* eslint-disable @typescript-eslint/no-explicit-any */
3
2
  import AsyncModules from '../base/asyncModules.js';
4
3
  /**
@@ -66,7 +65,7 @@ export default class EventsApi extends AsyncModules {
66
65
  * @param {string} marker - The marker of the event to unsubscribe from. Example: "product_price_change".
67
66
  * @param {number} productId - The ID of the product to unsubscribe from. Example: 12345.
68
67
  * @param {string} [langCode] - Language code. Default: "en_US".
69
- * @returns {Promise<any | IError>} - Returns a promise that resolves to the result of the unsubscription operation or an error object if there was an issue.
68
+ * @returns {Promise<boolean | IError>} - Returns true if the unsubscription succeeded, or an error object if there was an issue.
70
69
  * @throws {IError} When isShell=false and an error occurs during the fetch
71
70
  * @description This method requires user authorization.
72
71
  * @see For more information about configuring the {@link https://js-sdk.oneentry.cloud/docs/category/authprovider authorization module}, see the documentation in the {@link https://js-sdk.oneentry.cloud/docs/category/authprovider configuration settings section of the SDK}.
@@ -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
- * @returns {Promise<boolean | IError>} Returns a promise that resolves to the result of the deletion operation or an error object if there was an issue.
65
+ * @returns {Promise<boolean | IError>} Returns a promise that resolves to true when the file was deleted or an error object if there was an issue.
66
66
  * @throws {IError} When isShell=false and an error occurs during the fetch
67
67
  * @see {@link https://js-sdk.oneentry.cloud/docs/file-uploading/delete delete} documentation.
68
68
  */
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,18 +71,19 @@ 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
- * @returns {Promise<boolean | IError>} Returns a promise that resolves to the result of the deletion operation or an error object if there was an issue.
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
83
80
  * @see {@link https://js-sdk.oneentry.cloud/docs/file-uploading/delete delete} documentation.
84
81
  */
85
82
  async delete(filename, fileQuery) {
86
83
  const query = { ...this._defaultQuery, ...fileQuery };
87
- const result = await this._fetchDelete(`?filename=${filename}&` + this._queryParamsToString(query));
88
- return result;
84
+ // The endpoint answers 200 with an empty body, which _parseJson reads as `{}`;
85
+ // _fetchBoolean turns that into the declared `true` (CMS-1072)
86
+ return this._fetchBoolean(() => this._fetchDelete(`?filename=${filename}&` + this._queryParamsToString(query)));
89
87
  }
90
88
  /**
91
89
  * Public search across the content of files attached to records.
@@ -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
- * @returns {boolean | IError} Returns a promise that resolves to the result of the deletion operation or an error object if there was an issue.
58
+ * @returns {boolean | IError} Returns a promise that resolves to true when the file was deleted or an error object if there was an issue.
59
59
  * @throws {IError} - If there is an error during the fetch operation, it will return an error object.
60
60
  */
61
- 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
  /**
@@ -1,6 +1,6 @@
1
1
  import AsyncModules from '../base/asyncModules.js';
2
2
  import type StateModule from '../base/stateModule.js';
3
- import type { IError } from '../base/utils.js';
3
+ import type { IError, IVectorSearchResponse } from '../base/utils.js';
4
4
  import type { IBodyPostFormData, IFormsByMarkerDataEntity, IFormsData, IFormsDataFilter, IFormsDataSearchResponse, IFormsDataVectorSearch, IPostFormResponse, IUpdateFormsData } from './formsDataInterfaces.js';
5
5
  /**
6
6
  * Controllers for working with form data
@@ -76,7 +76,7 @@ export default class FormsDataApi extends AsyncModules implements IFormsData {
76
76
  /**
77
77
  * Removes `contentType` from a file value, which the endpoint does not accept.
78
78
  * @param {T} value - Value of a `file` / `image` / `groupOfImages` field, after the uploads.
79
- * @returns {T} The same value, without `contentType`.
79
+ * @returns {T} The value without `contentType`; entries that carried it are copies, the caller's objects are not modified.
80
80
  * @description `FileUploading.upload` returns `contentType` and form data rejects it,
81
81
  * so it is stripped from an array of values and from a lone value object alike. A value
82
82
  * of any other shape is returned untouched and the endpoint names the field it cannot
@@ -166,10 +166,10 @@ export default class FormsDataApi extends AsyncModules implements IFormsData {
166
166
  * @param {string} [langCode] - Language code. Default: "en_US".
167
167
  * @param {number} [offset] - Parameter for pagination. Default: 0.
168
168
  * @param {number} [limit] - Parameter for pagination. Default: 30.
169
- * @returns {Promise<IFormsDataSearchResponse | IError>} Returns an object with an array of found form data records and total count.
169
+ * @returns {Promise<IVectorSearchResponse<IFormsDataSearchResponse> | IError>} Returns an object with an array of found form data records and total count.
170
170
  * @throws {IError} When isShell=false and an error occurs during the fetch
171
171
  * @description This method performs a semantic (vector) search for form data.
172
172
  * @see {@link https://js-sdk.oneentry.cloud/docs/forms-data/getFormsDataByVectorSearch getFormsDataByVectorSearch} documentation.
173
173
  */
174
- getFormsDataByVectorSearch(body: IFormsDataVectorSearch, langCode?: string, offset?: number, limit?: number): Promise<IFormsDataSearchResponse | IError>;
174
+ getFormsDataByVectorSearch(body: IFormsDataVectorSearch, langCode?: string, offset?: number, limit?: number): Promise<IVectorSearchResponse<IFormsDataSearchResponse> | IError>;
175
175
  }
@@ -79,9 +79,12 @@ export default class FormsDataApi extends AsyncModules {
79
79
  // Create an instance of FileUploadingApi with the current state
80
80
  const fileUploader = new FileUploadingApi(this.state);
81
81
  // Process each element in formData[langCode] asynchronously
82
- formData[langCode] = await Promise.all(formData[langCode].map(async (fd) => {
82
+ formData[langCode] = await Promise.all(formData[langCode].map(async (field) => {
83
83
  // Check if the type is one of the specified types
84
- if (['file', 'image', 'groupOfImages'].includes(fd.type)) {
84
+ if (['file', 'image', 'groupOfImages'].includes(field.type)) {
85
+ // Work on a copy: the caller's field keeps its File and its fileQuery,
86
+ // so a reused body sends the same form again (CMS-1071)
87
+ const fd = { ...field };
85
88
  // If fileQuery does not exist, we create it and assign it to an object with the following properties:
86
89
  if (!fd.fileQuery) {
87
90
  const fileQuery = {
@@ -119,13 +122,15 @@ export default class FormsDataApi extends AsyncModules {
119
122
  delete fd.fileQuery;
120
123
  // Remove the 'contentType' property from the file object because it is not needed and not valid
121
124
  fd.value = this._stripContentType(fd.value);
125
+ return fd;
122
126
  }
123
- // Return the processed form data element
124
- return fd;
127
+ // Return the form data element untouched
128
+ return field;
125
129
  }));
126
130
  }
127
- body.formData = formData;
128
- const result = await this._fetchPost(``, body);
131
+ // The wrapped formData goes into a new body: written back into the caller's
132
+ // object, a second call with it wrapped the wrapper and answered `400` (CMS-1071)
133
+ const result = await this._fetchPost(``, { ...body, formData });
129
134
  // Validate response if validation is enabled
130
135
  const validated = await this._validateResponse(result, schema('PostFormResponseSchema'));
131
136
  return this._normalizeData(validated);
@@ -145,7 +150,7 @@ export default class FormsDataApi extends AsyncModules {
145
150
  /**
146
151
  * Removes `contentType` from a file value, which the endpoint does not accept.
147
152
  * @param {T} value - Value of a `file` / `image` / `groupOfImages` field, after the uploads.
148
- * @returns {T} The same value, without `contentType`.
153
+ * @returns {T} The value without `contentType`; entries that carried it are copies, the caller's objects are not modified.
149
154
  * @description `FileUploading.upload` returns `contentType` and form data rejects it,
150
155
  * so it is stripped from an array of values and from a lone value object alike. A value
151
156
  * of any other shape is returned untouched and the endpoint names the field it cannot
@@ -153,18 +158,20 @@ export default class FormsDataApi extends AsyncModules {
153
158
  * request is made (CMS-990).
154
159
  */
155
160
  _stripContentType(value) {
161
+ // An entry carrying `contentType` is copied without it rather than edited:
162
+ // a descriptor passed through untouched belongs to the caller (CMS-1071)
156
163
  const strip = (item) => {
157
- if (item && typeof item === 'object' && !Array.isArray(item)) {
158
- delete item.contentType;
164
+ if (item &&
165
+ typeof item === 'object' &&
166
+ !Array.isArray(item) &&
167
+ 'contentType' in item) {
168
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
169
+ const { contentType, ...rest } = item;
170
+ return rest;
159
171
  }
172
+ return item;
160
173
  };
161
- if (Array.isArray(value)) {
162
- value.forEach(strip);
163
- }
164
- else {
165
- strip(value);
166
- }
167
- return value;
174
+ return (Array.isArray(value) ? value.map(strip) : strip(value));
168
175
  }
169
176
  /**
170
177
  * Drops the date bounds the endpoint refuses to parse.
@@ -271,7 +278,7 @@ export default class FormsDataApi extends AsyncModules {
271
278
  * @param {string} [langCode] - Language code. Default: "en_US".
272
279
  * @param {number} [offset] - Parameter for pagination. Default: 0.
273
280
  * @param {number} [limit] - Parameter for pagination. Default: 30.
274
- * @returns {Promise<IFormsDataSearchResponse | IError>} Returns an object with an array of found form data records and total count.
281
+ * @returns {Promise<IVectorSearchResponse<IFormsDataSearchResponse> | IError>} Returns an object with an array of found form data records and total count.
275
282
  * @throws {IError} When isShell=false and an error occurs during the fetch
276
283
  * @description This method performs a semantic (vector) search for form data.
277
284
  * @see {@link https://js-sdk.oneentry.cloud/docs/forms-data/getFormsDataByVectorSearch getFormsDataByVectorSearch} documentation.
@@ -1,4 +1,4 @@
1
- import type { IError } from '../base/utils.js';
1
+ import type { IError, IVectorSearchResponse } from '../base/utils.js';
2
2
  import type { IUploadingQuery, IUploadingReturn } from '../file-uploading/fileUploadingInterfaces.js';
3
3
  /**
4
4
  * Interface for retrieving and posting form data in the system.
@@ -77,10 +77,10 @@ interface IFormsData {
77
77
  * @param {string} [langCode] - Language code. Default: "en_US".
78
78
  * @param {number} [offset] - Parameter for pagination. Default: 0.
79
79
  * @param {number} [limit] - Parameter for pagination. Default: 30.
80
- * @returns {Promise<IFormsDataSearchResponse | IError>} Returns an object with an array of found form data records and total count.
80
+ * @returns {Promise<IVectorSearchResponse<IFormsDataSearchResponse> | IError>} Returns an object with an array of found form data records and total count.
81
81
  * @throws {IError} When isShell=false and an error occurs during the fetch
82
82
  */
83
- getFormsDataByVectorSearch(body: IFormsDataVectorSearch, langCode?: string, offset?: number, limit?: number): Promise<IFormsDataSearchResponse | IError>;
83
+ getFormsDataByVectorSearch(body: IFormsDataVectorSearch, langCode?: string, offset?: number, limit?: number): Promise<IVectorSearchResponse<IFormsDataSearchResponse> | IError>;
84
84
  }
85
85
  /**
86
86
  * Body for semantic (vector) form data search.
@@ -10,7 +10,6 @@ import { z } from 'zod';
10
10
  export declare const GeneralTypeEntitySchema: z.ZodObject<{
11
11
  id: z.ZodNumber;
12
12
  type: z.ZodEnum<{
13
- none: "none";
14
13
  product: "product";
15
14
  order: "order";
16
15
  form: "form";
@@ -41,7 +40,6 @@ export declare const GeneralTypeEntitySchema: z.ZodObject<{
41
40
  export declare const GeneralTypesResponseSchema: z.ZodArray<z.ZodObject<{
42
41
  id: z.ZodNumber;
43
42
  type: z.ZodEnum<{
44
- none: "none";
45
43
  product: "product";
46
44
  order: "order";
47
45
  form: "form";
@@ -33,7 +33,6 @@ export const GeneralTypeEntitySchema = z.object({
33
33
  'service',
34
34
  'external_page',
35
35
  'discount',
36
- 'none',
37
36
  ]),
38
37
  });
39
38
  /**
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.