@matreshka/bff 0.30.2 → 0.32.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.
- package/dist/components/for-each.d.ts +19 -11
- package/dist/components/inputs/input-component.d.ts +5 -5
- package/dist/components/inputs/number-input.js +3 -1
- package/dist/components/inputs/password-input.js +3 -1
- package/dist/components/inputs/text-editor.js +3 -1
- package/dist/components/inputs/text-input.js +3 -1
- package/dist/components/inputs/textarea.js +3 -1
- package/dist/components/item-list/item-list.d.ts +3 -3
- package/dist/components/item-list/list-from-ref-context.d.ts +2 -2
- package/dist/components/item-list/types.d.ts +18 -13
- package/dist/components/outputs/output-component.d.ts +5 -5
- package/dist/components/types/component-sequence.d.ts +2 -2
- package/dist/core/actions/dec-context-value.d.ts +3 -3
- package/dist/core/actions/inc-context-value.d.ts +4 -4
- package/dist/core/actions/set-context.d.ts +8 -7
- package/dist/core/actions/toggle-context-value.d.ts +3 -3
- package/dist/core/conditions/condition-operand.d.ts +9 -9
- package/dist/core/conditions/context-array-includes.d.ts +4 -4
- package/dist/core/conditions/context-array-length.d.ts +15 -15
- package/dist/core/conditions/context-value-defined.d.ts +3 -3
- package/dist/core/conditions/context-value-defined.js +1 -1
- package/dist/core/conditions/context-value-equal.d.ts +2 -2
- package/dist/core/conditions/context-value-in.d.ts +2 -2
- package/dist/core/conditions/context-value-not-equal.d.ts +2 -2
- package/dist/core/conditions/context-value-undefined.d.ts +3 -3
- package/dist/core/conditions/context-value-undefined.js +1 -1
- package/dist/core/context/context-create.d.ts +91 -0
- package/dist/core/context/context-create.js +7 -0
- package/dist/core/context/context-ref.d.ts +20 -17
- package/dist/core/context/context.d.ts +35 -91
- package/dist/core/context/context.js +25 -4
- package/dist/core/types/context-value-ref.d.ts +54 -10
- package/dist/platforms/platform.d.ts +5 -5
- package/package.json +1 -1
|
@@ -1,31 +1,39 @@
|
|
|
1
1
|
import { ServerComponentClass } from "@matreshka/client-bff-protocol/enums/server-component-class";
|
|
2
2
|
import type { ForEachConfig } from "@matreshka/client-bff-protocol/types/for-each-config";
|
|
3
3
|
import { Paths, PathValue } from "ts-essentials";
|
|
4
|
-
import { ComponentInstance, ComponentTreeNode, Context, ContextRef,
|
|
4
|
+
import { AnySchemaContextRef, ComponentInstance, ComponentTreeNode, Context, ContextRef, ContextRefLocalActions, ContextRefValueType, JsonObject, StandaloneComponent, WritableContextRefOfValue } from "../core";
|
|
5
|
+
import type { z } from "zod";
|
|
5
6
|
import { Component, ComponentInitConfig, ComponentProperties } from "./component";
|
|
6
7
|
type ForEachArrayValue = readonly unknown[] | unknown[];
|
|
7
|
-
type ForEachItemArray<RefType extends
|
|
8
|
-
export type CompatibleForEachRef<RefType extends
|
|
8
|
+
type ForEachItemArray<RefType extends AnySchemaContextRef> = Extract<ContextRefValueType<RefType>, ForEachArrayValue>;
|
|
9
|
+
export type CompatibleForEachRef<RefType extends AnySchemaContextRef> = [
|
|
9
10
|
ForEachItemArray<RefType>
|
|
10
11
|
] extends [never] ? never : RefType;
|
|
11
|
-
type ForEachItemData<RefType extends
|
|
12
|
-
type
|
|
12
|
+
type ForEachItemData<RefType extends AnySchemaContextRef> = ForEachItemArray<RefType>[number];
|
|
13
|
+
type ForEachIsAny<T> = 0 extends 1 & T ? true : false;
|
|
14
|
+
/**
|
|
15
|
+
* `local` item-ref: при известной schema — по ней (writable-пути), при `any`
|
|
16
|
+
* (ref без привязки к schema) — по типу значения.
|
|
17
|
+
*/
|
|
18
|
+
type ForEachItemLocal<ContextType extends JsonObject, PathType extends string, SchemaType extends z.ZodObject | undefined, ValueType> = ForEachIsAny<SchemaType> extends true ? WritableContextRefOfValue<ValueType>["local"] : ContextRefLocalActions<ContextType, PathType, SchemaType>;
|
|
19
|
+
type ForEachTypedItemRef<ContextType extends JsonObject, PathType extends string, ValueType, SchemaType extends z.ZodObject | undefined = any> = Omit<AnySchemaContextRef, "context" | "path" | "ref" | "get" | "local"> & {
|
|
13
20
|
readonly context: Context<ContextType>;
|
|
14
21
|
readonly path: PathType;
|
|
15
22
|
readonly __valueType?: ValueType;
|
|
23
|
+
readonly local: ForEachItemLocal<ContextType, PathType, SchemaType, ValueType>;
|
|
16
24
|
get(): ValueType;
|
|
17
25
|
get(): JsonObject;
|
|
18
|
-
ref<K extends Paths<ValueType>>(path: K): ForEachTypedItemRef<ContextType, `${PathType}.${K & string}`, PathValue<ValueType, K
|
|
26
|
+
ref<K extends Paths<ValueType>>(path: K): ForEachTypedItemRef<ContextType, `${PathType}.${K & string}`, PathValue<ValueType, K>, SchemaType>;
|
|
19
27
|
ref<P2 extends string>(path: ContextRef<ContextType, P2>): ContextRef<ContextType, `${PathType}.${P2}`>;
|
|
20
28
|
};
|
|
21
|
-
type ForEachItemLink<RefType extends
|
|
29
|
+
type ForEachItemLink<RefType extends AnySchemaContextRef> = RefType extends ContextRef<infer ContextType, infer PathType, infer SchemaType> ? ForEachTypedItemRef<ContextType, `${PathType}.${number}`, ForEachItemData<RefType>, SchemaType> : never;
|
|
22
30
|
/**
|
|
23
31
|
* Свойства, передаваемые генератору компонентов в `ForEach`.
|
|
24
32
|
*
|
|
25
33
|
* @property component Компонент `ForEach`, инициирующий генерацию.
|
|
26
34
|
* @property key Ключ контекста, в котором хранятся данные элемента.
|
|
27
35
|
*/
|
|
28
|
-
export type ForEachGeneratorProperties<RefType extends
|
|
36
|
+
export type ForEachGeneratorProperties<RefType extends AnySchemaContextRef, ComponentType extends ComponentTreeNode = ComponentTreeNode> = {
|
|
29
37
|
component: ForEach<RefType, ComponentType>;
|
|
30
38
|
ref: ForEachItemLink<RefType>;
|
|
31
39
|
};
|
|
@@ -40,7 +48,7 @@ export type ForEachProperties = {
|
|
|
40
48
|
components?: (ComponentTreeNode | ComponentTreeNode[])[];
|
|
41
49
|
divider?: ComponentTreeNode[];
|
|
42
50
|
} & ComponentProperties;
|
|
43
|
-
export declare const forEach: <RefType extends
|
|
51
|
+
export declare const forEach: <RefType extends AnySchemaContextRef, ComponentType extends ComponentTreeNode = ComponentTreeNode, PropertiesType extends ForEachProperties = ForEachProperties>(config: ForEachInitConfig<RefType, ComponentType, PropertiesType>) => ForEach<RefType, ComponentType, PropertiesType>;
|
|
44
52
|
/**
|
|
45
53
|
* Конфигурация инициализации компонента `ForEach`.
|
|
46
54
|
*
|
|
@@ -49,7 +57,7 @@ export declare const forEach: <RefType extends ContextRef<any, any>, ComponentTy
|
|
|
49
57
|
* @property preload Флаг, указывающий, что компонент должен генерировать компоненты при инициализации, ускоряет загрузку страницы, но увеличивает время загрузки и объем данных, к тому же данные могут измениться к моменту onShow из-за изменения контекста.
|
|
50
58
|
* @property generator Функция, генерирующая компонент(ы) для каждого элемента данных.
|
|
51
59
|
*/
|
|
52
|
-
export type ForEachInitConfig<RefType extends
|
|
60
|
+
export type ForEachInitConfig<RefType extends AnySchemaContextRef, ComponentType extends ComponentTreeNode = ComponentTreeNode, PropertiesType extends ForEachProperties = ForEachProperties> = {
|
|
53
61
|
ref: CompatibleForEachRef<RefType>;
|
|
54
62
|
preload?: boolean;
|
|
55
63
|
track: (data: ForEachItemData<RefType>) => string;
|
|
@@ -60,7 +68,7 @@ export type ForEachInitConfig<RefType extends ContextRef<any, any>, ComponentTyp
|
|
|
60
68
|
/**
|
|
61
69
|
* Компонент, отображающий список элементов путём генерации компонентов на основе массива данных.
|
|
62
70
|
*/
|
|
63
|
-
export declare class ForEach<RefType extends
|
|
71
|
+
export declare class ForEach<RefType extends AnySchemaContextRef, ComponentType extends ComponentTreeNode = ComponentTreeNode, PropertiesType extends ForEachProperties = ForEachProperties> extends Component<ForEachInitConfig<RefType, ComponentType>, PropertiesType> implements StandaloneComponent {
|
|
64
72
|
/** Включён ли preload: элементы сериализуются уже в первом ответе страницы. */
|
|
65
73
|
private preload;
|
|
66
74
|
/** Сколько раз ForEach в состоянии onShow (несколько instance на клиенте). */
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { AnySchemaContextRef, Componentable, StandaloneComponent, WritableContextRefOfValue } from "../../core";
|
|
2
2
|
import { Component, ComponentInitConfig, ComponentProperties } from "../component";
|
|
3
3
|
/** Ref на поле ввода: значение `ValueType | undefined`. */
|
|
4
|
-
export type InputContextRef<ValueType> =
|
|
4
|
+
export type InputContextRef<ValueType> = WritableContextRefOfValue<ValueType | undefined>;
|
|
5
5
|
/** Ref на строковое поле ввода. */
|
|
6
6
|
export type StringInputContextRef = InputContextRef<string>;
|
|
7
7
|
/**
|
|
8
8
|
* Конфигурация инициализации компонента ввода.
|
|
9
9
|
* @property ref Ссылка в контексте.
|
|
10
10
|
*/
|
|
11
|
-
/**
|
|
12
|
-
export type CompatibleInputRef<ValueType, RefType extends
|
|
13
|
-
export type InputInitConfig<ValueType, ComponentType extends Componentable = InputComponent, RefType extends
|
|
11
|
+
/** Writable ref на поле ввода со значением `ValueType | undefined`. */
|
|
12
|
+
export type CompatibleInputRef<ValueType, RefType extends AnySchemaContextRef = AnySchemaContextRef> = WritableContextRefOfValue<ValueType | undefined>;
|
|
13
|
+
export type InputInitConfig<ValueType, ComponentType extends Componentable = InputComponent, RefType extends AnySchemaContextRef = AnySchemaContextRef, PropertiesType extends InputProperties = InputProperties> = {
|
|
14
14
|
ref: CompatibleInputRef<ValueType, RefType>;
|
|
15
15
|
} & ComponentInitConfig<ComponentType, PropertiesType>;
|
|
16
16
|
/**
|
|
@@ -14,7 +14,9 @@ function passwordInput(arg0, arg1) {
|
|
|
14
14
|
}
|
|
15
15
|
const single = arg0;
|
|
16
16
|
if (single instanceof core_1.ContextRef) {
|
|
17
|
-
return new PasswordInput({
|
|
17
|
+
return new PasswordInput({
|
|
18
|
+
ref: single,
|
|
19
|
+
});
|
|
18
20
|
}
|
|
19
21
|
return new PasswordInput(single);
|
|
20
22
|
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import type { ServerComponentConfig } from "@matreshka/client-bff-protocol/types/server-component-config";
|
|
2
|
-
import { ComponentInstance, ComponentTreeNode
|
|
2
|
+
import { AnySchemaContextRef, ComponentInstance, ComponentTreeNode } from "../../core";
|
|
3
3
|
import type { ItemListHost } from "./item-list-host";
|
|
4
4
|
import { type ItemListInitConfig, type NestedItemTreeNode } from "./types";
|
|
5
5
|
/**
|
|
6
6
|
* Динамический сегмент nested-элементов (map markers / board items):
|
|
7
7
|
* читает массив из `Context`, генерирует элементы и синхронизирует host через diff.
|
|
8
8
|
*/
|
|
9
|
-
export declare class ItemList<RefType extends
|
|
9
|
+
export declare class ItemList<RefType extends AnySchemaContextRef, ItemType extends NestedItemTreeNode = NestedItemTreeNode> {
|
|
10
10
|
readonly isItemList: true;
|
|
11
11
|
/** Уникальный id сегмента для nested path и release instances. */
|
|
12
12
|
readonly segmentId: string;
|
|
@@ -65,4 +65,4 @@ export declare class ItemList<RefType extends ContextRef<any, any>, ItemType ext
|
|
|
65
65
|
private generateItems;
|
|
66
66
|
}
|
|
67
67
|
/** Factory для DSL: `itemList({ ref, track, generator, preload? })`. */
|
|
68
|
-
export declare const itemList: <RefType extends
|
|
68
|
+
export declare const itemList: <RefType extends AnySchemaContextRef, ItemType extends NestedItemTreeNode = NestedItemTreeNode>(config: ItemListInitConfig<RefType, ItemType>) => ItemList<RefType, ItemType>;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { Context, type JsonObject } from "../../core";
|
|
1
|
+
import { Context, contextClientUpdatesForbiddenSchema, 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> {
|
|
6
|
+
export declare class ItemListIndexStore<T extends JsonObject = ItemListIndexContext> extends Context<T, typeof contextClientUpdatesForbiddenSchema> {
|
|
7
7
|
/**
|
|
8
8
|
* Синхронно поднимает хранилище до async {@link init}, чтобы `replace` в serialize
|
|
9
9
|
* не перезаписывался пустым `{}` из `initDataCallback`.
|
|
@@ -1,40 +1,45 @@
|
|
|
1
1
|
import type { Paths, PathValue } from "ts-essentials";
|
|
2
|
-
import type {
|
|
2
|
+
import type { z } from "zod";
|
|
3
|
+
import type { AnySchemaContextRef, ComponentTreeNode, ContextRef, ContextRefLocalActions, JsonObject, WritableContextRefOfValue } from "../../core";
|
|
3
4
|
export type ListArrayValue = readonly unknown[] | unknown[];
|
|
4
|
-
type ItemArray<RefType extends
|
|
5
|
-
export type CompatibleItemListRef<RefType extends
|
|
5
|
+
type ItemArray<RefType extends AnySchemaContextRef> = Extract<ReturnType<RefType["get"]>, ListArrayValue>;
|
|
6
|
+
export type CompatibleItemListRef<RefType extends AnySchemaContextRef> = [
|
|
6
7
|
ItemArray<RefType>
|
|
7
8
|
] extends [never] ? never : RefType;
|
|
8
|
-
export type ItemListItemData<RefType extends
|
|
9
|
-
|
|
9
|
+
export type ItemListItemData<RefType extends AnySchemaContextRef> = ItemArray<RefType>[number];
|
|
10
|
+
type ItemListIsAny<T> = 0 extends 1 & T ? true : false;
|
|
11
|
+
/** `local` item-ref: по schema, а при `any` — по типу значения. */
|
|
12
|
+
type ItemListItemLocal<ContextType extends JsonObject, PathType extends string, SchemaType extends z.ZodObject | undefined, ValueType> = ItemListIsAny<SchemaType> extends true ? WritableContextRefOfValue<ValueType>["local"] : ContextRefLocalActions<ContextType, PathType, SchemaType>;
|
|
13
|
+
export type ItemListTypedItemRef<ContextType extends JsonObject, PathType extends string, ValueType, SchemaType extends z.ZodObject | undefined = any> = Omit<AnySchemaContextRef, "path" | "ref" | "get" | "local"> & {
|
|
10
14
|
readonly path: PathType;
|
|
11
15
|
readonly __valueType?: ValueType;
|
|
16
|
+
readonly local: ItemListItemLocal<ContextType, PathType, SchemaType, ValueType>;
|
|
12
17
|
get(): ValueType;
|
|
13
18
|
get(): JsonObject;
|
|
14
|
-
ref<K extends Paths<ValueType>>(path: K): ItemListTypedItemRef<ContextType, `${PathType}.${K & string}`, PathValue<ValueType, K
|
|
15
|
-
ref<P2 extends string>(path: ContextRef<ContextType, P2>): ContextRef<ContextType, `${PathType}.${P2}
|
|
19
|
+
ref<K extends Paths<ValueType>>(path: K): ItemListTypedItemRef<ContextType, `${PathType}.${K & string}`, PathValue<ValueType, K>, SchemaType>;
|
|
20
|
+
ref<P2 extends string>(path: ContextRef<ContextType, P2, any>): ContextRef<ContextType, `${PathType}.${P2}`, any>;
|
|
16
21
|
};
|
|
17
|
-
export type ItemListItemLink<RefType extends
|
|
22
|
+
export type ItemListItemLink<RefType extends AnySchemaContextRef> = RefType extends ContextRef<infer ContextType, infer PathType, infer SchemaType> ? ItemListTypedItemRef<ContextType, `${PathType}.${number}`, ItemListItemData<RefType>, SchemaType> : never;
|
|
18
23
|
export type NestedItemTreeNode = {
|
|
19
24
|
component: ComponentTreeNode;
|
|
20
25
|
};
|
|
21
|
-
export type ItemListGeneratorProperties<RefType extends
|
|
26
|
+
export type ItemListGeneratorProperties<RefType extends AnySchemaContextRef, ItemType extends NestedItemTreeNode = NestedItemTreeNode> = {
|
|
22
27
|
ref: ItemListItemLink<RefType>;
|
|
23
28
|
itemList: {
|
|
24
29
|
readonly segmentId: string;
|
|
25
30
|
};
|
|
26
31
|
};
|
|
27
|
-
export type ItemListInitConfig<RefType extends
|
|
32
|
+
export type ItemListInitConfig<RefType extends AnySchemaContextRef, ItemType extends NestedItemTreeNode = NestedItemTreeNode> = {
|
|
28
33
|
ref: CompatibleItemListRef<RefType>;
|
|
29
34
|
track: (data: ItemListItemData<RefType>) => string;
|
|
30
35
|
preload?: boolean;
|
|
31
36
|
generator: (properties: ItemListGeneratorProperties<RefType, ItemType>) => ItemType;
|
|
32
37
|
};
|
|
33
|
-
export declare function getItemListValue<RefType extends
|
|
38
|
+
export declare function getItemListValue<RefType extends AnySchemaContextRef>(ref: RefType): ItemListItemData<RefType>[];
|
|
34
39
|
type ItemListIndexContextRecord = Record<string, {
|
|
35
40
|
index: `${number}`;
|
|
36
41
|
}>;
|
|
37
|
-
export declare function createItemListItemLink<ContextType extends JsonObject, PathType extends string, RefType extends ContextRef<ContextType, PathType> & {
|
|
42
|
+
export declare function createItemListItemLink<ContextType extends JsonObject, PathType extends string, RefType extends ContextRef<ContextType, PathType, any> & {
|
|
38
43
|
get(): ListArrayValue | undefined;
|
|
39
|
-
}>(ref: RefType, indexRef: ContextRef<ItemListIndexContextRecord, `${string}.index
|
|
44
|
+
}>(ref: RefType, indexRef: ContextRef<ItemListIndexContextRecord, `${string}.index`, any>): ItemListItemLink<RefType>;
|
|
40
45
|
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Componentable,
|
|
1
|
+
import { Componentable, ContextRefOfValue, ContextRefValueType, StandaloneComponent } from "../../core";
|
|
2
2
|
import { Component, ComponentInitConfig, ComponentProperties } from "../component";
|
|
3
3
|
/**
|
|
4
4
|
* Конфигурация инициализации для компонента вывода.
|
|
@@ -8,13 +8,13 @@ import { Component, ComponentInitConfig, ComponentProperties } from "../componen
|
|
|
8
8
|
* @property ref Ссылка на значение в контексте, откуда будет браться значение.
|
|
9
9
|
* @property value Статическое значение.
|
|
10
10
|
*/
|
|
11
|
-
/** Ref на поле вывода (`
|
|
12
|
-
export type OutputContextRef<ValueType> =
|
|
11
|
+
/** Ref на поле вывода (`ContextRefOfValue` для scalar `ValueType` компонента). */
|
|
12
|
+
export type OutputContextRef<ValueType> = ContextRefOfValue<ValueType | undefined>;
|
|
13
13
|
/** Ref на строковое поле вывода. */
|
|
14
14
|
export type StringOutputContextRef = OutputContextRef<string>;
|
|
15
15
|
/** Ref на числовое поле вывода. */
|
|
16
16
|
export type NumberOutputContextRef = OutputContextRef<number>;
|
|
17
|
-
export type CompatibleOutputRef<ValueType, RefType extends OutputContextRef<ValueType>> = ValueType extends
|
|
17
|
+
export type CompatibleOutputRef<ValueType, RefType extends OutputContextRef<ValueType>> = ValueType extends ContextRefValueType<RefType> ? RefType : never;
|
|
18
18
|
export type OutputInitConfig<ValueType, ComponentType extends Componentable = OutputComponent, RefType extends OutputContextRef<ValueType> = OutputContextRef<ValueType>, PropertiesType extends OutputProperties = OutputProperties> = ({
|
|
19
19
|
ref: CompatibleOutputRef<ValueType, RefType>;
|
|
20
20
|
} | {
|
|
@@ -56,7 +56,7 @@ export declare abstract class OutputComponent<InitConfigType extends OutputInitC
|
|
|
56
56
|
* Первая аргумент-мост для фабрик output: литерал `value` или экземпляр {@link ContextRef}.
|
|
57
57
|
*/
|
|
58
58
|
export declare function outputValueRefToConfig<TOpts extends object>(valueOrRef: unknown, opts: TOpts): TOpts & ({
|
|
59
|
-
ref:
|
|
59
|
+
ref: ContextRefOfValue<unknown>;
|
|
60
60
|
} | {
|
|
61
61
|
value: unknown;
|
|
62
62
|
});
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { ForEach } from "@matreshka/bff/components/for-each";
|
|
2
|
-
import type { ComponentTreeNode,
|
|
3
|
-
export type ComponentSequence<DataType, T extends ComponentTreeNode = ComponentTreeNode> = (T | ForEach<
|
|
2
|
+
import type { ComponentTreeNode, ContextArrayValueRef } from "@matreshka/bff/core";
|
|
3
|
+
export type ComponentSequence<DataType, T extends ComponentTreeNode = ComponentTreeNode> = (T | ForEach<ContextArrayValueRef<DataType>, T>)[];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ValueOrContextRef, WritableContextRefOfValue } from "../types/context-value-ref";
|
|
2
2
|
import { ActionConfig } from "./action";
|
|
3
3
|
import { NumberValueRef } from "./inc-context-value";
|
|
4
4
|
import { LocalAction } from "./local-action";
|
|
@@ -9,7 +9,7 @@ import { LocalAction } from "./local-action";
|
|
|
9
9
|
export declare class DecContextValue extends LocalAction {
|
|
10
10
|
private readonly ref;
|
|
11
11
|
private readonly step;
|
|
12
|
-
constructor(ref: NumberValueRef, step:
|
|
12
|
+
constructor(ref: NumberValueRef, step: ValueOrContextRef<number>, config?: ActionConfig);
|
|
13
13
|
class(): string;
|
|
14
14
|
payload(): object;
|
|
15
15
|
}
|
|
@@ -18,4 +18,4 @@ export declare class DecContextValue extends LocalAction {
|
|
|
18
18
|
* Принимает только `ContextRef` с числовым значением.
|
|
19
19
|
* Без `step` клиент вычитает 1.
|
|
20
20
|
*/
|
|
21
|
-
export declare function decContextValue(ref:
|
|
21
|
+
export declare function decContextValue(ref: WritableContextRefOfValue<number | undefined>, step?: ValueOrContextRef<number>, config?: ActionConfig): DecContextValue;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ContextRefOfValue, ValueOrContextRef, WritableContextRefOfValue } from "../types/context-value-ref";
|
|
2
2
|
import { ActionConfig } from "./action";
|
|
3
3
|
import { LocalAction } from "./local-action";
|
|
4
4
|
/** Ref на числовое поле контекста. */
|
|
5
|
-
export type NumberValueRef =
|
|
5
|
+
export type NumberValueRef = ContextRefOfValue<number | undefined>;
|
|
6
6
|
/**
|
|
7
7
|
* Изменение числового значения в Context на клиенте на `step`
|
|
8
8
|
* (с sync на BFF через `context-values`).
|
|
@@ -10,7 +10,7 @@ export type NumberValueRef = ContextValueRef<number | undefined>;
|
|
|
10
10
|
export declare class IncContextValue extends LocalAction {
|
|
11
11
|
private readonly ref;
|
|
12
12
|
private readonly step;
|
|
13
|
-
constructor(ref: NumberValueRef, step:
|
|
13
|
+
constructor(ref: NumberValueRef, step: ValueOrContextRef<number>, config?: ActionConfig);
|
|
14
14
|
class(): string;
|
|
15
15
|
payload(): object;
|
|
16
16
|
}
|
|
@@ -19,4 +19,4 @@ export declare class IncContextValue extends LocalAction {
|
|
|
19
19
|
* Принимает только `ContextRef` с числовым значением.
|
|
20
20
|
* Без `step` клиент прибавляет 1.
|
|
21
21
|
*/
|
|
22
|
-
export declare function incContextValue(ref:
|
|
22
|
+
export declare function incContextValue(ref: WritableContextRefOfValue<number | undefined>, step?: ValueOrContextRef<number>, config?: ActionConfig): IncContextValue;
|
|
@@ -1,20 +1,21 @@
|
|
|
1
1
|
import { JsonObject } from "@matreshka/client-bff-protocol/types/json";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
import { Context, WritableContextPath, WritablePathValue } from "../context/context";
|
|
4
|
+
import { ValueOrContextRef } from "../types/context-value-ref";
|
|
4
5
|
import { ActionConfig } from "./action";
|
|
5
6
|
import { LocalAction } from "./local-action";
|
|
6
|
-
export type LocalContextPathPatch<T extends JsonObject> = Partial<{
|
|
7
|
-
[K in
|
|
7
|
+
export type LocalContextPathPatch<T extends JsonObject, S extends z.ZodObject | undefined> = Partial<{
|
|
8
|
+
[K in WritableContextPath<T, S>]: ValueOrContextRef<WritablePathValue<S, K>>;
|
|
8
9
|
}>;
|
|
9
10
|
/**
|
|
10
11
|
* Локальная запись patch в Context на клиенте (с sync на BFF через `context-values`).
|
|
11
12
|
*/
|
|
12
|
-
export declare class SetContext<T extends JsonObject> extends LocalAction {
|
|
13
|
+
export declare class SetContext<T extends JsonObject, S extends z.ZodObject | undefined> extends LocalAction {
|
|
13
14
|
private readonly context;
|
|
14
15
|
private readonly patch;
|
|
15
|
-
constructor(context: Context<T>, patch: LocalContextPathPatch<T>, config?: ActionConfig);
|
|
16
|
+
constructor(context: Context<T, S>, patch: LocalContextPathPatch<T, S>, config?: ActionConfig);
|
|
16
17
|
class(): string;
|
|
17
18
|
payload(): object;
|
|
18
19
|
}
|
|
19
20
|
/** @internal */
|
|
20
|
-
export declare function createSetContext<T extends JsonObject>(context: Context<T>, patch: LocalContextPathPatch<T>, config?: ActionConfig): SetContext<T>;
|
|
21
|
+
export declare function createSetContext<T extends JsonObject, S extends z.ZodObject | undefined>(context: Context<T, S>, patch: LocalContextPathPatch<T, S>, config?: ActionConfig): SetContext<T, S>;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ContextRefOfValue, WritableContextRefOfValue } from "../types/context-value-ref";
|
|
2
2
|
import { ActionConfig } from "./action";
|
|
3
3
|
import { LocalAction } from "./local-action";
|
|
4
4
|
/** Ref на boolean-поле контекста. */
|
|
5
|
-
export type BooleanValueRef =
|
|
5
|
+
export type BooleanValueRef = ContextRefOfValue<boolean | undefined>;
|
|
6
6
|
/**
|
|
7
7
|
* Инверсия boolean-значения в Context на клиенте (с sync на BFF через `context-values`).
|
|
8
8
|
*/
|
|
@@ -16,4 +16,4 @@ export declare class ToggleContextValue extends LocalAction {
|
|
|
16
16
|
* Функциональная форма {@link ToggleContextValue}.
|
|
17
17
|
* Принимает только `ContextRef` с boolean-значением.
|
|
18
18
|
*/
|
|
19
|
-
export declare function toggleContextValue(ref:
|
|
19
|
+
export declare function toggleContextValue(ref: WritableContextRefOfValue<boolean | undefined>, config?: ActionConfig): ToggleContextValue;
|
|
@@ -1,32 +1,32 @@
|
|
|
1
1
|
import type { Json, JsonObject, JsonPrimitive } from "@matreshka/client-bff-protocol/types/json";
|
|
2
2
|
import type { SerializedOperand } from "@matreshka/client-bff-protocol/types/serialized-operand";
|
|
3
3
|
import { Paths, PathValue } from "ts-essentials";
|
|
4
|
-
import { ContextRef,
|
|
5
|
-
import type {
|
|
4
|
+
import { AnySchemaContextRef, ContextRef, ContextRefValueType } from "../context/context-ref";
|
|
5
|
+
import type { CompatibleContextRefOfValue } from "../types/context-value-ref";
|
|
6
6
|
type ContextArrayValue = readonly unknown[] | unknown[];
|
|
7
7
|
/** Элемент массива по значению `ContextRef`. */
|
|
8
|
-
export type ContextRefArrayElement<R extends
|
|
8
|
+
export type ContextRefArrayElement<R extends AnySchemaContextRef> = Extract<ContextRefValueType<R>, ContextArrayValue>[number];
|
|
9
9
|
/** Ref на массив в контексте (значение по ref — массив или readonly-массив). */
|
|
10
|
-
export type CompatibleArrayContextRef<R extends
|
|
11
|
-
Extract<
|
|
10
|
+
export type CompatibleArrayContextRef<R extends AnySchemaContextRef> = [
|
|
11
|
+
Extract<ContextRefValueType<R>, ContextArrayValue>
|
|
12
12
|
] extends [never] ? never : R;
|
|
13
13
|
/**
|
|
14
14
|
* Операнд сравнения по известному типу значения: JSON-примитив или совместимая `ContextRef`.
|
|
15
15
|
*
|
|
16
|
-
* Ref-операнд: {@link
|
|
16
|
+
* Ref-операнд: {@link CompatibleContextRefOfValue} с `AnySchemaContextRef` (item-ref из `forEach`
|
|
17
17
|
* и ref из другого контекста). Без `| undefined` у ValueType — иначе `(T | undefined) extends T`
|
|
18
18
|
* отсекает ref↔ref сравнения.
|
|
19
19
|
*/
|
|
20
|
-
export type ConditionOperandFor<ValueType> = (ValueType & JsonPrimitive) |
|
|
20
|
+
export type ConditionOperandFor<ValueType> = (ValueType & JsonPrimitive) | CompatibleContextRefOfValue<ValueType, AnySchemaContextRef>;
|
|
21
21
|
/**
|
|
22
22
|
* Операнд условия на BFF: JSON-примитив того же типа, что значение по `ref`,
|
|
23
23
|
* либо другая ссылка с совместимым типом значения (сравнение в рантайме через `===`).
|
|
24
24
|
*/
|
|
25
|
-
export type ConditionOperand<R extends
|
|
25
|
+
export type ConditionOperand<R extends AnySchemaContextRef> = ConditionOperandFor<ContextRefValueType<R>>;
|
|
26
26
|
/** Значение поля элемента массива по `itemPath` (пустой путь — сам элемент). */
|
|
27
27
|
export type ArrayIncludesItemValue<Item, P extends string> = P extends "" ? Item : Item extends JsonObject ? PathValue<Item, P & Paths<Item>> : never;
|
|
28
28
|
/** Операнд {@link ContextArrayIncludes} / {@link ContextArrayNotIncludes}. */
|
|
29
|
-
export type ArrayIncludesOperand<R extends
|
|
29
|
+
export type ArrayIncludesOperand<R extends AnySchemaContextRef, P extends string> = ConditionOperandFor<ArrayIncludesItemValue<ContextRefArrayElement<R>, P>>;
|
|
30
30
|
/** Операнд длины массива: число или ссылка на число в контексте. */
|
|
31
31
|
export type ConditionLengthOperand = ConditionOperandFor<number>;
|
|
32
32
|
/** Операнд без привязки к конкретному `ref` (сериализация на wire). */
|
|
@@ -10,11 +10,11 @@ import { ArrayIncludesOperand, CompatibleArrayContextRef, ContextRefArrayElement
|
|
|
10
10
|
*
|
|
11
11
|
* @internal Используйте {@link contextArrayIncludes} / {@link when.includes}.
|
|
12
12
|
*/
|
|
13
|
-
export declare class ContextArrayIncludes<R extends ContextRef<any, any>, P extends Extract<Paths<ContextRefArrayElement<R>>, string> | "" = ""> extends Condition {
|
|
13
|
+
export declare class ContextArrayIncludes<R extends ContextRef<any, any, any>, P extends Extract<Paths<ContextRefArrayElement<R>>, string> | "" = ""> extends Condition {
|
|
14
14
|
constructor(ref: CompatibleArrayContextRef<R>, itemPath: P, value: ArrayIncludesOperand<R, P>);
|
|
15
15
|
}
|
|
16
16
|
/** Функциональная форма {@link ContextArrayIncludes}. */
|
|
17
|
-
export declare function contextArrayIncludes<R extends ContextRef<any, any>, P extends Extract<Paths<ContextRefArrayElement<R>>, string> | "" = "">(ref: CompatibleArrayContextRef<R>, itemPath: P, value: ArrayIncludesOperand<R, P>): ContextArrayIncludes<R, P>;
|
|
17
|
+
export declare function contextArrayIncludes<R extends ContextRef<any, any, any>, P extends Extract<Paths<ContextRefArrayElement<R>>, string> | "" = "">(ref: CompatibleArrayContextRef<R>, itemPath: P, value: ArrayIncludesOperand<R, P>): ContextArrayIncludes<R, P>;
|
|
18
18
|
/**
|
|
19
19
|
* Условие: в массиве из контекста нет элемента, у которого значение по
|
|
20
20
|
* `itemPath` равно операнду (литерал или `ContextRef`).
|
|
@@ -23,8 +23,8 @@ export declare function contextArrayIncludes<R extends ContextRef<any, any>, P e
|
|
|
23
23
|
*
|
|
24
24
|
* @internal Используйте {@link contextArrayNotIncludes} / {@link when.excludes}.
|
|
25
25
|
*/
|
|
26
|
-
export declare class ContextArrayNotIncludes<R extends ContextRef<any, any>, P extends Extract<Paths<ContextRefArrayElement<R>>, string> | "" = ""> extends Condition {
|
|
26
|
+
export declare class ContextArrayNotIncludes<R extends ContextRef<any, any, any>, P extends Extract<Paths<ContextRefArrayElement<R>>, string> | "" = ""> extends Condition {
|
|
27
27
|
constructor(ref: CompatibleArrayContextRef<R>, itemPath: P, value: ArrayIncludesOperand<R, P>);
|
|
28
28
|
}
|
|
29
29
|
/** Функциональная форма {@link ContextArrayNotIncludes}. */
|
|
30
|
-
export declare function contextArrayNotIncludes<R extends ContextRef<any, any>, P extends Extract<Paths<ContextRefArrayElement<R>>, string> | "" = "">(ref: CompatibleArrayContextRef<R>, itemPath: P, value: ArrayIncludesOperand<R, P>): ContextArrayNotIncludes<R, P>;
|
|
30
|
+
export declare function contextArrayNotIncludes<R extends ContextRef<any, any, any>, P extends Extract<Paths<ContextRefArrayElement<R>>, string> | "" = "">(ref: CompatibleArrayContextRef<R>, itemPath: P, value: ArrayIncludesOperand<R, P>): ContextArrayNotIncludes<R, P>;
|
|
@@ -8,7 +8,7 @@ import { CompatibleArrayContextRef, ConditionLengthOperand } from "./condition-o
|
|
|
8
8
|
*
|
|
9
9
|
* @internal Используйте фабрики длины массива ({@link contextArrayLengthEqual} и др.).
|
|
10
10
|
*/
|
|
11
|
-
export declare abstract class ContextArrayLength<R extends ContextRef<any, any>> extends Condition {
|
|
11
|
+
export declare abstract class ContextArrayLength<R extends ContextRef<any, any, any>> extends Condition {
|
|
12
12
|
constructor(ref: CompatibleArrayContextRef<R>, length: ConditionLengthOperand, operator: ArrayLengthCompare);
|
|
13
13
|
}
|
|
14
14
|
/**
|
|
@@ -16,68 +16,68 @@ export declare abstract class ContextArrayLength<R extends ContextRef<any, any>>
|
|
|
16
16
|
*
|
|
17
17
|
* @internal Используйте {@link contextArrayLengthEqual} / {@link when.lengthEquals}.
|
|
18
18
|
*/
|
|
19
|
-
export declare class ContextArrayLengthEqual<R extends ContextRef<any, any>> extends Condition {
|
|
19
|
+
export declare class ContextArrayLengthEqual<R extends ContextRef<any, any, any>> extends Condition {
|
|
20
20
|
constructor(ref: CompatibleArrayContextRef<R>, length: ConditionLengthOperand);
|
|
21
21
|
}
|
|
22
22
|
/** Функциональная форма {@link ContextArrayLengthEqual}. */
|
|
23
|
-
export declare function contextArrayLengthEqual<R extends ContextRef<any, any>>(ref: CompatibleArrayContextRef<R>, length: ConditionLengthOperand): ContextArrayLengthEqual<R>;
|
|
23
|
+
export declare function contextArrayLengthEqual<R extends ContextRef<any, any, any>>(ref: CompatibleArrayContextRef<R>, length: ConditionLengthOperand): ContextArrayLengthEqual<R>;
|
|
24
24
|
/**
|
|
25
25
|
* Алиас: длина массива в контексте строго меньше операнда (`<`).
|
|
26
26
|
*
|
|
27
27
|
* @internal Используйте {@link contextArrayLengthLessThan} / {@link when.lengthLessThan}.
|
|
28
28
|
*/
|
|
29
|
-
export declare class ContextArrayLengthLessThan<R extends ContextRef<any, any>> extends Condition {
|
|
29
|
+
export declare class ContextArrayLengthLessThan<R extends ContextRef<any, any, any>> extends Condition {
|
|
30
30
|
constructor(ref: CompatibleArrayContextRef<R>, length: ConditionLengthOperand);
|
|
31
31
|
}
|
|
32
32
|
/** Функциональная форма {@link ContextArrayLengthLessThan}. */
|
|
33
|
-
export declare function contextArrayLengthLessThan<R extends ContextRef<any, any>>(ref: CompatibleArrayContextRef<R>, length: ConditionLengthOperand): ContextArrayLengthLessThan<R>;
|
|
33
|
+
export declare function contextArrayLengthLessThan<R extends ContextRef<any, any, any>>(ref: CompatibleArrayContextRef<R>, length: ConditionLengthOperand): ContextArrayLengthLessThan<R>;
|
|
34
34
|
/**
|
|
35
35
|
* Алиас: длина массива в контексте меньше или равна операнду (`<=`).
|
|
36
36
|
*
|
|
37
37
|
* @internal Используйте {@link contextArrayLengthLessOrEqual} / {@link when.lengthAtMost}.
|
|
38
38
|
*/
|
|
39
|
-
export declare class ContextArrayLengthLessOrEqual<R extends ContextRef<any, any>> extends Condition {
|
|
39
|
+
export declare class ContextArrayLengthLessOrEqual<R extends ContextRef<any, any, any>> extends Condition {
|
|
40
40
|
constructor(ref: CompatibleArrayContextRef<R>, length: ConditionLengthOperand);
|
|
41
41
|
}
|
|
42
42
|
/** Функциональная форма {@link ContextArrayLengthLessOrEqual}. */
|
|
43
|
-
export declare function contextArrayLengthLessOrEqual<R extends ContextRef<any, any>>(ref: CompatibleArrayContextRef<R>, length: ConditionLengthOperand): ContextArrayLengthLessOrEqual<R>;
|
|
43
|
+
export declare function contextArrayLengthLessOrEqual<R extends ContextRef<any, any, any>>(ref: CompatibleArrayContextRef<R>, length: ConditionLengthOperand): ContextArrayLengthLessOrEqual<R>;
|
|
44
44
|
/**
|
|
45
45
|
* Алиас: длина массива в контексте строго больше операнда (`>`).
|
|
46
46
|
*
|
|
47
47
|
* @internal Используйте {@link contextArrayLengthGreaterThan} / {@link when.lengthGreaterThan}.
|
|
48
48
|
*/
|
|
49
|
-
export declare class ContextArrayLengthGreaterThan<R extends ContextRef<any, any>> extends Condition {
|
|
49
|
+
export declare class ContextArrayLengthGreaterThan<R extends ContextRef<any, any, any>> extends Condition {
|
|
50
50
|
constructor(ref: CompatibleArrayContextRef<R>, length: ConditionLengthOperand);
|
|
51
51
|
}
|
|
52
52
|
/** Функциональная форма {@link ContextArrayLengthGreaterThan}. */
|
|
53
|
-
export declare function contextArrayLengthGreaterThan<R extends ContextRef<any, any>>(ref: CompatibleArrayContextRef<R>, length: ConditionLengthOperand): ContextArrayLengthGreaterThan<R>;
|
|
53
|
+
export declare function contextArrayLengthGreaterThan<R extends ContextRef<any, any, any>>(ref: CompatibleArrayContextRef<R>, length: ConditionLengthOperand): ContextArrayLengthGreaterThan<R>;
|
|
54
54
|
/**
|
|
55
55
|
* Алиас: длина массива в контексте больше или равна операнду (`>=`).
|
|
56
56
|
*
|
|
57
57
|
* @internal Используйте {@link contextArrayLengthGreaterOrEqual} / {@link when.lengthAtLeast}.
|
|
58
58
|
*/
|
|
59
|
-
export declare class ContextArrayLengthGreaterOrEqual<R extends ContextRef<any, any>> extends Condition {
|
|
59
|
+
export declare class ContextArrayLengthGreaterOrEqual<R extends ContextRef<any, any, any>> extends Condition {
|
|
60
60
|
constructor(ref: CompatibleArrayContextRef<R>, length: ConditionLengthOperand);
|
|
61
61
|
}
|
|
62
62
|
/** Функциональная форма {@link ContextArrayLengthGreaterOrEqual}. */
|
|
63
|
-
export declare function contextArrayLengthGreaterOrEqual<R extends ContextRef<any, any>>(ref: CompatibleArrayContextRef<R>, length: ConditionLengthOperand): ContextArrayLengthGreaterOrEqual<R>;
|
|
63
|
+
export declare function contextArrayLengthGreaterOrEqual<R extends ContextRef<any, any, any>>(ref: CompatibleArrayContextRef<R>, length: ConditionLengthOperand): ContextArrayLengthGreaterOrEqual<R>;
|
|
64
64
|
/**
|
|
65
65
|
* Алиас: массив в контексте пуст (длина равна 0).
|
|
66
66
|
*
|
|
67
67
|
* @internal Используйте {@link contextValueEmpty} / {@link when.isEmpty}.
|
|
68
68
|
*/
|
|
69
|
-
export declare class ContextValueEmpty<R extends ContextRef<any, any>> extends ContextArrayLengthEqual<R> {
|
|
69
|
+
export declare class ContextValueEmpty<R extends ContextRef<any, any, any>> extends ContextArrayLengthEqual<R> {
|
|
70
70
|
constructor(ref: CompatibleArrayContextRef<R>);
|
|
71
71
|
}
|
|
72
72
|
/** Функциональная форма {@link ContextValueEmpty}. */
|
|
73
|
-
export declare function contextValueEmpty<R extends ContextRef<any, any>>(ref: CompatibleArrayContextRef<R>): ContextValueEmpty<R>;
|
|
73
|
+
export declare function contextValueEmpty<R extends ContextRef<any, any, any>>(ref: CompatibleArrayContextRef<R>): ContextValueEmpty<R>;
|
|
74
74
|
/**
|
|
75
75
|
* Алиас: массив в контексте непуст (длина строго больше 0).
|
|
76
76
|
*
|
|
77
77
|
* @internal Используйте {@link contextValueNotEmpty} / {@link when.notEmpty}.
|
|
78
78
|
*/
|
|
79
|
-
export declare class ContextValueNotEmpty<R extends ContextRef<any, any>> extends ContextArrayLengthGreaterThan<R> {
|
|
79
|
+
export declare class ContextValueNotEmpty<R extends ContextRef<any, any, any>> extends ContextArrayLengthGreaterThan<R> {
|
|
80
80
|
constructor(ref: CompatibleArrayContextRef<R>);
|
|
81
81
|
}
|
|
82
82
|
/** Функциональная форма {@link ContextValueNotEmpty}. */
|
|
83
|
-
export declare function contextValueNotEmpty<R extends ContextRef<any, any>>(ref: CompatibleArrayContextRef<R>): ContextValueNotEmpty<R>;
|
|
83
|
+
export declare function contextValueNotEmpty<R extends ContextRef<any, any, any>>(ref: CompatibleArrayContextRef<R>): ContextValueNotEmpty<R>;
|
|
@@ -3,7 +3,7 @@ import { Condition } from "./condition";
|
|
|
3
3
|
/**
|
|
4
4
|
* Условие, означающее, что в контексте определено значение по заданному ключу.
|
|
5
5
|
*
|
|
6
|
-
* Параметр — `R extends ContextRef<any, any>`. Голый `ContextRef` раскрывается
|
|
6
|
+
* Параметр — `R extends ContextRef<any, any, any>`. Голый `ContextRef` раскрывается
|
|
7
7
|
* в `ContextRef<JsonObject, string>`. Метод `local.set` принимает значение по пути,
|
|
8
8
|
* поэтому ссылка инвариантна: при `strictFunctionTypes` конкретный ref страницы
|
|
9
9
|
* в этот параметр не входит. `any` в ограничении выводит `R` из аргумента
|
|
@@ -11,8 +11,8 @@ import { Condition } from "./condition";
|
|
|
11
11
|
*
|
|
12
12
|
* @internal Используйте {@link contextValueDefined} / {@link when.defined}.
|
|
13
13
|
*/
|
|
14
|
-
export declare class ContextValueDefined<R extends ContextRef<any, any>> extends Condition {
|
|
14
|
+
export declare class ContextValueDefined<R extends ContextRef<any, any, any>> extends Condition {
|
|
15
15
|
constructor(ref: R);
|
|
16
16
|
}
|
|
17
17
|
/** Функциональная форма {@link ContextValueDefined}. */
|
|
18
|
-
export declare function contextValueDefined<R extends ContextRef<any, any>>(ref: R): ContextValueDefined<R>;
|
|
18
|
+
export declare function contextValueDefined<R extends ContextRef<any, any, any>>(ref: R): ContextValueDefined<R>;
|
|
@@ -7,7 +7,7 @@ const condition_1 = require("./condition");
|
|
|
7
7
|
/**
|
|
8
8
|
* Условие, означающее, что в контексте определено значение по заданному ключу.
|
|
9
9
|
*
|
|
10
|
-
* Параметр — `R extends ContextRef<any, any>`. Голый `ContextRef` раскрывается
|
|
10
|
+
* Параметр — `R extends ContextRef<any, any, any>`. Голый `ContextRef` раскрывается
|
|
11
11
|
* в `ContextRef<JsonObject, string>`. Метод `local.set` принимает значение по пути,
|
|
12
12
|
* поэтому ссылка инвариантна: при `strictFunctionTypes` конкретный ref страницы
|
|
13
13
|
* в этот параметр не входит. `any` в ограничении выводит `R` из аргумента
|
|
@@ -7,8 +7,8 @@ import { ConditionOperand } from "./condition-operand";
|
|
|
7
7
|
*
|
|
8
8
|
* @internal Используйте {@link contextValueEqual} / {@link when.equals}.
|
|
9
9
|
*/
|
|
10
|
-
export declare class ContextValueEqual<R extends ContextRef<any, any>> extends Condition {
|
|
10
|
+
export declare class ContextValueEqual<R extends ContextRef<any, any, any>> extends Condition {
|
|
11
11
|
constructor(ref: R, value: ConditionOperand<R>);
|
|
12
12
|
}
|
|
13
13
|
/** Функциональная форма {@link ContextValueEqual}. */
|
|
14
|
-
export declare function contextValueEqual<R extends ContextRef<any, any>>(ref: R, value: ConditionOperand<R>): ContextValueEqual<R>;
|
|
14
|
+
export declare function contextValueEqual<R extends ContextRef<any, any, any>>(ref: R, value: ConditionOperand<R>): ContextValueEqual<R>;
|