oneentry 1.0.124 → 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.
Files changed (78) hide show
  1. package/README.md +24 -22
  2. package/dist/admins/adminsApi.d.ts +17 -4
  3. package/dist/admins/adminsApi.js +16 -3
  4. package/dist/admins/adminsInterfaces.d.ts +47 -26
  5. package/dist/attribute-sets/attributeSetsApi.d.ts +10 -18
  6. package/dist/attribute-sets/attributeSetsApi.js +9 -17
  7. package/dist/attribute-sets/attributeSetsInterfaces.d.ts +92 -44
  8. package/dist/auth-provider/authProviderApi.d.ts +146 -36
  9. package/dist/auth-provider/authProviderApi.js +163 -37
  10. package/dist/auth-provider/authProvidersInterfaces.d.ts +189 -40
  11. package/dist/base/asyncModules.d.ts +7 -1
  12. package/dist/base/asyncModules.js +127 -21
  13. package/dist/base/result.js +23 -0
  14. package/dist/base/syncModules.d.ts +4 -0
  15. package/dist/base/syncModules.js +19 -1
  16. package/dist/base/utils.d.ts +1 -1
  17. package/dist/blocks/blocksApi.d.ts +7 -17
  18. package/dist/blocks/blocksApi.js +7 -17
  19. package/dist/blocks/blocksInterfaces.d.ts +77 -32
  20. package/dist/events/eventsApi.d.ts +7 -8
  21. package/dist/events/eventsApi.js +12 -7
  22. package/dist/events/eventsInterfaces.d.ts +16 -11
  23. package/dist/file-uploading/fileUploadingApi.d.ts +22 -14
  24. package/dist/file-uploading/fileUploadingApi.js +20 -12
  25. package/dist/file-uploading/fileUploadingInterfaces.d.ts +42 -18
  26. package/dist/forms/formsApi.d.ts +3 -7
  27. package/dist/forms/formsApi.js +2 -6
  28. package/dist/forms/formsInterfaces.d.ts +44 -28
  29. package/dist/{formsData → forms-data}/formsDataApi.d.ts +31 -15
  30. package/dist/{formsData → forms-data}/formsDataApi.js +30 -14
  31. package/dist/forms-data/formsDataInterfaces.d.ts +462 -0
  32. package/dist/general-types/generalTypesApi.d.ts +1 -3
  33. package/dist/general-types/generalTypesApi.js +0 -2
  34. package/dist/general-types/generalTypesInterfaces.d.ts +2 -4
  35. package/dist/index.d.ts +1 -1
  36. package/dist/index.js +1 -1
  37. package/dist/integration-collections/integrationCollectionsApi.d.ts +74 -47
  38. package/dist/integration-collections/integrationCollectionsApi.js +64 -45
  39. package/dist/integration-collections/integrationCollectionsInterfaces.d.ts +144 -63
  40. package/dist/locales/localesApi.d.ts +1 -2
  41. package/dist/locales/localesApi.js +1 -2
  42. package/dist/locales/localesInterfaces.d.ts +2 -4
  43. package/dist/menus/menusApi.d.ts +1 -3
  44. package/dist/menus/menusApi.js +1 -3
  45. package/dist/menus/menusInterfaces.d.ts +39 -13
  46. package/dist/orders/ordersApi.d.ts +36 -18
  47. package/dist/orders/ordersApi.js +40 -22
  48. package/dist/orders/ordersInterfaces.d.ts +163 -81
  49. package/dist/pages/pagesApi.d.ts +48 -48
  50. package/dist/pages/pagesApi.js +40 -45
  51. package/dist/pages/pagesInterfaces.d.ts +147 -98
  52. package/dist/payments/paymentsApi.d.ts +25 -45
  53. package/dist/payments/paymentsApi.js +27 -46
  54. package/dist/payments/paymentsInterfaces.d.ts +42 -60
  55. package/dist/product-statuses/productStatusesApi.d.ts +6 -12
  56. package/dist/product-statuses/productStatusesApi.js +5 -11
  57. package/dist/product-statuses/productStatusesInterfaces.d.ts +16 -15
  58. package/dist/products/productsApi.d.ts +256 -104
  59. package/dist/products/productsApi.js +263 -97
  60. package/dist/products/productsInterfaces.d.ts +343 -160
  61. package/dist/system/systemApi.d.ts +21 -10
  62. package/dist/system/systemApi.js +22 -8
  63. package/dist/system/systemInterfaces.d.ts +0 -1
  64. package/dist/templates/templatesApi.d.ts +6 -12
  65. package/dist/templates/templatesApi.js +4 -10
  66. package/dist/templates/templatesInterfaces.d.ts +20 -20
  67. package/dist/templates-preview/templatesPreviewApi.d.ts +2 -6
  68. package/dist/templates-preview/templatesPreviewApi.js +1 -5
  69. package/dist/templates-preview/templatesPreviewInterfaces.d.ts +50 -25
  70. package/dist/users/usersApi.d.ts +33 -13
  71. package/dist/users/usersApi.js +38 -15
  72. package/dist/users/usersInterfaces.d.ts +78 -27
  73. package/dist/web-socket/wsApi.d.ts +1 -5
  74. package/dist/web-socket/wsApi.js +1 -5
  75. package/dist/web-socket/wsInterfaces.d.ts +0 -1
  76. package/package.json +18 -16
  77. package/dist/formsData/formsDataInterfaces.d.ts +0 -267
  78. /package/dist/{formsData → forms-data}/formsDataInterfaces.js +0 -0
@@ -20,11 +20,9 @@ class UsersApi extends asyncModules_1.default {
20
20
  * @handleName getUser
21
21
  *
22
22
  * @param {string} [langCode] - Language code. Default: "en_US".
23
- *
24
23
  * @return {IUserEntity} Returns a promise that resolves to the user entity object if successful; otherwise, returns an error object.
25
24
  * @throws {IError} If there is an error during the fetch operation, it will return an error object.
26
- *
27
- * @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.
25
+ * @description Getting the data of an authorized user. This method requires user authorization. For more information about configuring the authorization module, see the documentation in the configuration settings section of the SDK.
28
26
  */
29
27
  async getUser(langCode = this.state.lang) {
30
28
  const result = await this._fetchGet(`/me?langCode=${langCode}`);
@@ -35,14 +33,31 @@ class UsersApi extends asyncModules_1.default {
35
33
  *
36
34
  * @handleName updateUser
37
35
  *
38
- * @param {object} body - Request body. Example: {"formIdentifier": "reg", "authData": [{"marker": "password", "value": "12345"}], "formData": {"marker": "last_name", "type": "string", "value": "Username"}, "notificationData": {"email": "example@oneentry.cloud", "phonePush": ["+99999999999"], "phoneSMS": "+99999999999"}, "state": {}}
36
+ * @param {IUserBody} body - Request body. Example:
37
+ {
38
+ "formIdentifier": "reg",
39
+ "authData": [
40
+ {
41
+ "marker": "password",
42
+ "value": "12345"
43
+ }
44
+ ],
45
+ "formData": {
46
+ "marker": "last_name",
47
+ "type": "string",
48
+ "value": "Username"
49
+ },
50
+ "notificationData": {
51
+ "email": "example@oneentry.cloud",
52
+ "phonePush": ["+99999999999"],
53
+ "phoneSMS": "+99999999999"
54
+ },
55
+ "state": {}
56
+ }
39
57
  * @param {string} [langCode] - Language code. Default: "en_US".
40
- *
41
58
  * @return {boolean} Returns `true` if the user object was successfully updated; otherwise, returns an error object.
42
59
  * @throws {IError} If there is an error during the fetch operation, it will return an error object.
43
- *
44
- * @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.
45
- *
60
+ * @description Updating a single user object. This method requires user authorization. For more information about configuring the authorization module, see the documentation in the configuration settings section of the SDK.
46
61
  */
47
62
  async updateUser(body, langCode = this.state.lang) {
48
63
  if (!('langCode' in body))
@@ -55,17 +70,29 @@ class UsersApi extends asyncModules_1.default {
55
70
  return result;
56
71
  }
57
72
  /**
58
- * Delete a single user object.
73
+ * Archiving one user object (marked for deletion).
59
74
  *
60
- * @handleName deleteUser
75
+ * @handleName archiveUser
61
76
  *
62
77
  * @return {boolean} Returns `true` if the user was successfully deleted; otherwise, returns an error object.
63
78
  * @throws {IError} If there is an error during the fetch operation, it will return an error object.
79
+ * @description Archiving one user object (marked for deletion). This method requires user authorization. For more information about configuring the authorization module, see the documentation in the configuration settings section of the SDK.
80
+ */
81
+ async archiveUser() {
82
+ const result = await this._fetchDelete('/me');
83
+ return result;
84
+ }
85
+ /**
86
+ * Delete a single user.
87
+ *
88
+ * @handleName deleteUser
64
89
  *
90
+ * @return {boolean} Returns `true` if the user was successfully deleted; otherwise, returns an error object.
91
+ * @throws {IError} If there is an error during the fetch operation, it will return an error object.
65
92
  * @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.
66
93
  */
67
94
  async deleteUser() {
68
- const result = await this._fetchDelete('/me');
95
+ const result = await this._fetchDelete('/me/account');
69
96
  return result;
70
97
  }
71
98
  /**
@@ -74,10 +101,8 @@ class UsersApi extends asyncModules_1.default {
74
101
  * @handleName addFCMToken
75
102
  *
76
103
  * @param {string} token - The cloud messaging token to be added. This token is used to identify the user's device for push notifications. Example: "fcm_token_1234567890abcdefg".
77
- *
78
104
  * @return {boolean} Returns `true` if the token was successfully added; otherwise, returns an error object.
79
105
  * @throws {IError} If there is an error during the fetch operation, it will return an error object.
80
- *
81
106
  * @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.
82
107
  */
83
108
  async addFCMToken(token) {
@@ -90,10 +115,8 @@ class UsersApi extends asyncModules_1.default {
90
115
  * @handleName deleteFCMToken
91
116
  *
92
117
  * @param {string} token - The cloud messaging token to be deleted. This token is used to identify the user's device for push notifications and will be removed. Example: "fcm_token_1234567890abcdefg".
93
- *
94
118
  * @return {boolean} Returns `true` if the token was successfully deleted; otherwise, returns an error object.
95
119
  * @throws {IError} - If there is an error during the fetch operation, it will return an error object.
96
- *
97
120
  * @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.
98
121
  */
99
122
  async deleteFCMToken(token) {
@@ -1,6 +1,7 @@
1
+ import type { IFormConfig } from 'forms/formsInterfaces';
1
2
  import type { IAuthFormData } from '../auth-provider/authProvidersInterfaces';
2
3
  import type { IError } from '../base/utils';
3
- import type { FormDataType } from '../formsData/formsDataInterfaces';
4
+ import type { FormDataType } from '../forms-data/formsDataInterfaces';
4
5
  /**
5
6
  * Interface representing user-related operations.
6
7
  *
@@ -8,10 +9,10 @@ import type { FormDataType } from '../formsData/formsDataInterfaces';
8
9
  *
9
10
  * @property {function} getUser - Retrieves the data of an authorized user, optionally based on a language code.
10
11
  * @property {function} updateUser - Updates the user's data with the provided information.
12
+ * @property {function} archiveUser - Archiving one user object (marked for deletion).
11
13
  * @property {function} deleteUser - Deletes the user from the system.
12
14
  * @property {function} addFCMToken - Adds an FCM (Firebase Cloud Messaging) token for sending push notifications.
13
15
  * @property {function} deleteFCMToken - Deletes an existing FCM token.
14
- *
15
16
  * @description This interface defines methods for managing user data and handling Firebase Cloud Messaging tokens.
16
17
  */
17
18
  interface IUsers {
@@ -19,31 +20,54 @@ interface IUsers {
19
20
  * Retrieves the data of an authorized user.
20
21
  *
21
22
  * @param {string} [langCode] - Optional language code for localization. Default: "en_US".
22
- *
23
23
  * @return {IUserEntity} A promise resolving to the user entity or an error.
24
24
  * @throws {IError} - If there is an error during the fetch operation, it will return an error object.
25
- *
26
25
  * @description Retrieves the data of an authorized user.
27
26
  */
28
27
  getUser(langCode?: string): Promise<IUserEntity | IError>;
29
28
  /**
30
29
  * Updates the user's data.
31
30
  *
32
- * @param {IUserBody} data - The new data for the user. Example: {"formIdentifier": "reg", "authData": [{"marker": "password", "value": "12345"}], "formData": {"marker": "last_name", "type": "string", "value": "Username"}, "notificationData": {"email": "example@oneentry.cloud", "phonePush": ["+99999999999"], "phoneSMS": "+99999999999"}, "state": {}}
31
+ * @param {IUserBody} data - The new data for the user. Example:
32
+ {
33
+ "formIdentifier": "reg",
34
+ "authData": [
35
+ {
36
+ "marker": "password",
37
+ "value": "12345"
38
+ }
39
+ ],
40
+ "formData": {
41
+ "marker": "last_name",
42
+ "type": "string",
43
+ "value": "Username"
44
+ },
45
+ "notificationData": {
46
+ "email": "example@oneentry.cloud",
47
+ "phonePush": ["+99999999999"],
48
+ "phoneSMS": "+99999999999"
49
+ },
50
+ "state": {}
51
+ }
33
52
  * @param {string} [langCode] - Optional language code for localization. Default: "en_US".
34
- *
35
53
  * @return {boolean} A promise resolving to true if successful, or an error.
36
54
  * @throws {IError} - If there is an error during the fetch operation, it will return an error object.
37
- *
38
55
  * @description Updates the user's data.
39
56
  */
40
57
  updateUser(data: IUserBody, langCode?: string): Promise<boolean | IError>;
41
58
  /**
42
- * Deletes the user from the system.
59
+ * Archiving one user object (marked for deletion).
43
60
  *
44
61
  * @return {boolean} A promise resolving to true if successful, or an error.
45
62
  * @throws {IError} - If there is an error during the fetch operation, it will return an error object.
63
+ * @description Deletes the user from the system.
64
+ */
65
+ archiveUser(): Promise<boolean | IError>;
66
+ /**
67
+ * Deletes the user from the system.
46
68
  *
69
+ * @return {boolean} A promise resolving to true if successful, or an error.
70
+ * @throws {IError} - If there is an error during the fetch operation, it will return an error object.
47
71
  * @description Deletes the user from the system.
48
72
  */
49
73
  deleteUser(): Promise<boolean | IError>;
@@ -53,7 +77,6 @@ interface IUsers {
53
77
  * @param {string} token - The FCM token to be added. Example: "fcm_token_1234567890abcdefg".
54
78
  * @return {boolean} A promise resolving to true if successful, or an error.
55
79
  * @throws {IError} - If there is an error during the fetch operation, it will return an error object.
56
- *
57
80
  * @description Adds an FCM token for sending push notifications.
58
81
  */
59
82
  addFCMToken(token: string): Promise<boolean | IError>;
@@ -63,7 +86,6 @@ interface IUsers {
63
86
  * @param {string} token - The FCM token to be deleted. Example: "fcm_token_1234567890abcdefg".
64
87
  * @return {boolean} A promise resolving to true if successful, or an error.
65
88
  * @throws {IError} - If there is an error during the fetch operation, it will return an error object.
66
- *
67
89
  * @description Deletes an existing FCM token.
68
90
  */
69
91
  deleteFCMToken(token: string): Promise<boolean | IError>;
@@ -72,34 +94,63 @@ interface IUsers {
72
94
  * @interface IUserEntity
73
95
  *
74
96
  * @property {number} id - Object identifier. Example: 12345.
75
- * @property {string} identifier - Text identifier for record field. Example: 'user_12345'.
76
- * @property {Array<FormDataType>} formData - Array of data form objects with the following values. Example: [{"marker": "last_name", "type": "string", "value": "Username"}].
77
- * @property {string} formIdentifier - Text identifier of the form. Example: 'form_12345'.
78
- * @property {string} authProviderIdentifier - Text identifier of the authentication provider. Example: 'auth_provider_12345'.
79
- * @property {Array<string | number>} groups - Array of user groups. Example: ['group_1', 'group_2'].
80
- * @property {Record<string, any>} state - Object containing additional user state information. Example: {"key": "value"}.
81
- *
97
+ * @property {string} identifier - Text identifier for record field. Example: "user_12345".
98
+ * @property {string} authProviderIdentifier - Text identifier of the authentication provider. Example: "auth_provider_12345".
99
+ * @property {FormDataType[]} formData - Array of data form objects with the following values. Example:
100
+ [
101
+ {
102
+ "marker": "last_name",
103
+ "type": "string",
104
+ "value": "Username"
105
+ }
106
+ ]
107
+ * @property {string} formIdentifier - Text identifier of the form. Example: "form_12345".
108
+ * @property {any[]} groups - Array of user groups. Example: ["group_1", "group_2"].
109
+ * @property {any} state - Object containing additional user state information. Example: {"key": "value"}
82
110
  * @description Represents a user entity with various properties, including identifiers, form data, and user groups.
83
111
  */
84
112
  interface IUserEntity {
85
113
  id: number;
86
114
  identifier: string;
87
- formData: Array<FormDataType>;
88
- formIdentifier: string;
89
115
  authProviderIdentifier: string;
116
+ formData: FormDataType[];
117
+ formIdentifier: string;
90
118
  groups: Array<string | number>;
91
119
  state: Record<string, any>;
120
+ moduleFormConfigs: IFormConfig;
92
121
  }
93
122
  /**
94
123
  * @interface IUserBody
95
124
  *
96
- * @property {string} formIdentifier - Text identifier of the form. Example: 'form_12345'.
125
+ * @property {string} formIdentifier - Text identifier of the form. Example: "form_12345".
97
126
  * @property {string} [langCode] - Language code for localization. Default: "en_US".
98
- * @property {Array<{ marker: string; value: string }>} [authData] - Array of authentication data objects with markers and values. Example: [{"marker": "password", "value": "12345"}].
99
- * @property {IAuthFormData | Array<IAuthFormData>} [formData] - Form data object or array of form data objects. Example: {"marker": "last_name", "type": "string", "value": "Username"} or [{"marker": "first_name", "type": "string", "value": "John"}, {"marker": "last_name", "type": "string", "value": "Doe"}].
100
- * @property {object} [notificationData] - Object containing notification data, including email and phone information. Example: {"email": "example@oneentry.cloud", "phonePush": ["+99999999999"], "phoneSMS": "+99999999999"}.
101
- * @property {Record<string, any>} [state] - Object containing additional state information. Example: {"key": "value"}.
102
- *
127
+ * @property {{ marker: string; value: string }[]} [authData] - Array of authentication data objects with markers and values. Example:
128
+ [
129
+ {
130
+ "marker": "password",
131
+ "value": "12345"
132
+ }
133
+ ]
134
+ * @property {IAuthFormData | IAuthFormData[]} [formData] - Form data object or array of form data objects. Example:
135
+ [
136
+ {
137
+ "marker": "first_name",
138
+ "type": "string",
139
+ "value": "John"
140
+ },
141
+ {
142
+ "marker": "last_name",
143
+ "type": "string",
144
+ "value": "Doe"
145
+ }
146
+ ]
147
+ * @property {object} [notificationData] - Object containing notification data, including email and phone information. Example:
148
+ {
149
+ "email": "example@oneentry.cloud",
150
+ "phonePush": ["+99999999999"],
151
+ "phoneSMS": "+99999999999"
152
+ }
153
+ * @property {any} [state] - Object containing additional state information. Example: {"key": "value"}
103
154
  * @description Represents the body of a user request, including form identifiers, authentication data, form data, notification data, and state information.
104
155
  */
105
156
  interface IUserBody {
@@ -109,10 +160,10 @@ interface IUserBody {
109
160
  marker: string;
110
161
  value: string;
111
162
  }>;
112
- formData?: IAuthFormData | Array<IAuthFormData>;
163
+ formData?: IAuthFormData | IAuthFormData[];
113
164
  notificationData?: {
114
165
  email: string;
115
- phonePush: Array<string>;
166
+ phonePush: string[];
116
167
  phoneSMS: string;
117
168
  };
118
169
  state?: Record<string, any>;
@@ -16,11 +16,7 @@ export default class WsApi extends AsyncModules implements IWS {
16
16
  * @handleName connect
17
17
  *
18
18
  * @throws {IError} If there is an error during the fetch operation, it will return an error object.
19
- *
20
- * @description
21
- * @example
22
- * const socket = WS.connect()
23
- * socket.on('my_event', callback)
19
+ * @description Creates an instance of an object Socket.io with a connection. This method requires user authorization.
24
20
  */
25
21
  connect(): Socket;
26
22
  }
@@ -20,11 +20,7 @@ class WsApi extends asyncModules_1.default {
20
20
  * @handleName connect
21
21
  *
22
22
  * @throws {IError} If there is an error during the fetch operation, it will return an error object.
23
- *
24
- * @description
25
- * @example
26
- * const socket = WS.connect()
27
- * socket.on('my_event', callback)
23
+ * @description Creates an instance of an object Socket.io with a connection. This method requires user authorization.
28
24
  */
29
25
  connect() {
30
26
  if (!this.state.accessToken) {
@@ -3,7 +3,6 @@ import type { Socket } from 'socket.io-client';
3
3
  * @interface IWS
4
4
  *
5
5
  * @property {function} connect - WebSocket Connection.
6
- *
7
6
  * @description This interface defines a method for establishing a WebSocket connection.
8
7
  */
9
8
  interface IWS {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "oneentry",
3
- "version": "1.0.124",
3
+ "version": "1.0.126",
4
4
  "description": "OneEntry NPM package",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -9,14 +9,14 @@
9
9
  ],
10
10
  "scripts": {
11
11
  "productionBuild": "run-s lint testAll build",
12
- "testAll": "run-s admins attributesets authProvider blocks file-uploading forms formsdata generaltypes integrationcollections locales menus orders pages payments payments productstatuses products templates templatespreview users",
12
+ "testAll": "run-s admins attributesets authProvider blocks fileuploading forms formsdata generaltypes integrationcollections locales menus orders pages payments productstatuses products templates templatespreview users",
13
13
  "admins": "npx jest src/admins/tests/admins.spec.ts",
14
14
  "attributesets": "npx jest src/attribute-sets/tests/attributesets.spec.ts",
15
15
  "authProvider": "npx jest src/auth-provider/tests/authProvider.spec.ts",
16
16
  "blocks": "npx jest src/blocks/tests/blocks.spec.ts",
17
- "file-uploading": "npx jest src/file-uploading/tests/fileuploading.spec.ts",
17
+ "fileuploading": "npx jest src/file-uploading/tests/fileuploading.spec.ts",
18
18
  "forms": "npx jest src/forms/tests/forms.spec.ts",
19
- "formsdata": "npx jest src/formsData/tests/formsdata.spec.ts",
19
+ "formsdata": "npx jest src/forms-data/tests/formsdata.spec.ts",
20
20
  "generaltypes": "npx jest src/general-types/tests/generaltypes.spec.ts",
21
21
  "integrationcollections": "npx jest src/integration-collections/tests/integrationcollections.spec.ts",
22
22
  "locales": "npx jest src/locales/tests/locales.spec.ts",
@@ -38,26 +38,28 @@
38
38
  "author": "ONEENTRY PORTAL CO.",
39
39
  "license": "ISC",
40
40
  "dependencies": {
41
- "io": "^1.5.3",
41
+ "io": "^1.5.7",
42
42
  "socket.io-client": "^4.8.1"
43
43
  },
44
44
  "devDependencies": {
45
- "@jest/globals": "^29.7.0",
45
+ "@jest/globals": "^30.0.5",
46
46
  "@types/eslint-config-prettier": "^6.11.3",
47
- "@types/jest": "^29.5.14",
48
- "@types/node": "^22.16.0",
49
- "@typescript-eslint/eslint-plugin": "^8.35.1",
50
- "@typescript-eslint/parser": "^8.35.1",
47
+ "@types/jest": "^30.0.0",
48
+ "@types/node": "^24.2.1",
49
+ "@typescript-eslint/eslint-plugin": "^8.39.1",
50
+ "@typescript-eslint/parser": "^8.39.1",
51
51
  "eslint": "^8.57.1",
52
- "eslint-config-prettier": "^10.1.5",
52
+ "eslint-config-prettier": "^10.1.8",
53
53
  "eslint-plugin-import": "^2.32.0",
54
54
  "eslint-plugin-jest": "^29.0.1",
55
- "eslint-plugin-prettier": "^5.5.1",
55
+ "eslint-plugin-jest-extended": "^3.0.0",
56
+ "eslint-plugin-prettier": "^5.5.4",
56
57
  "eslint-plugin-simple-import-sort": "^12.1.1",
57
- "jest": "^29.7.0",
58
+ "jest": "^30.0.5",
59
+ "jest-extended": "^6.0.0",
58
60
  "npm-run-all": "^4.1.5",
59
61
  "prettier": "^3.6.2",
60
- "ts-jest": "^29.4.0",
61
- "typescript": "^5.8.3"
62
+ "ts-jest": "^29.4.1",
63
+ "typescript": "^5.9.2"
62
64
  }
63
- }
65
+ }
@@ -1,267 +0,0 @@
1
- import type { IUploadingQuery } from 'file-uploading/fileUploadingInterfaces';
2
- import type { IError } from '../base/utils';
3
- /**
4
- * Interface for retrieving and posting form data in the system.
5
- *
6
- * @interface IFormsData
7
- *
8
- * @property {function} getFormsData - Get all forms data.
9
- * @property {function} postFormsData - Find all product page objects with pagination and multiple filtering.
10
- * @property {function} getFormsDataByMarker - Get one object of form data by marker.
11
- *
12
- * @description This interface defines methods for retrieving and posting form data in the system.
13
- */
14
- interface IFormsData {
15
- /**
16
- * Retrieves all forms data.
17
- *
18
- * @param {string} langCode - The language code for localization. Default: "en_US".
19
- * @param {number} [offset] - Optional offset for pagination. Default: 0.
20
- * @param {number} [limit] - Optional limit for pagination. Default: 30.
21
- *
22
- * @return {IFormsDataEntity} A promise that resolves to a collection of form data entities or an error.
23
- * @throws {IError} - If there is an error during the fetch operation, it will return an error object.
24
- */
25
- getFormsData(langCode: string, offset?: number, limit?: number): Promise<IFormsDataEntity | IError>;
26
- /**
27
- * Posts form data to the system.
28
- *
29
- * @param {IFormsPost} data - The form data to be posted.
30
- * @param {string} [langCode] - Optional language code for localization. Default: "en_US".
31
- *
32
- * @return {IFormDataEntity} A promise that resolves to a form data entity or an error.
33
- * @throws {IError} - If there is an error during the fetch operation, it will return an error object.
34
- */
35
- postFormsData(data: IFormsPost, langCode?: string): Promise<IFormDataEntity | IError>;
36
- /**
37
- * Retrieves form data by its marker.
38
- *
39
- * @param {string} marker - The marker identifying the form data. Example: "contact_form_data".
40
- * @param {string} langCode - The language code for localization. Default: "en_US".
41
- * @param {number} [offset] - Optional offset for pagination. Default: 0.
42
- * @param {number} [limit] - Optional limit for pagination. Default: 30.
43
- *
44
- * @returns {IFormsDataEntity} A promise that resolves to a form data entity or an error.
45
- * @throws {IError} - If there is an error during the fetch operation, it will return an error object.
46
- */
47
- getFormsDataByMarker(marker: string, langCode: string, offset?: number, limit?: number): Promise<IFormsDataEntity | IError>;
48
- }
49
- /**
50
- * Represents the structure of a form data entity.
51
- *
52
- * @interface IFormDataEntity
53
- *
54
- * @property {number} id - The unique identifier of the form page. Example: 12345.
55
- * @property {string} formIdentifier - The identifier of the page. Example: "contact_form".
56
- * @property {Date | string} time - The identifier of the form. Example: "2023-10-01T12:00:00Z".
57
- * @property {IFormsPost} formData - The identifier of the position. Example: .
58
- * @property {string} [attributeSetIdentifier] - Text identifier (marker) of the used attribute set. Example: "product_attributes".
59
- * @property {string} [actionMessage] - Action message for the form data. Example: "Form submitted successfully".
60
- *
61
- * @description This interface defines the structure of a form data entity, including its identifiers, form data, and optional attributes.
62
- */
63
- interface IFormDataEntity {
64
- id: number;
65
- formIdentifier: string;
66
- time: Date | string;
67
- formData: IFormsPost;
68
- attributeSetIdentifier?: string;
69
- actionMessage?: string;
70
- }
71
- /**
72
- * Represents a collection of form data entities.
73
- *
74
- * @interface IFormsDataEntity
75
- *
76
- * @property {number} total - Total number of found records. Example: 100.
77
- * @property {Array<IFormDataEntity>} items - Array of form data objects. Example: .
78
- *
79
- * @description This interface defines the structure of a collection of form data entities, including a total count and an array of items.
80
- */
81
- interface IFormsDataEntity {
82
- total: number;
83
- items: Array<IFormDataEntity>;
84
- }
85
- /**
86
- * Contains an array of data form objects with the following values
87
- */
88
- type FormDataType = IBodyTypeStringNumberFloat | IBodyTypeTimeDate | IBodyTypeText | IBodyTypeTextWithHeader | IBodyTypeImageGroupOfImages | IBodyTypeFile | IBodyTypeRadioButtonList | Record<string, any>;
89
- /**
90
- * Represents the structure of a form post object.
91
- *
92
- * @interface IFormsPost
93
- *
94
- * @property {number} [id] - Optional identifier of the form post.
95
- * @property {string} formIdentifier - The identifier of the page.
96
- * @property {Date | string} [time] - Date and time of form modification.
97
- * @property {Array<FormDataType>} formData - The identifier of the page.
98
- * @property {IUploadingQuery} [fileQuery] - Optional file query for uploading files.
99
- *
100
- * @description This interface defines the structure of a form post object, including its identifiers, time, form data, and optional file query.
101
- */
102
- interface IFormsPost {
103
- id?: number;
104
- formIdentifier: string;
105
- time?: Date | string;
106
- formData: Array<FormDataType>;
107
- fileQuery?: IUploadingQuery;
108
- }
109
- /**
110
- * Represents a form data entity with a simple value.
111
- *
112
- * @interface IBodyTypeStringNumberFloat
113
- *
114
- * @property {string} marker - marker name.
115
- * @property {'string' | 'number' | 'float'} type - Type value.
116
- * @property {string} value - Value of the form data entity, which can be a string, number, or float.
117
- *
118
- * @description Represents a form data entity with a marker, type, and value.
119
- */
120
- interface IBodyTypeStringNumberFloat {
121
- marker: string;
122
- type: 'string' | 'number' | 'float';
123
- value: string;
124
- }
125
- /**
126
- * Represents a date/time form data entity.
127
- *
128
- * @interface IBodyTypeTimeDate
129
- *
130
- * @property {string} marker - marker name.
131
- * @property {'date' | 'dateTime' | 'time'} type - Type value.
132
- * @property {object} value - Date object. Contains fullDate, formattedValue, formatString.
133
- *
134
- * @description Represents a date, dateTime, or time value in a structured format.
135
- */
136
- interface IBodyTypeTimeDate {
137
- marker: string;
138
- type: 'date' | 'dateTime' | 'time';
139
- value: {
140
- fullDate: string;
141
- formattedValue: string;
142
- formatString: string;
143
- };
144
- }
145
- /**
146
- * Represents a text form data entity.
147
- *
148
- * @interface IBodyTypeText
149
- *
150
- * @property {string} marker - marker name.
151
- * @property {'text'} type - Type value.
152
- * @property {object} value - Text Object. Contains html as string, plain text and params.
153
- *
154
- * @description Represents a text value with HTML and plain text representations, along with parameters for editor and image compression settings.
155
- */
156
- interface IBodyTypeText {
157
- marker: string;
158
- type: 'text';
159
- value: {
160
- htmlValue: string;
161
- plainValue: string;
162
- params: {
163
- isEditorDisabled: boolean;
164
- isImageCompressed: boolean;
165
- };
166
- };
167
- }
168
- /**
169
- * Represents a text with header form data entity.
170
- *
171
- * @interface IBodyTypeTextWithHeader
172
- *
173
- * @property {string} marker - marker name.
174
- * @property {'textWithHeader'} type - Type value.
175
- * @property {object} value - Text Object. Contains html as string, header and params.
176
- *
177
- * @description Represents a text value with a header, HTML and plain text representations, along with parameters for editor and image compression settings.
178
- */
179
- interface IBodyTypeTextWithHeader {
180
- marker: string;
181
- type: 'textWithHeader';
182
- value: {
183
- header: string;
184
- htmlValue: string;
185
- plainValue: string;
186
- params: {
187
- isEditorDisabled: boolean;
188
- isImageCompressed: boolean;
189
- };
190
- };
191
- }
192
- /**
193
- * Represents an image or group of images form data entity.
194
- *
195
- * @interface IBodyTypeImageGroupOfImages
196
- *
197
- * @property {string} marker - marker name.
198
- * @property {'image' | 'groupOfImage'} type - Type value.
199
- * @property {object} value - Image Object. Contains image information.
200
- *
201
- * @description Represents an image or a group of images with their details, including filename, download link, size, preview link, and parameters for image compression.
202
- */
203
- interface IBodyTypeImageGroupOfImages {
204
- marker: string;
205
- type: 'image' | 'groupOfImage';
206
- value: {
207
- filename: string;
208
- downloadLink: string;
209
- size: number;
210
- previewLink: string;
211
- params: {
212
- isImageCompressed: boolean;
213
- };
214
- } | Array<{
215
- filename: string;
216
- downloadLink: string;
217
- size: number;
218
- previewLink: string;
219
- params: {
220
- isImageCompressed: boolean;
221
- };
222
- }>;
223
- }
224
- /**
225
- * Represents a file form data entity.
226
- *
227
- * @interface IBodyTypeFile
228
- *
229
- * @property {string} marker - marker name.
230
- * @property {'file'} type - Type value.
231
- * @property {object} value - File Object. Contains file information.
232
- *
233
- * @description Represents a file with its details, including filename, download link, and size.
234
- */
235
- interface IBodyTypeFile {
236
- marker: string;
237
- type: 'file';
238
- value: {
239
- filename: string;
240
- downloadLink: string;
241
- size: number;
242
- };
243
- }
244
- /**
245
- * Represents a radio button or list selection form data entity.
246
- *
247
- * @interface IBodyTypeRadioButtonList
248
- *
249
- * @property {string} marker - marker name.
250
- * @property {'file'} type - Type value.
251
- * @property {array} value - Array of list or radioButton bojects.
252
- *
253
- * @description Represents a list or radio button selection with multiple options, each containing a title, value, and extended information.
254
- */
255
- interface IBodyTypeRadioButtonList {
256
- marker: string;
257
- type: 'list' | 'radioButton';
258
- value: Array<{
259
- title: string;
260
- value: string;
261
- extended: {
262
- value: string;
263
- type: string;
264
- };
265
- }>;
266
- }
267
- export type { FormDataType, IBodyTypeFile, IBodyTypeImageGroupOfImages, IBodyTypeRadioButtonList, IBodyTypeStringNumberFloat, IBodyTypeText, IBodyTypeTextWithHeader, IBodyTypeTimeDate, IFormDataEntity, IFormsData, IFormsDataEntity, IFormsPost, };