@matreshka/bff 0.29.0 → 0.30.2

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.
@@ -26,15 +26,22 @@ type DefaultInitConfigType = EntryComponentInitConfig<EntryComponent>;
26
26
  export declare abstract class EntryComponent<InitConfigType extends EntryComponentInitConfig<any> = DefaultInitConfigType, PropertiesType extends EntryComponentProperties = EntryComponentProperties, SerializedConfigType extends EntryServerComponentConfig = EntryServerComponentConfig> extends Component<InitConfigType, PropertiesType> {
27
27
  private readonly registeredTools;
28
28
  private declaredToolsRegistered;
29
+ private entryLifecycleInteractionsRegistered;
29
30
  constructor(config: InitConfigType);
31
+ /**
32
+ * `onEnter` / `onLeave` читаются при первом создании entry-инстанса,
33
+ * уже после конструктора наследника — поля и `this.options` доступны.
34
+ * Дополнительные interaction для того же момента — в {@link registerEntryLifecycleInteractionsExtra}.
35
+ */
36
+ protected registerEntryLifecycleInteractions(): void;
37
+ /** Хук для наследников: один раз сразу после enter/leave (см. {@link registerEntryLifecycleInteractions}). */
38
+ protected registerEntryLifecycleInteractionsExtra(): void;
30
39
  /**
31
40
  * Показ entry. По умолчанию — `onEnter` конструктора.
32
- * Читается в конструкторе, до полей наследника.
33
41
  */
34
42
  protected onEnter(): InitConfigType["onEnter"];
35
43
  /**
36
44
  * Начало ухода entry. По умолчанию — `onLeave` конструктора.
37
- * Читается в конструкторе, до полей наследника.
38
45
  */
39
46
  protected onLeave(): InitConfigType["onLeave"];
40
47
  /**
@@ -63,6 +70,11 @@ export declare abstract class EntryComponent<InitConfigType extends EntryCompone
63
70
  protected subscribeClientEvents(client: Client): void;
64
71
  /** Контекст сериализации дочерних компонентов без полной serialize entry. @internal */
65
72
  beginSerializationContext(): ComponentInstance<this>;
73
+ /**
74
+ * Явное создание instance entry (редко для Page/Dialog; для App-оверлеев см.
75
+ * {@link beginSerializationContext}). Обработчики enter/leave регистрируются здесь же.
76
+ */
77
+ createInstance(): ComponentInstance<this>;
66
78
  protected createSelfEntry(): ComponentInstance<this>;
67
79
  protected emitInteraction(type: string, payload: unknown, instance: ComponentInstance<this>, handlers: number[]): void;
68
80
  }
@@ -18,20 +18,32 @@ class EntryComponent extends component_1.Component {
18
18
  super(config);
19
19
  this.registeredTools = [];
20
20
  this.declaredToolsRegistered = false;
21
- // До полей наследника. В отложенном обработчике this уже собран.
21
+ this.entryLifecycleInteractionsRegistered = false;
22
+ }
23
+ /**
24
+ * `onEnter` / `onLeave` читаются при первом создании entry-инстанса,
25
+ * уже после конструктора наследника — поля и `this.options` доступны.
26
+ * Дополнительные interaction для того же момента — в {@link registerEntryLifecycleInteractionsExtra}.
27
+ */
28
+ registerEntryLifecycleInteractions() {
29
+ if (this.entryLifecycleInteractionsRegistered) {
30
+ return;
31
+ }
32
+ this.entryLifecycleInteractionsRegistered = true;
22
33
  this.bindDeclaredInteraction("enter", this.onEnter());
23
34
  this.bindDeclaredInteraction("leave", this.onLeave());
35
+ this.registerEntryLifecycleInteractionsExtra();
24
36
  }
37
+ /** Хук для наследников: один раз сразу после enter/leave (см. {@link registerEntryLifecycleInteractions}). */
38
+ registerEntryLifecycleInteractionsExtra() { }
25
39
  /**
26
40
  * Показ entry. По умолчанию — `onEnter` конструктора.
27
- * Читается в конструкторе, до полей наследника.
28
41
  */
29
42
  onEnter() {
30
43
  return this.config.onEnter;
31
44
  }
32
45
  /**
33
46
  * Начало ухода entry. По умолчанию — `onLeave` конструктора.
34
- * Читается в конструкторе, до полей наследника.
35
47
  */
36
48
  onLeave() {
37
49
  return this.config.onLeave;
@@ -145,7 +157,16 @@ class EntryComponent extends component_1.Component {
145
157
  beginSerializationContext() {
146
158
  return this.createSelfEntry();
147
159
  }
160
+ /**
161
+ * Явное создание instance entry (редко для Page/Dialog; для App-оверлеев см.
162
+ * {@link beginSerializationContext}). Обработчики enter/leave регистрируются здесь же.
163
+ */
164
+ createInstance() {
165
+ this.registerEntryLifecycleInteractions();
166
+ return super.createInstance();
167
+ }
148
168
  createSelfEntry() {
169
+ this.registerEntryLifecycleInteractions();
149
170
  const instance = super.createSelfEntry();
150
171
  const client = (0, client_context_1.currentClient)();
151
172
  // Подписка на leave и прочие interaction до commitSerialization instance.entry.
@@ -1,9 +1,9 @@
1
- import { Context, type ContextClientUpdatesForbiddenSchema, type JsonObject } from "../../core";
1
+ import { Context, type JsonObject } from "../../core";
2
2
  type ItemListIndexContext = Record<string, {
3
3
  index: `${number}`;
4
4
  }>;
5
5
  /** Контекст индексов элементов ItemList; данные не загружаются снаружи. */
6
- export declare class ItemListIndexStore<T extends JsonObject = ItemListIndexContext> extends Context<T, ContextClientUpdatesForbiddenSchema> {
6
+ export declare class ItemListIndexStore<T extends JsonObject = ItemListIndexContext> extends Context<T> {
7
7
  /**
8
8
  * Синхронно поднимает хранилище до async {@link init}, чтобы `replace` в serialize
9
9
  * не перезаписывался пустым `{}` из `initDataCallback`.
@@ -28,6 +28,11 @@ type DefaultInitConfigType = PageInitConfig<Page>;
28
28
  */
29
29
  export declare abstract class Page<InitConfigType extends PageInitConfig<any> = DefaultInitConfigType, PropertiesType extends PageProperties = PageProperties> extends EntryComponent<InitConfigType, PropertiesType, PageConfig> implements Pageable {
30
30
  constructor();
31
+ /**
32
+ * Обработчик прокрутки регистрируется вместе с enter/leave — после конструктора наследника,
33
+ * когда доступны поля подкласса (см. {@link EntryComponent.registerEntryLifecycleInteractions}).
34
+ */
35
+ protected registerEntryLifecycleInteractionsExtra(): void;
31
36
  /**
32
37
  * Возвращает HTTP-статус страницы.
33
38
  * @returns Статус страницы (по умолчанию 200 OK).
@@ -14,6 +14,12 @@ class Page extends entry_component_1.EntryComponent {
14
14
  constructor() {
15
15
  // @ts-expect-error Page задаёт content в boot(), а не через конфиг конструктора Component.
16
16
  super({});
17
+ }
18
+ /**
19
+ * Обработчик прокрутки регистрируется вместе с enter/leave — после конструктора наследника,
20
+ * когда доступны поля подкласса (см. {@link EntryComponent.registerEntryLifecycleInteractions}).
21
+ */
22
+ registerEntryLifecycleInteractionsExtra() {
17
23
  this.bindDeclaredInteraction("scroll", this.onScroll());
18
24
  }
19
25
  /**
@@ -1,5 +1,4 @@
1
1
  import { JsonObject } from "@matreshka/client-bff-protocol/types/json";
2
- import { z } from "zod";
3
2
  import { Context, ContextPathPatch } from "../context/context";
4
3
  import { ContextValueOrRef } from "../types/context-value-ref";
5
4
  import { ActionConfig } from "./action";
@@ -13,9 +12,9 @@ export type LocalContextPathPatch<T extends JsonObject> = Partial<{
13
12
  export declare class SetContext<T extends JsonObject> extends LocalAction {
14
13
  private readonly context;
15
14
  private readonly patch;
16
- constructor(context: Context<T, z.ZodObject | undefined>, patch: LocalContextPathPatch<T>, config?: ActionConfig);
15
+ constructor(context: Context<T>, patch: LocalContextPathPatch<T>, config?: ActionConfig);
17
16
  class(): string;
18
17
  payload(): object;
19
18
  }
20
19
  /** @internal */
21
- export declare function createSetContext<T extends JsonObject>(context: Context<T, z.ZodObject | undefined>, patch: LocalContextPathPatch<T>, config?: ActionConfig): SetContext<T>;
20
+ export declare function createSetContext<T extends JsonObject>(context: Context<T>, patch: LocalContextPathPatch<T>, config?: ActionConfig): SetContext<T>;
@@ -1,7 +1,6 @@
1
1
  import { JsonObject } from "@matreshka/client-bff-protocol/types/json";
2
2
  import { Observable } from "rxjs";
3
3
  import { Paths, PathValue } from "ts-essentials";
4
- import { z } from "zod";
5
4
  import { ActionConfig } from "../actions/action";
6
5
  import { DecContextValue } from "../actions/dec-context-value";
7
6
  import { IncContextValue } from "../actions/inc-context-value";
@@ -26,11 +25,11 @@ export type ContextRefValue<R extends ContextRef> = R extends {
26
25
  readonly __valueType?: infer ValueType;
27
26
  } ? Exclude<ValueType, undefined> : R extends ContextRef<infer ContextType, infer PathType> ? PathValue<ContextType, PathType> : never;
28
27
  export declare class ContextRef<ContextType extends JsonObject = JsonObject, PathType extends string = string> {
29
- readonly context: Context<ContextType, z.ZodObject | undefined>;
28
+ readonly context: Context<ContextType>;
30
29
  readonly path: PathType;
31
30
  /** Локальные (client-only) действия по этому ref. */
32
31
  readonly local: ContextRefLocalActions<ContextType, PathType>;
33
- constructor(context: Context<ContextType, z.ZodObject | undefined>, path: PathType);
32
+ constructor(context: Context<ContextType>, path: PathType);
34
33
  /**
35
34
  * Продолжение пути в рамках того же контекста.
36
35
  * Строго типизировано: K должен быть путём внутри значения по текущему PathType.
@@ -24,11 +24,9 @@ export type ContextClientUpdatesForbiddenSchema = z.ZodObject<Record<string, nev
24
24
  export declare const contextClientUpdatesForbiddenSchema: ContextClientUpdatesForbiddenSchema;
25
25
  type StripNullish<T> = Exclude<T, null | undefined>;
26
26
  type ArrayElement<T> = T extends readonly (infer E)[] ? E : never;
27
- /** `true`, если output допускает null/undefined как значение, а поле `T` — нет. */
28
- type NullishValueMismatch<TField, IField> = (null extends IField ? (null extends TField ? never : true) : never) | (undefined extends IField ? undefined extends TField ? never : true : never);
29
27
  type FieldExtraSchemaKeysOne<TField, IField> = [StripNullish<IField>] extends [
30
- JsonObject
31
- ] ? [StripNullish<TField>] extends [JsonObject] ? ExtraSchemaKeys<StripNullish<TField>, StripNullish<IField>> : never : [StripNullish<IField>] extends [readonly unknown[]] ? [StripNullish<TField>] extends [readonly unknown[]] ? ExtraSchemaKeys<ArrayElement<StripNullish<TField>>, ArrayElement<StripNullish<IField>>> : never : never;
28
+ readonly unknown[]
29
+ ] ? [StripNullish<TField>] extends [readonly unknown[]] ? ExtraSchemaKeys<ArrayElement<StripNullish<TField>>, ArrayElement<StripNullish<IField>>> : never : [StripNullish<IField>] extends [JsonObject] ? [StripNullish<TField>] extends [JsonObject] ? ExtraSchemaKeys<StripNullish<TField>, StripNullish<IField>> : never : never;
32
30
  /** Лишние ключи внутри поля (union, optional/nullable, массивы объектов). */
33
31
  type FieldExtraSchemaKeys<TField, IField> = IField extends any ? FieldExtraSchemaKeysOne<TField, IField> : never;
34
32
  /** Лишние ключи для одной пары object-веток (коррелированные поля). `true` — есть лишние ключи. */
@@ -42,78 +40,71 @@ type SomeExtraSchemaKeysBranchOk<T, Input extends JsonObject> = T extends JsonOb
42
40
  * Union в `Input` и `T` проверяется по отдельным веткам. `true` — есть лишние ключи.
43
41
  */
44
42
  type ExtraSchemaKeys<T, Input> = Input extends JsonObject ? SomeExtraSchemaKeysBranchOk<T, Input> extends true ? never : true : never;
45
- type FieldSchemaCompatibleOne<TField, IField> = NullishValueMismatch<TField, IField> extends never ? FieldSchemaCompatibleShape<TField, IField> : true;
46
- type FieldSchemaCompatibleShape<TField, IField> = [
47
- StripNullish<IField>
48
- ] extends [JsonObject] ? [StripNullish<TField>] extends [JsonObject] ? SchemaCompatible<StripNullish<TField>, StripNullish<IField>> : true : [StripNullish<IField>] extends [readonly unknown[]] ? [StripNullish<TField>] extends [readonly unknown[]] ? FieldSchemaCompatible<ArrayElement<StripNullish<TField>>, ArrayElement<StripNullish<IField>>> : true : [StripNullish<IField>] extends [StripNullish<TField>] ? never : true;
49
- /** Совместимость типа поля с полем контекста (union на входе — по веткам). */
50
- type FieldSchemaCompatible<TField, IField> = IField extends any ? FieldSchemaCompatibleOne<TField, IField> : never;
51
- /** Совместимость для одной пары object-веток. `true` — несовместимость. */
52
- type SchemaCompatibleObjectExact<T extends JsonObject, Input extends JsonObject> = Exclude<keyof Input, keyof T> extends never ? {
53
- [K in keyof Input & keyof T]: FieldSchemaCompatible<T[K], Input[K]>;
54
- }[keyof Input & keyof T] extends never ? never : true : true;
55
- type SomeSchemaCompatibleBranchOk<T, Input extends JsonObject> = T extends JsonObject ? SchemaCompatibleObjectExact<T, Input> extends never ? true : never : never;
56
- /**
57
- * Типы полей shape схемы совместимы с `T` (рекурсивно; для клиентской схемы — {@link z.output}).
58
- * Подмножество ключей на любой глубине; union — по веткам. `true` — несовместимость.
59
- */
60
- type SchemaCompatible<T, Input> = Input extends JsonObject ? SomeSchemaCompatibleBranchOk<T, Input> extends true ? never : true : never;
43
+ type SchemaInputKeysSubset<T extends JsonObject, S extends z.ZodObject> = Exclude<keyof z.input<S>, keyof T> extends never ? true : false;
44
+ type DeepPartial<T> = T extends readonly (infer E)[] ? readonly DeepPartial<E>[] : T extends object ? {
45
+ [K in keyof T]?: DeepPartial<T[K]>;
46
+ } : T;
47
+ type SchemaOutputCompatible<T extends JsonObject, S extends z.ZodObject> = z.output<S> extends DeepPartial<T> ? true : false;
61
48
  /**
62
- * Zod-схема для {@link context}: без лишних ключей во {@link z.input} и {@link z.output}
49
+ * Zod-схема для {@link createContext}: без лишних ключей во {@link z.input} и {@link z.output}
63
50
  * ({@link ExtraSchemaKeys}, union по веткам); {@link z.output} совместим с `T`
64
51
  * ({@link SchemaCompatible}, вложенные подмножества). В контекст попадает output после `parse()`.
65
52
  */
66
- export type ContextSchema<T extends JsonObject, S extends z.ZodObject> = [
67
- S
68
- ] extends [ContextClientUpdatesForbiddenSchema] ? S : ExtraSchemaKeys<T, z.input<S>> extends never ? ExtraSchemaKeys<T, z.output<S>> extends never ? SchemaCompatible<T, z.output<S>> extends never ? S : never : never : never;
69
- /** Конфиг {@link context} без клиентской Zod-схемы. */
53
+ export type ContextSchema<T extends JsonObject, S extends z.ZodObject> = SchemaOutputCompatible<T, S> extends false ? never : SchemaInputKeysSubset<T, S> extends false ? never : ExtraSchemaKeys<T, z.input<S>> extends never ? ExtraSchemaKeys<T, z.output<S>> extends never ? S : never : never;
54
+ /** Конфиг {@link createContext} без клиентской Zod-схемы. */
70
55
  export type ContextInitWithoutSchema<T extends JsonObject> = {
71
56
  data: () => Promise<T>;
72
57
  schema?: undefined;
73
58
  preload?: boolean;
74
59
  persistent?: boolean;
75
60
  };
76
- /** Конфиг {@link context} с Zod-схемой клиентских изменений. */
61
+ /** Конфиг {@link createContext} с Zod-схемой клиентских изменений. */
77
62
  export type ContextInitWithSchema<T extends JsonObject, S extends z.ZodObject> = {
78
63
  data: () => Promise<T>;
79
64
  schema: ContextSchema<T, S>;
80
65
  preload?: boolean;
81
66
  persistent?: boolean;
82
67
  };
83
- /** Конфигурация {@link context} (единственный аргумент). */
68
+ /** Конфигурация {@link createContext} (единственный аргумент). */
84
69
  export type ContextInitConfig<T extends JsonObject, S extends z.ZodObject | undefined = undefined> = S extends z.ZodObject ? ContextInitWithSchema<T, S> : ContextInitWithoutSchema<T>;
85
- /** Минимальная форма аргумента {@link context}. */
70
+ /** Минимальная форма аргумента {@link createContext}. */
86
71
  type ContextInitShape = {
87
72
  data: () => Promise<JsonObject>;
88
73
  schema?: z.ZodObject;
89
74
  preload?: boolean;
90
75
  persistent?: boolean;
91
76
  };
77
+ type ContextRuntimeInit<T extends JsonObject> = {
78
+ data: () => Promise<T>;
79
+ schema?: z.ZodObject;
80
+ preload?: boolean;
81
+ persistent?: boolean;
82
+ };
92
83
  /** Тип данных `T` из поля `data` конфига. */
93
84
  export type ContextDataFromInit<C extends ContextInitShape> = Awaited<ReturnType<C["data"]>>;
94
85
  /** Zod-схема из поля `schema` конфига (или `undefined`). */
95
86
  export type ContextSchemaFromInit<C extends ContextInitShape> = C extends {
96
87
  schema: z.ZodObject;
97
88
  } ? C["schema"] : undefined;
98
- /** Экземпляр {@link Context} по форме конфига {@link context}. */
99
- export type ContextFromInit<C extends ContextInitShape> = ContextSchemaFromInit<C> extends z.ZodObject ? Context<ContextDataFromInit<C>, ContextSchemaFromInit<C>> : Context<ContextDataFromInit<C>, undefined>;
100
- type ValidatedContextInit<C extends ContextInitShape> = ContextInitConfig<ContextDataFromInit<C>, ContextSchemaFromInit<C> extends z.ZodObject ? ContextSchemaFromInit<C> : undefined>;
101
- type StoredContext = Context<JsonObject, z.ZodObject | undefined>;
89
+ /** Экземпляр {@link Context} по форме конфига {@link createContext}. */
90
+ export type ContextFromInit<C extends ContextInitShape> = Context<ContextDataFromInit<C>>;
102
91
  /**
103
92
  * Контекст данных, связанных с клиентом.
104
93
  *
105
- * @internal Создавайте экземпляры через {@link context}.
94
+ * @internal Создавайте экземпляры через {@link createContext}.
106
95
  *
107
96
  * @template T Тип структуры данных контекста.
108
- * @template S Zod-схема валидации клиентских изменений (см. {@link ContextSchema}).
97
+ *
98
+ * Zod-схема клиентских изменений задаётся в {@link createContext} через поле `schema`,
99
+ * а не вторым type-параметром: так проще согласовать runtime-схему и тип данных.
109
100
  */
110
- export declare class Context<T extends JsonObject, S extends z.ZodObject | undefined = undefined> {
101
+ export declare class Context<T extends JsonObject> {
111
102
  /** Уникальный идентификатор контекста */
112
103
  readonly id: `${string}-${string}-${string}-${string}-${string}`;
113
104
  /** Реактивное хранилище данных контекста. */
114
105
  protected data$?: BehaviorSubject<T>;
115
106
  /** Схема валидации данных контекста */
116
- readonly schema?: S extends z.ZodObject ? S : undefined;
107
+ readonly schema?: z.ZodObject;
117
108
  /** Флаг, указывающий, что контекст должен быть инициализирован при авторизации клиента */
118
109
  readonly preload: boolean;
119
110
  /**
@@ -165,7 +156,7 @@ export declare class Context<T extends JsonObject, S extends z.ZodObject | undef
165
156
  * Подписывается на входящие сообщения от клиента и ошибки, связанные с этим контекстом.
166
157
 
167
158
  */
168
- constructor(config: S extends z.ZodObject ? ContextInitWithSchema<T, S> : ContextInitWithoutSchema<T>);
159
+ constructor(config: ContextRuntimeInit<T>);
169
160
  /** `data$` создан (init мог ещё выполняться — см. {@link init}). */
170
161
  inited(): boolean;
171
162
  /** Данные загружены: `initDataCallback` завершился. */
@@ -275,14 +266,22 @@ export declare class Context<T extends JsonObject, S extends z.ZodObject | undef
275
266
  toJSON(): `${string}-${string}-${string}-${string}-${string}`;
276
267
  }
277
268
  /** Любой зарегистрированный контекст (с Zod-схемой или без). */
278
- export type AnyContext = StoredContext;
269
+ export type AnyContext = Context<any>;
279
270
  /**
280
271
  * Создаёт контекст данных BFF: хранилище состояния с синхронизацией клиент ↔ сервер.
281
272
  *
282
273
  * Тип данных выводится из `data`, тип Zod-схемы — из `schema`. Связь проверяется через
283
- * {@link ContextSchema}. Generic-параметры у вызова не задаются.
274
+ * {@link ContextSchema}.
284
275
  *
285
276
  * Если в начальном `data` нет части полей (например опциональных), укажите тип на колбэке:
286
277
  * `data: async (): Promise<MyT> => ({ … })`.
287
278
  */
288
- export declare function context<C extends ContextInitShape>(config: C & ValidatedContextInit<C>): ContextFromInit<C>;
279
+ type ContextWithSchemaInit = {
280
+ data: () => Promise<unknown>;
281
+ schema: z.ZodObject;
282
+ preload?: boolean;
283
+ persistent?: boolean;
284
+ };
285
+ type ContextDataForSchema<C extends ContextWithSchemaInit> = Awaited<ReturnType<C["data"]>> extends infer T ? T extends JsonObject ? T : never : never;
286
+ export declare function createContext<const C extends ContextWithSchemaInit>(config: C, ...validation: ContextSchema<ContextDataForSchema<C>, NoInfer<C["schema"]>> extends never ? [schemaMismatch: never] : []): Context<ContextDataForSchema<C>>;
287
+ export declare function createContext<const T extends JsonObject>(config: ContextInitWithoutSchema<T>): Context<T>;
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Context = exports.contextClientUpdatesForbiddenSchema = void 0;
4
- exports.context = context;
4
+ exports.createContext = createContext;
5
5
  const index_1 = require("@matreshka/client-bff-protocol/messages/bff-to-client/context/index");
6
6
  const index_2 = require("@matreshka/client-bff-protocol/messages/client-to-bff/context/index");
7
7
  const targeted_message_1 = require("@matreshka/client-bff-protocol/messages/targeted-message");
@@ -78,10 +78,12 @@ function isClientBound(contextId, client) {
78
78
  /**
79
79
  * Контекст данных, связанных с клиентом.
80
80
  *
81
- * @internal Создавайте экземпляры через {@link context}.
81
+ * @internal Создавайте экземпляры через {@link createContext}.
82
82
  *
83
83
  * @template T Тип структуры данных контекста.
84
- * @template S Zod-схема валидации клиентских изменений (см. {@link ContextSchema}).
84
+ *
85
+ * Zod-схема клиентских изменений задаётся в {@link createContext} через поле `schema`,
86
+ * а не вторым type-параметром: так проще согласовать runtime-схему и тип данных.
85
87
  */
86
88
  class Context {
87
89
  assertNotDestroyed() {
@@ -181,7 +183,7 @@ class Context {
181
183
  this.skipNextDataSync = false;
182
184
  /** Очередь входящих targeted-сообщений всех клиентов (последовательная обработка). */
183
185
  this.incomingClientMessages$ = new rxjs_1.Subject();
184
- this.schema = ("schema" in config ? config.schema : undefined);
186
+ this.schema = config.schema;
185
187
  if (this.schema) {
186
188
  (0, assert_client_update_schema_1.assertClientUpdateSchemaSupported)(this.schema);
187
189
  }
@@ -571,15 +573,6 @@ class Context {
571
573
  }
572
574
  }
573
575
  exports.Context = Context;
574
- /**
575
- * Создаёт контекст данных BFF: хранилище состояния с синхронизацией клиент ↔ сервер.
576
- *
577
- * Тип данных выводится из `data`, тип Zod-схемы — из `schema`. Связь проверяется через
578
- * {@link ContextSchema}. Generic-параметры у вызова не задаются.
579
- *
580
- * Если в начальном `data` нет части полей (например опциональных), укажите тип на колбэке:
581
- * `data: async (): Promise<MyT> => ({ … })`.
582
- */
583
- function context(config) {
576
+ function createContext(config, ..._validation) {
584
577
  return new Context(config);
585
578
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@matreshka/bff",
3
- "version": "0.29.0",
3
+ "version": "0.30.2",
4
4
  "description": "Matreshka BFF: server-driven UI runtime — routing, pages, context, component DSL, and platform APIs",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",