oneentry 1.0.127 → 1.0.130
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 +3 -0
- package/dist/admins/adminsApi.d.ts +20 -20
- package/dist/admins/adminsApi.js +20 -20
- package/dist/admins/adminsInterfaces.d.ts +43 -43
- package/dist/attribute-sets/attributeSetsApi.d.ts +16 -16
- package/dist/attribute-sets/attributeSetsApi.js +16 -16
- package/dist/attribute-sets/attributeSetsInterfaces.d.ts +87 -85
- package/dist/auth-provider/authProviderApi.d.ts +127 -127
- package/dist/auth-provider/authProviderApi.js +127 -127
- package/dist/auth-provider/authProvidersInterfaces.d.ts +208 -202
- package/dist/base/asyncModules.d.ts +17 -17
- package/dist/base/asyncModules.js +39 -27
- package/dist/base/result.d.ts +11 -11
- package/dist/base/result.js +12 -16
- package/dist/base/stateModule.d.ts +6 -5
- package/dist/base/stateModule.js +15 -14
- package/dist/base/syncModules.d.ts +42 -37
- package/dist/base/syncModules.js +103 -49
- package/dist/base/utils.d.ts +45 -22
- package/dist/blocks/blocksApi.d.ts +24 -24
- package/dist/blocks/blocksApi.js +24 -24
- package/dist/blocks/blocksInterfaces.d.ts +85 -85
- package/dist/events/eventsApi.d.ts +11 -11
- package/dist/events/eventsApi.js +11 -11
- package/dist/events/eventsInterfaces.d.ts +23 -23
- package/dist/file-uploading/fileUploadingApi.d.ts +38 -38
- package/dist/file-uploading/fileUploadingApi.js +38 -38
- package/dist/file-uploading/fileUploadingInterfaces.d.ts +44 -44
- package/dist/forms/formsApi.d.ts +7 -7
- package/dist/forms/formsApi.js +7 -7
- package/dist/forms/formsInterfaces.d.ts +43 -31
- package/dist/forms-data/formsDataApi.d.ts +49 -37
- package/dist/forms-data/formsDataApi.js +49 -38
- package/dist/forms-data/formsDataInterfaces.d.ts +241 -219
- package/dist/general-types/generalTypesApi.d.ts +1 -1
- package/dist/general-types/generalTypesApi.js +1 -1
- package/dist/general-types/generalTypesInterfaces.d.ts +3 -3
- package/dist/index.d.ts +11 -10
- package/dist/index.js +11 -10
- package/dist/integration-collections/integrationCollectionsApi.d.ts +76 -80
- package/dist/integration-collections/integrationCollectionsApi.js +76 -80
- package/dist/integration-collections/integrationCollectionsInterfaces.d.ts +145 -149
- package/dist/locales/localesInterfaces.d.ts +8 -8
- package/dist/menus/menusApi.d.ts +3 -3
- package/dist/menus/menusApi.js +3 -3
- package/dist/menus/menusInterfaces.d.ts +39 -39
- package/dist/orders/ordersApi.d.ts +56 -56
- package/dist/orders/ordersApi.js +56 -56
- package/dist/orders/ordersInterfaces.d.ts +204 -198
- package/dist/pages/pagesApi.d.ts +60 -60
- package/dist/pages/pagesApi.js +60 -60
- package/dist/pages/pagesInterfaces.d.ts +133 -141
- package/dist/payments/paymentsApi.d.ts +15 -15
- package/dist/payments/paymentsApi.js +15 -15
- package/dist/payments/paymentsInterfaces.d.ts +58 -57
- package/dist/product-statuses/productStatusesApi.d.ts +7 -7
- package/dist/product-statuses/productStatusesApi.js +7 -7
- package/dist/product-statuses/productStatusesInterfaces.d.ts +21 -21
- package/dist/products/productsApi.d.ts +240 -240
- package/dist/products/productsApi.js +240 -240
- package/dist/products/productsInterfaces.d.ts +311 -311
- package/dist/system/systemApi.d.ts +10 -10
- package/dist/system/systemApi.js +10 -10
- package/dist/templates/templatesApi.d.ts +8 -8
- package/dist/templates/templatesApi.js +8 -8
- package/dist/templates/templatesInterfaces.d.ts +22 -22
- package/dist/templates-preview/templatesPreviewApi.d.ts +5 -5
- package/dist/templates-preview/templatesPreviewApi.js +5 -5
- package/dist/templates-preview/templatesPreviewInterfaces.d.ts +54 -54
- package/dist/users/usersApi.d.ts +29 -29
- package/dist/users/usersApi.js +29 -29
- package/dist/users/usersInterfaces.d.ts +77 -77
- package/package.json +9 -8
|
@@ -17,32 +17,32 @@ export default abstract class AsyncModules extends SyncModules {
|
|
|
17
17
|
protected constructor(state: StateModule);
|
|
18
18
|
/**
|
|
19
19
|
* Performs an HTTP GET request.
|
|
20
|
-
* @param
|
|
21
|
-
* @returns {Promise<any>}
|
|
20
|
+
* @param {string} path - The path to append to the base URL.
|
|
21
|
+
* @returns {Promise<any>} A promise resolving to the response data.
|
|
22
22
|
* @description Define a protected asynchronous method '_fetchGet' that performs a GET request
|
|
23
23
|
*/
|
|
24
24
|
protected _fetchGet(path: string): Promise<any>;
|
|
25
25
|
/**
|
|
26
26
|
* Performs an HTTP POST request.
|
|
27
|
-
* @param
|
|
28
|
-
* @param
|
|
29
|
-
* @returns {Promise<any>}
|
|
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.
|
|
30
30
|
* @description Define a protected asynchronous method '_fetchPost' that performs a POST request
|
|
31
31
|
*/
|
|
32
32
|
protected _fetchPost(path: string, data?: any): Promise<any>;
|
|
33
33
|
/**
|
|
34
34
|
* Performs an HTTP PUT request.
|
|
35
|
-
* @param
|
|
36
|
-
* @param
|
|
37
|
-
* @returns {Promise<any>}
|
|
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.
|
|
38
38
|
* @description Define a protected asynchronous method '_fetchPut' that performs a PUT request
|
|
39
39
|
*/
|
|
40
40
|
protected _fetchPut(path: string, body: any): Promise<any>;
|
|
41
41
|
/**
|
|
42
42
|
* Performs an HTTP DELETE request.
|
|
43
|
-
* @param
|
|
44
|
-
* @param
|
|
45
|
-
* @returns {Promise<any>}
|
|
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.
|
|
46
46
|
* @description Define a protected asynchronous method '_fetchDelete' that performs a DELETE request
|
|
47
47
|
*/
|
|
48
48
|
protected _fetchDelete(path: string, body?: any): Promise<any>;
|
|
@@ -54,16 +54,16 @@ export default abstract class AsyncModules extends SyncModules {
|
|
|
54
54
|
protected refreshToken(): Promise<boolean>;
|
|
55
55
|
/**
|
|
56
56
|
* Creates options for HTTP requests.
|
|
57
|
-
* @param
|
|
58
|
-
* @param
|
|
59
|
-
* @returns {any}
|
|
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.
|
|
60
60
|
*/
|
|
61
61
|
private makeOptions;
|
|
62
62
|
/**
|
|
63
63
|
* Handles responses from the browser's fetch API.
|
|
64
|
-
* @param
|
|
65
|
-
* @param
|
|
66
|
-
* @returns {any}
|
|
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.
|
|
67
67
|
* @description Define an asynchronous method 'browserResponse' that takes a path and options as parameters
|
|
68
68
|
*/
|
|
69
69
|
private browserResponse;
|
|
@@ -25,8 +25,8 @@ class AsyncModules extends syncModules_1.default {
|
|
|
25
25
|
}
|
|
26
26
|
/**
|
|
27
27
|
* Performs an HTTP GET request.
|
|
28
|
-
* @param
|
|
29
|
-
* @returns {Promise<any>}
|
|
28
|
+
* @param {string} path - The path to append to the base URL.
|
|
29
|
+
* @returns {Promise<any>} A promise resolving to the response data.
|
|
30
30
|
* @description Define a protected asynchronous method '_fetchGet' that performs a GET request
|
|
31
31
|
*/
|
|
32
32
|
async _fetchGet(path) {
|
|
@@ -74,9 +74,9 @@ class AsyncModules extends syncModules_1.default {
|
|
|
74
74
|
}
|
|
75
75
|
/**
|
|
76
76
|
* Performs an HTTP POST request.
|
|
77
|
-
* @param
|
|
78
|
-
* @param
|
|
79
|
-
* @returns {Promise<any>}
|
|
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.
|
|
80
80
|
* @description Define a protected asynchronous method '_fetchPost' that performs a POST request
|
|
81
81
|
*/
|
|
82
82
|
async _fetchPost(path, data) {
|
|
@@ -96,10 +96,11 @@ class AsyncModules extends syncModules_1.default {
|
|
|
96
96
|
options, // Pass the options for the request
|
|
97
97
|
(res) => {
|
|
98
98
|
// Handle the response from the server
|
|
99
|
-
|
|
99
|
+
// Initialize a variable to accumulate response data
|
|
100
|
+
let responseData = '';
|
|
100
101
|
// Listen for 'data' events to receive chunks of data from the response
|
|
101
102
|
res.on('data', (chunk) => {
|
|
102
|
-
responseData += chunk;
|
|
103
|
+
responseData += chunk;
|
|
103
104
|
});
|
|
104
105
|
// Listen for the 'end' event to know when the response has been fully received
|
|
105
106
|
res.on('end', () => {
|
|
@@ -128,9 +129,9 @@ class AsyncModules extends syncModules_1.default {
|
|
|
128
129
|
}
|
|
129
130
|
/**
|
|
130
131
|
* Performs an HTTP PUT request.
|
|
131
|
-
* @param
|
|
132
|
-
* @param
|
|
133
|
-
* @returns {Promise<any>}
|
|
132
|
+
* @param {string} path - The path to append to the base URL.
|
|
133
|
+
* @param {any} body - The data to send in the request body.
|
|
134
|
+
* @returns {Promise<any>} A promise resolving to the response data.
|
|
134
135
|
* @description Define a protected asynchronous method '_fetchPut' that performs a PUT request
|
|
135
136
|
*/
|
|
136
137
|
async _fetchPut(path, body) {
|
|
@@ -182,9 +183,9 @@ class AsyncModules extends syncModules_1.default {
|
|
|
182
183
|
}
|
|
183
184
|
/**
|
|
184
185
|
* Performs an HTTP DELETE request.
|
|
185
|
-
* @param
|
|
186
|
-
* @param
|
|
187
|
-
* @returns {Promise<any>}
|
|
186
|
+
* @param {string} path - The path to append to the base URL.
|
|
187
|
+
* @param {any} body - The body of the request.
|
|
188
|
+
* @returns {Promise<any>} A promise resolving to the response data.
|
|
188
189
|
* @description Define a protected asynchronous method '_fetchDelete' that performs a DELETE request
|
|
189
190
|
*/
|
|
190
191
|
async _fetchDelete(path, body) {
|
|
@@ -236,17 +237,28 @@ class AsyncModules extends syncModules_1.default {
|
|
|
236
237
|
* @description Define an asynchronous method 'refreshToken' that attempts to refresh the authentication token
|
|
237
238
|
*/
|
|
238
239
|
async refreshToken() {
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
240
|
+
const url = this.state.url +
|
|
241
|
+
`/api/content/users-auth-providers/marker/` +
|
|
242
|
+
this.state.providerMarker +
|
|
243
|
+
`/users/refresh`;
|
|
244
|
+
/**
|
|
245
|
+
* Perform a fetch request to the specified URL to refresh the token
|
|
246
|
+
* @param {string} url - The URL to which the request will be sent
|
|
247
|
+
* @param {object} options - The options for the fetch request
|
|
248
|
+
* @param {string} options.method - The HTTP method to use for the request (default: 'POST')
|
|
249
|
+
* @param {object} options.headers - Set the necessary headers for the request
|
|
250
|
+
* @param {object} options.body - Send the current refresh token in the request body as a JSON string
|
|
251
|
+
*/
|
|
252
|
+
const response = await fetch(url, {
|
|
243
253
|
method: 'POST',
|
|
244
|
-
// Set the necessary headers for the request
|
|
245
254
|
headers: {
|
|
246
|
-
|
|
247
|
-
'
|
|
255
|
+
// Indicate that the request body is in JSON format
|
|
256
|
+
'Content-Type': 'application/json',
|
|
257
|
+
// Include the application token from the state
|
|
258
|
+
'x-app-token': this.state.token,
|
|
259
|
+
// Include the device fingerprint
|
|
260
|
+
'x-device-metadata': this._getDeviceMetadata(),
|
|
248
261
|
},
|
|
249
|
-
// Send the current refresh token in the request body as a JSON string
|
|
250
262
|
body: JSON.stringify({ refreshToken: this.state.refreshToken }),
|
|
251
263
|
});
|
|
252
264
|
// Check if the response status is OK (status code 200-299)
|
|
@@ -270,9 +282,9 @@ class AsyncModules extends syncModules_1.default {
|
|
|
270
282
|
}
|
|
271
283
|
/**
|
|
272
284
|
* Creates options for HTTP requests.
|
|
273
|
-
* @param
|
|
274
|
-
* @param
|
|
275
|
-
* @returns {any}
|
|
285
|
+
* @param {string} method - The HTTP method (GET, POST, PUT, DELETE, etc.).
|
|
286
|
+
* @param {any} data - Optional data to include in the request body.
|
|
287
|
+
* @returns {any} An object representing the request options.
|
|
276
288
|
*/
|
|
277
289
|
makeOptions(method, data) {
|
|
278
290
|
const options = {
|
|
@@ -315,9 +327,9 @@ class AsyncModules extends syncModules_1.default {
|
|
|
315
327
|
}
|
|
316
328
|
/**
|
|
317
329
|
* Handles responses from the browser's fetch API.
|
|
318
|
-
* @param
|
|
319
|
-
* @param
|
|
320
|
-
* @returns {any}
|
|
330
|
+
* @param {string} path - The path to append to the base URL.
|
|
331
|
+
* @param {any} options - The options for the fetch request.
|
|
332
|
+
* @returns {any} A promise resolving to the response data.
|
|
321
333
|
* @description Define an asynchronous method 'browserResponse' that takes a path and options as parameters
|
|
322
334
|
*/
|
|
323
335
|
async browserResponse(path, options) {
|
package/dist/base/result.d.ts
CHANGED
|
@@ -1,39 +1,39 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Result class for handling response data
|
|
3
|
-
* @description Result class for handling response data
|
|
2
|
+
* Result class for handling response data.
|
|
3
|
+
* @description Result class for handling response data.
|
|
4
4
|
*/
|
|
5
5
|
export default class Result {
|
|
6
6
|
body: any;
|
|
7
7
|
/**
|
|
8
|
-
* Constructor that initializes the class with a given data
|
|
9
|
-
* @param {Response | string} data - Response or string data
|
|
8
|
+
* Constructor that initializes the class with a given data.
|
|
9
|
+
* @param {Response | string} data - Response or string data.
|
|
10
10
|
* @description Constructor that initializes the class with a given data, which can be of type Response or string.
|
|
11
11
|
*/
|
|
12
12
|
constructor(data: Response | string);
|
|
13
13
|
/**
|
|
14
14
|
* Asynchronously converts the body to a blob and returns the current instance.
|
|
15
|
-
* @returns {Promise<Result>} Current instance
|
|
15
|
+
* @returns {Promise<Result>} Current instance.
|
|
16
16
|
* @description Asynchronously converts the body to a blob and returns the current instance.
|
|
17
17
|
*/
|
|
18
18
|
blob(): Promise<Result>;
|
|
19
19
|
/**
|
|
20
20
|
* Asynchronously parses the body as JSON and returns the current instance.
|
|
21
|
-
* @returns {Promise<Result>} Current instance
|
|
21
|
+
* @returns {Promise<Result>} Current instance.
|
|
22
22
|
* @description Asynchronously parses the body as JSON and returns the current instance.
|
|
23
23
|
*/
|
|
24
24
|
json(): Promise<Result>;
|
|
25
25
|
/**
|
|
26
26
|
* Recursively removes language-specific data from the provided data or the body.
|
|
27
|
-
* @param
|
|
28
|
-
* @param
|
|
29
|
-
* @returns {any}
|
|
27
|
+
* @param {string} langCode - Language code.
|
|
28
|
+
* @param {any} [data] - Data to process.
|
|
29
|
+
* @returns {any} Processed data.
|
|
30
30
|
* @description Recursively removes language-specific data from the provided data or the body.
|
|
31
31
|
*/
|
|
32
32
|
makeDataWithoutLang(langCode: string, data?: any): any;
|
|
33
33
|
/**
|
|
34
34
|
* Recursively simplifies arrays in the provided data or the body by removing single-element arrays.
|
|
35
|
-
* @param
|
|
36
|
-
* @returns {any}
|
|
35
|
+
* @param {any} data - The data to simplify.
|
|
36
|
+
* @returns {any} The simplified data.
|
|
37
37
|
*/
|
|
38
38
|
makeDataWithoutArray(data?: any): any;
|
|
39
39
|
}
|
package/dist/base/result.js
CHANGED
|
@@ -4,23 +4,21 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
4
4
|
/* eslint-disable no-restricted-syntax */
|
|
5
5
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
6
6
|
/**
|
|
7
|
-
* Result class for handling response data
|
|
8
|
-
* @description Result class for handling response data
|
|
7
|
+
* Result class for handling response data.
|
|
8
|
+
* @description Result class for handling response data.
|
|
9
9
|
*/
|
|
10
10
|
class Result {
|
|
11
|
-
// Constructor that initializes the class with a given data, which can be of type Response or string.
|
|
12
11
|
/**
|
|
13
|
-
* Constructor that initializes the class with a given data
|
|
14
|
-
* @param {Response | string} data - Response or string data
|
|
12
|
+
* Constructor that initializes the class with a given data.
|
|
13
|
+
* @param {Response | string} data - Response or string data.
|
|
15
14
|
* @description Constructor that initializes the class with a given data, which can be of type Response or string.
|
|
16
15
|
*/
|
|
17
16
|
constructor(data) {
|
|
18
17
|
this.body = data;
|
|
19
18
|
}
|
|
20
|
-
// Asynchronously converts the body to a blob and returns the current instance.
|
|
21
19
|
/**
|
|
22
20
|
* Asynchronously converts the body to a blob and returns the current instance.
|
|
23
|
-
* @returns {Promise<Result>} Current instance
|
|
21
|
+
* @returns {Promise<Result>} Current instance.
|
|
24
22
|
* @description Asynchronously converts the body to a blob and returns the current instance.
|
|
25
23
|
*/
|
|
26
24
|
async blob() {
|
|
@@ -28,10 +26,9 @@ class Result {
|
|
|
28
26
|
this.body = await this.body.blob();
|
|
29
27
|
return this;
|
|
30
28
|
}
|
|
31
|
-
// Asynchronously parses the body as JSON and returns the current instance.
|
|
32
29
|
/**
|
|
33
30
|
* Asynchronously parses the body as JSON and returns the current instance.
|
|
34
|
-
* @returns {Promise<Result>} Current instance
|
|
31
|
+
* @returns {Promise<Result>} Current instance.
|
|
35
32
|
* @description Asynchronously parses the body as JSON and returns the current instance.
|
|
36
33
|
*/
|
|
37
34
|
async json() {
|
|
@@ -42,12 +39,11 @@ class Result {
|
|
|
42
39
|
: this.body.json();
|
|
43
40
|
return this;
|
|
44
41
|
}
|
|
45
|
-
// Recursively removes language-specific data from the provided data or the body.
|
|
46
42
|
/**
|
|
47
43
|
* Recursively removes language-specific data from the provided data or the body.
|
|
48
|
-
* @param
|
|
49
|
-
* @param
|
|
50
|
-
* @returns {any}
|
|
44
|
+
* @param {string} langCode - Language code.
|
|
45
|
+
* @param {any} [data] - Data to process.
|
|
46
|
+
* @returns {any} Processed data.
|
|
51
47
|
* @description Recursively removes language-specific data from the provided data or the body.
|
|
52
48
|
*/
|
|
53
49
|
makeDataWithoutLang(langCode, data) {
|
|
@@ -66,7 +62,7 @@ class Result {
|
|
|
66
62
|
data[key] = data[key][langCode];
|
|
67
63
|
}
|
|
68
64
|
else if (typeof data[key] === 'object' && data[key] != null) {
|
|
69
|
-
// If the value is an object, recursively process it
|
|
65
|
+
// If the value is an object, recursively process it.
|
|
70
66
|
data[key] = this.makeDataWithoutLang(langCode, data[key]);
|
|
71
67
|
}
|
|
72
68
|
else if (Array.isArray(data[key])) {
|
|
@@ -106,8 +102,8 @@ class Result {
|
|
|
106
102
|
}
|
|
107
103
|
/**
|
|
108
104
|
* Recursively simplifies arrays in the provided data or the body by removing single-element arrays.
|
|
109
|
-
* @param
|
|
110
|
-
* @returns {any}
|
|
105
|
+
* @param {any} data - The data to simplify.
|
|
106
|
+
* @returns {any} The simplified data.
|
|
111
107
|
*/
|
|
112
108
|
makeDataWithoutArray(data) {
|
|
113
109
|
if (data) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { IConfig, IError } from './utils';
|
|
2
2
|
/**
|
|
3
|
-
* State module for managing application state and configuration
|
|
4
|
-
* @description State module for managing application state and configuration
|
|
3
|
+
* State module for managing application state and configuration.
|
|
4
|
+
* @description State module for managing application state and configuration.
|
|
5
5
|
*/
|
|
6
6
|
export default class StateModule {
|
|
7
7
|
url: string | undefined;
|
|
@@ -10,6 +10,7 @@ export default class StateModule {
|
|
|
10
10
|
accessToken: string | undefined;
|
|
11
11
|
traficLimit: boolean;
|
|
12
12
|
refreshToken: string | undefined;
|
|
13
|
+
providerMarker: string;
|
|
13
14
|
customAuth: boolean;
|
|
14
15
|
_NO_FETCH: boolean;
|
|
15
16
|
_https: any;
|
|
@@ -24,9 +25,9 @@ export default class StateModule {
|
|
|
24
25
|
saveFunction: (param: string) => void | null;
|
|
25
26
|
/**
|
|
26
27
|
* Constructor for StateModule
|
|
27
|
-
* @param {string}
|
|
28
|
-
* @param {IConfig} config - Configuration object
|
|
29
|
-
* @description Constructor for StateModule
|
|
28
|
+
* @param {string} url - Base URL for API requests.
|
|
29
|
+
* @param {IConfig} config - Configuration object.
|
|
30
|
+
* @description Constructor for StateModule.
|
|
30
31
|
*/
|
|
31
32
|
constructor(url: string, config: IConfig);
|
|
32
33
|
}
|
package/dist/base/stateModule.js
CHANGED
|
@@ -34,24 +34,25 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
34
34
|
})();
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
36
|
/**
|
|
37
|
-
* State module for managing application state and configuration
|
|
38
|
-
* @description State module for managing application state and configuration
|
|
37
|
+
* State module for managing application state and configuration.
|
|
38
|
+
* @description State module for managing application state and configuration.
|
|
39
39
|
*/
|
|
40
40
|
class StateModule {
|
|
41
41
|
/**
|
|
42
42
|
* Constructor for StateModule
|
|
43
|
-
* @param {string}
|
|
44
|
-
* @param {IConfig} config - Configuration object
|
|
45
|
-
* @description Constructor for StateModule
|
|
43
|
+
* @param {string} url - Base URL for API requests.
|
|
44
|
+
* @param {IConfig} config - Configuration object.
|
|
45
|
+
* @description Constructor for StateModule.
|
|
46
46
|
*/
|
|
47
47
|
constructor(url, config) {
|
|
48
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
|
|
48
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
|
|
49
49
|
this.url = url;
|
|
50
50
|
this.lang = (_a = config.langCode) !== null && _a !== void 0 ? _a : 'en_US';
|
|
51
51
|
this.token = config.token;
|
|
52
52
|
this.traficLimit = config.traficLimit || false;
|
|
53
53
|
this.refreshToken = (_c = (_b = config.auth) === null || _b === void 0 ? void 0 : _b.refreshToken) !== null && _c !== void 0 ? _c : undefined;
|
|
54
|
-
this.
|
|
54
|
+
this.providerMarker = (_e = (_d = config.auth) === null || _d === void 0 ? void 0 : _d.providerMarker) !== null && _e !== void 0 ? _e : 'email';
|
|
55
|
+
this.customAuth = (_g = (_f = config.auth) === null || _f === void 0 ? void 0 : _f.customAuth) !== null && _g !== void 0 ? _g : false;
|
|
55
56
|
this.errorsFunctions = {
|
|
56
57
|
'400': undefined,
|
|
57
58
|
'401': undefined,
|
|
@@ -59,20 +60,20 @@ class StateModule {
|
|
|
59
60
|
'404': undefined,
|
|
60
61
|
'500': undefined,
|
|
61
62
|
};
|
|
62
|
-
this.saveFunction = (
|
|
63
|
+
this.saveFunction = (_j = (_h = config.auth) === null || _h === void 0 ? void 0 : _h.saveFunction) !== null && _j !== void 0 ? _j : null;
|
|
63
64
|
if (config.errors) {
|
|
64
|
-
this.isShell = (
|
|
65
|
+
this.isShell = (_k = config.errors.isShell) !== null && _k !== void 0 ? _k : true;
|
|
65
66
|
if (config.errors.customErrors) {
|
|
66
67
|
this.errorsFunctions['400'] =
|
|
67
|
-
(
|
|
68
|
+
(_l = config.errors.customErrors['400']) !== null && _l !== void 0 ? _l : undefined;
|
|
68
69
|
this.errorsFunctions['401'] =
|
|
69
|
-
(
|
|
70
|
+
(_m = config.errors.customErrors['401']) !== null && _m !== void 0 ? _m : undefined;
|
|
70
71
|
this.errorsFunctions['403'] =
|
|
71
|
-
(
|
|
72
|
+
(_o = config.errors.customErrors['403']) !== null && _o !== void 0 ? _o : undefined;
|
|
72
73
|
this.errorsFunctions['404'] =
|
|
73
|
-
(
|
|
74
|
+
(_p = config.errors.customErrors['404']) !== null && _p !== void 0 ? _p : undefined;
|
|
74
75
|
this.errorsFunctions['500'] =
|
|
75
|
-
(
|
|
76
|
+
(_q = config.errors.customErrors['400']) !== null && _q !== void 0 ? _q : undefined;
|
|
76
77
|
}
|
|
77
78
|
}
|
|
78
79
|
else {
|
|
@@ -2,65 +2,70 @@ import type { IUploadingQuery } from '../file-uploading/fileUploadingInterfaces'
|
|
|
2
2
|
import type { IProductsQuery } from '../products/productsInterfaces';
|
|
3
3
|
import type StateModule from './stateModule';
|
|
4
4
|
/**
|
|
5
|
-
*
|
|
5
|
+
* Abstract class representing synchronization modules.
|
|
6
6
|
*/
|
|
7
7
|
export default abstract class SyncModules {
|
|
8
|
+
/** Protected properties for state and URL */
|
|
8
9
|
protected state: StateModule;
|
|
9
10
|
protected _url: string;
|
|
11
|
+
/**
|
|
12
|
+
* Constructor to initialize state and URL.
|
|
13
|
+
* @param {StateModule} state - StateModule instance.
|
|
14
|
+
*/
|
|
10
15
|
protected constructor(state: StateModule);
|
|
11
16
|
/**
|
|
12
17
|
* Constructs the full URL path by appending the given path to the base URL.
|
|
13
|
-
* @param
|
|
14
|
-
* @returns {string}
|
|
18
|
+
* @param {string} path - The path to append to the base URL.
|
|
19
|
+
* @returns {string} The full URL as a string.
|
|
15
20
|
*/
|
|
16
21
|
protected _getFullPath(path: string): string;
|
|
17
22
|
/**
|
|
18
23
|
* Converts query parameters into a query string.
|
|
19
|
-
* @param
|
|
20
|
-
* @returns {string}
|
|
24
|
+
* @param {IProductsQuery | IUploadingQuery | any} query - The query object containing key-value pairs.
|
|
25
|
+
* @returns {string} A string representation of the query parameters.
|
|
21
26
|
*/
|
|
22
27
|
protected _queryParamsToString(query: IProductsQuery | IUploadingQuery | any): string;
|
|
23
28
|
/**
|
|
24
29
|
* Normalizes data based on language code.
|
|
25
|
-
* @param
|
|
26
|
-
* @param
|
|
27
|
-
* @returns {any}
|
|
30
|
+
* @param {any} data - The data to normalize.
|
|
31
|
+
* @param {string} langCode - The language code for normalization.
|
|
32
|
+
* @returns {any} Normalized data.
|
|
28
33
|
*/
|
|
29
34
|
protected _normalizeData(data: any, langCode?: string): any;
|
|
30
35
|
/**
|
|
31
36
|
* Normalizes the body of a POST request.
|
|
32
|
-
* @param
|
|
33
|
-
* @param
|
|
34
|
-
* @returns {any}
|
|
37
|
+
* @param {any} body - The body to normalize.
|
|
38
|
+
* @param {string} [langCode] - The language code for normalization.
|
|
39
|
+
* @returns {any} Normalized body.
|
|
35
40
|
*/
|
|
36
41
|
protected _normalizePostBody(body: any, langCode?: string): any;
|
|
37
42
|
/**
|
|
38
43
|
* Clears arrays within the data structure.
|
|
39
|
-
* @param
|
|
40
|
-
* @returns {any}
|
|
44
|
+
* @param {Record<string, any>} data - The data to clear.
|
|
45
|
+
* @returns {any} Cleared data.
|
|
41
46
|
*/
|
|
42
47
|
protected _clearArray(data: Record<string, any>): any;
|
|
43
48
|
/**
|
|
44
49
|
* Sorts attributes by their positions.
|
|
45
|
-
* @param
|
|
46
|
-
* @returns {any}
|
|
50
|
+
* @param {any} data - The data containing attributes.
|
|
51
|
+
* @returns {any} Sorted attributes.
|
|
47
52
|
*/
|
|
48
53
|
protected _sortAttributes: (data: any) => any;
|
|
49
54
|
/**
|
|
50
55
|
* Adds a specified number of days to a date.
|
|
51
|
-
* @param
|
|
52
|
-
* @param
|
|
53
|
-
* @returns {any}
|
|
56
|
+
* @param {Date} date - The initial date.
|
|
57
|
+
* @param {number} days - The number of days to add.
|
|
58
|
+
* @returns {any} The new date with added days.
|
|
54
59
|
*/
|
|
55
|
-
protected _addDays(date: Date, days: number):
|
|
60
|
+
protected _addDays(date: Date, days: number): any;
|
|
56
61
|
/**
|
|
57
62
|
* Generates intervals for a specific date based on a schedule.
|
|
58
|
-
* @param {Date}
|
|
59
|
-
* @param {object}
|
|
60
|
-
* @param {boolean}
|
|
61
|
-
* @param {any[]}
|
|
62
|
-
* @param {boolean}
|
|
63
|
-
* @param {Set<Array<string>>} utcIntervals
|
|
63
|
+
* @param {Date} date - The date for which to generate intervals.
|
|
64
|
+
* @param {object} schedule - The schedule defining the intervals.
|
|
65
|
+
* @param {boolean} schedule.inEveryWeek - The number of weeks between intervals.
|
|
66
|
+
* @param {any[]} schedule.times - The times for each interval.
|
|
67
|
+
* @param {boolean} schedule.inEveryMonth - The month intervals for each interval.
|
|
68
|
+
* @param {Set<Array<string>>} utcIntervals - A set to store unique intervals.
|
|
64
69
|
*/
|
|
65
70
|
protected _generateIntervalsForDate(date: Date, schedule: {
|
|
66
71
|
inEveryWeek: boolean;
|
|
@@ -69,33 +74,33 @@ export default abstract class SyncModules {
|
|
|
69
74
|
}, utcIntervals: Set<Array<string>>): void;
|
|
70
75
|
/**
|
|
71
76
|
* Adds time intervals to schedules.
|
|
72
|
-
* @param
|
|
73
|
-
* @returns {any}
|
|
77
|
+
* @param {any[]} schedules - The schedules to process.
|
|
78
|
+
* @returns {any} Schedules with added time intervals.
|
|
74
79
|
*/
|
|
75
|
-
_addTimeIntervalsToSchedules(schedules: any[]): any
|
|
80
|
+
_addTimeIntervalsToSchedules(schedules: any[]): any;
|
|
76
81
|
/**
|
|
77
82
|
* Normalizes attributes within the data.
|
|
78
|
-
* @param
|
|
79
|
-
* @returns {any}
|
|
83
|
+
* @param {any} data - The data to normalize.
|
|
84
|
+
* @returns {any} Normalized attributes.
|
|
80
85
|
*/
|
|
81
86
|
protected _normalizeAttr(data: any): any;
|
|
82
87
|
/**
|
|
83
88
|
* Processes data after fetching or receiving it.
|
|
84
|
-
* @param
|
|
85
|
-
* @param
|
|
86
|
-
* @returns {any}
|
|
89
|
+
* @param {any} data - The data to process.
|
|
90
|
+
* @param {any} [langCode] - The language code for processing.
|
|
91
|
+
* @returns {any} Processed data.
|
|
87
92
|
*/
|
|
88
93
|
protected _dataPostProcess(data: any, langCode?: string): any;
|
|
89
94
|
/**
|
|
90
95
|
* Sets the access token in the state.
|
|
91
|
-
* @param
|
|
92
|
-
* @returns {any}
|
|
96
|
+
* @param {string} accessToken - The access token to set.
|
|
97
|
+
* @returns {any} The instance of SyncModules for chaining.
|
|
93
98
|
*/
|
|
94
99
|
setAccessToken(accessToken: string): any;
|
|
95
100
|
/**
|
|
96
101
|
* Sets the refresh token in the state.
|
|
97
|
-
* @param
|
|
98
|
-
* @returns {any}
|
|
102
|
+
* @param {string} refreshToken - The refresh token to set.
|
|
103
|
+
* @returns {any} The instance of SyncModules for chaining.
|
|
99
104
|
*/
|
|
100
105
|
setRefreshToken(refreshToken: string): any;
|
|
101
106
|
/**
|