@dxtmisha/functional-basic 1.8.10 → 1.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (199) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/ai-description.md +7 -3
  3. package/ai-mcp-resources.json +14 -2
  4. package/ai-resources/design-config.md +104 -0
  5. package/ai-resources/error-center.md +150 -0
  6. package/ai-types.md +1 -3233
  7. package/dist/library.d.ts +9991 -189
  8. package/dist/library.js +851 -835
  9. package/package.json +7 -2
  10. package/dist/classes/Api.d.ts +0 -209
  11. package/dist/classes/ApiCache.d.ts +0 -152
  12. package/dist/classes/ApiDataReturn.d.ts +0 -79
  13. package/dist/classes/ApiDefault.d.ts +0 -49
  14. package/dist/classes/ApiError.d.ts +0 -39
  15. package/dist/classes/ApiErrorItem.d.ts +0 -70
  16. package/dist/classes/ApiErrorStorage.d.ts +0 -92
  17. package/dist/classes/ApiHeaders.d.ts +0 -37
  18. package/dist/classes/ApiHydration.d.ts +0 -40
  19. package/dist/classes/ApiInstance.d.ts +0 -299
  20. package/dist/classes/ApiPreparation.d.ts +0 -58
  21. package/dist/classes/ApiResponse.d.ts +0 -154
  22. package/dist/classes/ApiStatus.d.ts +0 -131
  23. package/dist/classes/BroadcastMessage.d.ts +0 -76
  24. package/dist/classes/Cache.d.ts +0 -39
  25. package/dist/classes/CacheItem.d.ts +0 -65
  26. package/dist/classes/CacheStatic.d.ts +0 -36
  27. package/dist/classes/Cookie.d.ts +0 -54
  28. package/dist/classes/CookieBlock.d.ts +0 -30
  29. package/dist/classes/CookieBlockInstance.d.ts +0 -24
  30. package/dist/classes/CookieStorage.d.ts +0 -175
  31. package/dist/classes/DataStorage.d.ts +0 -107
  32. package/dist/classes/Datetime.d.ts +0 -571
  33. package/dist/classes/ErrorCenter.d.ts +0 -86
  34. package/dist/classes/ErrorCenterHandler.d.ts +0 -85
  35. package/dist/classes/ErrorCenterInstance.d.ts +0 -101
  36. package/dist/classes/EventItem.d.ts +0 -230
  37. package/dist/classes/Formatters.d.ts +0 -157
  38. package/dist/classes/Geo.d.ts +0 -172
  39. package/dist/classes/GeoFlag.d.ts +0 -135
  40. package/dist/classes/GeoInstance.d.ts +0 -264
  41. package/dist/classes/GeoIntl.d.ts +0 -291
  42. package/dist/classes/GeoPhone.d.ts +0 -110
  43. package/dist/classes/GeoUnit.d.ts +0 -207
  44. package/dist/classes/Global.d.ts +0 -29
  45. package/dist/classes/Hash.d.ts +0 -57
  46. package/dist/classes/HashInstance.d.ts +0 -29
  47. package/dist/classes/Icons.d.ts +0 -128
  48. package/dist/classes/Loading.d.ts +0 -62
  49. package/dist/classes/LoadingInstance.d.ts +0 -87
  50. package/dist/classes/Meta.d.ts +0 -189
  51. package/dist/classes/MetaManager.d.ts +0 -123
  52. package/dist/classes/MetaOg.d.ts +0 -120
  53. package/dist/classes/MetaStatic.d.ts +0 -179
  54. package/dist/classes/MetaTwitter.d.ts +0 -120
  55. package/dist/classes/Query.d.ts +0 -57
  56. package/dist/classes/QueryInstance.d.ts +0 -29
  57. package/dist/classes/ResumableTimer.d.ts +0 -85
  58. package/dist/classes/ScrollbarWidth.d.ts +0 -52
  59. package/dist/classes/SearchList.d.ts +0 -132
  60. package/dist/classes/SearchListData.d.ts +0 -144
  61. package/dist/classes/SearchListItem.d.ts +0 -49
  62. package/dist/classes/SearchListMatcher.d.ts +0 -58
  63. package/dist/classes/SearchListOptions.d.ts +0 -66
  64. package/dist/classes/ServerStorage.d.ts +0 -110
  65. package/dist/classes/StorageCallback.d.ts +0 -86
  66. package/dist/classes/Translate.d.ts +0 -117
  67. package/dist/classes/TranslateFile.d.ts +0 -81
  68. package/dist/classes/TranslateInstance.d.ts +0 -203
  69. package/dist/classes/UrlInstanceAbstract.d.ts +0 -98
  70. package/dist/classes/UrlItem.d.ts +0 -119
  71. package/dist/functions/addTagHighlightMatch.d.ts +0 -11
  72. package/dist/functions/anyToString.d.ts +0 -10
  73. package/dist/functions/applyTemplate.d.ts +0 -10
  74. package/dist/functions/arrFill.d.ts +0 -9
  75. package/dist/functions/blobToBase64.d.ts +0 -9
  76. package/dist/functions/capitalize.d.ts +0 -9
  77. package/dist/functions/copyObject.d.ts +0 -10
  78. package/dist/functions/copyObjectLite.d.ts +0 -9
  79. package/dist/functions/createElement.d.ts +0 -21
  80. package/dist/functions/domContentLoaded.d.ts +0 -13
  81. package/dist/functions/domQuerySelector.d.ts +0 -8
  82. package/dist/functions/domQuerySelectorAll.d.ts +0 -8
  83. package/dist/functions/encodeAttribute.d.ts +0 -8
  84. package/dist/functions/encodeLiteAttribute.d.ts +0 -8
  85. package/dist/functions/ensureMaxSize.d.ts +0 -10
  86. package/dist/functions/escapeExp.d.ts +0 -7
  87. package/dist/functions/eventStopPropagation.d.ts +0 -7
  88. package/dist/functions/executeFunction.d.ts +0 -12
  89. package/dist/functions/executePromise.d.ts +0 -11
  90. package/dist/functions/forEach.d.ts +0 -14
  91. package/dist/functions/frame.d.ts +0 -10
  92. package/dist/functions/getArrayHighlightMatch.d.ts +0 -10
  93. package/dist/functions/getAttributes.d.ts +0 -9
  94. package/dist/functions/getClipboardData.d.ts +0 -9
  95. package/dist/functions/getColumn.d.ts +0 -10
  96. package/dist/functions/getCurrentDate.d.ts +0 -19
  97. package/dist/functions/getCurrentTime.d.ts +0 -15
  98. package/dist/functions/getElement.d.ts +0 -9
  99. package/dist/functions/getElementId.d.ts +0 -26
  100. package/dist/functions/getElementImage.d.ts +0 -8
  101. package/dist/functions/getElementItem.d.ts +0 -12
  102. package/dist/functions/getElementOrWindow.d.ts +0 -8
  103. package/dist/functions/getElementSafeScript.d.ts +0 -9
  104. package/dist/functions/getExactSearchExp.d.ts +0 -8
  105. package/dist/functions/getExp.d.ts +0 -14
  106. package/dist/functions/getFirst.d.ts +0 -8
  107. package/dist/functions/getHydrationData.d.ts +0 -10
  108. package/dist/functions/getItemByPath.d.ts +0 -9
  109. package/dist/functions/getKey.d.ts +0 -8
  110. package/dist/functions/getLast.d.ts +0 -8
  111. package/dist/functions/getLength.d.ts +0 -10
  112. package/dist/functions/getLengthOfAllArray.d.ts +0 -8
  113. package/dist/functions/getMaxLengthAllArray.d.ts +0 -9
  114. package/dist/functions/getMinLengthAllArray.d.ts +0 -8
  115. package/dist/functions/getMouseClient.d.ts +0 -9
  116. package/dist/functions/getMouseClientX.d.ts +0 -8
  117. package/dist/functions/getMouseClientY.d.ts +0 -8
  118. package/dist/functions/getObjectByKeys.d.ts +0 -8
  119. package/dist/functions/getObjectNoUndefined.d.ts +0 -9
  120. package/dist/functions/getObjectOrNone.d.ts +0 -8
  121. package/dist/functions/getOnlyText.d.ts +0 -8
  122. package/dist/functions/getRandomItem.d.ts +0 -10
  123. package/dist/functions/getRandomText.d.ts +0 -12
  124. package/dist/functions/getRequestString.d.ts +0 -11
  125. package/dist/functions/getSearchExp.d.ts +0 -12
  126. package/dist/functions/getSeparatingSearchExp.d.ts +0 -9
  127. package/dist/functions/getStepPercent.d.ts +0 -9
  128. package/dist/functions/getStepValue.d.ts +0 -9
  129. package/dist/functions/goScroll.d.ts +0 -10
  130. package/dist/functions/goScrollSmooth.d.ts +0 -10
  131. package/dist/functions/goScrollTo.d.ts +0 -10
  132. package/dist/functions/handleShare.d.ts +0 -10
  133. package/dist/functions/inArray.d.ts +0 -9
  134. package/dist/functions/initScrollbarOffset.d.ts +0 -7
  135. package/dist/functions/intersectKey.d.ts +0 -9
  136. package/dist/functions/isApiSuccess.d.ts +0 -9
  137. package/dist/functions/isArray.d.ts +0 -8
  138. package/dist/functions/isDifferent.d.ts +0 -10
  139. package/dist/functions/isDomData.d.ts +0 -7
  140. package/dist/functions/isDomRuntime.d.ts +0 -10
  141. package/dist/functions/isElementVisible.d.ts +0 -11
  142. package/dist/functions/isEnter.d.ts +0 -9
  143. package/dist/functions/isFilled.d.ts +0 -10
  144. package/dist/functions/isFloat.d.ts +0 -8
  145. package/dist/functions/isFunction.d.ts +0 -9
  146. package/dist/functions/isInDom.d.ts +0 -9
  147. package/dist/functions/isInput.d.ts +0 -8
  148. package/dist/functions/isIntegerBetween.d.ts +0 -9
  149. package/dist/functions/isMetaKey.d.ts +0 -8
  150. package/dist/functions/isNull.d.ts +0 -9
  151. package/dist/functions/isNumber.d.ts +0 -8
  152. package/dist/functions/isObject.d.ts +0 -8
  153. package/dist/functions/isObjectNotArray.d.ts +0 -8
  154. package/dist/functions/isOnLine.d.ts +0 -7
  155. package/dist/functions/isSelected.d.ts +0 -9
  156. package/dist/functions/isSelectedByList.d.ts +0 -9
  157. package/dist/functions/isShare.d.ts +0 -7
  158. package/dist/functions/isString.d.ts +0 -8
  159. package/dist/functions/isTab.d.ts +0 -8
  160. package/dist/functions/isWindow.d.ts +0 -7
  161. package/dist/functions/random.d.ts +0 -9
  162. package/dist/functions/removeCommonPrefix.d.ts +0 -9
  163. package/dist/functions/replaceComponentName.d.ts +0 -9
  164. package/dist/functions/replaceRecursive.d.ts +0 -11
  165. package/dist/functions/replaceTemplate.d.ts +0 -10
  166. package/dist/functions/resizeImageByMax.d.ts +0 -19
  167. package/dist/functions/secondToTime.d.ts +0 -9
  168. package/dist/functions/setElementItem.d.ts +0 -11
  169. package/dist/functions/setValues.d.ts +0 -18
  170. package/dist/functions/sleep.d.ts +0 -8
  171. package/dist/functions/sortList.d.ts +0 -11
  172. package/dist/functions/splice.d.ts +0 -13
  173. package/dist/functions/strFill.d.ts +0 -9
  174. package/dist/functions/strSplit.d.ts +0 -12
  175. package/dist/functions/toArray.d.ts +0 -17
  176. package/dist/functions/toCamelCase.d.ts +0 -8
  177. package/dist/functions/toCamelCaseFirst.d.ts +0 -8
  178. package/dist/functions/toDate.d.ts +0 -8
  179. package/dist/functions/toKebabCase.d.ts +0 -15
  180. package/dist/functions/toNumber.d.ts +0 -19
  181. package/dist/functions/toNumberByMax.d.ts +0 -11
  182. package/dist/functions/toNumberPositive.d.ts +0 -9
  183. package/dist/functions/toPercent.d.ts +0 -9
  184. package/dist/functions/toPercentBy100.d.ts +0 -9
  185. package/dist/functions/toString.d.ts +0 -8
  186. package/dist/functions/transformation.d.ts +0 -21
  187. package/dist/functions/uint8ArrayToBase64.d.ts +0 -8
  188. package/dist/functions/uniqueArray.d.ts +0 -8
  189. package/dist/functions/writeClipboardData.d.ts +0 -8
  190. package/dist/media/errorCauseList.d.ts +0 -2
  191. package/dist/types/apiTypes.d.ts +0 -259
  192. package/dist/types/basicTypes.d.ts +0 -131
  193. package/dist/types/errorCenterTypes.d.ts +0 -50
  194. package/dist/types/formattersTypes.d.ts +0 -224
  195. package/dist/types/geoTypes.d.ts +0 -142
  196. package/dist/types/metaTypes.d.ts +0 -586
  197. package/dist/types/searchTypes.d.ts +0 -53
  198. package/dist/types/sortTypes.d.ts +0 -20
  199. package/dist/types/translateTypes.d.ts +0 -54
@@ -1,92 +0,0 @@
1
- import { ApiErrorStorageList, ApiErrorStorageItem, ApiMethodItem } from '../types/apiTypes';
2
- /**
3
- * Manager for handling and identifying API error states.
4
- *
5
- * This class provides a centralized storage for API error criteria. It allows the system
6
- * to identify specific errors by matching the response status, error code from the JSON body,
7
- * request method, and URL. It is used to transform raw network errors into structured
8
- * application-level error items for consistent processing.
9
- *
10
- * Менеджер для обработки и идентификации состояний ошибок API.
11
- *
12
- * Этот класс обеспечивает централизованное хранилище критериев ошибок API. Он позволяет
13
- * системе идентифицировать конкретные ошибки путем сопоставления статуса ответа,
14
- * кода ошибки из тела JSON, метода запроса и URL. Используется для преобразования
15
- * сырых сетевых ошибок в структурированные элементы ошибок прикладного уровня для
16
- * единообразной обработки.
17
- */
18
- export declare class ApiErrorStorage {
19
- /** Error storage list / Список хранилища ошибок */
20
- protected storage: ApiErrorStorageList;
21
- /**
22
- * Finds a matching error item in the storage by analyzing the response.
23
- *
24
- * Ищет подходящий элемент ошибки в хранилище путем анализа ответа.
25
- * @param method API method / Метод API
26
- * @param response fetch response / Ответ fetch
27
- * @returns matched error item or undefined / найденный элемент ошибки или undefined
28
- */
29
- find(method: ApiMethodItem, response: Response): Promise<ApiErrorStorageItem>;
30
- /**
31
- * Adds one or more error items or lists to the internal storage.
32
- *
33
- * Добавляет один или несколько элементов или списков ошибок во внутреннее хранилище.
34
- * @param item error item or list of items / элемент ошибки или список элементов
35
- * @param url URL pattern or RegExp / шаблон URL или регулярное выражение
36
- * @param method HTTP method of the request / HTTP-метод запроса
37
- * @returns current instance / текущий экземпляр
38
- */
39
- add(item: Partial<ApiErrorStorageItem> | Partial<ApiErrorStorageItem>[], url?: string | RegExp, method?: ApiMethodItem): this;
40
- /**
41
- * Checks if the response matches the criteria of any stored error item.
42
- *
43
- * Проверяет, соответствует ли ответ критериям любого сохраненного элемента ошибки.
44
- * @param method API method / Метод API
45
- * @param response fetch response / Ответ fetch
46
- * @param code error code from response body / код ошибки из тела ответа
47
- * @returns matched error item or undefined if no match found / найденный элемент ошибки или undefined, если совпадений не найдено
48
- */
49
- protected findItem(method: ApiMethodItem, response: Response, code?: string): ApiErrorStorageItem | undefined;
50
- /**
51
- * Validates if the given URL matches the specified pattern.
52
- *
53
- * Проверяет, соответствует ли данный URL указанному шаблону.
54
- * @param url URL to check / URL для проверки
55
- * @param pattern URL pattern or RegExp / шаблон URL или регулярное выражение
56
- * @returns true if the URL matches the pattern / true, если URL соответствует шаблону
57
- */
58
- protected isUrl(url: string, pattern: string | RegExp): boolean;
59
- /**
60
- * Attempts to extract an error code from the response body in JSON format.
61
- *
62
- * Пытается извлечь код ошибки из тела ответа в формате JSON.
63
- * @param response fetch response / Ответ fetch
64
- * @returns extracted error code or undefined / извлеченный код ошибки или undefined
65
- */
66
- protected getBody(response: Response): Promise<any>;
67
- /**
68
- * Retrieves data from the response body by key.
69
- *
70
- * Получает данные из тела ответа по ключу.
71
- * @param body response body / тело ответа
72
- * @param key property key / ключ свойства
73
- * @returns extracted value or undefined / извлеченное значение или undefined
74
- */
75
- protected getDataByKey<R = string>(body: any, key: string): R | undefined;
76
- /**
77
- * Attempts to extract an error code from the response body in JSON format.
78
- *
79
- * Пытается извлечь код ошибки из тела ответа в формате JSON.
80
- * @param body response body / тело ответа
81
- * @returns extracted error code or undefined / извлеченный код ошибки или undefined
82
- */
83
- protected getCode(body: any): string | undefined;
84
- /**
85
- * Attempts to extract an error message from the response body in JSON format.
86
- *
87
- * Пытается извлечь сообщение об ошибке из тела ответа в формате JSON.
88
- * @param body response body / тело ответа
89
- * @returns extracted error message or undefined / извлеченное сообщение об ошибке или undefined
90
- */
91
- protected getMessage(body: any): string | undefined;
92
- }
@@ -1,37 +0,0 @@
1
- import { ApiFetch, ApiHeadersValue } from '../types/apiTypes';
2
- /**
3
- * Class for managing HTTP request headers.
4
- *
5
- * Класс для управления заголовками HTTP-запросов.
6
- */
7
- export declare class ApiHeaders {
8
- /** Default headers / Заголовки по умолчанию */
9
- protected headers: ApiHeadersValue;
10
- /**
11
- * Gets the headers for the request.
12
- *
13
- * Получает заголовки для запроса.
14
- * @param value list of headers / список заголовков
15
- * @param type Content-Type header value / значение заголовка Content-Type
16
- * @returns merged headers or undefined / объединенные заголовки или undefined
17
- */
18
- get(value?: Record<string, string> | null, type?: string | undefined | null): Record<string, string> | undefined;
19
- /**
20
- * Gets the headers for the request based on request type.
21
- *
22
- * Получает заголовки для запроса на основе типа запроса.
23
- * @param request request data / данные запроса
24
- * @param value list of headers / список заголовков
25
- * @param type Content-Type header value / значение заголовка Content-Type
26
- * @returns merged headers or undefined / объединенные заголовки или undefined
27
- */
28
- getByRequest(request: ApiFetch['request'], value?: Record<string, string> | null, type?: string): Record<string, string> | undefined;
29
- /**
30
- * Sets the default headers.
31
- *
32
- * Устанавливает заголовки по умолчанию.
33
- * @param headers list of default headers/ список заголовков по умолчанию
34
- * @returns this instance for chaining / текущий экземпляр для цепочки вызовов
35
- */
36
- set(headers: ApiHeadersValue): this;
37
- }
@@ -1,40 +0,0 @@
1
- import { ApiResponse } from './ApiResponse';
2
- import { ApiFetch, ApiHydrationList } from '../types/apiTypes';
3
- /**
4
- * Class for collecting API data for hydration on the client side during SSR.
5
- *
6
- * Класс для сбора данных API для последующей гидратации на стороне клиента при SSR.
7
- */
8
- export declare class ApiHydration {
9
- /** Hydration data list / Список данных гидратации */
10
- protected list: ApiHydrationList;
11
- /**
12
- * Initializes the response with hydration data.
13
- *
14
- * Инициализирует ответ данными гидратации.
15
- * @param response API response / ответ API
16
- * @returns void / ничего не возвращает
17
- */
18
- initResponse(response: ApiResponse): void;
19
- /**
20
- * Saves API response for client-side hydration.
21
- *
22
- * Сохраняет ответ API для гидратации на стороне клиента.
23
- * @param apiFetch API request configuration / конфигурация запроса API
24
- * @param response API response data / данные ответа API
25
- * @returns void / ничего не возвращает
26
- */
27
- toClient<T>(apiFetch: ApiFetch, response: T): void;
28
- /**
29
- * Returns a string representation of the hydration data for the client.
30
- *
31
- * Возвращает строковое представление данных гидратации для клиента.
32
- */
33
- toString(): string;
34
- /**
35
- * Returns the list of API responses for the client.
36
- *
37
- * Возвращает список ответов API для клиента.
38
- */
39
- protected getListByClient(): ApiHydrationList;
40
- }
@@ -1,299 +0,0 @@
1
- import { GeoInstance } from './GeoInstance';
2
- import { LoadingInstance } from './LoadingInstance';
3
- import { ErrorCenterInstance } from './ErrorCenterInstance';
4
- import { ApiDefault } from './ApiDefault';
5
- import { ApiErrorItem } from './ApiErrorItem';
6
- import { ApiHeaders } from './ApiHeaders';
7
- import { ApiHydration } from './ApiHydration';
8
- import { ApiPreparation } from './ApiPreparation';
9
- import { ApiResponse } from './ApiResponse';
10
- import { ApiStatus } from './ApiStatus';
11
- import { ApiDefaultValue, ApiFetch, ApiHeadersValue, ApiMethod, ApiPreparationEnd } from '../types/apiTypes';
12
- /** Options for the API instance / Опции для экземпляра API */
13
- export type ApiInstanceOptions = {
14
- /** Class for working with headers / Класс для работы с заголовками */
15
- headersClass?: typeof ApiHeaders;
16
- /** Class for working with default request parameters / Класс для работы с параметрами запроса по умолчанию */
17
- requestDefaultClass?: typeof ApiDefault;
18
- /** Class for working with status / Класс для работы со статусом */
19
- statusClass?: typeof ApiStatus;
20
- /** Class for working with response / Класс для работы с ответом */
21
- responseClass?: typeof ApiResponse;
22
- /** Class for working with preparation / Класс для работы с модификацией запроса */
23
- preparationClass?: typeof ApiPreparation;
24
- /** Instance of loading handler / Экземпляр обработчика загрузки */
25
- loadingClass?: LoadingInstance;
26
- /** Instance of error handler / Экземпляр обработчика ошибок */
27
- errorCenterClass?: ErrorCenterInstance;
28
- /** Class for working with hydration / Класс для работы с гидратацией */
29
- hydrationClass?: typeof ApiHydration;
30
- /** Wrapper function for requests / Функция-обертка для запросов */
31
- wrapper?: <R>(callback: () => Promise<R>, apiFetch: ApiFetch) => Promise<R>;
32
- };
33
- /**
34
- * Core class for managing HTTP requests using the Fetch API.
35
- *
36
- * Основной класс для управления HTTP-запросами через Fetch API.
37
- */
38
- export declare class ApiInstance {
39
- protected url: string;
40
- /** Geo class instance / Экземпляр класса Geo */
41
- protected geo: GeoInstance;
42
- /** Headers / Заголовки */
43
- protected headers: ApiHeaders;
44
- /** Default request parameters / Параметры запроса по умолчанию */
45
- protected requestDefault: ApiDefault;
46
- /** Status of the last request / Статус последнего запроса */
47
- protected status: ApiStatus;
48
- /** Response handler / Обработчик ответа */
49
- protected response: ApiResponse;
50
- /** Request modification handler / Обработчик модификации запроса */
51
- protected preparation: ApiPreparation;
52
- /** Loading handler / Обработчик загрузки */
53
- protected loading: LoadingInstance;
54
- /** Error handler / Обработчик ошибок */
55
- protected errorCenter: ErrorCenterInstance;
56
- /** Hydration handler / Обработчик гидратации */
57
- protected hydration: ApiHydration;
58
- /** Timeout for the request in milliseconds / Таймаут запроса в миллисекундах */
59
- protected timeout: number;
60
- /** Base URL origin / Базовый origin URL */
61
- protected origin?: string;
62
- /** Wrapper function for requests / Функция-обертка для запросов */
63
- protected wrapper?: <R>(callback: () => Promise<R>, apiFetch: ApiFetch) => Promise<R>;
64
- /**
65
- * Constructor
66
- * @param url base path to the script / базовый путь к скрипту
67
- * @param options options for the API instance / опции для экземпляра API
68
- */
69
- constructor(url?: string, options?: ApiInstanceOptions);
70
- /**
71
- * Checks if the server is running on localhost.
72
- *
73
- * Проверяет, работает ли сервер на localhost.
74
- * @returns true if server is localhost / true, если сервер является локальным
75
- */
76
- isLocalhost(): boolean;
77
- /**
78
- * Returns the status of the last request.
79
- *
80
- * Возвращает статус последнего запроса.
81
- * @returns ApiStatus instance / экземпляр ApiStatus
82
- */
83
- getStatus(): ApiStatus;
84
- /**
85
- * Gets the response handler.
86
- *
87
- * Получает обработчик ответа.
88
- * @returns ApiResponse instance / экземпляр ApiResponse
89
- */
90
- getResponse(): ApiResponse;
91
- /**
92
- * Gets the hydration handler.
93
- *
94
- * Получает обработчик гидратации.
95
- * @returns ApiHydration instance / экземпляр ApiHydration
96
- */
97
- getHydration(): ApiHydration;
98
- /**
99
- * Gets the base origin URL combined with the API path.
100
- *
101
- * Получает базовый URL источника, объединенный с путем API.
102
- * @returns final base URL string / итоговая строка базового URL
103
- */
104
- getOrigin(): string;
105
- /**
106
- * Gets the full path to the request script.
107
- *
108
- * Получает полный путь к скрипту запроса.
109
- * @param path path to the script / путь к скрипту
110
- * @param api whether to prepend base API URL / нужно ли добавить базовый URL API
111
- * @returns full URL / полный URL
112
- */
113
- getUrl(path: string, api?: boolean): string;
114
- /**
115
- * Gets data for the request body.
116
- *
117
- * Получает данные для тела запроса.
118
- * @param request request data / данные запроса
119
- * @param method HTTP method / HTTP метод
120
- * @returns body data for non-GET requests or FormData / данные тела для не-GET запросов или FormData
121
- */
122
- getBody(request?: ApiFetch['request'], method?: ApiMethod): string | FormData | undefined;
123
- /**
124
- * Gets query string for GET method requests.
125
- *
126
- * Получает строку запроса для GET-методов.
127
- * @param request request data / данные запроса
128
- * @param path path to request / путь к запросу
129
- * @param method HTTP method / HTTP метод
130
- * @returns query string with prefix (? or &) / строка запроса с префиксом (? или &)
131
- */
132
- getBodyForGet(request: ApiFetch['request'], path?: string, method?: ApiMethod): string;
133
- /**
134
- * Returns a string representation of the hydration data for the client.
135
- *
136
- * Возвращает строковое представление данных гидратации для клиента.
137
- * @returns HTML script element string / строка HTML элемента script
138
- */
139
- getHydrationScript(): string;
140
- /**
141
- * Modifies the default header data.
142
- *
143
- * Изменяет данные заголовка по умолчанию.
144
- * @param headers default headers / заголовки по умолчанию
145
- */
146
- setHeaders(headers: ApiHeadersValue): this;
147
- /**
148
- * Modifies the default request data.
149
- *
150
- * Изменяет данные запроса по умолчанию.
151
- * @param request default request data / данные запроса по умолчанию
152
- */
153
- setRequestDefault(request: ApiDefaultValue): this;
154
- /**
155
- * Changes the base path to the script.
156
- *
157
- * Изменяет базовый путь к скрипту.
158
- * @param url path to the script / путь к скрипту
159
- */
160
- setUrl(url: string): this;
161
- /**
162
- * Modifies the function to be called before the request.
163
- *
164
- * Изменяет функцию для вызова перед запросом.
165
- * @param callback function to call before request / функция для вызова перед запросом
166
- */
167
- setPreparation(callback: (apiFetch: ApiFetch) => Promise<void>): this;
168
- /**
169
- * Modifies the function to be called after the request.
170
- *
171
- * Изменяет функцию для вызова после запроса.
172
- * @param callback function to call after request / функция для вызова после запроса
173
- */
174
- setEnd(callback: (query: Response, apiFetch: ApiFetch) => Promise<ApiPreparationEnd>): this;
175
- /**
176
- * Changes the timeout for the request in milliseconds.
177
- *
178
- * Изменяет таймаут запроса в миллисекундах.
179
- * @param timeout timeout in milliseconds / таймаут в миллисекундах
180
- */
181
- setTimeout(timeout: number): this;
182
- /**
183
- * Changes the origin (protocol and domain) for the base URL.
184
- *
185
- * Изменяет источник (протокол и домен) для базового URL.
186
- * @param origin protocol and domain / протокол и домен
187
- */
188
- setOrigin(origin: string): this;
189
- /**
190
- * Sets the wrapper function for requests.
191
- *
192
- * Устанавливает функцию-обертку для запросов.
193
- * @param wrapper wrapper function / функция-обертка
194
- */
195
- setWrapper(wrapper: <R>(callback: () => Promise<R>, apiFetch: ApiFetch) => Promise<R>): this;
196
- /**
197
- * Executes a request with the given path or configuration.
198
- *
199
- * Выполняет запрос с указанным путем или конфигурацией.
200
- * @param pathRequest path or configuration / путь или конфигурация запроса
201
- * @returns Promise with response data / Promise с данными ответа
202
- */
203
- request<T>(pathRequest: string | ApiFetch): Promise<T>;
204
- /**
205
- * Sends a GET method request.
206
- *
207
- * Отправляет запрос метода GET.
208
- * @param request fetch configuration / конфигурация запроса
209
- * @returns Promise with response data / Promise с данными ответа
210
- */
211
- get<T>(request: ApiFetch): Promise<T>;
212
- /**
213
- * Sends a POST method request.
214
- *
215
- * Отправляет запрос метода POST.
216
- * @param request fetch configuration / конфигурация запроса
217
- * @returns Promise with response data / Promise с данными ответа
218
- */
219
- post<T>(request: ApiFetch): Promise<T>;
220
- /**
221
- * Sends a PUT method request.
222
- *
223
- * Отправляет запрос метода PUT.
224
- * @param request fetch configuration / конфигурация запроса
225
- * @returns Promise with response data / Promise с данными ответа
226
- */
227
- put<T>(request: ApiFetch): Promise<T>;
228
- /**
229
- * Sends a PATCH method request.
230
- *
231
- * Отправляет запрос метода PATCH.
232
- * @param request fetch configuration / конфигурация запроса
233
- * @returns Promise with response data / Promise с данными ответа
234
- */
235
- patch<T>(request: ApiFetch): Promise<T>;
236
- /**
237
- * Sends a DELETE method request.
238
- *
239
- * Отправляет запрос метода DELETE.
240
- * @param request fetch configuration / конфигурация запроса
241
- * @returns Promise with response data / Promise с данными ответа
242
- */
243
- delete<T>(request: ApiFetch): Promise<T>;
244
- /**
245
- * Gets retry delay with jitter.
246
- *
247
- * Получает задержку повтора с джиттером.
248
- * @param retryCount count of retries / количество повторов
249
- * @param retryDelay base delay between retries / базовая задержка между повторами
250
- * @returns delay in milliseconds / задержка в миллисекундах
251
- */
252
- protected getRetryDelay(retryCount: number, retryDelay: number): number;
253
- /**
254
- * Execute API request with retry support.
255
- *
256
- * Выполнить запрос API с поддержкой повторов.
257
- * @param apiFetch fetch configuration / конфигурация запроса
258
- * @param retryCount current retry count / текущий счетчик повторов
259
- */
260
- protected fetch<T>(apiFetch: ApiFetch, retryCount?: number): Promise<T>;
261
- /**
262
- * Executing the HTTP request.
263
- *
264
- * Выполнение HTTP-запроса.
265
- * @param apiFetch fetch configuration / конфигурация запроса
266
- * @param pathToApi base path to API / базовый путь к API
267
- * @returns object containing response and optional timeout ID / объект, содержащий ответ и опциональный ID таймера
268
- */
269
- protected makeQuery(apiFetch: ApiFetch, pathToApi: string): Promise<{
270
- query: Response;
271
- timeoutId: any;
272
- }>;
273
- /**
274
- * Processing an error.
275
- *
276
- * Обработка ошибки.
277
- * @param error error object / объект ошибки
278
- * @param group error group for error center (default: 'api') / группа ошибки для центра ошибок (по умолчанию: 'api')
279
- */
280
- protected makeError(error: Record<string, any> & {
281
- name: string;
282
- }, group?: string): void;
283
- /**
284
- * Processes an error response.
285
- *
286
- * Обрабатывает ошибку ответа.
287
- * @param error error details / данные ошибки
288
- */
289
- protected makeErrorQuery(error: ApiErrorItem | Response): void;
290
- /**
291
- * Initialize controller for request with timeout support.
292
- *
293
- * Инициализация контроллера для запроса с поддержкой таймаута.
294
- * @param apiFetch request options / опции запроса
295
- * @param fetchInit request initialization object / объект инициализации запроса
296
- * @returns timeout ID (from setTimeout) or undefined / ID таймера (от setTimeout) или undefined
297
- */
298
- protected initController(apiFetch: ApiFetch, fetchInit: RequestInit): any;
299
- }
@@ -1,58 +0,0 @@
1
- import { ApiFetch, ApiPreparationEnd } from '../types/apiTypes';
2
- /**
3
- * Class for preparing requests.
4
- *
5
- * Класс для подготовки запросов.
6
- */
7
- export declare class ApiPreparation {
8
- /** Function for call before the request / Функция для вызова перед запросом */
9
- protected callback?: (apiFetch: ApiFetch) => Promise<void>;
10
- /** Function for call after the request / Функция для вызова после запроса */
11
- protected callbackEnd?: (query: Response, apiFetch: ApiFetch) => Promise<ApiPreparationEnd>;
12
- /** Is the preparation in progress / Идет ли подготовка */
13
- protected loading: boolean;
14
- /**
15
- * Executes preparation before the request.
16
- *
17
- * Выполняет подготовку перед выполнением запроса.
18
- * @param active is preparation active / активна ли подготовка
19
- * @param apiFetch request options / опции запроса
20
- * @returns Promise<void> / Promise без возвращаемого значения
21
- */
22
- make(active: boolean, apiFetch: ApiFetch): Promise<void>;
23
- /**
24
- * Analyzes the request after execution.
25
- *
26
- * Анализирует запрос после выполнения.
27
- * @param active is preparation active / активна ли подготовка
28
- * @param query data received in the request / данные, полученные в запросе
29
- * @param apiFetch request options / опции запроса
30
- * @returns preparation end data / данные завершения подготовки
31
- */
32
- makeEnd(active: boolean, query: Response, apiFetch: ApiFetch): Promise<ApiPreparationEnd>;
33
- /**
34
- * Modifies the function to be called before the request.
35
- *
36
- * Изменяет функцию для вызова перед запросом.
37
- * @param callback function to call before request / функция для вызова перед запросом
38
- * @returns this instance for chaining / текущий экземпляр для цепочки вызовов
39
- */
40
- set(callback: (apiFetch: ApiFetch) => Promise<void>): this;
41
- /**
42
- * Modifies the function to be called after the request.
43
- *
44
- * Изменяет функцию для вызова после запроса.
45
- * @param callback function to call after request / функция для вызова после запроса
46
- * @returns this instance for chaining / текущий экземпляр для цепочки вызовов
47
- */
48
- setEnd(callback: (query: Response, apiFetch: ApiFetch) => Promise<ApiPreparationEnd>): this;
49
- /**
50
- * To execute preparation.
51
- *
52
- * Выполнить подготовку.
53
- * @param apiFetch request options / опции запроса
54
- * @param limit limit of retry attempts / лимит попыток повтора
55
- * @returns Promise<void> / Promise без возвращаемого значения
56
- */
57
- protected go(apiFetch: ApiFetch, limit?: number): Promise<void>;
58
- }