oneentry 1.0.126 → 1.0.128
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 +18 -13
- package/dist/admins/adminsApi.js +18 -13
- package/dist/admins/adminsInterfaces.d.ts +16 -25
- package/dist/attribute-sets/attributeSetsApi.d.ts +14 -15
- package/dist/attribute-sets/attributeSetsApi.js +14 -15
- package/dist/attribute-sets/attributeSetsInterfaces.d.ts +78 -84
- package/dist/auth-provider/authProviderApi.d.ts +53 -79
- package/dist/auth-provider/authProviderApi.js +52 -78
- package/dist/auth-provider/authProvidersInterfaces.d.ts +98 -94
- package/dist/base/asyncModules.d.ts +23 -21
- package/dist/base/asyncModules.js +39 -29
- package/dist/base/result.d.ts +31 -0
- package/dist/base/result.js +32 -5
- package/dist/base/stateModule.d.ts +10 -0
- package/dist/base/stateModule.js +50 -2
- package/dist/base/syncModules.d.ts +42 -50
- package/dist/base/syncModules.js +106 -58
- package/dist/base/utils.d.ts +33 -2
- package/dist/blocks/blocksApi.d.ts +9 -18
- package/dist/blocks/blocksApi.js +9 -18
- package/dist/blocks/blocksInterfaces.d.ts +41 -46
- package/dist/config.d.ts +13 -0
- package/dist/config.js +30 -0
- package/dist/events/eventsApi.d.ts +10 -27
- package/dist/events/eventsApi.js +26 -40
- package/dist/events/eventsInterfaces.d.ts +33 -28
- package/dist/file-uploading/fileUploadingApi.d.ts +12 -17
- package/dist/file-uploading/fileUploadingApi.js +14 -17
- package/dist/file-uploading/fileUploadingInterfaces.d.ts +8 -19
- package/dist/forms/formsApi.d.ts +10 -9
- package/dist/forms/formsApi.js +10 -9
- package/dist/forms/formsInterfaces.d.ts +20 -12
- package/dist/forms-data/formsDataApi.d.ts +24 -28
- package/dist/forms-data/formsDataApi.js +25 -28
- package/dist/forms-data/formsDataInterfaces.d.ts +71 -71
- package/dist/general-types/generalTypesApi.d.ts +5 -5
- package/dist/general-types/generalTypesApi.js +5 -5
- package/dist/general-types/generalTypesInterfaces.d.ts +5 -8
- package/dist/index.d.ts +3 -4
- package/dist/index.js +3 -4
- package/dist/integration-collections/integrationCollectionsApi.d.ts +29 -47
- package/dist/integration-collections/integrationCollectionsApi.js +31 -51
- package/dist/integration-collections/integrationCollectionsInterfaces.d.ts +62 -58
- package/dist/locales/localesApi.d.ts +7 -3
- package/dist/locales/localesApi.js +7 -3
- package/dist/locales/localesInterfaces.d.ts +6 -5
- package/dist/menus/menusApi.d.ts +7 -3
- package/dist/menus/menusApi.js +7 -3
- package/dist/menus/menusInterfaces.d.ts +5 -10
- package/dist/menus/menusInterfaces.js +1 -0
- package/dist/orders/ordersApi.d.ts +17 -25
- package/dist/orders/ordersApi.js +17 -26
- package/dist/orders/ordersInterfaces.d.ts +94 -53
- package/dist/pages/pagesApi.d.ts +47 -60
- package/dist/pages/pagesApi.js +51 -61
- package/dist/pages/pagesInterfaces.d.ts +44 -48
- package/dist/payments/paymentsApi.d.ts +17 -27
- package/dist/payments/paymentsApi.js +17 -31
- package/dist/payments/paymentsInterfaces.d.ts +35 -29
- package/dist/product-statuses/productStatusesApi.d.ts +9 -9
- package/dist/product-statuses/productStatusesApi.js +9 -9
- package/dist/product-statuses/productStatusesInterfaces.d.ts +14 -12
- package/dist/products/productsApi.d.ts +23 -44
- package/dist/products/productsApi.js +24 -44
- package/dist/products/productsInterfaces.d.ts +51 -57
- package/dist/system/systemApi.d.ts +11 -13
- package/dist/system/systemApi.js +12 -13
- package/dist/system/systemInterfaces.d.ts +14 -3
- package/dist/templates/templatesApi.d.ts +8 -11
- package/dist/templates/templatesApi.js +8 -11
- package/dist/templates/templatesInterfaces.d.ts +13 -12
- package/dist/templates-preview/templatesPreviewApi.d.ts +7 -8
- package/dist/templates-preview/templatesPreviewApi.js +7 -8
- package/dist/templates-preview/templatesPreviewInterfaces.d.ts +15 -18
- package/dist/users/usersApi.d.ts +13 -20
- package/dist/users/usersApi.js +13 -20
- package/dist/users/usersInterfaces.d.ts +26 -30
- 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
|
@@ -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 path - The path to append to the base URL.
|
|
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 path
|
|
75
|
-
* @param data - The data to send in the request body.
|
|
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) {
|
|
@@ -93,16 +96,18 @@ class AsyncModules extends syncModules_1.default {
|
|
|
93
96
|
options, // Pass the options for the request
|
|
94
97
|
(res) => {
|
|
95
98
|
// Handle the response from the server
|
|
96
|
-
|
|
99
|
+
// Initialize a variable to accumulate response data
|
|
100
|
+
let responseData = '';
|
|
97
101
|
// Listen for 'data' events to receive chunks of data from the response
|
|
98
102
|
res.on('data', (chunk) => {
|
|
99
|
-
responseData += chunk;
|
|
103
|
+
responseData += chunk;
|
|
100
104
|
});
|
|
101
105
|
// Listen for the 'end' event to know when the response has been fully received
|
|
102
106
|
res.on('end', () => {
|
|
103
107
|
try {
|
|
104
108
|
// Attempt to parse the accumulated response data as JSON and resolve the promise with it
|
|
105
109
|
resolve(JSON.parse(responseData));
|
|
110
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
106
111
|
}
|
|
107
112
|
catch (error) {
|
|
108
113
|
// If parsing fails, resolve the promise with the raw response data
|
|
@@ -124,14 +129,14 @@ class AsyncModules extends syncModules_1.default {
|
|
|
124
129
|
}
|
|
125
130
|
/**
|
|
126
131
|
* Performs an HTTP PUT request.
|
|
127
|
-
* @param path - The path to append to the base URL.
|
|
128
|
-
* @param
|
|
129
|
-
* @
|
|
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.
|
|
130
135
|
* @description Define a protected asynchronous method '_fetchPut' that performs a PUT request
|
|
131
136
|
*/
|
|
132
|
-
async _fetchPut(path,
|
|
137
|
+
async _fetchPut(path, body) {
|
|
133
138
|
// Create options for the PUT request using the 'makeOptions' method, including the data to be sent
|
|
134
|
-
const options = this.makeOptions('PUT',
|
|
139
|
+
const options = this.makeOptions('PUT', body);
|
|
135
140
|
// Check if the fetch operation should be performed using the Fetch API or an alternative method
|
|
136
141
|
if (!this._NO_FETCH) {
|
|
137
142
|
// If Fetch API is allowed, use 'browserResponse' to perform the request and return the result
|
|
@@ -156,6 +161,7 @@ class AsyncModules extends syncModules_1.default {
|
|
|
156
161
|
try {
|
|
157
162
|
// Attempt to parse the accumulated response data as JSON and resolve the promise with it
|
|
158
163
|
resolve(JSON.parse(responseData));
|
|
164
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
159
165
|
}
|
|
160
166
|
catch (error) {
|
|
161
167
|
// If parsing fails, resolve the promise with the raw response data
|
|
@@ -169,7 +175,7 @@ class AsyncModules extends syncModules_1.default {
|
|
|
169
175
|
reject(error);
|
|
170
176
|
});
|
|
171
177
|
// Write the provided data to the request body in JSON format
|
|
172
|
-
req.write(JSON.stringify(
|
|
178
|
+
req.write(JSON.stringify(body));
|
|
173
179
|
// End the request to signal that all data has been sent
|
|
174
180
|
req.end();
|
|
175
181
|
});
|
|
@@ -177,15 +183,14 @@ class AsyncModules extends syncModules_1.default {
|
|
|
177
183
|
}
|
|
178
184
|
/**
|
|
179
185
|
* Performs an HTTP DELETE request.
|
|
180
|
-
* @param path - The path to append to the base URL.
|
|
181
|
-
* @param
|
|
182
|
-
* @
|
|
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.
|
|
183
189
|
* @description Define a protected asynchronous method '_fetchDelete' that performs a DELETE request
|
|
184
190
|
*/
|
|
185
|
-
|
|
186
|
-
async _fetchDelete(path, data) {
|
|
191
|
+
async _fetchDelete(path, body) {
|
|
187
192
|
// Create options for the DELETE request using the 'makeOptions' method
|
|
188
|
-
const options = this.makeOptions('DELETE');
|
|
193
|
+
const options = this.makeOptions('DELETE', body);
|
|
189
194
|
// Check if the fetch operation should be performed using the Fetch API or an alternative method
|
|
190
195
|
if (!this._NO_FETCH) {
|
|
191
196
|
// If Fetch API is allowed, use 'browserResponse' to perform the request and return the result
|
|
@@ -210,6 +215,7 @@ class AsyncModules extends syncModules_1.default {
|
|
|
210
215
|
try {
|
|
211
216
|
// Attempt to parse the accumulated response data as JSON and resolve the promise with it
|
|
212
217
|
resolve(JSON.parse(responseData));
|
|
218
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
213
219
|
}
|
|
214
220
|
catch (error) {
|
|
215
221
|
// If parsing fails, resolve the promise with the raw response data
|
|
@@ -227,7 +233,7 @@ class AsyncModules extends syncModules_1.default {
|
|
|
227
233
|
}
|
|
228
234
|
/**
|
|
229
235
|
* Refreshes the authentication token.
|
|
230
|
-
* @
|
|
236
|
+
* @returns {Promise<boolean>} A promise resolving to a boolean indicating success or failure.
|
|
231
237
|
* @description Define an asynchronous method 'refreshToken' that attempts to refresh the authentication token
|
|
232
238
|
*/
|
|
233
239
|
async refreshToken() {
|
|
@@ -238,8 +244,12 @@ class AsyncModules extends syncModules_1.default {
|
|
|
238
244
|
method: 'POST',
|
|
239
245
|
// Set the necessary headers for the request
|
|
240
246
|
headers: {
|
|
241
|
-
|
|
242
|
-
'
|
|
247
|
+
// Indicate that the request body is in JSON format
|
|
248
|
+
'Content-Type': 'application/json',
|
|
249
|
+
// Include the application token from the state
|
|
250
|
+
'x-app-token': this.state.token,
|
|
251
|
+
// Include the device fingerprint
|
|
252
|
+
'x-device-metadata': this._getDeviceMetadata(),
|
|
243
253
|
},
|
|
244
254
|
// Send the current refresh token in the request body as a JSON string
|
|
245
255
|
body: JSON.stringify({ refreshToken: this.state.refreshToken }),
|
|
@@ -265,9 +275,9 @@ class AsyncModules extends syncModules_1.default {
|
|
|
265
275
|
}
|
|
266
276
|
/**
|
|
267
277
|
* Creates options for HTTP requests.
|
|
268
|
-
* @param method - The HTTP method (GET, POST, PUT, DELETE, etc.).
|
|
269
|
-
* @param data - Optional data to include in the request body.
|
|
270
|
-
* @
|
|
278
|
+
* @param {string} method - The HTTP method (GET, POST, PUT, DELETE, etc.).
|
|
279
|
+
* @param {any} data - Optional data to include in the request body.
|
|
280
|
+
* @returns {any} An object representing the request options.
|
|
271
281
|
*/
|
|
272
282
|
makeOptions(method, data) {
|
|
273
283
|
const options = {
|
|
@@ -310,9 +320,9 @@ class AsyncModules extends syncModules_1.default {
|
|
|
310
320
|
}
|
|
311
321
|
/**
|
|
312
322
|
* Handles responses from the browser's fetch API.
|
|
313
|
-
* @param path - The path to append to the base URL.
|
|
314
|
-
* @param options - The options for the fetch request.
|
|
315
|
-
* @
|
|
323
|
+
* @param {string} path - The path to append to the base URL.
|
|
324
|
+
* @param {any} options - The options for the fetch request.
|
|
325
|
+
* @returns {any} A promise resolving to the response data.
|
|
316
326
|
* @description Define an asynchronous method 'browserResponse' that takes a path and options as parameters
|
|
317
327
|
*/
|
|
318
328
|
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,36 @@
|
|
|
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
|
+
/**
|
|
12
|
+
* Constructor that initializes the class with a given data
|
|
13
|
+
* @param {Response | string} data - Response or string data
|
|
14
|
+
* @description Constructor that initializes the class with a given data, which can be of type Response or string.
|
|
15
|
+
*/
|
|
7
16
|
constructor(data) {
|
|
8
17
|
this.body = data;
|
|
9
18
|
}
|
|
10
|
-
|
|
19
|
+
/**
|
|
20
|
+
* Asynchronously converts the body to a blob and returns the current instance.
|
|
21
|
+
* @returns {Promise<Result>} Current instance
|
|
22
|
+
* @description Asynchronously converts the body to a blob and returns the current instance.
|
|
23
|
+
*/
|
|
11
24
|
async blob() {
|
|
12
25
|
// Convert the body to a blob using the blob() method.
|
|
13
26
|
this.body = await this.body.blob();
|
|
14
27
|
return this;
|
|
15
28
|
}
|
|
16
|
-
|
|
29
|
+
/**
|
|
30
|
+
* Asynchronously parses the body as JSON and returns the current instance.
|
|
31
|
+
* @returns {Promise<Result>} Current instance
|
|
32
|
+
* @description Asynchronously parses the body as JSON and returns the current instance.
|
|
33
|
+
*/
|
|
17
34
|
async json() {
|
|
18
35
|
// Check if the body is a string, then parse it as JSON, otherwise call the json() method.
|
|
19
36
|
this.body =
|
|
@@ -22,7 +39,13 @@ class Result {
|
|
|
22
39
|
: this.body.json();
|
|
23
40
|
return this;
|
|
24
41
|
}
|
|
25
|
-
|
|
42
|
+
/**
|
|
43
|
+
* Recursively removes language-specific data from the provided data or the body.
|
|
44
|
+
* @param {string} langCode - Language code
|
|
45
|
+
* @param {any} [data] - Data to process
|
|
46
|
+
* @returns {any} Processed data
|
|
47
|
+
* @description Recursively removes language-specific data from the provided data or the body.
|
|
48
|
+
*/
|
|
26
49
|
makeDataWithoutLang(langCode, data) {
|
|
27
50
|
if (data) {
|
|
28
51
|
// If data is an array, recursively process each item.
|
|
@@ -77,7 +100,11 @@ class Result {
|
|
|
77
100
|
return this;
|
|
78
101
|
}
|
|
79
102
|
}
|
|
80
|
-
|
|
103
|
+
/**
|
|
104
|
+
* Recursively simplifies arrays in the provided data or the body by removing single-element arrays.
|
|
105
|
+
* @param {any} data - The data to simplify.
|
|
106
|
+
* @returns {any} The simplified data.
|
|
107
|
+
*/
|
|
81
108
|
makeDataWithoutArray(data) {
|
|
82
109
|
if (data) {
|
|
83
110
|
// 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
|
-
_addTimeIntervalsToSchedules(schedules: any[]): any
|
|
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
|
}
|