oneentry 1.0.126 → 1.0.127
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.
- package/README.md +0 -2
- package/configure.js +25 -18
- package/dist/admins/adminsApi.d.ts +30 -25
- package/dist/admins/adminsApi.js +30 -25
- package/dist/admins/adminsInterfaces.d.ts +45 -54
- package/dist/attribute-sets/attributeSetsApi.d.ts +26 -27
- package/dist/attribute-sets/attributeSetsApi.js +26 -27
- package/dist/attribute-sets/attributeSetsInterfaces.d.ts +101 -109
- package/dist/auth-provider/authProviderApi.d.ts +132 -158
- package/dist/auth-provider/authProviderApi.js +131 -157
- package/dist/auth-provider/authProvidersInterfaces.d.ts +241 -237
- package/dist/base/asyncModules.d.ts +23 -21
- package/dist/base/asyncModules.js +30 -25
- package/dist/base/result.d.ts +31 -0
- package/dist/base/result.js +32 -1
- package/dist/base/stateModule.d.ts +10 -0
- package/dist/base/stateModule.js +50 -2
- package/dist/base/syncModules.d.ts +41 -49
- package/dist/base/syncModules.js +49 -48
- package/dist/base/utils.d.ts +38 -7
- package/dist/blocks/blocksApi.d.ts +27 -36
- package/dist/blocks/blocksApi.js +27 -36
- package/dist/blocks/blocksInterfaces.d.ts +92 -97
- package/dist/config.d.ts +13 -0
- package/dist/config.js +30 -0
- package/dist/events/eventsApi.d.ts +16 -33
- package/dist/events/eventsApi.js +32 -46
- package/dist/events/eventsInterfaces.d.ts +42 -37
- package/dist/file-uploading/fileUploadingApi.d.ts +42 -47
- package/dist/file-uploading/fileUploadingApi.js +44 -47
- package/dist/file-uploading/fileUploadingInterfaces.d.ts +49 -60
- package/dist/forms/formsApi.d.ts +15 -14
- package/dist/forms/formsApi.js +15 -14
- package/dist/forms/formsInterfaces.d.ts +36 -40
- package/dist/forms-data/formsDataApi.d.ts +40 -44
- package/dist/forms-data/formsDataApi.js +42 -44
- package/dist/forms-data/formsDataInterfaces.d.ts +231 -231
- package/dist/general-types/generalTypesApi.d.ts +5 -5
- package/dist/general-types/generalTypesApi.js +5 -5
- package/dist/general-types/generalTypesInterfaces.d.ts +6 -9
- package/dist/index.d.ts +12 -13
- package/dist/index.js +12 -13
- package/dist/integration-collections/integrationCollectionsApi.d.ts +84 -98
- package/dist/integration-collections/integrationCollectionsApi.js +86 -102
- package/dist/integration-collections/integrationCollectionsInterfaces.d.ts +177 -169
- package/dist/locales/localesApi.d.ts +7 -3
- package/dist/locales/localesApi.js +7 -3
- package/dist/locales/localesInterfaces.d.ts +14 -13
- package/dist/menus/menusApi.d.ts +9 -5
- package/dist/menus/menusApi.js +9 -5
- package/dist/menus/menusInterfaces.d.ts +43 -48
- package/dist/menus/menusInterfaces.js +1 -0
- package/dist/orders/ordersApi.d.ts +62 -70
- package/dist/orders/ordersApi.js +62 -71
- package/dist/orders/ordersInterfaces.d.ts +238 -203
- package/dist/pages/pagesApi.d.ts +67 -80
- package/dist/pages/pagesApi.js +71 -81
- package/dist/pages/pagesInterfaces.d.ts +164 -160
- package/dist/payments/paymentsApi.d.ts +24 -34
- package/dist/payments/paymentsApi.js +24 -38
- package/dist/payments/paymentsInterfaces.d.ts +82 -76
- package/dist/product-statuses/productStatusesApi.d.ts +13 -13
- package/dist/product-statuses/productStatusesApi.js +13 -13
- package/dist/product-statuses/productStatusesInterfaces.d.ts +29 -27
- package/dist/products/productsApi.d.ts +246 -267
- package/dist/products/productsApi.js +247 -267
- package/dist/products/productsInterfaces.d.ts +333 -339
- package/dist/system/systemApi.d.ts +19 -21
- package/dist/system/systemApi.js +20 -21
- package/dist/system/systemInterfaces.d.ts +14 -3
- package/dist/templates/templatesApi.d.ts +13 -16
- package/dist/templates/templatesApi.js +13 -16
- package/dist/templates/templatesInterfaces.d.ts +30 -29
- package/dist/templates-preview/templatesPreviewApi.d.ts +10 -11
- package/dist/templates-preview/templatesPreviewApi.js +10 -11
- package/dist/templates-preview/templatesPreviewInterfaces.d.ts +61 -64
- package/dist/users/usersApi.d.ts +36 -43
- package/dist/users/usersApi.js +36 -43
- package/dist/users/usersInterfaces.d.ts +92 -96
- package/dist/web-socket/wsApi.d.ts +5 -3
- package/dist/web-socket/wsApi.js +6 -3
- package/dist/web-socket/wsInterfaces.d.ts +7 -2
- package/package.json +16 -12
|
@@ -2,6 +2,7 @@ import type StateModule from './stateModule';
|
|
|
2
2
|
import SyncModules from './syncModules';
|
|
3
3
|
/**
|
|
4
4
|
* Abstract class AsyncModules extends SyncModules to provide asynchronous HTTP request functionalities.
|
|
5
|
+
* @description Abstract class AsyncModules extends SyncModules to provide asynchronous HTTP request functionalities.
|
|
5
6
|
*/
|
|
6
7
|
export default abstract class AsyncModules extends SyncModules {
|
|
7
8
|
protected state: StateModule;
|
|
@@ -10,58 +11,59 @@ export default abstract class AsyncModules extends SyncModules {
|
|
|
10
11
|
protected _url: string;
|
|
11
12
|
/**
|
|
12
13
|
* Constructor initializes the AsyncModules with a given state.
|
|
13
|
-
* @param state - Instance of StateModule containing configuration and state data.
|
|
14
|
+
* @param {StateModule} state - Instance of StateModule containing configuration and state data.
|
|
15
|
+
* @description Constructor initializes the AsyncModules with a given state.
|
|
14
16
|
*/
|
|
15
17
|
protected constructor(state: StateModule);
|
|
16
18
|
/**
|
|
17
19
|
* Performs an HTTP GET request.
|
|
18
|
-
* @param
|
|
19
|
-
* @
|
|
20
|
+
* @param {string} path - The path to append to the base URL.
|
|
21
|
+
* @returns {Promise<any>} A promise resolving to the response data.
|
|
20
22
|
* @description Define a protected asynchronous method '_fetchGet' that performs a GET request
|
|
21
23
|
*/
|
|
22
24
|
protected _fetchGet(path: string): Promise<any>;
|
|
23
25
|
/**
|
|
24
26
|
* Performs an HTTP POST request.
|
|
25
|
-
* @param
|
|
26
|
-
* @param
|
|
27
|
-
* @
|
|
27
|
+
* @param {string} path - The path to append to the base URL.
|
|
28
|
+
* @param {any} [data] - The data to send in the request body.
|
|
29
|
+
* @returns {Promise<any>} A promise resolving to the response data.
|
|
28
30
|
* @description Define a protected asynchronous method '_fetchPost' that performs a POST request
|
|
29
31
|
*/
|
|
30
32
|
protected _fetchPost(path: string, data?: any): Promise<any>;
|
|
31
33
|
/**
|
|
32
34
|
* Performs an HTTP PUT request.
|
|
33
|
-
* @param
|
|
34
|
-
* @param
|
|
35
|
-
* @
|
|
35
|
+
* @param {string} path - The path to append to the base URL.
|
|
36
|
+
* @param {any} body - The data to send in the request body.
|
|
37
|
+
* @returns {Promise<any>} A promise resolving to the response data.
|
|
36
38
|
* @description Define a protected asynchronous method '_fetchPut' that performs a PUT request
|
|
37
39
|
*/
|
|
38
|
-
protected _fetchPut(path: string,
|
|
40
|
+
protected _fetchPut(path: string, body: any): Promise<any>;
|
|
39
41
|
/**
|
|
40
42
|
* Performs an HTTP DELETE request.
|
|
41
|
-
* @param
|
|
42
|
-
* @param
|
|
43
|
-
* @
|
|
43
|
+
* @param {string} path - The path to append to the base URL.
|
|
44
|
+
* @param {any} body - The body of the request.
|
|
45
|
+
* @returns {Promise<any>} A promise resolving to the response data.
|
|
44
46
|
* @description Define a protected asynchronous method '_fetchDelete' that performs a DELETE request
|
|
45
47
|
*/
|
|
46
|
-
protected _fetchDelete(path: string,
|
|
48
|
+
protected _fetchDelete(path: string, body?: any): Promise<any>;
|
|
47
49
|
/**
|
|
48
50
|
* Refreshes the authentication token.
|
|
49
|
-
* @
|
|
51
|
+
* @returns {Promise<boolean>} A promise resolving to a boolean indicating success or failure.
|
|
50
52
|
* @description Define an asynchronous method 'refreshToken' that attempts to refresh the authentication token
|
|
51
53
|
*/
|
|
52
54
|
protected refreshToken(): Promise<boolean>;
|
|
53
55
|
/**
|
|
54
56
|
* Creates options for HTTP requests.
|
|
55
|
-
* @param method - The HTTP method (GET, POST, PUT, DELETE, etc.).
|
|
56
|
-
* @param
|
|
57
|
-
* @
|
|
57
|
+
* @param {string} method - The HTTP method (GET, POST, PUT, DELETE, etc.).
|
|
58
|
+
* @param {any} data - Optional data to include in the request body.
|
|
59
|
+
* @returns {any} An object representing the request options.
|
|
58
60
|
*/
|
|
59
61
|
private makeOptions;
|
|
60
62
|
/**
|
|
61
63
|
* Handles responses from the browser's fetch API.
|
|
62
|
-
* @param path
|
|
63
|
-
* @param
|
|
64
|
-
* @
|
|
64
|
+
* @param {string} path - The path to append to the base URL.
|
|
65
|
+
* @param {any} options - The options for the fetch request.
|
|
66
|
+
* @returns {any} A promise resolving to the response data.
|
|
65
67
|
* @description Define an asynchronous method 'browserResponse' that takes a path and options as parameters
|
|
66
68
|
*/
|
|
67
69
|
private browserResponse;
|
|
@@ -7,11 +7,13 @@ const syncModules_1 = __importDefault(require("./syncModules"));
|
|
|
7
7
|
// import { IError } from './utils';
|
|
8
8
|
/**
|
|
9
9
|
* Abstract class AsyncModules extends SyncModules to provide asynchronous HTTP request functionalities.
|
|
10
|
+
* @description Abstract class AsyncModules extends SyncModules to provide asynchronous HTTP request functionalities.
|
|
10
11
|
*/
|
|
11
12
|
class AsyncModules extends syncModules_1.default {
|
|
12
13
|
/**
|
|
13
14
|
* Constructor initializes the AsyncModules with a given state.
|
|
14
|
-
* @param state - Instance of StateModule containing configuration and state data.
|
|
15
|
+
* @param {StateModule} state - Instance of StateModule containing configuration and state data.
|
|
16
|
+
* @description Constructor initializes the AsyncModules with a given state.
|
|
15
17
|
*/
|
|
16
18
|
constructor(state) {
|
|
17
19
|
var _a;
|
|
@@ -23,8 +25,8 @@ class AsyncModules extends syncModules_1.default {
|
|
|
23
25
|
}
|
|
24
26
|
/**
|
|
25
27
|
* Performs an HTTP GET request.
|
|
26
|
-
* @param
|
|
27
|
-
* @
|
|
28
|
+
* @param {string} path - The path to append to the base URL.
|
|
29
|
+
* @returns {Promise<any>} A promise resolving to the response data.
|
|
28
30
|
* @description Define a protected asynchronous method '_fetchGet' that performs a GET request
|
|
29
31
|
*/
|
|
30
32
|
async _fetchGet(path) {
|
|
@@ -54,6 +56,7 @@ class AsyncModules extends syncModules_1.default {
|
|
|
54
56
|
try {
|
|
55
57
|
// Attempt to parse the accumulated response data as JSON and resolve the promise with it
|
|
56
58
|
resolve(JSON.parse(responseData));
|
|
59
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
57
60
|
}
|
|
58
61
|
catch (error) {
|
|
59
62
|
// If parsing fails, resolve the promise with the raw response data
|
|
@@ -71,9 +74,9 @@ class AsyncModules extends syncModules_1.default {
|
|
|
71
74
|
}
|
|
72
75
|
/**
|
|
73
76
|
* Performs an HTTP POST request.
|
|
74
|
-
* @param
|
|
75
|
-
* @param
|
|
76
|
-
* @
|
|
77
|
+
* @param {string} path - The path to append to the base URL.
|
|
78
|
+
* @param {any} [data] - The data to send in the request body.
|
|
79
|
+
* @returns {Promise<any>} A promise resolving to the response data.
|
|
77
80
|
* @description Define a protected asynchronous method '_fetchPost' that performs a POST request
|
|
78
81
|
*/
|
|
79
82
|
async _fetchPost(path, data) {
|
|
@@ -103,6 +106,7 @@ class AsyncModules extends syncModules_1.default {
|
|
|
103
106
|
try {
|
|
104
107
|
// Attempt to parse the accumulated response data as JSON and resolve the promise with it
|
|
105
108
|
resolve(JSON.parse(responseData));
|
|
109
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
106
110
|
}
|
|
107
111
|
catch (error) {
|
|
108
112
|
// If parsing fails, resolve the promise with the raw response data
|
|
@@ -124,14 +128,14 @@ class AsyncModules extends syncModules_1.default {
|
|
|
124
128
|
}
|
|
125
129
|
/**
|
|
126
130
|
* Performs an HTTP PUT request.
|
|
127
|
-
* @param
|
|
128
|
-
* @param
|
|
129
|
-
* @
|
|
131
|
+
* @param {string} path - The path to append to the base URL.
|
|
132
|
+
* @param {any} body - The data to send in the request body.
|
|
133
|
+
* @returns {Promise<any>} A promise resolving to the response data.
|
|
130
134
|
* @description Define a protected asynchronous method '_fetchPut' that performs a PUT request
|
|
131
135
|
*/
|
|
132
|
-
async _fetchPut(path,
|
|
136
|
+
async _fetchPut(path, body) {
|
|
133
137
|
// Create options for the PUT request using the 'makeOptions' method, including the data to be sent
|
|
134
|
-
const options = this.makeOptions('PUT',
|
|
138
|
+
const options = this.makeOptions('PUT', body);
|
|
135
139
|
// Check if the fetch operation should be performed using the Fetch API or an alternative method
|
|
136
140
|
if (!this._NO_FETCH) {
|
|
137
141
|
// If Fetch API is allowed, use 'browserResponse' to perform the request and return the result
|
|
@@ -156,6 +160,7 @@ class AsyncModules extends syncModules_1.default {
|
|
|
156
160
|
try {
|
|
157
161
|
// Attempt to parse the accumulated response data as JSON and resolve the promise with it
|
|
158
162
|
resolve(JSON.parse(responseData));
|
|
163
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
159
164
|
}
|
|
160
165
|
catch (error) {
|
|
161
166
|
// If parsing fails, resolve the promise with the raw response data
|
|
@@ -169,7 +174,7 @@ class AsyncModules extends syncModules_1.default {
|
|
|
169
174
|
reject(error);
|
|
170
175
|
});
|
|
171
176
|
// Write the provided data to the request body in JSON format
|
|
172
|
-
req.write(JSON.stringify(
|
|
177
|
+
req.write(JSON.stringify(body));
|
|
173
178
|
// End the request to signal that all data has been sent
|
|
174
179
|
req.end();
|
|
175
180
|
});
|
|
@@ -177,15 +182,14 @@ class AsyncModules extends syncModules_1.default {
|
|
|
177
182
|
}
|
|
178
183
|
/**
|
|
179
184
|
* Performs an HTTP DELETE request.
|
|
180
|
-
* @param
|
|
181
|
-
* @param
|
|
182
|
-
* @
|
|
185
|
+
* @param {string} path - The path to append to the base URL.
|
|
186
|
+
* @param {any} body - The body of the request.
|
|
187
|
+
* @returns {Promise<any>} A promise resolving to the response data.
|
|
183
188
|
* @description Define a protected asynchronous method '_fetchDelete' that performs a DELETE request
|
|
184
189
|
*/
|
|
185
|
-
|
|
186
|
-
async _fetchDelete(path, data) {
|
|
190
|
+
async _fetchDelete(path, body) {
|
|
187
191
|
// Create options for the DELETE request using the 'makeOptions' method
|
|
188
|
-
const options = this.makeOptions('DELETE');
|
|
192
|
+
const options = this.makeOptions('DELETE', body);
|
|
189
193
|
// Check if the fetch operation should be performed using the Fetch API or an alternative method
|
|
190
194
|
if (!this._NO_FETCH) {
|
|
191
195
|
// If Fetch API is allowed, use 'browserResponse' to perform the request and return the result
|
|
@@ -210,6 +214,7 @@ class AsyncModules extends syncModules_1.default {
|
|
|
210
214
|
try {
|
|
211
215
|
// Attempt to parse the accumulated response data as JSON and resolve the promise with it
|
|
212
216
|
resolve(JSON.parse(responseData));
|
|
217
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
213
218
|
}
|
|
214
219
|
catch (error) {
|
|
215
220
|
// If parsing fails, resolve the promise with the raw response data
|
|
@@ -227,7 +232,7 @@ class AsyncModules extends syncModules_1.default {
|
|
|
227
232
|
}
|
|
228
233
|
/**
|
|
229
234
|
* Refreshes the authentication token.
|
|
230
|
-
* @
|
|
235
|
+
* @returns {Promise<boolean>} A promise resolving to a boolean indicating success or failure.
|
|
231
236
|
* @description Define an asynchronous method 'refreshToken' that attempts to refresh the authentication token
|
|
232
237
|
*/
|
|
233
238
|
async refreshToken() {
|
|
@@ -265,9 +270,9 @@ class AsyncModules extends syncModules_1.default {
|
|
|
265
270
|
}
|
|
266
271
|
/**
|
|
267
272
|
* Creates options for HTTP requests.
|
|
268
|
-
* @param method - The HTTP method (GET, POST, PUT, DELETE, etc.).
|
|
269
|
-
* @param
|
|
270
|
-
* @
|
|
273
|
+
* @param {string} method - The HTTP method (GET, POST, PUT, DELETE, etc.).
|
|
274
|
+
* @param {any} data - Optional data to include in the request body.
|
|
275
|
+
* @returns {any} An object representing the request options.
|
|
271
276
|
*/
|
|
272
277
|
makeOptions(method, data) {
|
|
273
278
|
const options = {
|
|
@@ -310,9 +315,9 @@ class AsyncModules extends syncModules_1.default {
|
|
|
310
315
|
}
|
|
311
316
|
/**
|
|
312
317
|
* Handles responses from the browser's fetch API.
|
|
313
|
-
* @param path
|
|
314
|
-
* @param
|
|
315
|
-
* @
|
|
318
|
+
* @param {string} path - The path to append to the base URL.
|
|
319
|
+
* @param {any} options - The options for the fetch request.
|
|
320
|
+
* @returns {any} A promise resolving to the response data.
|
|
316
321
|
* @description Define an asynchronous method 'browserResponse' that takes a path and options as parameters
|
|
317
322
|
*/
|
|
318
323
|
async browserResponse(path, options) {
|
package/dist/base/result.d.ts
CHANGED
|
@@ -1,8 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Result class for handling response data
|
|
3
|
+
* @description Result class for handling response data
|
|
4
|
+
*/
|
|
1
5
|
export default class Result {
|
|
2
6
|
body: any;
|
|
7
|
+
/**
|
|
8
|
+
* Constructor that initializes the class with a given data
|
|
9
|
+
* @param {Response | string} data - Response or string data
|
|
10
|
+
* @description Constructor that initializes the class with a given data, which can be of type Response or string.
|
|
11
|
+
*/
|
|
3
12
|
constructor(data: Response | string);
|
|
13
|
+
/**
|
|
14
|
+
* Asynchronously converts the body to a blob and returns the current instance.
|
|
15
|
+
* @returns {Promise<Result>} Current instance
|
|
16
|
+
* @description Asynchronously converts the body to a blob and returns the current instance.
|
|
17
|
+
*/
|
|
4
18
|
blob(): Promise<Result>;
|
|
19
|
+
/**
|
|
20
|
+
* Asynchronously parses the body as JSON and returns the current instance.
|
|
21
|
+
* @returns {Promise<Result>} Current instance
|
|
22
|
+
* @description Asynchronously parses the body as JSON and returns the current instance.
|
|
23
|
+
*/
|
|
5
24
|
json(): Promise<Result>;
|
|
25
|
+
/**
|
|
26
|
+
* Recursively removes language-specific data from the provided data or the body.
|
|
27
|
+
* @param {string} langCode - Language code
|
|
28
|
+
* @param {any} [data] - Data to process
|
|
29
|
+
* @returns {any} Processed data
|
|
30
|
+
* @description Recursively removes language-specific data from the provided data or the body.
|
|
31
|
+
*/
|
|
6
32
|
makeDataWithoutLang(langCode: string, data?: any): any;
|
|
33
|
+
/**
|
|
34
|
+
* Recursively simplifies arrays in the provided data or the body by removing single-element arrays.
|
|
35
|
+
* @param {any} data - The data to simplify.
|
|
36
|
+
* @returns {any} The simplified data.
|
|
37
|
+
*/
|
|
7
38
|
makeDataWithoutArray(data?: any): any;
|
|
8
39
|
}
|
package/dist/base/result.js
CHANGED
|
@@ -1,19 +1,39 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
/* eslint-disable jsdoc/reject-any-type */
|
|
3
4
|
/* eslint-disable no-restricted-syntax */
|
|
4
5
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
6
|
+
/**
|
|
7
|
+
* Result class for handling response data
|
|
8
|
+
* @description Result class for handling response data
|
|
9
|
+
*/
|
|
5
10
|
class Result {
|
|
6
11
|
// Constructor that initializes the class with a given data, which can be of type Response or string.
|
|
12
|
+
/**
|
|
13
|
+
* Constructor that initializes the class with a given data
|
|
14
|
+
* @param {Response | string} data - Response or string data
|
|
15
|
+
* @description Constructor that initializes the class with a given data, which can be of type Response or string.
|
|
16
|
+
*/
|
|
7
17
|
constructor(data) {
|
|
8
18
|
this.body = data;
|
|
9
19
|
}
|
|
10
20
|
// Asynchronously converts the body to a blob and returns the current instance.
|
|
21
|
+
/**
|
|
22
|
+
* Asynchronously converts the body to a blob and returns the current instance.
|
|
23
|
+
* @returns {Promise<Result>} Current instance
|
|
24
|
+
* @description Asynchronously converts the body to a blob and returns the current instance.
|
|
25
|
+
*/
|
|
11
26
|
async blob() {
|
|
12
27
|
// Convert the body to a blob using the blob() method.
|
|
13
28
|
this.body = await this.body.blob();
|
|
14
29
|
return this;
|
|
15
30
|
}
|
|
16
31
|
// Asynchronously parses the body as JSON and returns the current instance.
|
|
32
|
+
/**
|
|
33
|
+
* Asynchronously parses the body as JSON and returns the current instance.
|
|
34
|
+
* @returns {Promise<Result>} Current instance
|
|
35
|
+
* @description Asynchronously parses the body as JSON and returns the current instance.
|
|
36
|
+
*/
|
|
17
37
|
async json() {
|
|
18
38
|
// Check if the body is a string, then parse it as JSON, otherwise call the json() method.
|
|
19
39
|
this.body =
|
|
@@ -23,6 +43,13 @@ class Result {
|
|
|
23
43
|
return this;
|
|
24
44
|
}
|
|
25
45
|
// Recursively removes language-specific data from the provided data or the body.
|
|
46
|
+
/**
|
|
47
|
+
* Recursively removes language-specific data from the provided data or the body.
|
|
48
|
+
* @param {string} langCode - Language code
|
|
49
|
+
* @param {any} [data] - Data to process
|
|
50
|
+
* @returns {any} Processed data
|
|
51
|
+
* @description Recursively removes language-specific data from the provided data or the body.
|
|
52
|
+
*/
|
|
26
53
|
makeDataWithoutLang(langCode, data) {
|
|
27
54
|
if (data) {
|
|
28
55
|
// If data is an array, recursively process each item.
|
|
@@ -77,7 +104,11 @@ class Result {
|
|
|
77
104
|
return this;
|
|
78
105
|
}
|
|
79
106
|
}
|
|
80
|
-
|
|
107
|
+
/**
|
|
108
|
+
* Recursively simplifies arrays in the provided data or the body by removing single-element arrays.
|
|
109
|
+
* @param {any} data - The data to simplify.
|
|
110
|
+
* @returns {any} The simplified data.
|
|
111
|
+
*/
|
|
81
112
|
makeDataWithoutArray(data) {
|
|
82
113
|
if (data) {
|
|
83
114
|
// If data is an array, recursively process each item.
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
import type { IConfig, IError } from './utils';
|
|
2
|
+
/**
|
|
3
|
+
* State module for managing application state and configuration
|
|
4
|
+
* @description State module for managing application state and configuration
|
|
5
|
+
*/
|
|
2
6
|
export default class StateModule {
|
|
3
7
|
url: string | undefined;
|
|
4
8
|
lang: string | undefined;
|
|
@@ -18,5 +22,11 @@ export default class StateModule {
|
|
|
18
22
|
500?: (data: IError) => any | null;
|
|
19
23
|
};
|
|
20
24
|
saveFunction: (param: string) => void | null;
|
|
25
|
+
/**
|
|
26
|
+
* Constructor for StateModule
|
|
27
|
+
* @param {string} url - Base URL for API requests
|
|
28
|
+
* @param {IConfig} config - Configuration object
|
|
29
|
+
* @description Constructor for StateModule
|
|
30
|
+
*/
|
|
21
31
|
constructor(url: string, config: IConfig);
|
|
22
32
|
}
|
package/dist/base/stateModule.js
CHANGED
|
@@ -1,6 +1,49 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
2
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
/**
|
|
37
|
+
* State module for managing application state and configuration
|
|
38
|
+
* @description State module for managing application state and configuration
|
|
39
|
+
*/
|
|
3
40
|
class StateModule {
|
|
41
|
+
/**
|
|
42
|
+
* Constructor for StateModule
|
|
43
|
+
* @param {string} url - Base URL for API requests
|
|
44
|
+
* @param {IConfig} config - Configuration object
|
|
45
|
+
* @description Constructor for StateModule
|
|
46
|
+
*/
|
|
4
47
|
constructor(url, config) {
|
|
5
48
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
|
|
6
49
|
this.url = url;
|
|
@@ -40,8 +83,13 @@ class StateModule {
|
|
|
40
83
|
+process.versions.node.split('.')[0] < 18) {
|
|
41
84
|
try {
|
|
42
85
|
this._NO_FETCH = true;
|
|
43
|
-
//
|
|
44
|
-
|
|
86
|
+
// Dynamically import https for older Node.js versions
|
|
87
|
+
Promise.resolve().then(() => __importStar(require('https'))).then((https) => {
|
|
88
|
+
this._https = https;
|
|
89
|
+
})
|
|
90
|
+
.catch(() => {
|
|
91
|
+
this._https = null;
|
|
92
|
+
});
|
|
45
93
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
46
94
|
}
|
|
47
95
|
catch (e) {
|
|
@@ -1,70 +1,66 @@
|
|
|
1
1
|
import type { IUploadingQuery } from '../file-uploading/fileUploadingInterfaces';
|
|
2
2
|
import type { IProductsQuery } from '../products/productsInterfaces';
|
|
3
3
|
import type StateModule from './stateModule';
|
|
4
|
+
/**
|
|
5
|
+
*
|
|
6
|
+
*/
|
|
4
7
|
export default abstract class SyncModules {
|
|
5
8
|
protected state: StateModule;
|
|
6
9
|
protected _url: string;
|
|
7
10
|
protected constructor(state: StateModule);
|
|
8
11
|
/**
|
|
9
12
|
* Constructs the full URL path by appending the given path to the base URL.
|
|
10
|
-
*
|
|
11
|
-
* @
|
|
12
|
-
* @return The full URL as a string.
|
|
13
|
+
* @param {string} path - The path to append to the base URL.
|
|
14
|
+
* @returns {string} The full URL as a string.
|
|
13
15
|
*/
|
|
14
16
|
protected _getFullPath(path: string): string;
|
|
15
17
|
/**
|
|
16
18
|
* Converts query parameters into a query string.
|
|
17
|
-
*
|
|
18
|
-
* @
|
|
19
|
-
* @return A string representation of the query parameters.
|
|
19
|
+
* @param {IProductsQuery | IUploadingQuery | any} query - The query object containing key-value pairs.
|
|
20
|
+
* @returns {string} A string representation of the query parameters.
|
|
20
21
|
*/
|
|
21
22
|
protected _queryParamsToString(query: IProductsQuery | IUploadingQuery | any): string;
|
|
22
23
|
/**
|
|
23
24
|
* Normalizes data based on language code.
|
|
24
|
-
*
|
|
25
|
-
* @param
|
|
26
|
-
* @
|
|
27
|
-
* @return Normalized data.
|
|
25
|
+
* @param {any} data - The data to normalize.
|
|
26
|
+
* @param {string} langCode - The language code for normalization.
|
|
27
|
+
* @returns {any} Normalized data.
|
|
28
28
|
*/
|
|
29
29
|
protected _normalizeData(data: any, langCode?: string): any;
|
|
30
30
|
/**
|
|
31
31
|
* Normalizes the body of a POST request.
|
|
32
|
-
*
|
|
33
|
-
* @param
|
|
34
|
-
* @
|
|
35
|
-
* @return Normalized body.
|
|
32
|
+
* @param {any} body - The body to normalize.
|
|
33
|
+
* @param {string} langCode - The language code for normalization.
|
|
34
|
+
* @returns {any} Normalized body.
|
|
36
35
|
*/
|
|
37
36
|
protected _normalizePostBody(body: any, langCode?: string): any;
|
|
38
37
|
/**
|
|
39
38
|
* Clears arrays within the data structure.
|
|
40
|
-
*
|
|
41
|
-
* @
|
|
42
|
-
* @return Cleared data.
|
|
39
|
+
* @param {Record<string, any>} data - The data to clear.
|
|
40
|
+
* @returns {any} Cleared data.
|
|
43
41
|
*/
|
|
44
42
|
protected _clearArray(data: Record<string, any>): any;
|
|
45
43
|
/**
|
|
46
44
|
* Sorts attributes by their positions.
|
|
47
|
-
*
|
|
48
|
-
* @
|
|
49
|
-
* @return Sorted attributes.
|
|
45
|
+
* @param {any} data - The data containing attributes.
|
|
46
|
+
* @returns {any} Sorted attributes.
|
|
50
47
|
*/
|
|
51
|
-
protected _sortAttributes: (data: any) =>
|
|
52
|
-
[k: string]: unknown;
|
|
53
|
-
};
|
|
48
|
+
protected _sortAttributes: (data: any) => any;
|
|
54
49
|
/**
|
|
55
50
|
* Adds a specified number of days to a date.
|
|
56
|
-
*
|
|
57
|
-
* @param
|
|
58
|
-
* @
|
|
59
|
-
* @return The new date with added days.
|
|
51
|
+
* @param {Date} date - The initial date.
|
|
52
|
+
* @param {number} days - The number of days to add.
|
|
53
|
+
* @returns {any} The new date with added days.
|
|
60
54
|
*/
|
|
61
55
|
protected _addDays(date: Date, days: number): Date;
|
|
62
56
|
/**
|
|
63
57
|
* Generates intervals for a specific date based on a schedule.
|
|
64
|
-
*
|
|
65
|
-
* @param
|
|
66
|
-
* @param schedule
|
|
67
|
-
* @param
|
|
58
|
+
* @param {Date} date - The date for which to generate intervals.
|
|
59
|
+
* @param {object} schedule - The schedule defining the intervals.
|
|
60
|
+
* @param {boolean} schedule.inEveryWeek - The number of weeks between intervals.
|
|
61
|
+
* @param {any[]} schedule.times - The times for each interval.
|
|
62
|
+
* @param {boolean} schedule.inEveryMonth - The month intervals for each interval.
|
|
63
|
+
* @param {Set<Array<string>>} utcIntervals - A set to store unique intervals.
|
|
68
64
|
*/
|
|
69
65
|
protected _generateIntervalsForDate(date: Date, schedule: {
|
|
70
66
|
inEveryWeek: boolean;
|
|
@@ -73,42 +69,38 @@ export default abstract class SyncModules {
|
|
|
73
69
|
}, utcIntervals: Set<Array<string>>): void;
|
|
74
70
|
/**
|
|
75
71
|
* Adds time intervals to schedules.
|
|
76
|
-
*
|
|
77
|
-
* @
|
|
78
|
-
* @return Schedules with added time intervals.
|
|
72
|
+
* @param {any[]} schedules - The schedules to process.
|
|
73
|
+
* @returns {any} Schedules with added time intervals.
|
|
79
74
|
*/
|
|
80
75
|
_addTimeIntervalsToSchedules(schedules: any[]): any[];
|
|
81
76
|
/**
|
|
82
77
|
* Normalizes attributes within the data.
|
|
83
|
-
*
|
|
84
|
-
* @
|
|
85
|
-
* @return Normalized attributes.
|
|
78
|
+
* @param {any} data - The data to normalize.
|
|
79
|
+
* @returns {any} Normalized attributes.
|
|
86
80
|
*/
|
|
87
81
|
protected _normalizeAttr(data: any): any;
|
|
88
82
|
/**
|
|
89
83
|
* Processes data after fetching or receiving it.
|
|
90
|
-
*
|
|
91
|
-
* @param
|
|
92
|
-
* @
|
|
93
|
-
* @return Processed data.
|
|
84
|
+
* @param {any} data - The data to process.
|
|
85
|
+
* @param {any} langCode - The language code for processing.
|
|
86
|
+
* @returns {any} Processed data.
|
|
94
87
|
*/
|
|
95
88
|
protected _dataPostProcess(data: any, langCode?: string): any;
|
|
96
89
|
/**
|
|
97
90
|
* Sets the access token in the state.
|
|
98
|
-
*
|
|
99
|
-
* @
|
|
100
|
-
* @return The instance of SyncModules for chaining.
|
|
91
|
+
* @param {string} accessToken - The access token to set.
|
|
92
|
+
* @returns {any} The instance of SyncModules for chaining.
|
|
101
93
|
*/
|
|
102
|
-
setAccessToken(accessToken: string):
|
|
94
|
+
setAccessToken(accessToken: string): any;
|
|
103
95
|
/**
|
|
104
96
|
* Sets the refresh token in the state.
|
|
105
|
-
*
|
|
106
|
-
* @
|
|
107
|
-
* @return The instance of SyncModules for chaining.
|
|
97
|
+
* @param {any} refreshToken - The refresh token to set.
|
|
98
|
+
* @returns {any} The instance of SyncModules for chaining.
|
|
108
99
|
*/
|
|
109
|
-
setRefreshToken(refreshToken: string):
|
|
100
|
+
setRefreshToken(refreshToken: string): any;
|
|
110
101
|
/**
|
|
111
102
|
* Get deviceMetadata
|
|
103
|
+
* @returns {string} - Returns an object containing device metadata.
|
|
112
104
|
*/
|
|
113
105
|
protected _getDeviceMetadata(): string;
|
|
114
106
|
}
|