oneentry 1.0.125 → 1.0.126

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.
@@ -1,7 +1,7 @@
1
1
  import AsyncModules from '../base/asyncModules';
2
2
  import type StateModule from '../base/stateModule';
3
3
  import type { IError } from '../base/utils';
4
- import type { IFormDataEntity, IFormsData, IFormsDataEntity, IFormsPost } from './formsDataInterfaces';
4
+ import type { IBodyPostFormData, IFormsByMarkerDataEntity, IFormsData, IFormsDataEntity, IPostFormResponse } from './formsDataInterfaces';
5
5
  /**
6
6
  * Controllers for working with form data
7
7
  *
@@ -33,45 +33,49 @@ export default class FormsDataApi extends AsyncModules implements IFormsData {
33
33
  *
34
34
  * @handleName postFormsData
35
35
  *
36
- * @param {object} body - Request body. Example:
37
- {
38
- "formIdentifier": "file",
39
- "formData": [
40
- {
41
- "marker": "name",
42
- "type": "string",
43
- "value": "filesArray"
44
- },
45
- {
46
- "marker": "file",
47
- "type": "file",
48
- "value": filesArray,
49
- "fileQuery": {
50
- "type": "page",
51
- "entity": "editor",
52
- "id": 3492,
53
- }
54
- }
55
- ]
56
- }
36
+ * @param {IBodyPostFormData} body - Request body. Example:
37
+ {
38
+ formIdentifier: 'test-form',
39
+ formModuleConfigId: 2,
40
+ moduleEntityIdentifier: 'blog',
41
+ replayTo: null,
42
+ status: 'sent',
43
+ formData: [
44
+ {
45
+ marker: 'name',
46
+ type: 'string',
47
+ value: 'Test'
48
+ }
49
+ ]
50
+ }
57
51
  * @param {string} [langCode] - Language code. Default: "en_US".
58
- * @return {IFormDataEntity} Returns an object containing the created form data entry or an error object if there was an issue.
52
+ * @return {IPostFormResponse} Returns an object containing the created form data entry or an error object if there was an issue.
59
53
  * @throws {IError} - If there is an error during the fetch operation, it will return an error object.
60
54
  * @description This method requires user authorization. For more information about configuring the authorization module, see the documentation in the configuration settings section of the SDK.
61
55
  */
62
- postFormsData(body: IFormsPost, langCode?: string): Promise<IFormDataEntity | IError>;
56
+ postFormsData(body: IBodyPostFormData, langCode?: string): Promise<IPostFormResponse | IError>;
63
57
  /**
64
58
  * Get one object of form data by marker.
65
59
  *
66
60
  * @handleName getFormsDataByMarker
67
61
  *
68
- * @param {string} marker - Marker of the form data. Example: "contact_form_data".
62
+ * @param {string} marker - Marker of the form. Example: "contact_form".
63
+ * @param {number} formModuleConfigId - Example: 12.
64
+ * @param {object} [body] - Example:
65
+ {
66
+ "entityIdentifier": "test",
67
+ "userIdentifier": "",
68
+ "status": "",
69
+ "dateFrom": "2025-08-11",
70
+ "dateTo": ""
71
+ }
72
+ * @param {any} [isNested] - Example: 1.
69
73
  * @param {string} [langCode] - Language code. Default: "en_US".
70
74
  * @param {number} [offset] - Parameter for pagination. Default: 0.
71
75
  * @param {number} [limit] - Parameter for pagination. Default: 30.
72
- * @return {IFormsDataEntity} Returns an object containing the form data or an error object if there was an issue.
76
+ * @return {IFormsByMarkerDataEntity} Returns an object containing the form data or an error object if there was an issue.
73
77
  * @throws {IError} - If there is an error during the fetch operation, it will return an error object.
74
78
  * @description This method requires user authorization. For more information about configuring the authorization module, see the documentation in the configuration settings section of the SDK.
75
79
  */
76
- getFormsDataByMarker(marker: string, langCode?: string, offset?: number, limit?: number): Promise<IFormsDataEntity | IError>;
80
+ getFormsDataByMarker(marker: string, formModuleConfigId: number, body?: object, isNested?: number, langCode?: string, offset?: number, limit?: number): Promise<IFormsByMarkerDataEntity | IError>;
77
81
  }
@@ -41,29 +41,23 @@ class FormsDataApi extends asyncModules_1.default {
41
41
  *
42
42
  * @handleName postFormsData
43
43
  *
44
- * @param {object} body - Request body. Example:
45
- {
46
- "formIdentifier": "file",
47
- "formData": [
48
- {
49
- "marker": "name",
50
- "type": "string",
51
- "value": "filesArray"
52
- },
53
- {
54
- "marker": "file",
55
- "type": "file",
56
- "value": filesArray,
57
- "fileQuery": {
58
- "type": "page",
59
- "entity": "editor",
60
- "id": 3492,
61
- }
62
- }
63
- ]
64
- }
44
+ * @param {IBodyPostFormData} body - Request body. Example:
45
+ {
46
+ formIdentifier: 'test-form',
47
+ formModuleConfigId: 2,
48
+ moduleEntityIdentifier: 'blog',
49
+ replayTo: null,
50
+ status: 'sent',
51
+ formData: [
52
+ {
53
+ marker: 'name',
54
+ type: 'string',
55
+ value: 'Test'
56
+ }
57
+ ]
58
+ }
65
59
  * @param {string} [langCode] - Language code. Default: "en_US".
66
- * @return {IFormDataEntity} Returns an object containing the created form data entry or an error object if there was an issue.
60
+ * @return {IPostFormResponse} Returns an object containing the created form data entry or an error object if there was an issue.
67
61
  * @throws {IError} - If there is an error during the fetch operation, it will return an error object.
68
62
  * @description This method requires user authorization. For more information about configuring the authorization module, see the documentation in the configuration settings section of the SDK.
69
63
  */
@@ -125,16 +119,26 @@ class FormsDataApi extends asyncModules_1.default {
125
119
  *
126
120
  * @handleName getFormsDataByMarker
127
121
  *
128
- * @param {string} marker - Marker of the form data. Example: "contact_form_data".
122
+ * @param {string} marker - Marker of the form. Example: "contact_form".
123
+ * @param {number} formModuleConfigId - Example: 12.
124
+ * @param {object} [body] - Example:
125
+ {
126
+ "entityIdentifier": "test",
127
+ "userIdentifier": "",
128
+ "status": "",
129
+ "dateFrom": "2025-08-11",
130
+ "dateTo": ""
131
+ }
132
+ * @param {any} [isNested] - Example: 1.
129
133
  * @param {string} [langCode] - Language code. Default: "en_US".
130
134
  * @param {number} [offset] - Parameter for pagination. Default: 0.
131
135
  * @param {number} [limit] - Parameter for pagination. Default: 30.
132
- * @return {IFormsDataEntity} Returns an object containing the form data or an error object if there was an issue.
136
+ * @return {IFormsByMarkerDataEntity} Returns an object containing the form data or an error object if there was an issue.
133
137
  * @throws {IError} - If there is an error during the fetch operation, it will return an error object.
134
138
  * @description This method requires user authorization. For more information about configuring the authorization module, see the documentation in the configuration settings section of the SDK.
135
139
  */
136
- async getFormsDataByMarker(marker, langCode = this.state.lang, offset = 0, limit = 30) {
137
- const result = await this._fetchGet(`/marker/${marker}?langCode=${langCode}&offset=${offset}&limit=${limit}`);
140
+ async getFormsDataByMarker(marker, formModuleConfigId, body = {}, isNested = 1, langCode = this.state.lang, offset = 0, limit = 30) {
141
+ const result = await this._fetchPost(`/marker/${marker}?formModuleConfigId=${formModuleConfigId}&isNested=${isNested}&langCode=${langCode}&offset=${offset}&limit=${limit}`, body);
138
142
  return this._dataPostProcess(result, langCode);
139
143
  }
140
144
  }
@@ -1,5 +1,5 @@
1
- import type { IUploadingQuery } from 'file-uploading/fileUploadingInterfaces';
2
1
  import type { IError } from '../base/utils';
2
+ import type { IUploadingQuery } from '../file-uploading/fileUploadingInterfaces';
3
3
  /**
4
4
  * Interface for retrieving and posting form data in the system.
5
5
  *
@@ -22,37 +22,60 @@ interface IFormsData {
22
22
  */
23
23
  getFormsData(langCode: string, offset?: number, limit?: number): Promise<IFormsDataEntity | IError>;
24
24
  /**
25
- * Posts form data to the system.
25
+ * Creating an object of data save information by form
26
26
  *
27
- * @param {IFormsPost} data - The form data to be posted. Example:
27
+ * @handleName postFormsData
28
+ *
29
+ * @param {IBodyPostFormData} body - Request body. Example:
28
30
  {
29
- "id": 1,
30
- "formIdentifier": "string",
31
- "time": "string",
32
- "formData": [],
33
- "fileQuery": {
34
- "type": null;
35
- "entity": null;
36
- "id": null;
37
- "key": null;
38
- }
31
+ "formIdentifier": "form",
32
+ "formData": [
33
+ {
34
+ "marker": "name",
35
+ "type": "string",
36
+ "value": "Jack"
37
+ }
38
+ ]
39
39
  }
40
- * @param {string} [langCode] - Optional language code for localization. Default: "en_US".
41
- * @return {IFormDataEntity} A promise that resolves to a form data entity or an error.
40
+ * @param {string} body.formIdentifier - The identifier for the form. Example: "form".
41
+ * @param {FormDataType[]} body.formData - Example:
42
+ [
43
+ {
44
+ "marker": "name",
45
+ "type": "string",
46
+ "value": "Jack"
47
+ }
48
+ ]
49
+ * @param {string} body.formData.marker - The marker identifying the form field. Example: "name".
50
+ * @param {string} body.formData.type - The type of the form field. Example: "string".
51
+ * @param {string} body.formData.value - The value of the form field. Example: "Jack".
52
+ * @param {string} [langCode] - Language code. Default: "en_US".
53
+ * @return {IPostFormResponse} Returns an object containing the created form data entry and message.
42
54
  * @throws {IError} - If there is an error during the fetch operation, it will return an error object.
55
+ * @description This method requires user authorization. For more information about configuring the authorization module, see the documentation in the configuration settings section of the SDK.
43
56
  */
44
- postFormsData(data: IFormsPost, langCode?: string): Promise<IFormDataEntity | IError>;
57
+ postFormsData(body: IBodyPostFormData, langCode?: string): Promise<IPostFormResponse | IError>;
45
58
  /**
46
59
  * Retrieves form data by its marker.
47
60
  *
48
61
  * @param {string} marker - The marker identifying the form data. Example: "contact_form_data".
49
- * @param {string} langCode - The language code for localization. Default: "en_US".
62
+ * @param {number} formModuleConfigId - Example: 4.
63
+ * @param {object} [body] - Default: {}. Example:
64
+ {
65
+ "entityIdentifier": "test",
66
+ "userIdentifier": "",
67
+ "status": "",
68
+ "dateFrom": "2025-08-11",
69
+ "dateTo": ""
70
+ }
71
+ * @param {any} [isNested] - Flag for getting hierarchical data. Example: 1.
72
+ * @param {string} [langCode] - The language code for localization. Default: "en_US".
50
73
  * @param {number} [offset] - Optional offset for pagination. Default: 0.
51
74
  * @param {number} [limit] - Optional limit for pagination. Default: 30.
52
75
  * @returns {IFormsDataEntity} A promise that resolves to a form data entity or an error.
53
76
  * @throws {IError} - If there is an error during the fetch operation, it will return an error object.
54
77
  */
55
- getFormsDataByMarker(marker: string, langCode: string, offset?: number, limit?: number): Promise<IFormsDataEntity | IError>;
78
+ getFormsDataByMarker(marker: string, formModuleConfigId: number, body?: object, isNested?: number, langCode?: string, offset?: number, limit?: number): Promise<IFormsDataEntity | IError>;
56
79
  }
57
80
  /**
58
81
  * Represents the structure of a form data entity.
@@ -62,87 +85,176 @@ interface IFormsData {
62
85
  * @property {number} id - The unique identifier of the form page. Example: 12345.
63
86
  * @property {string} formIdentifier - The identifier of the page. Example: "contact_form".
64
87
  * @property {Date | string} time - The identifier of the form. Example: "2023-10-01T12:00:00Z".
65
- * @property {IFormsPost} formData - The identifier of the position. Example:
66
- {
67
- "id": 1,
68
- "formIdentifier": "string",
69
- "time": "string",
70
- "formData": [],
71
- "fileQuery": {
72
- "type": null;
73
- "entity": null;
74
- "id": null;
75
- "key": null;
88
+ * @property {FormDataType[]} formData - Form data. Example:
89
+ [
90
+ {
91
+ "marker": "name",
92
+ "type": "string",
93
+ "value": "Test"
76
94
  }
77
- }
78
- * @property {string} [attributeSetIdentifier] - Text identifier (marker) of the used attribute set. Example: "product_attributes".
79
- * @property {string} [actionMessage] - Action message for the form data. Example: "Form submitted successfully".
95
+ ]
96
+ * @property {string | null} [attributeSetIdentifier] - Text identifier (marker) of the used attribute set. Example: "product_attributes".
97
+ * @property {string | null} [actionMessage] - Action message for the form data. Example: "Form submitted successfully".
80
98
  * @description This interface defines the structure of a form data entity, including its identifiers, form data, and optional attributes.
81
99
  */
82
100
  interface IFormDataEntity {
83
101
  id: number;
84
102
  formIdentifier: string;
85
103
  time: Date | string;
86
- formData: IFormsPost;
87
- attributeSetIdentifier?: string;
88
- actionMessage?: string;
104
+ formData: FormDataType[];
105
+ attributeSetIdentifier?: string | null;
106
+ actionMessage?: string | null;
89
107
  }
90
108
  /**
91
109
  * Represents a collection of form data entities.
92
110
  *
93
111
  * @interface IFormsDataEntity
94
112
  *
95
- * @property {number} total - Total number of found records. Example: 100.
96
113
  * @property {IFormDataEntity[]} items - Array of form data objects. Example:
97
114
  [
98
115
  {
99
116
  "id": 1,
100
- "formIdentifier": "string",
101
- "time": "string",
102
- "formData": "IFormsPost",
103
- "attributeSetIdentifier": "string",
104
- "actionMessage": "string"
117
+ "formIdentifier": "form",
118
+ "time": "2025-06-06T19:07:45.993Z",
119
+ "formData": {},
120
+ "attributeSetIdentifier": "form",
121
+ "actionMessage": "Action message string"
105
122
  }
106
123
  ]
107
124
  * @description This interface defines the structure of a collection of form data entities, including a total count and an array of items.
125
+ * @property {number} total - Total number of found records. Example: 100.
108
126
  */
109
127
  interface IFormsDataEntity {
110
- total: number;
111
128
  items: IFormDataEntity[];
129
+ total: number;
130
+ }
131
+ /**
132
+ * Represents the structure of a form data entity.
133
+ *
134
+ * @interface IFormByMarkerDataEntity
135
+ *
136
+ * @property {number} id - The unique identifier of the form page. Example: 12345.
137
+ * @property {null | number} parentId - The unique identifier of the parent form page. Example: 123.
138
+ * @property {string} formIdentifier - The identifier of the page. Example: "contact_form".
139
+ * @property {Date | string} time - The identifier of the form. Example: "2023-10-01T12:00:00Z".
140
+ * @property {number} depth - Example: 1.
141
+ * @property {FormDataType[]} formData - Form data. Example:
142
+ [
143
+ {
144
+ "marker": "name",
145
+ "type": "string",
146
+ "value": "Test"
147
+ }
148
+ ]
149
+ * @property {string | null} [actionMessage] - Action message for the form data. Example: "Form submitted successfully".
150
+ * @property {string | null} [attributeSetIdentifier] - Text identifier (marker) of the used attribute set. Example: "product_attributes".
151
+ * @property {string | null} [ip] - Example: '127.0.0.1'.
152
+ * @property {string | null} [status] - Example: ''.
153
+ * @property {string | null} [userIdentifier] - Example: ''.
154
+ * @property {string} [entityIdentifier] - Example: 'blog'.
155
+ * @property {boolean} [isUserAdmin] - Example: false.
156
+ * @property {number} [formModuleConfigId] - Example: 2.
157
+ * @description This interface defines the structure of a form data entity, including its identifiers, form data, and optional attributes.
158
+ */
159
+ interface IFormByMarkerDataEntity {
160
+ id: number;
161
+ parentId: null | number;
162
+ formIdentifier: string;
163
+ depth: number;
164
+ time: Date | string;
165
+ formData: FormDataType[];
166
+ actionMessage?: string | null;
167
+ attributeSetIdentifier?: string | null;
168
+ ip?: string | null;
169
+ status?: string | null;
170
+ userIdentifier?: string | null;
171
+ entityIdentifier: string;
172
+ isUserAdmin: boolean;
173
+ formModuleConfigId: number;
174
+ }
175
+ /**
176
+ * Represents a collection of form data entities.
177
+ *
178
+ * @interface IFormsByMarkerDataEntity
179
+ *
180
+ * @property {IFormByMarkerDataEntity[]} items - Array of form data objects. Example:
181
+ [
182
+ {
183
+ id: 42,
184
+ parentId: null,
185
+ formIdentifier: 'test-form',
186
+ depth: 0,
187
+ ip: null,
188
+ status: null,
189
+ userIdentifier: null,
190
+ formData: [{ marker: 'name', type: 'string', value: 'Test' }],
191
+ attributeSetIdentifier: 'form',
192
+ time: '2025-03-03T15:51:17.458Z',
193
+ entityIdentifier: 'blog',
194
+ isUserAdmin: false,
195
+ formModuleConfigId: 2
196
+ }
197
+ ]
198
+ * @property {number} total - Total number of found records. Example: 100.
199
+ * @description This interface defines the structure of a collection of form data entities, including a total count and an array of items.
200
+ */
201
+ interface IFormsByMarkerDataEntity {
202
+ items: IFormByMarkerDataEntity[];
203
+ total: number;
204
+ }
205
+ interface IPostFormResponse {
206
+ actionMessage: string;
207
+ formData: {
208
+ id: number;
209
+ formIdentifier: string;
210
+ time: string;
211
+ entityIdentifier: string;
212
+ isUserAdmin: boolean;
213
+ formModuleId: number;
214
+ userIdentifier: any;
215
+ parentId: any;
216
+ formData: FormDataType[];
217
+ };
112
218
  }
113
219
  /**
114
220
  * Contains an array of data form objects with the following values
115
221
  */
116
222
  type FormDataType = IBodyTypeStringNumberFloat | IBodyTypeTimeDate | IBodyTypeText | IBodyTypeTextWithHeader | IBodyTypeImageGroupOfImages | IBodyTypeFile | IBodyTypeRadioButtonList | Record<string, any>;
117
223
  /**
118
- * Represents the structure of a form post object.
224
+ * Represents the structure of the body for posting form data.
119
225
  *
120
- * @interface IFormsPost
226
+ * @interface IBodyPostFormData
121
227
  *
122
- * @property {number} [id] - Optional identifier of the form post. Example: 1.
123
- * @property {string} formIdentifier - The identifier of the page. Example: "string".
124
- * @property {Date | string} [time] - Date and time of form modification. Example: "string".
125
- * @property {FormDataType[]} formData - The form data object. Example:
228
+ * @property {string} formIdentifier - Text identifier (marker) of the form. Example: "form".
229
+ * @property {number} formModuleConfigId - Example: 2.
230
+ * @property {string} moduleEntityIdentifier - Example: "blog".
231
+ * @property {string | null} replayTo - Example: "".
232
+ * @property {string} status - Example: "sent".
233
+ * @property {FormDataType[]} formData - Array of form data objects. Example:
126
234
  [
127
235
  {
128
- "marker": "string",
236
+ "marker": "name",
129
237
  "type": "string",
130
- "value": "string"
238
+ "value": "Jack"
131
239
  }
132
240
  ]
241
+ * @property {string} formData[index].marker - The marker identifying the form field. Example: "name".
242
+ * @property {string} formData[index].type - The type of the form field. Example: "string".
243
+ * @property {string} formData[index].value - The value of the form field. Example: "name".
133
244
  * @property {IUploadingQuery} [fileQuery] - Optional file query for uploading files. Example:
134
245
  {
135
- "type": null,
136
- "entity": null,
137
- "id": null,
138
- "key": null,
246
+ "type": "page",
247
+ "entity": "editor",
248
+ "id": 3787
139
249
  }
140
250
  * @description This interface defines the structure of a form post object, including its identifiers, time, form data, and optional file query.
141
251
  */
142
- interface IFormsPost {
143
- id?: number;
252
+ interface IBodyPostFormData {
144
253
  formIdentifier: string;
145
- time?: Date | string;
254
+ formModuleConfigId: number;
255
+ moduleEntityIdentifier: string;
256
+ replayTo: string | null;
257
+ status: string;
146
258
  formData: FormDataType[];
147
259
  fileQuery?: IUploadingQuery;
148
260
  }
@@ -347,4 +459,4 @@ interface IBodyTypeRadioButtonList {
347
459
  };
348
460
  }>;
349
461
  }
350
- export type { FormDataType, IBodyTypeFile, IBodyTypeImageGroupOfImages, IBodyTypeRadioButtonList, IBodyTypeStringNumberFloat, IBodyTypeText, IBodyTypeTextWithHeader, IBodyTypeTimeDate, IFormDataEntity, IFormsData, IFormsDataEntity, IFormsPost, };
462
+ export type { FormDataType, IBodyPostFormData, IBodyTypeFile, IBodyTypeImageGroupOfImages, IBodyTypeRadioButtonList, IBodyTypeStringNumberFloat, IBodyTypeText, IBodyTypeTextWithHeader, IBodyTypeTimeDate, IFormByMarkerDataEntity, IFormDataEntity, IFormsByMarkerDataEntity, IFormsData, IFormsDataEntity, IPostFormResponse, };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "oneentry",
3
- "version": "1.0.125",
3
+ "version": "1.0.126",
4
4
  "description": "OneEntry NPM package",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",