oneentry 1.0.166 → 1.0.168

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 (79) hide show
  1. package/README.md +5 -1
  2. package/changelog.md +46 -0
  3. package/dist/auth-provider/authProviderApi.js +3 -2
  4. package/dist/base/asyncModules.d.ts +18 -0
  5. package/dist/base/asyncModules.js +34 -1
  6. package/dist/base/syncModules.d.ts +10 -3
  7. package/dist/base/syncModules.js +25 -14
  8. package/dist/base/utils.d.ts +5 -2
  9. package/dist/base/validation.d.ts +7 -5
  10. package/dist/base/validation.js +7 -4
  11. package/dist/discounts/discountsApi.d.ts +3 -3
  12. package/dist/discounts/discountsApi.js +1 -1
  13. package/dist/discounts/discountsInterfaces.d.ts +15 -3
  14. package/dist/file-uploading/fileUploadingApi.d.ts +27 -1
  15. package/dist/file-uploading/fileUploadingApi.js +42 -0
  16. package/dist/file-uploading/fileUploadingInterfaces.d.ts +102 -1
  17. package/dist/file-uploading/fileUploadingSchemas.d.ts +73 -0
  18. package/dist/file-uploading/fileUploadingSchemas.js +47 -1
  19. package/dist/forms-data/formsDataInterfaces.d.ts +130 -3
  20. package/dist/index.d.ts +4 -0
  21. package/dist/index.js +3 -0
  22. package/dist/orders/ordersApi.d.ts +14 -0
  23. package/dist/orders/ordersApi.js +19 -0
  24. package/dist/orders/ordersInterfaces.d.ts +11 -0
  25. package/dist/payments/paymentsApi.d.ts +14 -1
  26. package/dist/payments/paymentsApi.js +18 -0
  27. package/dist/payments/paymentsInterfaces.d.ts +43 -1
  28. package/dist/payments/paymentsSchemas.d.ts +32 -0
  29. package/dist/payments/paymentsSchemas.js +20 -1
  30. package/dist/search/searchApi.d.ts +3 -2
  31. package/dist/search/searchApi.js +6 -2
  32. package/dist/search/searchInterfaces.d.ts +3 -2
  33. package/dist/types.d.ts +1 -0
  34. package/dist/user-groups/userGroupsApi.d.ts +81 -0
  35. package/dist/user-groups/userGroupsApi.js +145 -0
  36. package/dist/user-groups/userGroupsInterfaces.d.ts +100 -0
  37. package/dist/user-groups/userGroupsInterfaces.js +2 -0
  38. package/dist/user-groups/userGroupsSchemas.d.ts +55 -0
  39. package/dist/user-groups/userGroupsSchemas.js +35 -0
  40. package/dist/users/usersApi.js +3 -3
  41. package/esm/auth-provider/authProviderApi.js +3 -2
  42. package/esm/base/asyncModules.d.ts +18 -0
  43. package/esm/base/asyncModules.js +34 -1
  44. package/esm/base/syncModules.d.ts +10 -3
  45. package/esm/base/syncModules.js +25 -14
  46. package/esm/base/utils.d.ts +5 -2
  47. package/esm/base/validation.d.ts +7 -5
  48. package/esm/base/validation.js +7 -4
  49. package/esm/discounts/discountsApi.d.ts +3 -3
  50. package/esm/discounts/discountsApi.js +1 -1
  51. package/esm/discounts/discountsInterfaces.d.ts +15 -3
  52. package/esm/file-uploading/fileUploadingApi.d.ts +27 -1
  53. package/esm/file-uploading/fileUploadingApi.js +42 -0
  54. package/esm/file-uploading/fileUploadingInterfaces.d.ts +102 -1
  55. package/esm/file-uploading/fileUploadingSchemas.d.ts +73 -0
  56. package/esm/file-uploading/fileUploadingSchemas.js +46 -0
  57. package/esm/forms-data/formsDataInterfaces.d.ts +130 -3
  58. package/esm/index.d.ts +4 -0
  59. package/esm/index.js +3 -0
  60. package/esm/orders/ordersApi.d.ts +14 -0
  61. package/esm/orders/ordersApi.js +19 -0
  62. package/esm/orders/ordersInterfaces.d.ts +11 -0
  63. package/esm/payments/paymentsApi.d.ts +14 -1
  64. package/esm/payments/paymentsApi.js +18 -0
  65. package/esm/payments/paymentsInterfaces.d.ts +43 -1
  66. package/esm/payments/paymentsSchemas.d.ts +32 -0
  67. package/esm/payments/paymentsSchemas.js +19 -0
  68. package/esm/search/searchApi.d.ts +3 -2
  69. package/esm/search/searchApi.js +6 -2
  70. package/esm/search/searchInterfaces.d.ts +3 -2
  71. package/esm/types.d.ts +1 -0
  72. package/esm/user-groups/userGroupsApi.d.ts +81 -0
  73. package/esm/user-groups/userGroupsApi.js +106 -0
  74. package/esm/user-groups/userGroupsInterfaces.d.ts +100 -0
  75. package/esm/user-groups/userGroupsInterfaces.js +1 -0
  76. package/esm/user-groups/userGroupsSchemas.d.ts +55 -0
  77. package/esm/user-groups/userGroupsSchemas.js +32 -0
  78. package/esm/users/usersApi.js +3 -3
  79. package/package.json +2 -2
@@ -169,12 +169,15 @@ export function createPaginatedSchema(itemSchema) {
169
169
  });
170
170
  }
171
171
  /**
172
- * Validation helper function
172
+ * Validation helper function.
173
+ *
174
+ * This is the strict half of the pair: it reports a failure instead of hiding it.
175
+ * Strictness is the choice of function, not an option — `validateResponseSafe` is the
176
+ * lenient one, and `_validateResponse` picks between them by `config.validation.strictMode`.
173
177
  * @param {z.ZodSchema<T>} schema - Zod schema to validate against
174
178
  * @param {unknown} data - Data to validate
175
- * @param {object} options - Validation options
176
- * @param {boolean} options.strict - Whether to use strict mode
177
- * @param {boolean} options.logErrors - Whether to log errors
179
+ * @param {object} [options] - Validation options
180
+ * @param {boolean} [options.logErrors] - Whether to log errors
178
181
  * @returns {object} Validated data or error
179
182
  */
180
183
  export function validateResponse(schema, data, options) {
@@ -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 { IBonusBalanceEntity, IBonusTransactionEntity, IBonusTransactionType, ICouponValidationResult, IDiscountsApi, IDiscountsEntity, IDiscountsResponse, IDiscountsVectorSearch, IDiscountType } from './discountsInterfaces.js';
4
+ import type { IBonusBalanceEntity, IBonusHistoryResponse, IBonusTransactionType, ICouponValidationResult, IDiscountsApi, IDiscountsEntity, IDiscountsResponse, IDiscountsVectorSearch, IDiscountType } from './discountsInterfaces.js';
5
5
  /**
6
6
  * Controllers for working with events
7
7
  * @handle /api/content/events
@@ -63,11 +63,11 @@ export default class DiscountsApi extends AsyncModules implements IDiscountsApi
63
63
  * @param {number} [discountId] - Discount id filter.
64
64
  * @param {number} [moduleId] - Module id filter.
65
65
  * @param {boolean} [isAdmin] - Admin filter.
66
- * @returns {Promise<IBonusTransactionEntity[] | IError>} Returns array of bonus transactions or an error object.
66
+ * @returns {Promise<IBonusHistoryResponse | IError>} Returns the container with the transactions and their total, or an error object.
67
67
  * @throws {IError} When isShell=false and an error occurs during the fetch
68
68
  * @see {@link https://js-sdk.oneentry.cloud/docs/discounts/getBonusHistory getBonusHistory} documentation.
69
69
  */
70
- getBonusHistory(type?: IBonusTransactionType, dateFrom?: string, dateTo?: string, discountId?: number, moduleId?: number, isAdmin?: boolean): Promise<IBonusTransactionEntity[] | IError>;
70
+ getBonusHistory(type?: IBonusTransactionType, dateFrom?: string, dateTo?: string, discountId?: number, moduleId?: number, isAdmin?: boolean): Promise<IBonusHistoryResponse | IError>;
71
71
  /**
72
72
  * Validate discounts coupon
73
73
  * @handleName validateDiscountsCoupon
@@ -80,7 +80,7 @@ export default class DiscountsApi extends AsyncModules {
80
80
  * @param {number} [discountId] - Discount id filter.
81
81
  * @param {number} [moduleId] - Module id filter.
82
82
  * @param {boolean} [isAdmin] - Admin filter.
83
- * @returns {Promise<IBonusTransactionEntity[] | IError>} Returns array of bonus transactions or an error object.
83
+ * @returns {Promise<IBonusHistoryResponse | IError>} Returns the container with the transactions and their total, or an error object.
84
84
  * @throws {IError} When isShell=false and an error occurs during the fetch
85
85
  * @see {@link https://js-sdk.oneentry.cloud/docs/discounts/getBonusHistory getBonusHistory} documentation.
86
86
  */
@@ -55,10 +55,10 @@ interface IDiscountsApi {
55
55
  * @param {number} [discountId] - Discount id filter.
56
56
  * @param {number} [moduleId] - Module id filter.
57
57
  * @param {boolean} [isAdmin] - Admin filter.
58
- * @returns {Promise<IBonusTransactionEntity[] | IError>} Returns array of bonus transactions or an error object.
58
+ * @returns {Promise<IBonusHistoryResponse | IError>} Returns the container with the transactions and their total, or an error object.
59
59
  * @throws {IError} When isShell=false and an error occurs during the fetch
60
60
  */
61
- getBonusHistory(type?: IBonusTransactionType, dateFrom?: string, dateTo?: string, discountId?: number, moduleId?: number, isAdmin?: boolean): Promise<IBonusTransactionEntity[] | IError>;
61
+ getBonusHistory(type?: IBonusTransactionType, dateFrom?: string, dateTo?: string, discountId?: number, moduleId?: number, isAdmin?: boolean): Promise<IBonusHistoryResponse | IError>;
62
62
  /**
63
63
  * Semantic (vector) search for discounts.
64
64
  * @handleName getDiscountsByVectorSearch
@@ -284,6 +284,18 @@ interface IBonusTransactionEntity {
284
284
  expiresAt?: string;
285
285
  createdAt?: string;
286
286
  }
287
+ /**
288
+ * @interface IBonusHistoryResponse
289
+ * @property {IBonusTransactionEntity[]} items - The transactions of the current page.
290
+ * @property {number} total - How many transactions the filter matches in total.
291
+ * @description Container the bonus history arrives in. The endpoint answers
292
+ * `{ items, total }`, not a bare array — measured on the SDK test stand,
293
+ * 2026-09-28: an account with no transactions answers `{"items":[],"total":0}`.
294
+ */
295
+ interface IBonusHistoryResponse {
296
+ items: IBonusTransactionEntity[];
297
+ total: number;
298
+ }
287
299
  /**
288
300
  * @interface IBonusBalanceEntity
289
301
  * @description Represents the balance of bonus points.
@@ -292,4 +304,4 @@ interface IBonusTransactionEntity {
292
304
  interface IBonusBalanceEntity {
293
305
  balance: number;
294
306
  }
295
- export type { IBonusBalanceEntity, IBonusHistoryQuery, IBonusTransactionEntity, IBonusTransactionType, ICouponEntity, ICouponValidationResult, IDiscountByMarkerQuery, IDiscountCondition, IDiscountsApi, IDiscountsEntity, IDiscountsQuery, IDiscountsResponse, IDiscountsValidateCoupon, IDiscountsVectorSearch, IDiscountType, IDiscountValue, };
307
+ export type { IBonusBalanceEntity, IBonusHistoryQuery, IBonusHistoryResponse, IBonusTransactionEntity, IBonusTransactionType, ICouponEntity, ICouponValidationResult, IDiscountByMarkerQuery, IDiscountCondition, IDiscountsApi, IDiscountsEntity, IDiscountsQuery, IDiscountsResponse, IDiscountsValidateCoupon, IDiscountsVectorSearch, IDiscountType, IDiscountValue, };
@@ -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 { IFileUploading, IUploadingQuery, IUploadingReturn } from './fileUploadingInterfaces.js';
4
+ import type { IFileSearchResponse, IFileUploading, IUploadingQuery, IUploadingReturn } from './fileUploadingInterfaces.js';
5
5
  /**
6
6
  * Controllers for working with file uploading
7
7
  * @handle /api/content/files
@@ -67,6 +67,32 @@ export default class FileUploadingApi extends AsyncModules implements IFileUploa
67
67
  * @see {@link https://js-sdk.oneentry.cloud/docs/file-uploading/delete delete} documentation.
68
68
  */
69
69
  delete(filename: string, fileQuery?: IUploadingQuery): Promise<boolean | IError>;
70
+ /**
71
+ * Public search across the content of files attached to records.
72
+ * @handleName searchFileContent
73
+ * @param {string} query - Search query, at least 3 characters — shorter is rejected with 400. Example: "transportation".
74
+ * @param {string} [langCode] - Language of the query. Example: "en_US".
75
+ * @param {string[]} [extensions] - Filter by file extension, sent comma-separated. Example: ["pdf", "docx"].
76
+ * @param {string[]} [ownerTables] - Filter by the section the attached record belongs to, sent comma-separated. Example: ["products", "pages"].
77
+ * @param {string[]} [localeCodes] - Filter by the locale of the link, not of the file content. Example: ["en_US"].
78
+ * @param {boolean} [onlyTruncated] - Return only files whose extracted text was cut at the size ceiling.
79
+ * @param {number} [offset] - Parameter for pagination. Default: 0.
80
+ * @param {number} [limit] - Parameter for pagination. Default: 10, maximum 50 — a larger value is rejected with 400 "limit must not be greater than 50".
81
+ * @returns {Promise<IFileSearchResponse | IError>} Returns the found files with their matching fragments.
82
+ * @throws {IError} When isShell=false and an error occurs during the fetch
83
+ * @description The unit of the result is a **file, not a fragment**: one `snippet` per file,
84
+ * even when the document matches on many pages. Matches inside the snippet are wrapped in the
85
+ * control characters `U+0002` and `U+0003` rather than HTML, so replace them before rendering.
86
+ * The result is narrowed by access: only files of visible records of the sections enabled in the
87
+ * project settings, personal sections only down to the caller's own records, and the admins
88
+ * section is never returned. A separate 403 means the feature is not part of the project tariff.
89
+ * @example
90
+ * ```ts
91
+ * const found = await api.FileUploading.searchFileContent('transportation', 'en_US', ['pdf']);
92
+ * ```
93
+ * @see {@link https://js-sdk.oneentry.cloud/docs/file-uploading/searchFileContent searchFileContent} documentation.
94
+ */
95
+ searchFileContent(query: string, langCode?: string, extensions?: string[], ownerTables?: string[], localeCodes?: string[], onlyTruncated?: boolean, offset?: number, limit?: number): Promise<IFileSearchResponse | IError>;
70
96
  /**
71
97
  * Create a File object from a URL.
72
98
  * @param {string} url - The URL to fetch the file from.
@@ -87,6 +87,48 @@ export default class FileUploadingApi extends AsyncModules {
87
87
  const result = await this._fetchDelete(`?filename=${filename}&` + this._queryParamsToString(query));
88
88
  return result;
89
89
  }
90
+ /**
91
+ * Public search across the content of files attached to records.
92
+ * @handleName searchFileContent
93
+ * @param {string} query - Search query, at least 3 characters — shorter is rejected with 400. Example: "transportation".
94
+ * @param {string} [langCode] - Language of the query. Example: "en_US".
95
+ * @param {string[]} [extensions] - Filter by file extension, sent comma-separated. Example: ["pdf", "docx"].
96
+ * @param {string[]} [ownerTables] - Filter by the section the attached record belongs to, sent comma-separated. Example: ["products", "pages"].
97
+ * @param {string[]} [localeCodes] - Filter by the locale of the link, not of the file content. Example: ["en_US"].
98
+ * @param {boolean} [onlyTruncated] - Return only files whose extracted text was cut at the size ceiling.
99
+ * @param {number} [offset] - Parameter for pagination. Default: 0.
100
+ * @param {number} [limit] - Parameter for pagination. Default: 10, maximum 50 — a larger value is rejected with 400 "limit must not be greater than 50".
101
+ * @returns {Promise<IFileSearchResponse | IError>} Returns the found files with their matching fragments.
102
+ * @throws {IError} When isShell=false and an error occurs during the fetch
103
+ * @description The unit of the result is a **file, not a fragment**: one `snippet` per file,
104
+ * even when the document matches on many pages. Matches inside the snippet are wrapped in the
105
+ * control characters `U+0002` and `U+0003` rather than HTML, so replace them before rendering.
106
+ * The result is narrowed by access: only files of visible records of the sections enabled in the
107
+ * project settings, personal sections only down to the caller's own records, and the admins
108
+ * section is never returned. A separate 403 means the feature is not part of the project tariff.
109
+ * @example
110
+ * ```ts
111
+ * const found = await api.FileUploading.searchFileContent('transportation', 'en_US', ['pdf']);
112
+ * ```
113
+ * @see {@link https://js-sdk.oneentry.cloud/docs/file-uploading/searchFileContent searchFileContent} documentation.
114
+ */
115
+ async searchFileContent(query, langCode = this.state.lang, extensions, ownerTables, localeCodes, onlyTruncated, offset, limit) {
116
+ // Array filters are sent comma-separated — an array stringifies to exactly that.
117
+ const params = {
118
+ q: query,
119
+ langCode,
120
+ extensions,
121
+ ownerTables,
122
+ localeCodes,
123
+ onlyTruncated,
124
+ offset,
125
+ limit,
126
+ };
127
+ const result = await this._fetchGet(`/search?` + this._queryParamsToString(params));
128
+ // Validate response if validation is enabled
129
+ const validated = await this._validateResponse(result, schema('FileSearchResponseSchema'));
130
+ return this._normalizeData(validated);
131
+ }
90
132
  /**
91
133
  * Create a File object from a URL.
92
134
  * @param {string} url - The URL to fetch the file from.
@@ -71,6 +71,22 @@ interface IFileUploading {
71
71
  * @throws {IError} - If there is an error during the fetch operation, it will return an error object.
72
72
  */
73
73
  getFile(id: number, type: string, entity: string, filename: string, template?: string): Promise<Response | IError>;
74
+ /**
75
+ * Public search across the content of files attached to records.
76
+ * @handleName searchFileContent
77
+ * @param {string} query - Search query, at least 3 characters. Example: "transportation".
78
+ * @param {string} [langCode] - Language of the query. Example: "en_US".
79
+ * @param {string[]} [extensions] - Filter by file extension, sent comma-separated. Example: ["pdf", "docx"].
80
+ * @param {string[]} [ownerTables] - Filter by the section the attached record belongs to. Example: ["products", "pages"].
81
+ * @param {string[]} [localeCodes] - Filter by the locale of the link, not of the file content. Example: ["en_US"].
82
+ * @param {boolean} [onlyTruncated] - Return only files whose extracted text was cut at the size ceiling.
83
+ * @param {number} [offset] - Parameter for pagination. Default: 0.
84
+ * @param {number} [limit] - Parameter for pagination, 1 to 50. Default: 10.
85
+ * @returns {IFileSearchResponse} Returns the found files with their matching fragments.
86
+ * @throws {IError} - If there is an error during the fetch operation, it will return an error object.
87
+ * @description This method searches the content of files attached to records.
88
+ */
89
+ searchFileContent(query: string, langCode?: string, extensions?: string[], ownerTables?: string[], localeCodes?: string[], onlyTruncated?: boolean, offset?: number, limit?: number): Promise<IFileSearchResponse | IError>;
74
90
  }
75
91
  /**
76
92
  * Represents a file entity that may contain a file object or a path as a string.
@@ -113,4 +129,89 @@ interface IUploadingReturn {
113
129
  size: number;
114
130
  contentType: string;
115
131
  }
116
- export type { IFileEntity, IFileUploading, IUploadingQuery, IUploadingReturn };
132
+ /**
133
+ * The `IFileSearchOwner` interface describes one record a found file is attached to.
134
+ * @interface IFileSearchOwner
135
+ * @property {string} tableName - Section the record belongs to. Example: "products".
136
+ * @property {number} dataId - Identifier of the record. Example: 644.
137
+ * @property {string} title - Title of the record. Example: "COG — March 17, 2016".
138
+ * @property {string} langCode - Locale of the link, not of the file content. Example: "en_US".
139
+ * @description One record a found file is attached to. The same file can be attached to several records, and a record contributes one entry per locale.
140
+ */
141
+ interface IFileSearchOwner {
142
+ tableName: string;
143
+ dataId: number;
144
+ title: string;
145
+ langCode: string;
146
+ }
147
+ /**
148
+ * The `IFileSearchSnippet` interface describes the matching fragment of a file.
149
+ * @interface IFileSearchSnippet
150
+ * @property {string} text - The fragment itself. Every match inside it is wrapped in the control characters U+0002 and U+0003 — not HTML, so replace them before rendering. Example: "… Active \u0002Transportation\u0003 2…".
151
+ * @property {number | null} pageFrom - Page the fragment starts on, for paged formats. Example: 86.
152
+ * @description The matching fragment of a file. One fragment per file, even when the document matches on many pages.
153
+ */
154
+ interface IFileSearchSnippet {
155
+ text: string;
156
+ pageFrom: number | null;
157
+ }
158
+ /**
159
+ * The `IFileSearchItem` interface describes one found file.
160
+ * @interface IFileSearchItem
161
+ * @property {number} id - Identifier of the indexed file. Example: 1077.
162
+ * @property {string} storageKey - Key of the object in the storage; the file link is built from it. Example: "files/project/file/644/product/db1918c4.pdf".
163
+ * @property {string} extension - File extension. Example: "pdf".
164
+ * @property {string | null} title - Title from the document metadata, `null` when the document carries none. Example: "Microsoft Word - COG Agenda.docx".
165
+ * @property {string | null} langCode - Language of the file content, detected on indexing. Example: "en".
166
+ * @property {number | null} pageCount - Number of pages, for paged formats. Example: 244.
167
+ * @property {number} rank - Relevance of the match; the API sorts by it descending. Example: 0.0971.
168
+ * @property {IFileSearchSnippet | null} snippet - The matching fragment.
169
+ * @property {IFileSearchOwner[]} owners - Records the file is attached to, limited to those the caller may see.
170
+ * @property {number} ownersTotal - How many records visible to the caller reference the file. Example: 2.
171
+ * @description One found file. The unit of the result is a file, not a fragment.
172
+ */
173
+ interface IFileSearchItem {
174
+ id: number;
175
+ storageKey: string;
176
+ extension: string;
177
+ title: string | null;
178
+ langCode: string | null;
179
+ pageCount: number | null;
180
+ rank: number;
181
+ snippet: IFileSearchSnippet | null;
182
+ owners: IFileSearchOwner[];
183
+ ownersTotal: number;
184
+ }
185
+ /**
186
+ * The `IFileSearchQueryLanguage` interface describes how the query language was resolved.
187
+ * @interface IFileSearchQueryLanguage
188
+ * @property {string[]} resolved - Languages the query was actually run in. Example: ["english"].
189
+ * @property {string} source - How they were chosen: "explicit" when taken from `langCode`, otherwise detected. Example: "explicit".
190
+ * @property {string[]} candidates - Languages considered. Example: ["english"].
191
+ * @description How the query language was resolved for the search.
192
+ */
193
+ interface IFileSearchQueryLanguage {
194
+ resolved: string[];
195
+ source: string;
196
+ candidates: string[];
197
+ }
198
+ /**
199
+ * The `IFileSearchResponse` interface describes the result of a file content search.
200
+ * @interface IFileSearchResponse
201
+ * @property {number} total - Total number of matching files. Example: 166.
202
+ * @property {number} offset - Offset the page starts at. Example: 0.
203
+ * @property {number} limit - Page size. Example: 10.
204
+ * @property {IFileSearchQueryLanguage} queryLanguage - How the query language was resolved.
205
+ * @property {string[]} warnings - Warnings about the search, empty when there are none.
206
+ * @property {IFileSearchItem[]} items - The found files.
207
+ * @description The result of a file content search.
208
+ */
209
+ interface IFileSearchResponse {
210
+ total: number;
211
+ offset: number;
212
+ limit: number;
213
+ queryLanguage: IFileSearchQueryLanguage;
214
+ warnings: string[];
215
+ items: IFileSearchItem[];
216
+ }
217
+ export type { IFileEntity, IFileSearchItem, IFileSearchOwner, IFileSearchQueryLanguage, IFileSearchResponse, IFileSearchSnippet, IFileUploading, IUploadingQuery, IUploadingReturn, };
@@ -22,3 +22,76 @@ export declare const UploadResponseSchema: z.ZodArray<z.ZodObject<{
22
22
  size: z.ZodNumber;
23
23
  contentType: z.ZodString;
24
24
  }, z.core.$strip>>;
25
+ /**
26
+ * One record a found file is attached to
27
+ */
28
+ export declare const FileSearchOwnerSchema: z.ZodObject<{
29
+ tableName: z.ZodString;
30
+ dataId: z.ZodNumber;
31
+ title: z.ZodString;
32
+ langCode: z.ZodString;
33
+ }, z.core.$strip>;
34
+ /**
35
+ * Matching fragment of a found file
36
+ */
37
+ export declare const FileSearchSnippetSchema: z.ZodObject<{
38
+ text: z.ZodString;
39
+ pageFrom: z.ZodNullable<z.ZodNumber>;
40
+ }, z.core.$strip>;
41
+ /**
42
+ * One found file
43
+ */
44
+ export declare const FileSearchItemSchema: z.ZodObject<{
45
+ id: z.ZodNumber;
46
+ storageKey: z.ZodString;
47
+ extension: z.ZodString;
48
+ title: z.ZodNullable<z.ZodString>;
49
+ langCode: z.ZodNullable<z.ZodString>;
50
+ pageCount: z.ZodNullable<z.ZodNumber>;
51
+ rank: z.ZodNumber;
52
+ snippet: z.ZodNullable<z.ZodObject<{
53
+ text: z.ZodString;
54
+ pageFrom: z.ZodNullable<z.ZodNumber>;
55
+ }, z.core.$strip>>;
56
+ owners: z.ZodArray<z.ZodObject<{
57
+ tableName: z.ZodString;
58
+ dataId: z.ZodNumber;
59
+ title: z.ZodString;
60
+ langCode: z.ZodString;
61
+ }, z.core.$strip>>;
62
+ ownersTotal: z.ZodNumber;
63
+ }, z.core.$strip>;
64
+ /**
65
+ * File content search response
66
+ */
67
+ export declare const FileSearchResponseSchema: z.ZodObject<{
68
+ total: z.ZodNumber;
69
+ offset: z.ZodNumber;
70
+ limit: z.ZodNumber;
71
+ queryLanguage: z.ZodObject<{
72
+ resolved: z.ZodArray<z.ZodString>;
73
+ source: z.ZodString;
74
+ candidates: z.ZodArray<z.ZodString>;
75
+ }, z.core.$strip>;
76
+ warnings: z.ZodArray<z.ZodString>;
77
+ items: z.ZodArray<z.ZodObject<{
78
+ id: z.ZodNumber;
79
+ storageKey: z.ZodString;
80
+ extension: z.ZodString;
81
+ title: z.ZodNullable<z.ZodString>;
82
+ langCode: z.ZodNullable<z.ZodString>;
83
+ pageCount: z.ZodNullable<z.ZodNumber>;
84
+ rank: z.ZodNumber;
85
+ snippet: z.ZodNullable<z.ZodObject<{
86
+ text: z.ZodString;
87
+ pageFrom: z.ZodNullable<z.ZodNumber>;
88
+ }, z.core.$strip>>;
89
+ owners: z.ZodArray<z.ZodObject<{
90
+ tableName: z.ZodString;
91
+ dataId: z.ZodNumber;
92
+ title: z.ZodString;
93
+ langCode: z.ZodString;
94
+ }, z.core.$strip>>;
95
+ ownersTotal: z.ZodNumber;
96
+ }, z.core.$strip>>;
97
+ }, z.core.$strip>;
@@ -17,3 +17,49 @@ export const UploadingReturnSchema = z.object({
17
17
  * Upload response schema (array of upload results)
18
18
  */
19
19
  export const UploadResponseSchema = z.array(UploadingReturnSchema);
20
+ /**
21
+ * One record a found file is attached to
22
+ */
23
+ export const FileSearchOwnerSchema = z.object({
24
+ tableName: z.string(),
25
+ dataId: z.number(),
26
+ title: z.string(),
27
+ langCode: z.string(),
28
+ });
29
+ /**
30
+ * Matching fragment of a found file
31
+ */
32
+ export const FileSearchSnippetSchema = z.object({
33
+ text: z.string(),
34
+ pageFrom: z.number().nullable(),
35
+ });
36
+ /**
37
+ * One found file
38
+ */
39
+ export const FileSearchItemSchema = z.object({
40
+ id: z.number(),
41
+ storageKey: z.string(),
42
+ extension: z.string(),
43
+ title: z.string().nullable(),
44
+ langCode: z.string().nullable(),
45
+ pageCount: z.number().nullable(),
46
+ rank: z.number(),
47
+ snippet: FileSearchSnippetSchema.nullable(),
48
+ owners: z.array(FileSearchOwnerSchema),
49
+ ownersTotal: z.number(),
50
+ });
51
+ /**
52
+ * File content search response
53
+ */
54
+ export const FileSearchResponseSchema = z.object({
55
+ total: z.number(),
56
+ offset: z.number(),
57
+ limit: z.number(),
58
+ queryLanguage: z.object({
59
+ resolved: z.array(z.string()),
60
+ source: z.string(),
61
+ candidates: z.array(z.string()),
62
+ }),
63
+ warnings: z.array(z.string()),
64
+ items: z.array(FileSearchItemSchema),
65
+ });
@@ -420,6 +420,133 @@ interface IUpdateFormsData {
420
420
  * Contains an array of data form objects with the following values
421
421
  */
422
422
  type FormDataType = IBodyTypeStringNumberFloat | IBodyTypeTimeDate | IBodyTypeText | IBodyTypeTextWithHeader | IBodyTypeImageGroupOfImages | IBodyTypeFile | IBodyTypeRadioButtonList | Record<string, unknown>;
423
+ /**
424
+ * Value shapes accepted by a SUBMISSION (`POST /form-data`).
425
+ *
426
+ * For three field kinds they are not the shapes a page attribute uses, and a
427
+ * body written from the read types is refused. Measured on
428
+ * rwah2o.oneentry.cloud, 2026-09-12 and again 2026-09-28 (CMS-888).
429
+ *
430
+ * `list` takes a list of strings; the `[{ title, value }]` form of a page
431
+ * attribute answers `400 formData's marker '<marker>' value[0] must be a string`.
432
+ *
433
+ * `text` takes a one-element array holding exactly ONE of `plainValue`,
434
+ * `htmlValue` or `mdValue`, and no `params`. The object form answers
435
+ * `400 … value must be an array`, `params` answers `… is not allowed`, and two
436
+ * representations answer `Only one of htmlValue, plainValue or mdValue can be provided`.
437
+ *
438
+ * `spam` takes the captcha event, not the bare token.
439
+ */
440
+ type FormDataPostType = IBodyTypeStringNumberFloat | IBodyTypeTimeDate | IBodyPostTypeText | IBodyPostTypeList | IBodyPostTypeSpam | IBodyTypeTextWithHeader | IBodyTypeImageGroupOfImages | IBodyTypeFile | Record<string, unknown>;
441
+ /**
442
+ * Represents a `list` field of a form SUBMISSION.
443
+ * @interface IBodyPostTypeList
444
+ * @property {string} marker - marker name. Example: "recipient".
445
+ * @property {string} type - Type value. Example: "list".
446
+ * @property {string[]} value - Chosen options as plain strings. Example: ["Tom Hoffart"].
447
+ * @example
448
+ {
449
+ "marker": "recipient",
450
+ "type": "list",
451
+ "value": ["Tom Hoffart"]
452
+ }
453
+ * @description A submission sends the chosen options as strings. The `[{ title, value }]`
454
+ * shape a page attribute stores is refused here with `value[0] must be a string`.
455
+ */
456
+ interface IBodyPostTypeList {
457
+ marker: string;
458
+ type: 'list';
459
+ value: string[];
460
+ }
461
+ /**
462
+ * Represents a `text` field of a form SUBMISSION.
463
+ * @interface IBodyPostTypeText
464
+ * @property {string} marker - marker name. Example: "your_message".
465
+ * @property {string} type - Type value. Example: "text".
466
+ * @property {ITextSubmissionValue[]} value - One-element array holding exactly one representation.
467
+ * @example
468
+ {
469
+ "marker": "your_message",
470
+ "type": "text",
471
+ "value": [{ "plainValue": "Hello" }]
472
+ }
473
+ * @description The array holds one object carrying exactly one of `plainValue`,
474
+ * `htmlValue` or `mdValue`. Editor `params` are refused, and so is sending two
475
+ * representations at once.
476
+ */
477
+ interface IBodyPostTypeText {
478
+ marker: string;
479
+ type: 'text';
480
+ value: ITextSubmissionValue[];
481
+ }
482
+ /**
483
+ * @interface ITextSubmissionValuePlain
484
+ * @property {string} plainValue - Plain-text representation. Example: "Hello".
485
+ * @description Plain-text branch of a submitted text value.
486
+ */
487
+ interface ITextSubmissionValuePlain {
488
+ plainValue: string;
489
+ }
490
+ /**
491
+ * @interface ITextSubmissionValueHtml
492
+ * @property {string} htmlValue - HTML representation. Example: "<p>Hello</p>".
493
+ * @description HTML branch of a submitted text value.
494
+ */
495
+ interface ITextSubmissionValueHtml {
496
+ htmlValue: string;
497
+ }
498
+ /**
499
+ * @interface ITextSubmissionValueMd
500
+ * @property {string} mdValue - Markdown representation. Must not be empty. Example: "**Hello**".
501
+ * @description Markdown branch of a submitted text value.
502
+ */
503
+ interface ITextSubmissionValueMd {
504
+ mdValue: string;
505
+ }
506
+ /**
507
+ * Exactly one representation of a submitted text value.
508
+ */
509
+ type ITextSubmissionValue = ITextSubmissionValuePlain | ITextSubmissionValueHtml | ITextSubmissionValueMd;
510
+ /**
511
+ * Represents a `spam` (captcha) field of a form SUBMISSION.
512
+ * @interface IBodyPostTypeSpam
513
+ * @property {string} marker - marker name. Example: "spam".
514
+ * @property {string} type - Type value. Example: "spam".
515
+ * @property {ICaptchaValue} value - The captcha event, not the bare token.
516
+ * @example
517
+ {
518
+ "marker": "spam",
519
+ "type": "spam",
520
+ "value": { "event": { "token": "<reCAPTCHA v3 token>", "siteKey": "6Ldjk7Yt…" } }
521
+ }
522
+ * @description The field carries a reCAPTCHA v3 token obtained in the browser.
523
+ * A bare string is refused with the same sentence as a wrong token —
524
+ * `Captcha Validation Failed, captcha type is: google` — so a malformed value
525
+ * is indistinguishable from a bot.
526
+ */
527
+ interface IBodyPostTypeSpam {
528
+ marker: string;
529
+ type: 'spam';
530
+ value: ICaptchaValue;
531
+ }
532
+ /**
533
+ * @interface ICaptchaEvent
534
+ * @property {string} token - The token issued by the captcha provider in the browser.
535
+ * @property {string} siteKey - The site key the token was issued for. Example: "6Ldjk7Yt…".
536
+ * @description The captcha payload of a `spam` field.
537
+ */
538
+ interface ICaptchaEvent {
539
+ token: string;
540
+ siteKey: string;
541
+ }
542
+ /**
543
+ * @interface ICaptchaValue
544
+ * @property {ICaptchaEvent} event - The captcha payload.
545
+ * @description Wrapper the platform expects around the captcha payload.
546
+ */
547
+ interface ICaptchaValue {
548
+ event: ICaptchaEvent;
549
+ }
423
550
  /**
424
551
  * Represents the structure of the body for posting form data.
425
552
  * @interface IBodyPostFormData
@@ -428,7 +555,7 @@ type FormDataType = IBodyTypeStringNumberFloat | IBodyTypeTimeDate | IBodyTypeTe
428
555
  * @property {string} moduleEntityIdentifier - Text identifier (marker) of the module entity. Example: "blog".
429
556
  * @property {string | null} replayTo - Email to reply to. Example: "some@email.com".
430
557
  * @property {string} status - Status of the form. Example: "sent".
431
- * @property {FormDataType[]} formData - Array of form data objects.
558
+ * @property {FormDataPostType[]} formData - Array of form data objects. A submission's value shapes differ from the read shapes — see FormDataPostType.
432
559
  * @example
433
560
  [
434
561
  {
@@ -455,7 +582,7 @@ interface IBodyPostFormData {
455
582
  moduleEntityIdentifier: string;
456
583
  replayTo: string | null;
457
584
  status: string;
458
- formData: FormDataType[];
585
+ formData: FormDataPostType[];
459
586
  fileQuery?: IUploadingQuery;
460
587
  }
461
588
  /**
@@ -711,4 +838,4 @@ interface IListOptionValue {
711
838
  value: string;
712
839
  extended: IListOptionExtended;
713
840
  }
714
- export type { FormDataStatus, FormDataType, IBodyPostFormData, IBodyTypeFile, IBodyTypeImageGroupOfImages, IBodyTypeRadioButtonList, IBodyTypeStringNumberFloat, IBodyTypeText, IBodyTypeTextWithHeader, IBodyTypeTimeDate, IFileValue, IFormByMarkerDataEntity, IFormDataEntity, IFormDataSearchEntity, IFormsByMarkerDataEntity, IFormsData, IFormsDataEntity, IFormsDataFilter, IFormsDataSearchResponse, IFormsDataVectorSearch, IImageValue, IImageValueParams, IListOptionExtended, IListOptionValue, IPostFormResponse, IPostFormResponseData, ITextEditorParams, ITextValue, ITextWithHeaderValue, ITimeDateValue, IUpdateFormsData, };
841
+ export type { FormDataPostType, FormDataStatus, FormDataType, IBodyPostFormData, IBodyPostTypeList, IBodyPostTypeSpam, IBodyPostTypeText, IBodyTypeFile, IBodyTypeImageGroupOfImages, IBodyTypeRadioButtonList, IBodyTypeStringNumberFloat, IBodyTypeText, IBodyTypeTextWithHeader, IBodyTypeTimeDate, ICaptchaEvent, ICaptchaValue, IFileValue, IFormByMarkerDataEntity, IFormDataEntity, IFormDataSearchEntity, IFormsByMarkerDataEntity, IFormsData, IFormsDataEntity, IFormsDataFilter, IFormsDataSearchResponse, IFormsDataVectorSearch, IImageValue, IImageValueParams, IListOptionExtended, IListOptionValue, IPostFormResponse, IPostFormResponseData, ITextEditorParams, ITextSubmissionValue, ITextValue, ITextWithHeaderValue, ITimeDateValue, IUpdateFormsData, };
package/esm/index.d.ts CHANGED
@@ -28,6 +28,7 @@ import SystemApi from './system/systemApi.js';
28
28
  import TemplatesApi from './templates/templatesApi.js';
29
29
  import TemplatePreviewsApi from './templates-preview/templatesPreviewApi.js';
30
30
  import UserActivityApi from './user-activity/userActivityApi.js';
31
+ import UserGroupsApi from './user-groups/userGroupsApi.js';
31
32
  import UsersApi from './users/usersApi.js';
32
33
  import WsApi from './web-socket/wsApi.js';
33
34
  export { getAdditionalFields, getAttributeFile, getAttributeFiles, isFileAttribute, isListAttribute, isNumberAttribute, isStringAttribute, } from './base/attributes.js';
@@ -62,6 +63,7 @@ export type * from './types.js';
62
63
  * @property {TemplatesApi} Templates - Templates API module.
63
64
  * @property {TemplatePreviewsApi} TemplatePreviews - Template previews API module.
64
65
  * @property {UserActivityApi} UserActivity - User activity API module.
66
+ * @property {UserGroupsApi} UserGroups - User groups API module.
65
67
  * @property {UsersApi} Users - Users API module.
66
68
  * @property {WsApi} WS - WebSocket API module.
67
69
  */
@@ -118,6 +120,8 @@ interface IDefineApi {
118
120
  TemplatePreviews: TemplatePreviewsApi;
119
121
  /** User/guest activity tracking: trackUserActivity */
120
122
  UserActivity: UserActivityApi;
123
+ /** User groups tree: getUserGroups, getRootUserGroups, getUserGroupByMarker, getChildUserGroupsByMarker */
124
+ UserGroups: UserGroupsApi;
121
125
  /** Current authenticated user: getUser, updateUser */
122
126
  Users: UsersApi;
123
127
  /** WebSocket real-time updates */
package/esm/index.js CHANGED
@@ -28,6 +28,7 @@ import SystemApi from './system/systemApi.js';
28
28
  import TemplatesApi from './templates/templatesApi.js';
29
29
  import TemplatePreviewsApi from './templates-preview/templatesPreviewApi.js';
30
30
  import UserActivityApi from './user-activity/userActivityApi.js';
31
+ import UserGroupsApi from './user-groups/userGroupsApi.js';
31
32
  import UsersApi from './users/usersApi.js';
32
33
  import WsApi from './web-socket/wsApi.js';
33
34
  export { getAdditionalFields, getAttributeFile, getAttributeFiles, isFileAttribute, isListAttribute, isNumberAttribute, isStringAttribute, } from './base/attributes.js';
@@ -90,6 +91,7 @@ export function defineOneEntry(url, config) {
90
91
  const Templates = new TemplatesApi(stateModule);
91
92
  const TemplatePreviews = new TemplatePreviewsApi(stateModule);
92
93
  const UserActivity = new UserActivityApi(stateModule);
94
+ const UserGroups = new UserGroupsApi(stateModule);
93
95
  const Users = new UsersApi(stateModule);
94
96
  const WS = new WsApi(stateModule);
95
97
  return {
@@ -119,6 +121,7 @@ export function defineOneEntry(url, config) {
119
121
  Templates,
120
122
  TemplatePreviews,
121
123
  UserActivity,
124
+ UserGroups,
122
125
  Users,
123
126
  WS,
124
127
  };
@@ -70,6 +70,20 @@ export default class OrdersApi extends AsyncModules implements IOrdersApi {
70
70
  * @see {@link https://js-sdk.oneentry.cloud/docs/orders/getOrderByMarkerAndId getOrderByMarkerAndId} documentation.
71
71
  */
72
72
  getOrderByMarkerAndId(marker: string, id: number, langCode?: string): Promise<IOrderByMarkerEntity | IError>;
73
+ /**
74
+ * Getting a single order created by the user, by its own id.
75
+ * @handleName getOrderById
76
+ * @param {number} id - ID of the order object. Example: 12345.
77
+ * @param {string} [langCode] - Language code. Default: "en_US".
78
+ * @returns {Promise<IOrderByMarkerEntity | IError>} Returns an object with the order.
79
+ * @throws {IError} When isShell=false and an error occurs during the fetch
80
+ * @description This method requires user authorization. Unlike `getOrderByMarkerAndId`,
81
+ * it does not need the storage marker — use it when only the order id is at hand, for
82
+ * example on the return URL of a payment provider or in a link from a notification.
83
+ * @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}.
84
+ * @see {@link https://js-sdk.oneentry.cloud/docs/orders/getOrderById getOrderById} documentation.
85
+ */
86
+ getOrderById(id: number, langCode?: string): Promise<IOrderByMarkerEntity | IError>;
73
87
  /**
74
88
  * Preview order calculation with discounts and coupons (without saving).
75
89
  * @handleName previewOrder