oneentry 1.0.140 → 1.0.141

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 (149) hide show
  1. package/dist/admins/adminsApi.d.ts +50 -0
  2. package/dist/admins/adminsApi.js +65 -0
  3. package/dist/admins/adminsInterfaces.d.ts +99 -0
  4. package/dist/admins/adminsInterfaces.js +2 -0
  5. package/dist/admins/adminsSchemas.d.ts +30 -0
  6. package/dist/admins/adminsSchemas.js +27 -0
  7. package/dist/attribute-sets/attributeSetsApi.d.ts +63 -0
  8. package/dist/attribute-sets/attributeSetsApi.js +98 -0
  9. package/dist/attribute-sets/attributeSetsInterfaces.d.ts +187 -0
  10. package/dist/attribute-sets/attributeSetsInterfaces.js +2 -0
  11. package/dist/attribute-sets/attributeSetsSchemas.d.ts +90 -0
  12. package/dist/attribute-sets/attributeSetsSchemas.js +74 -0
  13. package/dist/auth-provider/authProviderApi.d.ts +249 -0
  14. package/dist/auth-provider/authProviderApi.js +351 -0
  15. package/dist/auth-provider/authProviderSchemas.d.ts +131 -0
  16. package/dist/auth-provider/authProviderSchemas.js +82 -0
  17. package/dist/auth-provider/authProvidersInterfaces.d.ts +425 -0
  18. package/dist/auth-provider/authProvidersInterfaces.js +2 -0
  19. package/dist/base/asyncModules.d.ts +80 -0
  20. package/dist/base/asyncModules.js +440 -0
  21. package/dist/base/result.d.ts +39 -0
  22. package/dist/base/result.js +154 -0
  23. package/dist/base/stateModule.d.ts +41 -0
  24. package/dist/base/stateModule.js +128 -0
  25. package/dist/base/syncModules.d.ts +149 -0
  26. package/dist/base/syncModules.js +549 -0
  27. package/dist/base/utils.d.ts +197 -0
  28. package/dist/base/utils.js +2 -0
  29. package/dist/base/validation.d.ts +118 -0
  30. package/dist/base/validation.js +132 -0
  31. package/dist/blocks/blocksApi.d.ts +76 -0
  32. package/dist/blocks/blocksApi.js +188 -0
  33. package/dist/blocks/blocksInterfaces.d.ts +173 -0
  34. package/dist/blocks/blocksInterfaces.js +2 -0
  35. package/dist/blocks/blocksSchemas.d.ts +187 -0
  36. package/dist/blocks/blocksSchemas.js +43 -0
  37. package/dist/discounts/discountsApi.d.ts +56 -0
  38. package/dist/discounts/discountsApi.js +82 -0
  39. package/dist/discounts/discountsInterfaces.d.ts +145 -0
  40. package/dist/discounts/discountsInterfaces.js +2 -0
  41. package/dist/events/eventsApi.d.ts +60 -0
  42. package/dist/events/eventsApi.js +97 -0
  43. package/dist/events/eventsInterfaces.d.ts +87 -0
  44. package/dist/events/eventsInterfaces.js +2 -0
  45. package/dist/file-uploading/fileUploadingApi.d.ts +88 -0
  46. package/dist/file-uploading/fileUploadingApi.js +132 -0
  47. package/dist/file-uploading/fileUploadingInterfaces.d.ts +117 -0
  48. package/dist/file-uploading/fileUploadingInterfaces.js +2 -0
  49. package/dist/file-uploading/fileUploadingSchemas.d.ts +22 -0
  50. package/dist/file-uploading/fileUploadingSchemas.js +21 -0
  51. package/dist/forms/formsApi.d.ts +42 -0
  52. package/dist/forms/formsApi.js +57 -0
  53. package/dist/forms/formsInterfaces.d.ts +132 -0
  54. package/dist/forms/formsInterfaces.js +2 -0
  55. package/dist/forms/formsSchemas.d.ts +50 -0
  56. package/dist/forms/formsSchemas.js +31 -0
  57. package/dist/forms-data/formsDataApi.d.ts +106 -0
  58. package/dist/forms-data/formsDataApi.js +189 -0
  59. package/dist/forms-data/formsDataInterfaces.d.ts +525 -0
  60. package/dist/forms-data/formsDataInterfaces.js +2 -0
  61. package/dist/forms-data/formsDataSchemas.d.ts +115 -0
  62. package/dist/forms-data/formsDataSchemas.js +86 -0
  63. package/dist/general-types/generalTypesApi.d.ts +28 -0
  64. package/dist/general-types/generalTypesApi.js +38 -0
  65. package/dist/general-types/generalTypesInterfaces.d.ts +30 -0
  66. package/dist/general-types/generalTypesInterfaces.js +2 -0
  67. package/dist/general-types/generalTypesSchemas.d.ts +50 -0
  68. package/dist/general-types/generalTypesSchemas.js +35 -0
  69. package/dist/index.d.ts +100 -0
  70. package/dist/index.js +103 -0
  71. package/dist/integration-collections/integrationCollectionsApi.d.ts +173 -0
  72. package/dist/integration-collections/integrationCollectionsApi.js +220 -0
  73. package/dist/integration-collections/integrationCollectionsInterfaces.d.ts +313 -0
  74. package/dist/integration-collections/integrationCollectionsInterfaces.js +2 -0
  75. package/dist/integration-collections/integrationCollectionsSchemas.d.ts +80 -0
  76. package/dist/integration-collections/integrationCollectionsSchemas.js +61 -0
  77. package/dist/locales/localesApi.d.ts +27 -0
  78. package/dist/locales/localesApi.js +37 -0
  79. package/dist/locales/localesInterfaces.d.ts +41 -0
  80. package/dist/locales/localesInterfaces.js +2 -0
  81. package/dist/locales/localesSchemas.d.ts +32 -0
  82. package/dist/locales/localesSchemas.js +26 -0
  83. package/dist/menus/menusApi.d.ts +29 -0
  84. package/dist/menus/menusApi.js +39 -0
  85. package/dist/menus/menusInterfaces.d.ts +88 -0
  86. package/dist/menus/menusInterfaces.js +4 -0
  87. package/dist/menus/menusSchemas.d.ts +16 -0
  88. package/dist/menus/menusSchemas.js +28 -0
  89. package/dist/orders/ordersApi.d.ts +149 -0
  90. package/dist/orders/ordersApi.js +203 -0
  91. package/dist/orders/ordersInterfaces.d.ts +527 -0
  92. package/dist/orders/ordersInterfaces.js +2 -0
  93. package/dist/orders/ordersSchemas.d.ts +120 -0
  94. package/dist/orders/ordersSchemas.js +101 -0
  95. package/dist/pages/pagesApi.d.ts +151 -0
  96. package/dist/pages/pagesApi.js +390 -0
  97. package/dist/pages/pagesInterfaces.d.ts +292 -0
  98. package/dist/pages/pagesInterfaces.js +2 -0
  99. package/dist/pages/pagesSchemas.d.ts +85 -0
  100. package/dist/pages/pagesSchemas.js +46 -0
  101. package/dist/payments/paymentsApi.d.ts +82 -0
  102. package/dist/payments/paymentsApi.js +121 -0
  103. package/dist/payments/paymentsInterfaces.d.ts +206 -0
  104. package/dist/payments/paymentsInterfaces.js +2 -0
  105. package/dist/payments/paymentsSchemas.d.ts +100 -0
  106. package/dist/payments/paymentsSchemas.js +65 -0
  107. package/dist/product-statuses/productStatusesApi.d.ts +47 -0
  108. package/dist/product-statuses/productStatusesApi.js +70 -0
  109. package/dist/product-statuses/productStatusesInterfaces.d.ts +66 -0
  110. package/dist/product-statuses/productStatusesInterfaces.js +2 -0
  111. package/dist/product-statuses/productStatusesSchemas.d.ts +34 -0
  112. package/dist/product-statuses/productStatusesSchemas.js +30 -0
  113. package/dist/products/productsApi.d.ts +365 -0
  114. package/dist/products/productsApi.js +459 -0
  115. package/dist/products/productsInterfaces.d.ts +586 -0
  116. package/dist/products/productsInterfaces.js +2 -0
  117. package/dist/products/productsSchemas.d.ts +192 -0
  118. package/dist/products/productsSchemas.js +96 -0
  119. package/dist/sitemap/sitemapApi.d.ts +35 -0
  120. package/dist/sitemap/sitemapApi.js +45 -0
  121. package/dist/sitemap/sitemapInterfaces.d.ts +40 -0
  122. package/dist/sitemap/sitemapInterfaces.js +2 -0
  123. package/dist/system/systemApi.d.ts +43 -0
  124. package/dist/system/systemApi.js +58 -0
  125. package/dist/system/systemInterfaces.d.ts +31 -0
  126. package/dist/system/systemInterfaces.js +5 -0
  127. package/dist/templates/templatesApi.d.ts +49 -0
  128. package/dist/templates/templatesApi.js +75 -0
  129. package/dist/templates/templatesInterfaces.d.ts +70 -0
  130. package/dist/templates/templatesInterfaces.js +2 -0
  131. package/dist/templates/templatesSchemas.d.ts +48 -0
  132. package/dist/templates/templatesSchemas.js +31 -0
  133. package/dist/templates-preview/templatesPreviewApi.d.ts +38 -0
  134. package/dist/templates-preview/templatesPreviewApi.js +53 -0
  135. package/dist/templates-preview/templatesPreviewInterfaces.d.ts +121 -0
  136. package/dist/templates-preview/templatesPreviewInterfaces.js +2 -0
  137. package/dist/templates-preview/templatesPreviewSchemas.d.ts +83 -0
  138. package/dist/templates-preview/templatesPreviewSchemas.js +48 -0
  139. package/dist/users/usersApi.d.ts +143 -0
  140. package/dist/users/usersApi.js +173 -0
  141. package/dist/users/usersInterfaces.d.ts +235 -0
  142. package/dist/users/usersInterfaces.js +2 -0
  143. package/dist/users/usersSchemas.d.ts +38 -0
  144. package/dist/users/usersSchemas.js +28 -0
  145. package/dist/web-socket/wsApi.d.ts +25 -0
  146. package/dist/web-socket/wsApi.js +45 -0
  147. package/dist/web-socket/wsInterfaces.d.ts +17 -0
  148. package/dist/web-socket/wsInterfaces.js +2 -0
  149. package/package.json +3 -81
@@ -0,0 +1,425 @@
1
+ import type { IError, ILocalizeInfo } from '../base/utils';
2
+ /**
3
+ * @interface IAuthProvider
4
+ * @property {Function} signUp - User registration.
5
+ * @property {Function} generateCode - Getting a user activation code.
6
+ * @property {Function} checkCode - User activation code verification.
7
+ * @property {Function} activateUser - User activate.
8
+ * @property {Function} auth - User authorization.
9
+ * @property {Function} refresh - Refresh token.
10
+ * @property {Function} logout - User logout.
11
+ * @property {Function} logoutAll - User logout.
12
+ * @property {Function} changePassword - Change password.
13
+ * @property {Function} getAuthProviders - Get all auth providers objects.
14
+ * @property {Function} getAuthProviderByMarker - Get one auth provider object by marker.
15
+ * @property {Function} getActiveSessionsByMarker - Get one auth provider object by marker.
16
+ * @property {Function} oauth - User registration (authorization) via OAUTH.
17
+ * @description This interface defines methods for user authentication and registration through various auth providers.
18
+ */
19
+ interface IAuthProvider {
20
+ /**
21
+ * Registers a new user.
22
+ * @handleName signUp
23
+ * @param {string} marker - The marker identifying the auth provider. Example: "email".
24
+ * @param {ISignUpData} data - The data required for user registration.
25
+ * @example
26
+ {
27
+ "formIdentifier": "reg",
28
+ "authData": [
29
+ {
30
+ "marker": "login",
31
+ "value": "example@oneentry.cloud"
32
+ },
33
+ {
34
+ "marker": "password",
35
+ "value": "12345"
36
+ }
37
+ ],
38
+ "formData": [
39
+ {
40
+ "marker": "last_name",
41
+ "type": "string",
42
+ "value": "Name"
43
+ }
44
+ ],
45
+ "notificationData": {
46
+ "email": "example@oneentry.cloud",
47
+ "phonePush": ["+99999999999"],
48
+ "phoneSMS": "+99999999999"
49
+ }
50
+ }
51
+ * @param {string} [langCode] - Optional language code for localization. Default: "en_US".
52
+ * @returns {ISignUpEntity} A promise that resolves to a sign-up entity or an error.
53
+ * @throws {IError} - If there is an error during the fetch operation, it will return an error object.
54
+ * @description This method registers a new user.
55
+ */
56
+ signUp(marker: string, data: ISignUpData, langCode?: string): Promise<ISignUpEntity | IError>;
57
+ /**
58
+ * Generates an activation code for a user.
59
+ * @handleName generateCode
60
+ * @param {string} marker - The marker identifying the auth provider. Example: "email".
61
+ * @param {string} userIdentifier - The user's identifier. Example: "example@oneentry.cloud".
62
+ * @param {string} eventIdentifier - The event identifier related to the code generation. Example: "user_registration".
63
+ * @returns {void} A promise that resolves to void or an error.
64
+ * @throws {IError} - If there is an error during the fetch operation, it will return an error object.
65
+ * @description This method generates an activation code for a user.
66
+ */
67
+ generateCode(marker: string, userIdentifier: string, eventIdentifier: string): Promise<void | IError>;
68
+ /**
69
+ * Verifies a user activation code.
70
+ * @handleName checkCode
71
+ * @param {string} marker - The marker identifying the auth provider. Example: "email".
72
+ * @param {string} userIdentifier - The user's identifier. Example: "example@oneentry.cloud".
73
+ * @param {string} eventIdentifier - The event identifier related to the code verification. Example: "user_registration".
74
+ * @param {string} code - The activation code to verify. Example: "123456".
75
+ * @returns {boolean} A promise that resolves to a boolean indicating success or failure, or an error.
76
+ * @throws {IError} - If there is an error during the fetch operation, it will return an error object.
77
+ * @description This method verifies a user activation code.
78
+ */
79
+ checkCode(marker: string, userIdentifier: string, eventIdentifier: string, code: string): Promise<boolean | IError>;
80
+ /**
81
+ * Activates a user account.
82
+ * @handleName activateUser
83
+ * @param {string} marker - The marker identifying the auth provider. Example: "email".
84
+ * @param {string} userIdentifier - The user's identifier. Example: "example@oneentry.cloud".
85
+ * @param {string} code - The activation code. Example: "123456".
86
+ * @returns {boolean} A promise that resolves to a boolean indicating success or failure, or an error.
87
+ * @throws {IError} - If there is an error during the fetch operation, it will return an error object.
88
+ * @description This method activates a user account.
89
+ */
90
+ activateUser(marker: string, userIdentifier: string, code: string): Promise<boolean | IError>;
91
+ /**
92
+ * Authorizes a user.
93
+ * @handleName auth
94
+ * @param {string} marker - The marker identifying the auth provider. Example: "email".
95
+ * @param {IAuthPostBody} data - The data required for user authorization. Example: .
96
+ * @returns {IAuthEntity} A promise that resolves to an auth entity or an error.
97
+ * @throws {IError} - If there is an error during the fetch operation, it will return an error object.
98
+ * @description This method authorizes a user.
99
+ */
100
+ auth(marker: string, data: IAuthPostBody): Promise<IAuthEntity | IError>;
101
+ /**
102
+ * Refreshes a user's access token.
103
+ * @handleName refresh
104
+ * @param {string} marker - The marker identifying the auth provider. Example: "email".
105
+ * @param {string} token - The refresh token. Example: "abcdef123456".
106
+ * @returns {IAuthEntity} A promise that resolves to an auth entity or an error.
107
+ * @throws {IError} - If there is an error during the fetch operation, it will return an error object.
108
+ * @description This method refreshes a user's access token.
109
+ */
110
+ refresh(marker: string, token: string): Promise<IAuthEntity | IError>;
111
+ /**
112
+ * Logs out a user.
113
+ * @handleName logout
114
+ * @param {string} marker - The marker identifying the auth provider. Example: "email".
115
+ * @param {string} token - The access token. Example: "abcdef123456".
116
+ * @returns {boolean} A promise that resolves to a boolean indicating success or failure, or an error.
117
+ * @throws {IError} - If there is an error during the fetch operation, it will return an error object.
118
+ * @description This method logs out a user.
119
+ */
120
+ logout(marker: string, token: string): Promise<boolean | IError>;
121
+ /**
122
+ * Logout of user account on all devices.
123
+ * @handleName logoutAll
124
+ * @param {string} marker - The marker identifying the auth provider. Example: "email".
125
+ * @returns {boolean} A promise that resolves to a boolean indicating success or failure, or an error.
126
+ * @throws {IError} - If there is an error during the fetch operation, it will return an error object.
127
+ * @description This method logs out a user account on all devices.
128
+ */
129
+ logoutAll(marker: string): Promise<boolean | IError>;
130
+ /**
131
+ * Changes a user's password.
132
+ * @handleName changePassword
133
+ * @param {string} marker - The marker identifying the auth provider. Example: "email".
134
+ * @param {string} userIdentifier - The user's identifier. Example: "example@oneentry.cloud".
135
+ * @param {string} eventIdentifier - The event identifier. Example: "reg".
136
+ * @param {number} type - The type of password change. 1 for changing password, 2 for recovery. Example: 1.
137
+ * @param {string} code - The code for password change verification. Example: "123456".
138
+ * @param {string} newPassword - The new password. Example: "newPassword123".
139
+ * @param {string} [repeatPassword] - Optional repeat of the new password for confirmation. Example: "newPassword123".
140
+ * @returns {boolean} A promise that resolves to a boolean indicating success or failure, or an error.
141
+ * @throws {IError} - If there is an error during the fetch operation, it will return an error object.
142
+ * @description This method changes a user's password.
143
+ */
144
+ changePassword(marker: string, userIdentifier: string, eventIdentifier: string, type: number, code: string, newPassword: string, repeatPassword?: string): Promise<boolean | IError>;
145
+ /**
146
+ * Retrieves all authentication providers.
147
+ * @handleName getAuthProviders
148
+ * @param {string} [langCode] - Optional language code for localization. Default: "en_US".
149
+ * @param {number} [offset] - Optional offset for pagination. Default: 0.
150
+ * @param {number} [limit] - Optional limit for pagination. Default: 30.
151
+ * @returns {IAuthProvidersEntity[]} A promise that resolves to an array of auth provider entities or an error.
152
+ * @throws {IError} - If there is an error during the fetch operation, it will return an error object.
153
+ * @description This method retrieves all authentication providers.
154
+ */
155
+ getAuthProviders(langCode?: string, offset?: number, limit?: number): Promise<IAuthProvidersEntity[] | IError>;
156
+ /**
157
+ * Retrieves a specific auth provider by its marker.
158
+ * @handleName getAuthProviderByMarker
159
+ * @param {string} marker - The marker identifying the auth provider. Example: "email".
160
+ * @param {string} [langCode] - Optional language code for localization. Default: "en_US".
161
+ * @returns {IAuthProvidersEntity} A promise that resolves to an auth provider entity or an error.
162
+ * @throws {IError} - If there is an error during the fetch operation, it will return an error object.
163
+ * @description This method retrieves a specific auth provider by its marker.
164
+ */
165
+ getAuthProviderByMarker(marker: string, langCode?: string): Promise<IAuthProvidersEntity | IError>;
166
+ /**
167
+ * Retrieves active user sessions data object.
168
+ * @handleName getActiveSessionsByMarker
169
+ * @param {string} marker - The marker identifying the auth provider. Example: "email".
170
+ * @returns {any} A promise that resolves to active user sessions data object.
171
+ * @throws {IError} - If there is an error during the fetch operation, it will return an error object.
172
+ * @description This method retrieves active user sessions data object.
173
+ */
174
+ getActiveSessionsByMarker(marker: string): Promise<any | IError>;
175
+ /**
176
+ * User registration (authorization) via OAUTH.
177
+ * @handleName oauthSignUp
178
+ * @param {string} marker - The text identifier of the authorization provider. Example: "email".
179
+ * @param {IOauthData} body - Object contains OAuth information for registration.
180
+ * @example
181
+ {
182
+ "client_id": "34346983-luuct343473qdkqidjopdfp3eb3k4thp.apps.googleusercontent.com",
183
+ "client_secret": "43434343434",
184
+ "code": "4/0AVMBsJgwewewewewewei4D7T6E_fbswxnL3g",
185
+ "grant_type": "authorization_code",
186
+ "redirect_uri": "http://localhost:3000"
187
+ }
188
+ * @param {string} [langCode] - Language code. Default: "en_US".
189
+ * @returns {ISignUpEntity} Returns a user object.
190
+ * @throws {IError} - If there is an error during the fetch operation, it will return an error object.
191
+ * @description User registration (authorization) via OAUTH.
192
+ */
193
+ oauth(marker: string, body: IOauthData, langCode?: string): Promise<IAuthEntity | IError>;
194
+ }
195
+ /**
196
+ * Interface representing the structure of authentication form data.
197
+ * @interface IAuthFormData
198
+ * @property {string} marker - A unique identifier for the form field. Example: "email".
199
+ * @property {string} type - The type of the form field, such as 'string', 'email', etc. Example: "string".
200
+ * @property {string} value - The value entered in the form field. Example: "example@oneentry.cloud".
201
+ * @description This interface defines the structure of authentication form data used in user registration and authentication processes.
202
+ */
203
+ interface IAuthFormData {
204
+ marker: string;
205
+ type: string;
206
+ value: string;
207
+ }
208
+ /**
209
+ * Interface representing the data required for user registration.
210
+ * @interface ISignUpData
211
+ * @property {string} formIdentifier - The identifier for the registration form. Example: "reg".
212
+ * @property {string} [langCode] - Language code. Default: "en_US".
213
+ * @property {Array} authData - An array of authentication data objects, each containing a marker and its corresponding value.
214
+ * @property {IAuthFormData | IAuthFormData[]} formData - The form data for the registration.
215
+ * @property {object} notificationData - An object containing notification data, including email, phonePush, and phoneSMS.
216
+ * @description User registration (❗️For a provider with user activation, the activation code is sent through the corresponding user notification method).
217
+ */
218
+ interface ISignUpData {
219
+ formIdentifier: string;
220
+ langCode?: string;
221
+ authData: Array<{
222
+ marker: string;
223
+ value: string;
224
+ }>;
225
+ formData: IAuthFormData | IAuthFormData[];
226
+ notificationData: {
227
+ email: string;
228
+ phonePush: Array<string>;
229
+ phoneSMS: string;
230
+ };
231
+ }
232
+ /**
233
+ * Interface representing the data required for user registration via OAUTH.
234
+ * @interface IOauthData
235
+ * @property {string} client_id - The client ID for the OAuth application. Example: "34346983-luuct343473qdkqidjopdfp3eb3k4thp.apps.googleusercontent.com".
236
+ * @property {string} client_secret - The client secret for the OAuth application. Example: "43434343434".
237
+ * @property {string} code - The authorization code received from the OAuth provider. Example: "4/0AVMBsJgwewewewewewei4D7T6E_fbswxnL3g".
238
+ * @property {string} grant_type - The grant type for the OAuth request. Example: "authorization_code".
239
+ * @property {string} redirect_uri - The redirect URI for the OAuth application. Example: "http://localhost:3000".
240
+ * @description User registration (❗️For a provider with user activation, the activation code is sent through the corresponding user notification method).
241
+ */
242
+ interface IOauthData {
243
+ client_id: string;
244
+ client_secret: string;
245
+ code: string;
246
+ grant_type: string;
247
+ redirect_uri: string;
248
+ }
249
+ /**
250
+ * Interface representing a sign-up entity.
251
+ * @interface ISignUpEntity
252
+ * @property {number} id - The unique identifier of the sign-up entity. Example: 12345.
253
+ * @property {string} updatedDate - The date when the sign-up entity was last updated. Example: "2023-10-01T12:00:00Z".
254
+ * @property {number} version - The version number of the sign-up entity. Example: 1.
255
+ * @property {string} identifier - A unique string that identifies the sign-up entity. Example: "signup_12345".
256
+ * @property {boolean} isActive - Indicates whether the sign-up entity is active. Example: true.
257
+ * @property {Array<object>} formData - An array of objects representing the form data, each containing a marker and its corresponding value.
258
+ * @example
259
+ [
260
+ {
261
+ "marker": "first_name",
262
+ "value": "John"
263
+ },
264
+ {
265
+ "marker": "last_name",
266
+ "value": "Doe"
267
+ }
268
+ ]
269
+ * @property {object} notificationData - An object containing notification data, including email, phonePush, and phoneSMS.
270
+ * @example
271
+ {
272
+ "email": "example@oneentry.cloud",
273
+ "phonePush": ["+99999999999"],
274
+ "phoneSMS": "+99999999999"
275
+ }
276
+ * @property {string} [locale] - The locale or language code associated with the sign-up entity. Example: "en_US".
277
+ * @description This interface defines the structure of a sign-up entity.
278
+ */
279
+ interface ISignUpEntity {
280
+ id: number;
281
+ updatedDate: string;
282
+ version: number;
283
+ identifier: string;
284
+ isActive: boolean;
285
+ formData: Array<{
286
+ marker: string;
287
+ value: string;
288
+ }>;
289
+ notificationData: {
290
+ email: string;
291
+ phonePush: Array<string>;
292
+ phoneSMS: string;
293
+ };
294
+ locale?: string;
295
+ }
296
+ /**
297
+ * Interface representing a code entity used for user registration or verification processes.
298
+ * @interface ICodeEntity
299
+ * @property {string} code - The activation code for user registration or verification. Example: "123456".
300
+ * @property {string} expiredDate - The date when the activation code expires. Example: "2023-10-01T12:00:00Z".
301
+ * @description This interface defines the structure of a code entity used for user registration or verification processes.
302
+ */
303
+ interface ICodeEntity {
304
+ code: string;
305
+ expiredDate: string;
306
+ }
307
+ /**
308
+ * Interface representing an authentication entity.
309
+ * @interface IAuthEntity
310
+ * @property {string} userIdentifier - The unique identifier for the user. Example: "user12345".
311
+ * @property {string} authProviderIdentifier - The identifier for the authentication provider. Example: "email".
312
+ * @property {string} accessToken - The access token for the user session. Example: "abcdef123456".
313
+ * @property {string} refreshToken - The refresh token for renewing the access token. Example: "ghijkl789012".
314
+ * @description This interface defines the structure of an authentication entity.
315
+ */
316
+ interface IAuthEntity {
317
+ userIdentifier: string;
318
+ authProviderIdentifier: string;
319
+ accessToken: string;
320
+ refreshToken: string;
321
+ }
322
+ /**
323
+ * Interface representing an authentication provider entity.
324
+ * @interface IAuthProvidersEntity
325
+ * @property {number} id - The unique identifier of the auth provider entity. Example: 194.
326
+ * @property {ILocalizeInfo} localizeInfos - Localized information for the auth provider.
327
+ * @example
328
+ {
329
+ "key": "value"
330
+ }
331
+ * @property {IAuthProvidersEntityConfig} config - Configuration settings for the auth provider, stored as a key-value pair object.
332
+ * @example
333
+ {
334
+ "key": "value"
335
+ }
336
+ * @property {number} version - The version number of the auth provider entity. Example: 1.
337
+ * @property {string} identifier - A unique string that identifies the auth provider. Example: "email".
338
+ * @property {string} type - The type of the auth provider (e.g., 'email', 'google', etc.). Example: "email".
339
+ * @property {string | null} formIdentifier - The identifier for the form associated with the auth provider, or null if not applicable. Example: "reg_form".
340
+ * @property {string} userGroupIdentifier - The identifier for the userGroup associated with the auth provider. Example: "guest".
341
+ * @property {boolean} isActive - Indicates whether the auth provider is active. Example: true.
342
+ * @property {boolean} isCheckCode - Indicates whether the auth provider requires code verification. Example: false.
343
+ * @description This interface defines the structure of an authentication provider entity.
344
+ */
345
+ interface IAuthProvidersEntity {
346
+ id: number;
347
+ localizeInfos: ILocalizeInfo;
348
+ config: IAuthProvidersEntityConfig;
349
+ version: number;
350
+ identifier: string;
351
+ type: string;
352
+ formIdentifier: string | null;
353
+ userGroupIdentifier: string;
354
+ isActive: boolean;
355
+ isCheckCode: boolean;
356
+ }
357
+ /**
358
+ * Interface representing an authentication provider config.
359
+ * @interface IAuthProvidersEntityConfig
360
+ * @property {string} accessTokenTtlSec - Access token time to live in seconds. Example: "3600".
361
+ * @property {string} refreshTokenTtlMc - Refresh token time to live in milliseconds. Example: "86400000".
362
+ * @property {string} deleteNoneActiveUsersAfterDays - Delete none active users after days. Example: "30".
363
+ * @property {string} systemCodeTlsSec - System code time to live in seconds. Example: "86400".
364
+ * @property {string} systemCodeLength - System code length. Example: "6".
365
+ * @property {string | null} oauthAuthUrl - OAuth authorization URL. Example: null.
366
+ * @property {string | null} systemCodeOnlyNumbers - System code only numbers flag. Example: null.
367
+ */
368
+ interface IAuthProvidersEntityConfig {
369
+ accessTokenTtlSec: string;
370
+ refreshTokenTtlMc: string;
371
+ deleteNoneActiveUsersAfterDays: string;
372
+ systemCodeTlsSec: string;
373
+ systemCodeLength: string;
374
+ oauthAuthUrl: string | null;
375
+ systemCodeOnlyNumbers: string | null;
376
+ }
377
+ /**
378
+ * Authentication data object.
379
+ * @interface IAuthData
380
+ * @property {string} marker - The marker identifying the auth field. Example: "login".
381
+ * @property {string} value - The value of the auth field. Example: "user@example.com".
382
+ */
383
+ interface IAuthData {
384
+ marker: string;
385
+ value: string;
386
+ }
387
+ /**
388
+ * Interface representing the body used in authentication requests.
389
+ * @interface IAuthPostBody
390
+ * @property {IAuthData[]} authData - An array of authentication data objects, each containing a marker and its corresponding value.
391
+ * @example
392
+ [
393
+ {
394
+ "marker": "login",
395
+ "value": "user@example.com"
396
+ }
397
+ ]
398
+ * @description This interface defines the structure of the body used in authentication requests, containing an array of authentication data.
399
+ */
400
+ interface IAuthPostBody {
401
+ authData: IAuthData[];
402
+ }
403
+ /**
404
+ * Interface representing the active session data.
405
+ * @interface IActiveSession
406
+ * @property {object} deviceInfo - Information about the device used in the active session.
407
+ * @example
408
+ {
409
+ "os": "Win32",
410
+ "browser": "Node.js/22",
411
+ "location": "ru-RU"
412
+ }
413
+ * @property {string} deviceInfo.os - The operating system of the active session. Example: "Win32".
414
+ * @property {string} deviceInfo.browser - The browser used in the active session. Example: "Node.js/22".
415
+ * @property {string} deviceInfo.location - The location of the active session. Example: "ru-RU".
416
+ * @description This interface defines the structure of the body used in authentication requests, containing an array of authentication data.
417
+ */
418
+ interface IActiveSession {
419
+ deviceInfo: {
420
+ os: string;
421
+ browser: string;
422
+ location: string;
423
+ };
424
+ }
425
+ export type { IActiveSession, IAuthData, IAuthEntity, IAuthFormData, IAuthPostBody, IAuthProvider, IAuthProvidersEntity, ICodeEntity, IOauthData, ISignUpData, ISignUpEntity, };
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,80 @@
1
+ import type { z } from 'zod';
2
+ import type StateModule from './stateModule';
3
+ import SyncModules from './syncModules';
4
+ import type { IError } from './utils';
5
+ /**
6
+ * Abstract class AsyncModules extends SyncModules to provide asynchronous HTTP request functionalities.
7
+ * @description Abstract class AsyncModules extends SyncModules to provide asynchronous HTTP request functionalities.
8
+ */
9
+ export default abstract class AsyncModules extends SyncModules {
10
+ protected state: StateModule;
11
+ protected _NO_FETCH: boolean;
12
+ protected _https: any;
13
+ protected _url: string;
14
+ /**
15
+ * Constructor initializes the AsyncModules with a given state.
16
+ * @param {StateModule} state - Instance of StateModule containing configuration and state data.
17
+ * @description Constructor initializes the AsyncModules with a given state.
18
+ */
19
+ protected constructor(state: StateModule);
20
+ /**
21
+ * Validates API response against a Zod schema (optional)
22
+ * @param {unknown} data - The data to validate
23
+ * @param {z.ZodSchema<T>} [schema] - Optional Zod schema for validation
24
+ * @returns {T | IError} Validated data or error object
25
+ * @description Validates response data if validation is enabled in config
26
+ */
27
+ protected _validateResponse<T>(data: unknown, schema?: z.ZodSchema<T>): T | IError;
28
+ /**
29
+ * Performs an HTTP GET request.
30
+ * @param {string} path - The path to append to the base URL.
31
+ * @returns {Promise<T>} A promise resolving to the response data.
32
+ * @description Define a protected asynchronous method '_fetchGet' that performs a GET request
33
+ */
34
+ protected _fetchGet<T = unknown>(path: string): Promise<T>;
35
+ /**
36
+ * Performs an HTTP POST request.
37
+ * @param {string} path - The path to append to the base URL.
38
+ * @param {unknown} [data] - The data to send in the request body.
39
+ * @returns {Promise<T>} A promise resolving to the response data.
40
+ * @description Define a protected asynchronous method '_fetchPost' that performs a POST request
41
+ */
42
+ protected _fetchPost<T = unknown>(path: string, data?: unknown): Promise<T>;
43
+ /**
44
+ * Performs an HTTP PUT request.
45
+ * @param {string} path - The path to append to the base URL.
46
+ * @param {unknown} body - The data to send in the request body.
47
+ * @returns {Promise<T>} A promise resolving to the response data.
48
+ * @description Define a protected asynchronous method '_fetchPut' that performs a PUT request
49
+ */
50
+ protected _fetchPut<T = unknown>(path: string, body: unknown): Promise<T>;
51
+ /**
52
+ * Performs an HTTP DELETE request.
53
+ * @param {string} path - The path to append to the base URL.
54
+ * @param {unknown} body - The body of the request.
55
+ * @returns {Promise<T>} A promise resolving to the response data.
56
+ * @description Define a protected asynchronous method '_fetchDelete' that performs a DELETE request
57
+ */
58
+ protected _fetchDelete<T = unknown>(path: string, body?: unknown): Promise<T>;
59
+ /**
60
+ * Refreshes the authentication token.
61
+ * @returns {Promise<boolean>} A promise resolving to a boolean indicating success or failure.
62
+ * @description Define an asynchronous method 'refreshToken' that attempts to refresh the authentication token
63
+ */
64
+ protected refreshToken(): Promise<boolean>;
65
+ /**
66
+ * Creates options for HTTP requests.
67
+ * @param {string} method - The HTTP method (GET, POST, PUT, DELETE, etc.).
68
+ * @param {unknown} data - Optional data to include in the request body.
69
+ * @returns {IHttpOptions} An object representing the request options.
70
+ */
71
+ private makeOptions;
72
+ /**
73
+ * Handles responses from the browser's fetch API.
74
+ * @param {string} path - The path to append to the base URL.
75
+ * @param {IHttpOptions} options - The options for the fetch request.
76
+ * @returns {Promise<T>} A promise resolving to the response data.
77
+ * @description Define an asynchronous method 'browserResponse' that takes a path and options as parameters
78
+ */
79
+ private browserResponse;
80
+ }