@dxtmisha/functional-basic 0.12.4 → 0.12.7

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/dist/library.d.ts CHANGED
@@ -100,13 +100,6 @@ export declare class Api {
100
100
  * @param callback function for call/ функция для вызова
101
101
  */
102
102
  static setPreparation(callback: (apiFetch: ApiFetch) => Promise<void>): Api;
103
- /**
104
- * Set config for API.
105
- *
106
- * Установить конфигурацию для API.
107
- * @param config config for API/ конфигурация для API
108
- */
109
- static setConfig(config?: ApiConfig): Api;
110
103
  /**
111
104
  * Modify the function after the request.
112
105
  *
@@ -114,6 +107,20 @@ export declare class Api {
114
107
  * @param callback function for call/ функция для вызова
115
108
  */
116
109
  static setEnd(callback: (query: Response, apiFetch: ApiFetch) => Promise<ApiPreparationEnd>): Api;
110
+ /**
111
+ * Change the timeout for the request in milliseconds.
112
+ *
113
+ * Изменить таймаут запроса в миллисекундах.
114
+ * @param timeout timeout in milliseconds/ таймаут в миллисекундах
115
+ */
116
+ static setTimeout(timeout: number): Api;
117
+ /**
118
+ * Set config for API.
119
+ *
120
+ * Установить конфигурацию для API.
121
+ * @param config config for API/ конфигурация для API
122
+ */
123
+ static setConfig(config?: ApiConfig): Api;
117
124
  /**
118
125
  * To execute a request.
119
126
  *
@@ -165,6 +172,8 @@ export declare type ApiConfig = {
165
172
  preparation?: (apiFetch: ApiFetch) => Promise<void>;
166
173
  /** Function to call after request/ Функция для вызова после запроса */
167
174
  end: (query: Response, apiFetch: ApiFetch) => Promise<ApiPreparationEnd>;
175
+ /** Timeout for the request in milliseconds/ Таймаут запроса в миллисекундах */
176
+ timeout?: number;
168
177
  };
169
178
 
170
179
  /**
@@ -266,6 +275,10 @@ export declare type ApiFetch = {
266
275
  hideError?: boolean;
267
276
  /** Suppress loading/ Подавить загрузку */
268
277
  hideLoading?: boolean;
278
+ /** Retry count/ Количество повторов */
279
+ retry?: number;
280
+ /** Retry delay in milliseconds/ Задержка повтора в миллисекундах */
281
+ retryDelay?: number;
269
282
  /** Custom response processor/ Пользовательский процессор ответа */
270
283
  queryReturn?: (query: Response) => Promise<any>;
271
284
  /** Run global preparation hooks/ Запускать глобальные хуки подготовки */
@@ -325,6 +338,8 @@ export declare class ApiInstance {
325
338
  protected loading: LoadingInstance;
326
339
  /** Error handler / Обработчик ошибок */
327
340
  protected errorCenter: ErrorCenterInstance;
341
+ /** Timeout for the request in milliseconds/ Таймаут запроса в миллисекундах */
342
+ protected timeout: number;
328
343
  /**
329
344
  * Constructor
330
345
  * @param url base path to the script/ базовый путь к скрипту
@@ -407,6 +422,13 @@ export declare class ApiInstance {
407
422
  * @param callback function for call/ функция для вызова
408
423
  */
409
424
  setEnd(callback: (query: Response, apiFetch: ApiFetch) => Promise<ApiPreparationEnd>): this;
425
+ /**
426
+ * Change the timeout for the request in milliseconds.
427
+ *
428
+ * Изменить таймаут запроса в миллисекундах.
429
+ * @param timeout timeout in milliseconds/ таймаут в миллисекундах
430
+ */
431
+ setTimeout(timeout: number): this;
410
432
  /**
411
433
  * To execute a request.
412
434
  *
@@ -442,13 +464,22 @@ export declare class ApiInstance {
442
464
  * @param request list of parameters/ список параметров
443
465
  */
444
466
  delete<T>(request: ApiFetch): Promise<T>;
467
+ /**
468
+ * Get retry delay.
469
+ *
470
+ * Получить задержку повтора.
471
+ * @param retryCount count of retries/ количество повторов
472
+ * @param retryDelay delay between retries/ задержка между повторами
473
+ */
474
+ protected getRetryDelay(retryCount: number, retryDelay: number): number;
445
475
  /**
446
476
  * To execute a request.
447
477
  *
448
478
  * Выполнить запрос.
449
479
  * @param apiFetch property of the request/ свойство запроса
480
+ * @param retryCount count of retries/ количество повторов
450
481
  */
451
- protected fetch<T>(apiFetch: ApiFetch): Promise<T>;
482
+ protected fetch<T>(apiFetch: ApiFetch, retryCount?: number): Promise<T>;
452
483
  /**
453
484
  * Reading data from the response.
454
485
  *
@@ -1092,6 +1123,14 @@ export declare class CacheStatic {
1092
1123
  static get<T>(name: string, callback: () => T, comparison?: any[]): T;
1093
1124
  }
1094
1125
 
1126
+ /**
1127
+ * Capitalizes the first letter of a string.
1128
+ *
1129
+ * Делает первую букву строки заглавной.
1130
+ * @param value string to capitalize / строка для капитализации
1131
+ */
1132
+ export declare function capitalize(value: string): string;
1133
+
1095
1134
  /**
1096
1135
  * Class for working with cookies.
1097
1136
  *
@@ -6127,6 +6166,14 @@ export declare function setValues<T>(selected: T | T[] | undefined, value: any,
6127
6166
  notEmpty?: boolean | undefined;
6128
6167
  }): T | T[] | undefined;
6129
6168
 
6169
+ /**
6170
+ * Pause execution for a specified number of milliseconds.
6171
+ *
6172
+ * Приостановить выполнение на указанное количество миллисекунд.
6173
+ * @param ms milliseconds/ миллисекунды
6174
+ */
6175
+ export declare function sleep(ms: number): Promise<void>;
6176
+
6130
6177
  /**
6131
6178
  * This method is used to copy the values of all enumerable own properties from one source object to a target object.
6132
6179
  * In priority according to the processing list.