oneentry 1.0.174 → 1.0.176

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 (60) hide show
  1. package/changelog.md +36 -0
  2. package/dist/attribute-sets/attributeSetsApi.js +3 -3
  3. package/dist/auth-provider/authProviderApi.d.ts +1 -1
  4. package/dist/auth-provider/authProviderApi.js +13 -13
  5. package/dist/auth-provider/authProviderSchemas.d.ts +1 -1
  6. package/dist/auth-provider/authProvidersInterfaces.d.ts +3 -2
  7. package/dist/base/asyncModules.d.ts +11 -0
  8. package/dist/base/asyncModules.js +14 -0
  9. package/dist/base/validation.d.ts +1 -1
  10. package/dist/base/validation.js +1 -1
  11. package/dist/blocks/blocksApi.js +24 -15
  12. package/dist/discounts/discountsApi.js +2 -1
  13. package/dist/events/eventsApi.js +4 -4
  14. package/dist/filters/filtersApi.js +1 -1
  15. package/dist/forms/formsApi.js +1 -1
  16. package/dist/forms-data/formsDataApi.d.ts +10 -8
  17. package/dist/forms-data/formsDataApi.js +14 -10
  18. package/dist/forms-data/formsDataInterfaces.d.ts +75 -54
  19. package/dist/integration-collections/integrationCollectionsApi.js +7 -6
  20. package/dist/menus/menusApi.js +1 -1
  21. package/dist/orders/ordersApi.js +7 -6
  22. package/dist/pages/pagesApi.js +2 -2
  23. package/dist/product-statuses/productStatusesApi.js +2 -2
  24. package/dist/templates/templatesApi.js +1 -1
  25. package/dist/templates-preview/templatesPreviewApi.js +1 -1
  26. package/dist/user-groups/userGroupsApi.js +2 -2
  27. package/dist/users/usersApi.d.ts +2 -2
  28. package/dist/users/usersApi.js +2 -2
  29. package/dist/users/usersInterfaces.d.ts +8 -7
  30. package/dist/users/usersSchemas.d.ts +1 -1
  31. package/esm/attribute-sets/attributeSetsApi.js +3 -3
  32. package/esm/auth-provider/authProviderApi.d.ts +1 -1
  33. package/esm/auth-provider/authProviderApi.js +13 -13
  34. package/esm/auth-provider/authProviderSchemas.d.ts +1 -1
  35. package/esm/auth-provider/authProvidersInterfaces.d.ts +3 -2
  36. package/esm/base/asyncModules.d.ts +11 -0
  37. package/esm/base/asyncModules.js +14 -0
  38. package/esm/base/validation.d.ts +1 -1
  39. package/esm/base/validation.js +1 -1
  40. package/esm/blocks/blocksApi.js +24 -15
  41. package/esm/discounts/discountsApi.js +2 -1
  42. package/esm/events/eventsApi.js +4 -4
  43. package/esm/filters/filtersApi.js +1 -1
  44. package/esm/forms/formsApi.js +1 -1
  45. package/esm/forms-data/formsDataApi.d.ts +10 -8
  46. package/esm/forms-data/formsDataApi.js +14 -10
  47. package/esm/forms-data/formsDataInterfaces.d.ts +75 -54
  48. package/esm/integration-collections/integrationCollectionsApi.js +7 -6
  49. package/esm/menus/menusApi.js +1 -1
  50. package/esm/orders/ordersApi.js +7 -6
  51. package/esm/pages/pagesApi.js +2 -2
  52. package/esm/product-statuses/productStatusesApi.js +2 -2
  53. package/esm/templates/templatesApi.js +1 -1
  54. package/esm/templates-preview/templatesPreviewApi.js +1 -1
  55. package/esm/user-groups/userGroupsApi.js +2 -2
  56. package/esm/users/usersApi.d.ts +2 -2
  57. package/esm/users/usersApi.js +2 -2
  58. package/esm/users/usersInterfaces.d.ts +8 -7
  59. package/esm/users/usersSchemas.d.ts +1 -1
  60. package/package.json +2 -2
@@ -85,9 +85,9 @@ interface IFormsData {
85
85
  /**
86
86
  * Body for semantic (vector) form data search.
87
87
  * @interface IFormsDataVectorSearch
88
- * @property {string} queryText - Natural-language search query. Example: "order confirmation".
89
- * @property {number} [vectorDistanceThreshold] - Override of the cosine distance threshold (0..2). Example: 0.3.
90
- * @property {number} [maxHits] - Number of top candidates fetched before pagination. Default: 100. Maximum: 500. Example: 10.
88
+ * @property {string} queryText - Natural-language search query, 1 to 512 characters: an empty one answers `400 queryText should not be empty`, a longer one `400 queryText must be shorter than or equal to 512 characters`. Example: "order confirmation".
89
+ * @property {number} [vectorDistanceThreshold] - Override of the cosine distance threshold (0..2); a negative value answers `400`. Example: 0.3.
90
+ * @property {number} [maxHits] - Number of top candidates fetched before pagination, from 1. Default: 100. Maximum: 500. Example: 10.
91
91
  * @property {boolean} [debug] - When `true`, each returned item gets a `distance` field. Example: false.
92
92
  * @description Body for the form-data vector/search endpoint.
93
93
  */
@@ -113,14 +113,14 @@ type FormDataStatus = 'sent' | 'moderation' | 'approved' | 'banned' | 'deleted';
113
113
  * @property {number} [parentId] - Identifier of the parent record — the way to fetch replies to one comment. Example: 10.
114
114
  * @property {string} [userIdentifier] - Text identifier of the sender; an empty string means "no filter". Example: "admin".
115
115
  * @property {FormDataStatus[]} [status] - Moderation statuses to keep. Must be an array — a bare string is rejected with `400`. An empty array means "no filter". Example: ["approved"].
116
- * @property {string} [dateFrom] - Lower bound of the submission date, `YYYY-MM-DD`; an empty string means "no bound" — `getFormsDataByMarker` strips it from the body, since the endpoint rejects an empty date with a `400`. A non-empty value the API cannot parse still fails the request. Example: "2025-01-01".
117
- * @property {string} [dateTo] - Upper bound of the submission date, `YYYY-MM-DD`; an empty string means "no bound", handled like `dateFrom`. Example: "2025-12-31".
116
+ * @property {string} [dateFrom] - Lower bound of the submission date, `YYYY-MM-DD` or `YYYY-MM-DD HH:MM:SS`; an empty string means "no bound" — `getFormsDataByMarker` strips it from the body, since the endpoint rejects an empty date with a `400`. A non-empty value the API cannot parse still fails the request. Example: "2025-01-01".
117
+ * @property {string} [dateTo] - Upper bound of the submission date, `YYYY-MM-DD` or `YYYY-MM-DD HH:MM:SS`; an empty string means "no bound", handled like `dateFrom`. Example: "2025-12-31".
118
118
  * @description Filter for reading form submissions. Every field is optional and an omitted one is simply not applied.
119
119
  *
120
- * Typed rather than left as `object` on purpose: the API **ignores** a field it
121
- * does not know, so `statuses: ['approved']` (note the "s") is not an error —
122
- * it returns every record, unmoderated ones included. That is premoderation
123
- * leaking onto a public page, from one typo the compiler used to accept.
120
+ * Typed rather than left as `object` on purpose: the API **refuses** a field it
121
+ * does not know, so `statuses: ['approved']` (note the "s") answers
122
+ * `400 property statuses should not exist` — the compiler catches the typo
123
+ * before the request does.
124
124
  */
125
125
  interface IFormsDataFilter {
126
126
  /**
@@ -419,7 +419,7 @@ interface IUpdateFormsData {
419
419
  /**
420
420
  * Contains an array of data form objects with the following values
421
421
  */
422
- type FormDataType = IBodyTypeStringNumberFloat | IBodyTypeTimeDate | IBodyTypeText | IBodyTypeTextWithHeader | IBodyTypeImageGroupOfImages | IBodyTypeFile | IBodyTypeRadioButtonList | Record<string, unknown>;
422
+ type FormDataType = IBodyTypeStringNumberFloat | IBodyTypeTimeDate | IBodyTypeText | IBodyTypeTextWithHeader | IBodyTypeImageGroupOfImages | IBodyTypeFile | IBodyTypeRadioButtonList | IBodyTypeEntity | IBodyTypeTimeInterval | Record<string, unknown>;
423
423
  /**
424
424
  * Value shapes accepted by a SUBMISSION (`POST /form-data`).
425
425
  *
@@ -588,13 +588,13 @@ interface IBodyPostFormData {
588
588
  * Represents a form data entity with a simple value.
589
589
  * @interface IBodyTypeStringNumberFloat
590
590
  * @property {string} marker - marker name. Example: "some_marker".
591
- * @property {string} type - Type value. "string" | "number" | "float". Example: "string".
592
- * @property {string | number | null} value - Value of the form data entity. Send it as a string; in responses numeric fields come back normalized to `number`, or `null` when the field is empty. Example: "string".
591
+ * @property {string} type - Type value. "string" | "integer" | "number" | "float". Example: "string".
592
+ * @property {string | number | null} value - Value of the form data entity. A submission may send a number or a string; responses return numeric fields **as strings** — `3` comes back as `"3"`, `2.565` as `"2.565"` — or `null` when the field is empty. Convert with `Number(value)` before arithmetic. Example: "string".
593
593
  * @description Represents a form data entity with a marker, type, and value.
594
594
  */
595
595
  interface IBodyTypeStringNumberFloat {
596
596
  marker: string;
597
- type: 'string' | 'number' | 'float';
597
+ type: 'string' | 'integer' | 'number' | 'float';
598
598
  value: string | number | null;
599
599
  }
600
600
  /**
@@ -633,43 +633,46 @@ interface ITimeDateValue {
633
633
  * @interface IBodyTypeText
634
634
  * @property {string} marker - marker name. Example: "some_marker".
635
635
  * @property {string} type - Type value. Example: "text".
636
- * @property {object} value - Text Object. Contains html as string, plain text and params.
636
+ * @property {ITextValue | ITextValue[]} value - Text value. A read returns a one-element **array**, without `plainValue` and with `params.editorMode`; older records may hold a single object.
637
637
  * @example
638
- {
639
- "htmlValue": "<p>Hello world</p>",
640
- "plainValue": "",
641
- "params": {
642
- "isEditorDisabled": false,
643
- "isImageCompressed": true
638
+ [
639
+ {
640
+ "htmlValue": "<p>Hello world</p>",
641
+ "params": {
642
+ "isImageCompressed": true,
643
+ "editorMode": "html"
644
+ }
644
645
  }
645
- }
646
- * @description Represents a text value with HTML and plain text representations, along with parameters for editor and image compression settings.
646
+ ]
647
+ * @description Represents a text value with HTML and plain text representations, along with parameters for editor and image compression settings. To submit a text field use {@link IBodyPostTypeText}.
647
648
  */
648
649
  interface IBodyTypeText {
649
650
  marker: string;
650
651
  type: 'text';
651
- value: ITextValue;
652
+ value: ITextValue | ITextValue[];
652
653
  }
653
654
  /**
654
655
  * @interface ITextEditorParams
655
- * @property {boolean} isEditorDisabled - Whether the rich-text editor is disabled. Example: false.
656
+ * @property {boolean} [isEditorDisabled] - Whether the rich-text editor is disabled. Older records only; current reads carry `editorMode` instead. Example: false.
656
657
  * @property {boolean} isImageCompressed - Whether embedded images are compressed. Example: true.
658
+ * @property {string} [editorMode] - Editor the value was written in. Example: "html".
657
659
  * @description Editor parameters attached to text-type form values.
658
660
  */
659
661
  interface ITextEditorParams {
660
- isEditorDisabled: boolean;
662
+ isEditorDisabled?: boolean;
661
663
  isImageCompressed: boolean;
664
+ editorMode?: string;
662
665
  }
663
666
  /**
664
667
  * @interface ITextValue
665
668
  * @property {string} htmlValue - HTML representation of the text. Example: "<p>Hello world</p>".
666
- * @property {string} plainValue - Plain-text representation.
669
+ * @property {string} [plainValue] - Plain-text representation. Absent from current reads. Example: "Hello world".
667
670
  * @property {ITextEditorParams} params - Editor configuration applied to this value.
668
671
  * @description Value payload for `text` form fields.
669
672
  */
670
673
  interface ITextValue {
671
674
  htmlValue: string;
672
- plainValue: string;
675
+ plainValue?: string;
673
676
  params: ITextEditorParams;
674
677
  }
675
678
  /**
@@ -677,36 +680,37 @@ interface ITextValue {
677
680
  * @interface IBodyTypeTextWithHeader
678
681
  * @property {string} marker - marker name. Example: "about".
679
682
  * @property {string} type - Type value. Example: "textWithHeader".
680
- * @property {object} value - Text Object. Contains html as string, header and params.
683
+ * @property {ITextWithHeaderValue | ITextWithHeaderValue[]} value - Text with a header. A read returns a one-element **array**, without `plainValue` and with `params.editorMode`; older records may hold a single object.
681
684
  * @example
682
- {
683
- "header": "Headline",
684
- "htmlValue": "<p>Hello World</p>",
685
- "plainValue": "",
686
- "params": {
687
- "isEditorDisabled": false,
688
- "isImageCompressed": true
685
+ [
686
+ {
687
+ "header": "Headline",
688
+ "htmlValue": "<p>Hello World</p>",
689
+ "params": {
690
+ "isImageCompressed": true,
691
+ "editorMode": "html"
692
+ }
689
693
  }
690
- }
694
+ ]
691
695
  * @description Represents a text value with a header, HTML and plain text representations, along with parameters for editor and image compression settings.
692
696
  */
693
697
  interface IBodyTypeTextWithHeader {
694
698
  marker: string;
695
699
  type: 'textWithHeader';
696
- value: ITextWithHeaderValue;
700
+ value: ITextWithHeaderValue | ITextWithHeaderValue[];
697
701
  }
698
702
  /**
699
703
  * @interface ITextWithHeaderValue
700
704
  * @property {string} header - Headline text. Example: "Headline".
701
705
  * @property {string} htmlValue - HTML body. Example: "<p>Hello world</p>".
702
- * @property {string} plainValue - Plain-text body.
706
+ * @property {string} [plainValue] - Plain-text body. Absent from current reads. Example: "Hello world".
703
707
  * @property {ITextEditorParams} params - Editor configuration applied to this value.
704
708
  * @description Value payload for `textWithHeader` form fields.
705
709
  */
706
710
  interface ITextWithHeaderValue {
707
711
  header: string;
708
712
  htmlValue: string;
709
- plainValue: string;
713
+ plainValue?: string;
710
714
  params: ITextEditorParams;
711
715
  }
712
716
  /**
@@ -765,7 +769,7 @@ interface IImageValue {
765
769
  * @interface IBodyTypeFile
766
770
  * @property {string} marker - marker name. Example: "picture".
767
771
  * @property {'file'} type - Type value. Example: "file".
768
- * @property {object} value - The attached file. Three shapes are accepted and may be mixed in one array: a `File`/`Blob` (also a `FileList`), which the SDK uploads first; the descriptor `FileUploading.upload` returns for a file **already in storage**, which is passed through as it is; or a hand-built {@link IFileValue}. In a SUBMISSION the value must be an **array** — a lone descriptor or {@link IFileValue} answers `400 formData's marker '<marker>' value must be an array`, while a lone `File`/`Blob` is fine because the SDK wraps the upload result. A READ returns a single attached file as the object itself.
772
+ * @property {object} value - The attached file. Three shapes are accepted and may be mixed in one array: a `File`/`Blob` (also a `FileList`), which the SDK uploads first; the descriptor `FileUploading.upload` returns for a file **already in storage**, which is passed through as it is; or a hand-built {@link IFileValue}. In a SUBMISSION the value must be an **array** — a lone descriptor or {@link IFileValue} answers `400 formData's marker '<marker>' value must be an array`, while a lone `File`/`Blob` is fine because the SDK wraps the upload result. A READ returns the files as an array too — a single attached file is a one-element array.
769
773
  * @example
770
774
  [
771
775
  {
@@ -800,24 +804,41 @@ interface IFileValue {
800
804
  * @interface IBodyTypeRadioButtonList
801
805
  * @property {string} marker - marker name. Example: "selector".
802
806
  * @property {string} type - Type value. Example: 'list'.
803
- * @property {Array} value - Array of list or radioButton bojects.
807
+ * @property {IListOptionValue[] | string[] | string} value - Chosen option(s). A read of a submission returns the option **values as stored**: `list` — an array of strings (`["1"]`), `radioButton` — one string (`"1"`). The `[{ title, value, extended }]` form is the shape of a page attribute.
804
808
  * @example
805
- [
806
- {
807
- "title": "red",
808
- "value": "1",
809
- "extended": {
810
- "value": "red",
811
- "type": "string"
812
- }
813
- }
814
- ]
815
- * @description Represents a list or radio button selection with multiple options, each containing a title, value, and extended information.
809
+ ["1"]
810
+ * @description Represents a list or radio button selection. Look the titles up in the form's attribute (`Forms.getFormByMarker`) by the stored value.
816
811
  */
817
812
  interface IBodyTypeRadioButtonList {
818
813
  marker: string;
819
814
  type: 'list' | 'radioButton';
820
- value: IListOptionValue[];
815
+ value: IListOptionValue[] | string[] | string;
816
+ }
817
+ /**
818
+ * Represents an `entity` form data field — links to other entities.
819
+ * @interface IBodyTypeEntity
820
+ * @property {string} marker - marker name. Example: "related".
821
+ * @property {'entity'} type - Type value. Example: "entity".
822
+ * @property {number[]} value - Identifiers of the linked entities. Example: [2954, 2957].
823
+ * @description A form field that stores links to other entities (for example products) by id.
824
+ */
825
+ interface IBodyTypeEntity {
826
+ marker: string;
827
+ type: 'entity';
828
+ value: number[];
829
+ }
830
+ /**
831
+ * Represents a `timeInterval` form data field.
832
+ * @interface IBodyTypeTimeInterval
833
+ * @property {string} marker - marker name. Example: "booking".
834
+ * @property {'timeInterval'} type - Type value. Example: "timeInterval".
835
+ * @property {string[][]} value - Intervals as `[start, end]` pairs of ISO dates. Example: [["2025-02-11T16:00:00.000Z", "2025-02-13T16:00:00.000Z"]].
836
+ * @description A form field that stores one or more time intervals.
837
+ */
838
+ interface IBodyTypeTimeInterval {
839
+ marker: string;
840
+ type: 'timeInterval';
841
+ value: string[][];
821
842
  }
822
843
  /**
823
844
  * @interface IListOptionExtended
@@ -841,4 +862,4 @@ interface IListOptionValue {
841
862
  value: string;
842
863
  extended: IListOptionExtended;
843
864
  }
844
- 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, };
865
+ export type { FormDataPostType, FormDataStatus, FormDataType, IBodyPostFormData, IBodyPostTypeList, IBodyPostTypeSpam, IBodyPostTypeText, IBodyTypeEntity, IBodyTypeFile, IBodyTypeImageGroupOfImages, IBodyTypeRadioButtonList, IBodyTypeStringNumberFloat, IBodyTypeText, IBodyTypeTextWithHeader, IBodyTypeTimeDate, IBodyTypeTimeInterval, ICaptchaEvent, ICaptchaValue, IFileValue, IFormByMarkerDataEntity, IFormDataEntity, IFormDataSearchEntity, IFormsByMarkerDataEntity, IFormsData, IFormsDataEntity, IFormsDataFilter, IFormsDataSearchResponse, IFormsDataVectorSearch, IImageValue, IImageValueParams, IListOptionExtended, IListOptionValue, IPostFormResponse, IPostFormResponseData, ITextEditorParams, ITextSubmissionValue, ITextValue, ITextWithHeaderValue, ITimeDateValue, IUpdateFormsData, };
@@ -108,7 +108,7 @@ export default class IntegrationCollectionsApi extends AsyncModules {
108
108
  * @see {@link https://js-sdk.oneentry.cloud/docs/integration-collections/validateICollectionMarker validateICollectionMarker} documentation.
109
109
  */
110
110
  async validateICollectionMarker(marker) {
111
- const result = await this._fetchGet(`/marker-validation/${marker}`);
111
+ const result = await this._fetchGet(`/marker-validation/${this._pathSegment(marker)}`);
112
112
  // Validate response if validation is enabled
113
113
  const validated = await this._validateResponse(result, schema('CollectionIsValidSchema'));
114
114
  return this._normalizeData(validated);
@@ -123,7 +123,7 @@ export default class IntegrationCollectionsApi extends AsyncModules {
123
123
  * @see {@link https://js-sdk.oneentry.cloud/docs/integration-collections/getICollectionRowsByMarker getICollectionRowsByMarker} documentation.
124
124
  */
125
125
  async getICollectionRowsByMarker(marker, langCode = this.state.lang) {
126
- const result = await this._fetchGet(`/marker/${marker}/rows?langCode=${langCode}`);
126
+ const result = await this._fetchGet(`/marker/${this._pathSegment(marker)}/rows?langCode=${langCode}`);
127
127
  // Validate response if validation is enabled
128
128
  const validated = await this._validateResponse(result, schema('CollectionRowsResponseSchema'));
129
129
  return this._normalizeData(validated, langCode);
@@ -139,7 +139,7 @@ export default class IntegrationCollectionsApi extends AsyncModules {
139
139
  * @see {@link https://js-sdk.oneentry.cloud/docs/integration-collections/getICollectionRowByMarkerAndId getICollectionRowByMarkerAndId} documentation.
140
140
  */
141
141
  async getICollectionRowByMarkerAndId(marker, id, langCode = this.state.lang) {
142
- const result = await this._fetchGet(`/marker/${marker}/rows/${id}?langCode=${langCode}`);
142
+ const result = await this._fetchGet(`/marker/${this._pathSegment(marker)}/rows/${id}?langCode=${langCode}`);
143
143
  // Validate response if validation is enabled
144
144
  const validated = await this._validateResponse(result, schema('CollectionRowSchema'));
145
145
  return this._normalizeData(validated, langCode);
@@ -167,7 +167,7 @@ export default class IntegrationCollectionsApi extends AsyncModules {
167
167
  * @see {@link https://js-sdk.oneentry.cloud/docs/integration-collections/createICollectionRow createICollectionRow} documentation.
168
168
  */
169
169
  async createICollectionRow(marker, body, langCode = this.state.lang) {
170
- const response = await this._fetchPost(`/marker/${marker}/rows?langCode=${langCode}`, body);
170
+ const response = await this._fetchPost(`/marker/${this._pathSegment(marker)}/rows?langCode=${langCode}`, body);
171
171
  // Validate response if validation is enabled
172
172
  const validated = await this._validateResponse(response, schema('CollectionRowSchema'));
173
173
  return this._normalizeData(validated, langCode);
@@ -198,7 +198,8 @@ export default class IntegrationCollectionsApi extends AsyncModules {
198
198
  * @see {@link https://js-sdk.oneentry.cloud/docs/integration-collections/updateICollectionRow updateICollectionRow} documentation.
199
199
  */
200
200
  async updateICollectionRow(marker, id, body, langCode = this.state.lang) {
201
- const response = await this._fetchPut(`/marker/${marker}/rows/${id}?` + `langCode=${langCode}`, body);
201
+ const response = await this._fetchPut(`/marker/${this._pathSegment(marker)}/rows/${id}?` +
202
+ `langCode=${langCode}`, body);
202
203
  // Validate response if validation is enabled
203
204
  const validated = await this._validateResponse(response, schema('CollectionRowSchema'));
204
205
  return this._normalizeData(validated, langCode);
@@ -214,7 +215,7 @@ export default class IntegrationCollectionsApi extends AsyncModules {
214
215
  * @see {@link https://js-sdk.oneentry.cloud/docs/integration-collections/deleteICollectionRowByMarkerAndId deleteICollectionRowByMarkerAndId} documentation.
215
216
  */
216
217
  async deleteICollectionRowByMarkerAndId(marker, id) {
217
- const result = await this._fetchDelete(`/marker/${marker}/rows/${id}`);
218
+ const result = await this._fetchDelete(`/marker/${this._pathSegment(marker)}/rows/${id}`);
218
219
  return result;
219
220
  }
220
221
  }
@@ -27,7 +27,7 @@ export default class MenusApi extends AsyncModules {
27
27
  * @see {@link https://js-sdk.oneentry.cloud/docs/menus/getMenusByMarker getMenusByMarker} documentation.
28
28
  */
29
29
  async getMenusByMarker(marker, langCode = this.state.lang) {
30
- const result = await this._fetchGet(`/marker/${marker}?langCode=${langCode}`);
30
+ const result = await this._fetchGet(`/marker/${this._pathSegment(marker)}?langCode=${langCode}`);
31
31
  // Validate response if validation is enabled
32
32
  const validated = await this._validateResponse(result, schema('MenuEntitySchema'));
33
33
  return this._normalizeData(validated, langCode);
@@ -48,7 +48,7 @@ export default class OrdersApi extends AsyncModules {
48
48
  * @see {@link https://js-sdk.oneentry.cloud/docs/orders/getAllOrdersByMarker getAllOrdersByMarker} documentation.
49
49
  */
50
50
  async getAllOrdersByMarker(marker, langCode = this.state.lang, offset = 0, limit = 30) {
51
- const result = await this._fetchGet(`/marker/${marker}/orders?langCode=${langCode}&limit=${limit}&offset=${offset}`);
51
+ const result = await this._fetchGet(`/marker/${this._pathSegment(marker)}/orders?langCode=${langCode}&limit=${limit}&offset=${offset}`);
52
52
  // Validate response if validation is enabled
53
53
  const validated = await this._validateResponse(result, schema('OrdersResponseSchema'));
54
54
  return this._normalizeData(validated);
@@ -65,7 +65,7 @@ export default class OrdersApi extends AsyncModules {
65
65
  * @see {@link https://js-sdk.oneentry.cloud/docs/orders/getOrdersStorageByMarker getOrdersStorageByMarker} documentation.
66
66
  */
67
67
  async getOrdersStorageByMarker(marker, langCode = this.state.lang) {
68
- const result = await this._fetchGet(`/marker/${marker}?langCode=${langCode}`);
68
+ const result = await this._fetchGet(`/marker/${this._pathSegment(marker)}?langCode=${langCode}`);
69
69
  return this._normalizeData(result);
70
70
  }
71
71
  /**
@@ -81,7 +81,7 @@ export default class OrdersApi extends AsyncModules {
81
81
  * @see {@link https://js-sdk.oneentry.cloud/docs/orders/getOrderByMarkerAndId getOrderByMarkerAndId} documentation.
82
82
  */
83
83
  async getOrderByMarkerAndId(marker, id, langCode = this.state.lang) {
84
- const result = await this._fetchGet(`/marker/${marker}/orders/${id}?langCode=${langCode}`);
84
+ const result = await this._fetchGet(`/marker/${this._pathSegment(marker)}/orders/${id}?langCode=${langCode}`);
85
85
  // Validate response if validation is enabled
86
86
  const validated = await this._validateResponse(result, schema('OrderEntitySchema'));
87
87
  return this._normalizeData(validated);
@@ -149,7 +149,7 @@ export default class OrdersApi extends AsyncModules {
149
149
  * @see {@link https://js-sdk.oneentry.cloud/docs/orders/createOrder createOrder} documentation.
150
150
  */
151
151
  async createOrder(marker, body, langCode = this.state.lang) {
152
- const result = await this._fetchPost(`/marker/${marker}/orders`, this._wrapOrderFormData(body, langCode));
152
+ const result = await this._fetchPost(`/marker/${this._pathSegment(marker)}/orders`, this._wrapOrderFormData(body, langCode));
153
153
  // Validate response if validation is enabled
154
154
  const validated = await this._validateResponse(result, schema('CreateOrderResponseSchema'));
155
155
  return this._normalizeData(validated);
@@ -185,7 +185,7 @@ export default class OrdersApi extends AsyncModules {
185
185
  * @see {@link https://js-sdk.oneentry.cloud/docs/orders/updateOrderByMarkerAndId updateOrderByMarkerAndId} documentation.
186
186
  */
187
187
  async updateOrderByMarkerAndId(marker, id, body, langCode = this.state.lang) {
188
- const result = await this._fetchPut(`/marker/${marker}/orders/${id}?langCode=${langCode}`, this._wrapOrderFormData(body, langCode));
188
+ const result = await this._fetchPut(`/marker/${this._pathSegment(marker)}/orders/${id}?langCode=${langCode}`, this._wrapOrderFormData(body, langCode));
189
189
  // Validate response if validation is enabled
190
190
  const validated = await this._validateResponse(result, schema('UpdateOrderResponseSchema'));
191
191
  return this._normalizeData(validated);
@@ -208,7 +208,8 @@ export default class OrdersApi extends AsyncModules {
208
208
  offset,
209
209
  limit,
210
210
  };
211
- const data = await this._fetchGet(`/marker/${marker}/order-statuses?` + this._queryParamsToString(query));
211
+ const data = await this._fetchGet(`/marker/${this._pathSegment(marker)}/order-statuses?` +
212
+ this._queryParamsToString(query));
212
213
  return this._normalizeData(data);
213
214
  }
214
215
  /**
@@ -376,13 +376,13 @@ class StaffModule extends AsyncModules {
376
376
  // ({ total, items }) to match BlocksApi's similarProducts contract.
377
377
  async getSimilarProducts(marker, langCode = this.state.lang, offset = 0, limit = 30) {
378
378
  // Fetch similar products from the server
379
- const result = await this._fetchGet(`/${marker}/similar-products?langCode=${langCode}&offset=${offset}&limit=${limit}`);
379
+ const result = await this._fetchGet(`/${this._pathSegment(marker)}/similar-products?langCode=${langCode}&offset=${offset}&limit=${limit}`);
380
380
  return this._normalizeData(result);
381
381
  }
382
382
  // Method to fetch products by block marker
383
383
  async getProductsByBlockMarker(marker, langCode = this.state.lang, offset = 0, limit = 30) {
384
384
  // Fetch products from the server
385
- const result = await this._fetchGet(`/${marker}/products?langCode=${langCode}&offset=${offset}&limit=${limit}`);
385
+ const result = await this._fetchGet(`/${this._pathSegment(marker)}/products?langCode=${langCode}&offset=${offset}&limit=${limit}`);
386
386
  // On API error responses there is no `items` array — return the (normalized)
387
387
  // error as-is instead of producing `undefined` from `result.items`.
388
388
  if (!Array.isArray(result === null || result === void 0 ? void 0 : result.items)) {
@@ -42,7 +42,7 @@ export default class ProductStatusesApi extends AsyncModules {
42
42
  * @see {@link https://js-sdk.oneentry.cloud/docs/product-statuses/getProductsByStatusMarker getProductsByStatusMarker} documentation.
43
43
  */
44
44
  async getProductsByStatusMarker(marker, langCode = this.state.lang) {
45
- const result = await this._fetchGet(`/marker/${marker}`);
45
+ const result = await this._fetchGet(`/marker/${this._pathSegment(marker)}`);
46
46
  // Validate response if validation is enabled
47
47
  const validated = await this._validateResponse(result, schema('ProductStatusEntitySchema'));
48
48
  return this._normalizeData(validated, langCode);
@@ -57,7 +57,7 @@ export default class ProductStatusesApi extends AsyncModules {
57
57
  * @see {@link https://js-sdk.oneentry.cloud/docs/product-statuses/validateMarker validateMarker} documentation.
58
58
  */
59
59
  async validateMarker(marker) {
60
- const result = await this._fetchGet(`/marker-validation/${marker}`);
60
+ const result = await this._fetchGet(`/marker-validation/${this._pathSegment(marker)}`);
61
61
  // Validate response if validation is enabled
62
62
  const validated = await this._validateResponse(result, schema('ValidateMarkerResponseSchema'));
63
63
  // Extract the 'valid' boolean value from the response object
@@ -70,7 +70,7 @@ export default class TemplatesPreviewApi extends AsyncModules {
70
70
  * @see {@link https://js-sdk.oneentry.cloud/docs/templates/getTemplateByMarker getTemplateByMarker} documentation.
71
71
  */
72
72
  async getTemplateByMarker(marker, langCode = this.state.lang) {
73
- const result = await this._fetchGet(`/marker/${marker}?langCode=${langCode}`);
73
+ const result = await this._fetchGet(`/marker/${this._pathSegment(marker)}?langCode=${langCode}`);
74
74
  // Validate response if validation is enabled
75
75
  const validated = await this._validateResponse(result, schema('TemplateEntitySchema'));
76
76
  return this._normalizeData(validated);
@@ -42,7 +42,7 @@ export default class TemplatePreviewsApi extends AsyncModules {
42
42
  * @see {@link https://js-sdk.oneentry.cloud/docs/templates-preview/getTemplatePreviewByMarker getTemplatePreviewByMarker} documentation.
43
43
  */
44
44
  async getTemplatePreviewByMarker(marker, langCode = this.state.lang) {
45
- const result = await this._fetchGet(`/marker/${marker}?langCode=${langCode}`);
45
+ const result = await this._fetchGet(`/marker/${this._pathSegment(marker)}?langCode=${langCode}`);
46
46
  // Validate response if validation is enabled
47
47
  const validated = await this._validateResponse(result, schema('TemplatePreviewEntitySchema'));
48
48
  return this._normalizeData(validated, langCode);
@@ -81,7 +81,7 @@ export default class UserGroupsApi extends AsyncModules {
81
81
  * @see {@link https://js-sdk.oneentry.cloud/docs/user-groups/getUserGroupByMarker getUserGroupByMarker} documentation.
82
82
  */
83
83
  async getUserGroupByMarker(marker, langCode = this.state.lang) {
84
- const result = await this._fetchGet(`/marker/${marker}?langCode=${langCode}`);
84
+ const result = await this._fetchGet(`/marker/${this._pathSegment(marker)}?langCode=${langCode}`);
85
85
  // Validate response if validation is enabled
86
86
  const validated = await this._validateResponse(result, schema('UserGroupEntitySchema'));
87
87
  return this._normalizeData(validated, langCode);
@@ -98,7 +98,7 @@ export default class UserGroupsApi extends AsyncModules {
98
98
  * @see {@link https://js-sdk.oneentry.cloud/docs/user-groups/getChildUserGroupsByMarker getChildUserGroupsByMarker} documentation.
99
99
  */
100
100
  async getChildUserGroupsByMarker(marker, langCode = this.state.lang) {
101
- const result = await this._fetchGet(`/marker/${marker}/children?langCode=${langCode}`);
101
+ const result = await this._fetchGet(`/marker/${this._pathSegment(marker)}/children?langCode=${langCode}`);
102
102
  // Validate response if validation is enabled
103
103
  const validated = await this._validateResponse(result, schema('UserGroupsResponseSchema'));
104
104
  return this._normalizeData(validated, langCode);
@@ -73,7 +73,7 @@ export default class UsersApi extends AsyncModules implements IUsersApi {
73
73
  ]
74
74
  * @param {string} body.authData[].marker - Identifies the field being used. Example: "email_reg".
75
75
  * @param {string} body.authData[].value - Contains the value of the field. Example: "example@oneentry.cloud".
76
- * @param {string} body.formData - Contains additional data for the user.
76
+ * @param {FormDataType | FormDataType[]} body.formData - Form fields of the user. Field values: {@link FormDataType} — a value shaped by the field type (a string, a date object, a text object, a list, a file descriptor), not only a string. A file goes in as the descriptor `FileUploading.upload` returns: these methods do not upload a `File`/`Blob` themselves.
77
77
  * @example
78
78
  [
79
79
  {
@@ -84,7 +84,7 @@ export default class UsersApi extends AsyncModules implements IUsersApi {
84
84
  ]
85
85
  * @param {string} body.formData[].marker - The marker of the field. Example: "last_name".
86
86
  * @param {string} body.formData[].type - The type of the field. Example: "string".
87
- * @param {string} body.formData[].value - The value of the field. Example: "Username".
87
+ * @param {unknown} body.formData[].value - The value of the field, shaped by its type. Example: "Username".
88
88
  * @param {string} body.notificationData - The notification data.
89
89
  * @example
90
90
  {
@@ -78,7 +78,7 @@ export default class UsersApi extends AsyncModules {
78
78
  ]
79
79
  * @param {string} body.authData[].marker - Identifies the field being used. Example: "email_reg".
80
80
  * @param {string} body.authData[].value - Contains the value of the field. Example: "example@oneentry.cloud".
81
- * @param {string} body.formData - Contains additional data for the user.
81
+ * @param {FormDataType | FormDataType[]} body.formData - Form fields of the user. Field values: {@link FormDataType} — a value shaped by the field type (a string, a date object, a text object, a list, a file descriptor), not only a string. A file goes in as the descriptor `FileUploading.upload` returns: these methods do not upload a `File`/`Blob` themselves.
82
82
  * @example
83
83
  [
84
84
  {
@@ -89,7 +89,7 @@ export default class UsersApi extends AsyncModules {
89
89
  ]
90
90
  * @param {string} body.formData[].marker - The marker of the field. Example: "last_name".
91
91
  * @param {string} body.formData[].type - The type of the field. Example: "string".
92
- * @param {string} body.formData[].value - The value of the field. Example: "Username".
92
+ * @param {unknown} body.formData[].value - The value of the field, shaped by its type. Example: "Username".
93
93
  * @param {string} body.notificationData - The notification data.
94
94
  * @example
95
95
  {
@@ -1,4 +1,4 @@
1
- import type { IAuthData, IAuthFormData, INotificationData } from '../auth-provider/authProvidersInterfaces.js';
1
+ import type { IAuthData, INotificationData } from '../auth-provider/authProvidersInterfaces.js';
2
2
  import type { IError, IRating, IVectorSearchResponse } from '../base/utils.js';
3
3
  import type { IFormConfig } from '../forms/formsInterfaces.js';
4
4
  import type { FormDataType } from '../forms-data/formsDataInterfaces.js';
@@ -64,7 +64,7 @@ interface IUsersApi {
64
64
  ]
65
65
  * @param {string} body.authData[index].marker - Identifies the field being used. Example: "email_reg".
66
66
  * @param {string} body.authData[index].value - Contains the value of the field. Example: "example@oneentry.cloud".
67
- * @param {string} body.formData - Contains additional data for the user.
67
+ * @param {FormDataType | FormDataType[]} body.formData - Form fields of the user. Field values: {@link FormDataType} — a value shaped by the field type (a string, a date object, a text object, a list, a file descriptor), not only a string. A file goes in as the descriptor `FileUploading.upload` returns: these methods do not upload a `File`/`Blob` themselves.
68
68
  * @example
69
69
  [
70
70
  {
@@ -75,7 +75,7 @@ interface IUsersApi {
75
75
  ]
76
76
  * @param {string} body.formData[index].marker - The marker of the field. Example: "last_name".
77
77
  * @param {string} body.formData[index].type - The type of the field. Example: "string".
78
- * @param {string} body.formData[index].value - The value of the field. Example: "Username".
78
+ * @param {unknown} body.formData[index].value - The value of the field, shaped by its type. Example: "Username".
79
79
  * @param {string} body.notificationData - The notification data.
80
80
  * @example
81
81
  {
@@ -264,7 +264,7 @@ interface IUsersResponse {
264
264
  }
265
265
  ]
266
266
  * @property {string} formIdentifier - Marker of the form. Example: "form_12345".
267
- * @property {string} total - Returned by the API as a numeric string, such as `"1"`. The API reference does not describe this field. Example: "0".
267
+ * @property {string} [total] - Deprecated, do not rely on it. A service counter that leaks into the response of a single user: always `"1"`, it carries no data about the user. The API reference does not describe it, and the field may disappear from the response. Example: "1".
268
268
  * @property {Array<string | number>} groups - User groups.
269
269
  * @example
270
270
  [
@@ -287,7 +287,8 @@ interface IUserEntity {
287
287
  authProviderIdentifier: string;
288
288
  formData: FormDataType[];
289
289
  formIdentifier: string;
290
- total: string;
290
+ /** @deprecated Service counter leaking into the response, always `"1"`; the field may disappear. */
291
+ total?: string;
291
292
  groups: Array<string | number>;
292
293
  state: Record<string, unknown>;
293
294
  moduleFormConfigs?: Array<IFormConfig>;
@@ -306,7 +307,7 @@ interface IUserEntity {
306
307
  "value": "12345"
307
308
  }
308
309
  ]
309
- * @property {IAuthFormData | IAuthFormData[]} [formData] - One form field object or an array of them.
310
+ * @property {FormDataType | FormDataType[]} [formData] - One form field object or an array of them. Field values: {@link FormDataType} — a value shaped by the field type (a string, a date object, a text object, a list, a file descriptor), not only a string. A file goes in as the descriptor `FileUploading.upload` returns: these methods do not upload a `File`/`Blob` themselves.
310
311
  * @example
311
312
  [
312
313
  {
@@ -338,7 +339,7 @@ interface IUserBody {
338
339
  formIdentifier: string;
339
340
  langCode?: string;
340
341
  authData?: IAuthData[];
341
- formData?: IAuthFormData | IAuthFormData[];
342
+ formData?: FormDataType | FormDataType[];
342
343
  notificationData?: INotificationData;
343
344
  state?: Record<string, unknown>;
344
345
  }
@@ -13,7 +13,7 @@ export declare const UserResponseSchema: z.ZodObject<{
13
13
  authProviderIdentifier: z.ZodString;
14
14
  formData: z.ZodUnion<readonly [z.ZodArray<z.ZodAny>, z.ZodRecord<z.ZodString, z.ZodAny>]>;
15
15
  formIdentifier: z.ZodString;
16
- total: z.ZodString;
16
+ total: z.ZodOptional<z.ZodString>;
17
17
  groups: z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
18
18
  state: z.ZodRecord<z.ZodString, z.ZodAny>;
19
19
  moduleFormConfigs: z.ZodOptional<z.ZodArray<z.ZodAny>>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "oneentry",
3
- "version": "1.0.174",
3
+ "version": "1.0.176",
4
4
  "description": "OneEntry NPM package",
5
5
  "main": "dist/index.js",
6
6
  "module": "esm/index.js",
@@ -48,7 +48,7 @@
48
48
  },
49
49
  "scripts": {
50
50
  "prepublishOnly": "node ../scripts/smoke-pack.js --files-only",
51
- "postpublish": "node ../scripts/verify-published.js --named defineOneEntry --expect 1.0.174"
51
+ "postpublish": "node ../scripts/verify-published.js --named defineOneEntry --expect 1.0.176"
52
52
  },
53
53
  "sideEffects": false,
54
54
  "files": [