@reformer/core 2.0.0-beta.6 → 3.0.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.
@@ -348,22 +348,13 @@ function Q(e, t, i) {
348
348
  const m = a.value.value;
349
349
  c || h(() => {
350
350
  c = !0;
351
- try {
352
- const U = s ? s(m) : m;
353
- r.setValue(U, { emitEvent: !1 });
354
- } finally {
355
- c = !1;
356
- }
351
+ const U = s ? s(m) : m;
352
+ r.setValue(U, { emitEvent: !1 }), c = !1;
357
353
  });
358
354
  }), b = g(() => {
359
355
  const m = r.value.value;
360
356
  c || h(() => {
361
- c = !0;
362
- try {
363
- a.setValue(m, { emitEvent: !1 });
364
- } finally {
365
- c = !1;
366
- }
357
+ c = !0, a.setValue(m, { emitEvent: !1 }), c = !1;
367
358
  });
368
359
  });
369
360
  return () => {
package/dist/behaviors.js CHANGED
@@ -1,4 +1,4 @@
1
- import { a as s, b as r, g as t, c as o, m as l, i as h, f as n, e as i, k as m, j as p, s as c, t as d, l as f, n as F, h as y } from "./behaviors-2HSqHPb4.js";
1
+ import { a as s, b as r, g as t, c as o, m as l, i as h, f as n, e as i, k as m, j as p, s as c, t as d, l as f, n as F, h as y } from "./behaviors-DzYL8kY_.js";
2
2
  import { d as v, B, c as b } from "./registry-helpers-BRxAr6nG.js";
3
3
  export {
4
4
  v as BehaviorContextImpl,
@@ -49,7 +49,6 @@ export declare class FieldNode<T> extends FormNode<T> {
49
49
  private updateOn;
50
50
  private initialValue;
51
51
  private currentValidationId;
52
- private currentAbortController?;
53
52
  private debounceMs;
54
53
  private validateDebounceTimer?;
55
54
  private validateDebounceResolve?;
@@ -138,10 +137,12 @@ export declare class FieldNode<T> extends FormNode<T> {
138
137
  * Немедленная валидация без debounce
139
138
  * @private
140
139
  * @remarks
141
- * Защищена от race conditions через AbortController:
142
- * - Отменяет предыдущую валидацию при запуске новой
143
- * - Передаёт AbortSignal в async валидаторы для отмены операций (например, fetch)
144
- * - Проверяет signal.aborted в ключевых точках
140
+ * Защищена от race conditions:
141
+ * - Проверка validationId после синхронной валидации
142
+ * - Проверка перед установкой pending
143
+ * - Проверка после Promise.all
144
+ * - Проверка перед обработкой async результатов
145
+ * - Проверка перед очисткой errors
145
146
  */
146
147
  private validateImmediate;
147
148
  setErrors(errors: ValidationError[]): void;
@@ -255,13 +256,6 @@ export declare class FieldNode<T> extends FormNode<T> {
255
256
  * Очистить все ресурсы и таймеры
256
257
  * Должен вызываться при unmount компонента
257
258
  *
258
- * @remarks
259
- * Освобождает все ресурсы:
260
- * - Отписывает все subscriptions через SubscriptionManager
261
- * - Очищает debounce таймер
262
- * - Resolve'ит висячий debounce промис (предотвращает утечку памяти)
263
- * - Отменяет текущую async валидацию через AbortController
264
- *
265
259
  * @example
266
260
  * ```typescript
267
261
  * useEffect(() => {
@@ -20,46 +20,12 @@ export type UnknownFormValue = unknown;
20
20
  * @category Validation Types
21
21
  */
22
22
  export type ValidatorFn<T = FormValue> = (value: T) => ValidationError | null;
23
- /**
24
- * Опции для асинхронного валидатора
25
- * @group Types
26
- * @category Validation Types
27
- */
28
- export interface AsyncValidatorOptions {
29
- /**
30
- * AbortSignal для отмены валидации
31
- * Позволяет отменить асинхронную операцию при новой валидации
32
- */
33
- signal?: AbortSignal;
34
- }
35
23
  /**
36
24
  * Асинхронная функция валидации
37
- *
38
- * @param value - Значение для валидации
39
- * @param options - Опции валидации (опционально)
40
- * @returns Promise с ошибкой валидации или null если значение валидно
41
- *
42
- * @example
43
- * ```typescript
44
- * // Простой валидатор (без поддержки отмены)
45
- * const emailExists: AsyncValidatorFn<string> = async (value) => {
46
- * const exists = await checkEmail(value);
47
- * return exists ? { code: 'exists', message: 'Email already exists' } : null;
48
- * };
49
- *
50
- * // Валидатор с поддержкой отмены
51
- * const emailExistsAbortable: AsyncValidatorFn<string> = async (value, options) => {
52
- * const exists = await fetch(`/api/check-email?email=${value}`, {
53
- * signal: options?.signal // Передаём signal в fetch для отмены запроса
54
- * });
55
- * return exists ? { code: 'exists', message: 'Email already exists' } : null;
56
- * };
57
- * ```
58
- *
59
25
  * @group Types
60
26
  * @category Validation Types
61
27
  */
62
- export type AsyncValidatorFn<T = FormValue> = (value: T, options?: AsyncValidatorOptions) => Promise<ValidationError | null>;
28
+ export type AsyncValidatorFn<T = FormValue> = (value: T) => Promise<ValidationError | null>;
63
29
  /**
64
30
  * Ошибка валидации
65
31
  * @group Types