@matreshka/bff 0.31.0 → 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/core/actions/dec-context-value.d.ts +2 -2
- package/dist/core/actions/inc-context-value.d.ts +2 -2
- package/dist/core/actions/set-context.d.ts +7 -6
- package/dist/core/actions/toggle-context-value.d.ts +2 -2
- package/dist/core/conditions/condition-operand.d.ts +7 -7
- 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 +3 -3
- package/dist/core/context/context-ref.d.ts +17 -14
- package/dist/core/context/context.d.ts +27 -14
- package/dist/core/types/context-value-ref.d.ts +51 -7
- 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, ContextRefValueType, JsonObject, StandaloneComponent } from "../core";
|
|
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 { ValueOrContextRef } from "../types/context-value-ref";
|
|
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";
|
|
@@ -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,4 +1,4 @@
|
|
|
1
|
-
import { ContextRefOfValue, ValueOrContextRef } from "../types/context-value-ref";
|
|
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 на числовое поле контекста. */
|
|
@@ -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 {
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
import { Context, WritableContextPath, WritablePathValue } from "../context/context";
|
|
3
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,4 +1,4 @@
|
|
|
1
|
-
import { ContextRefOfValue } from "../types/context-value-ref";
|
|
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-поле контекста. */
|
|
@@ -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, ContextRefValueType } from "../context/context-ref";
|
|
4
|
+
import { AnySchemaContextRef, ContextRef, ContextRefValueType } from "../context/context-ref";
|
|
5
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
|
|
10
|
+
export type CompatibleArrayContextRef<R extends AnySchemaContextRef> = [
|
|
11
11
|
Extract<ContextRefValueType<R>, ContextArrayValue>
|
|
12
12
|
] extends [never] ? never : R;
|
|
13
13
|
/**
|
|
14
14
|
* Операнд сравнения по известному типу значения: JSON-примитив или совместимая `ContextRef`.
|
|
15
15
|
*
|
|
16
|
-
* Ref-операнд: {@link CompatibleContextRefOfValue} с `
|
|
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) | CompatibleContextRefOfValue<ValueType,
|
|
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>;
|
|
@@ -7,8 +7,8 @@ import { ConditionOperand } from "./condition-operand";
|
|
|
7
7
|
*
|
|
8
8
|
* @internal Используйте {@link contextValueIn} / {@link when.oneOf}.
|
|
9
9
|
*/
|
|
10
|
-
export declare class ContextValueIn<R extends ContextRef<any, any>> extends Condition {
|
|
10
|
+
export declare class ContextValueIn<R extends ContextRef<any, any, any>> extends Condition {
|
|
11
11
|
constructor(ref: R, value: ConditionOperand<R>[]);
|
|
12
12
|
}
|
|
13
13
|
/** Функциональная форма {@link ContextValueIn}. */
|
|
14
|
-
export declare function contextValueIn<R extends ContextRef<any, any>>(ref: R, value: ConditionOperand<R>[]): ContextValueIn<R>;
|
|
14
|
+
export declare function contextValueIn<R extends ContextRef<any, any, any>>(ref: R, value: ConditionOperand<R>[]): ContextValueIn<R>;
|
|
@@ -7,8 +7,8 @@ import { ConditionOperand } from "./condition-operand";
|
|
|
7
7
|
*
|
|
8
8
|
* @internal Используйте {@link contextValueNotEqual} / {@link when.notEquals}.
|
|
9
9
|
*/
|
|
10
|
-
export declare class ContextValueNotEqual<R extends ContextRef<any, any>> extends Condition {
|
|
10
|
+
export declare class ContextValueNotEqual<R extends ContextRef<any, any, any>> extends Condition {
|
|
11
11
|
constructor(ref: R, value: ConditionOperand<R>);
|
|
12
12
|
}
|
|
13
13
|
/** Функциональная форма {@link ContextValueNotEqual}. */
|
|
14
|
-
export declare function contextValueNotEqual<R extends ContextRef<any, any>>(ref: R, value: ConditionOperand<R>): ContextValueNotEqual<R>;
|
|
14
|
+
export declare function contextValueNotEqual<R extends ContextRef<any, any, any>>(ref: R, value: ConditionOperand<R>): ContextValueNotEqual<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 contextValueUndefined} / {@link when.notDefined}.
|
|
13
13
|
*/
|
|
14
|
-
export declare class ContextValueUndefined<R extends ContextRef<any, any>> extends Condition {
|
|
14
|
+
export declare class ContextValueUndefined<R extends ContextRef<any, any, any>> extends Condition {
|
|
15
15
|
constructor(ref: R);
|
|
16
16
|
}
|
|
17
17
|
/** Функциональная форма {@link ContextValueUndefined}. */
|
|
18
|
-
export declare function contextValueUndefined<R extends ContextRef<any, any>>(ref: R): ContextValueUndefined<R>;
|
|
18
|
+
export declare function contextValueUndefined<R extends ContextRef<any, any, any>>(ref: R): ContextValueUndefined<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` из аргумента
|
|
@@ -64,7 +64,7 @@ export type ContextSchemaFromInit<C extends ContextInitShape> = C extends {
|
|
|
64
64
|
schema: z.ZodObject;
|
|
65
65
|
} ? C["schema"] : undefined;
|
|
66
66
|
/** Экземпляр {@link Context} по форме конфига {@link createContext}. */
|
|
67
|
-
export type ContextFromInit<C extends ContextInitShape> = Context<ContextDataFromInit<C>>;
|
|
67
|
+
export type ContextFromInit<C extends ContextInitShape> = Context<ContextDataFromInit<C>, ContextSchemaFromInit<C>>;
|
|
68
68
|
type ContextSchemaCompatibilityGuard<C extends ContextInitShape> = C extends {
|
|
69
69
|
schema: z.ZodObject;
|
|
70
70
|
} ? ContextSchema<ContextDataFromInit<C>, NoInfer<C["schema"]>> extends never ? {
|
|
@@ -84,8 +84,8 @@ type ContextCreateConfig<C extends ContextInitShape> = C & ContextSchemaCompatib
|
|
|
84
84
|
* Если в начальном `data` нет части полей (например опциональных), укажите тип на колбэке:
|
|
85
85
|
* `data: async (): Promise<MyT> => ({ … })`.
|
|
86
86
|
*/
|
|
87
|
-
export declare function createContext<const T extends JsonObject>(config: ContextInitWithoutSchema<T>): Context<T>;
|
|
87
|
+
export declare function createContext<const T extends JsonObject>(config: ContextInitWithoutSchema<T>): Context<T, undefined>;
|
|
88
88
|
export declare function createContext<const C extends ContextInitShape & {
|
|
89
89
|
schema: z.ZodObject;
|
|
90
|
-
}>(config: ContextCreateConfig<C>): Context<ContextDataFromInit<C>>;
|
|
90
|
+
}>(config: ContextCreateConfig<C>): Context<ContextDataFromInit<C>, ContextSchemaFromInit<C>>;
|
|
91
91
|
export {};
|
|
@@ -1,6 +1,7 @@
|
|
|
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";
|
|
4
5
|
import { ActionConfig } from "../actions/action";
|
|
5
6
|
import { DecContextValue } from "../actions/dec-context-value";
|
|
6
7
|
import { IncContextValue } from "../actions/inc-context-value";
|
|
@@ -8,10 +9,10 @@ import { SetContext } from "../actions/set-context";
|
|
|
8
9
|
import { ToggleContextValue } from "../actions/toggle-context-value";
|
|
9
10
|
import type { ContextUpdateDelivery } from "../types/context-update-delivery";
|
|
10
11
|
import { ValueOrContextRef } from "../types/context-value-ref";
|
|
11
|
-
import { Context } from "./context";
|
|
12
|
-
type ContextRefLocalSet<ContextType extends JsonObject, PathType extends string> = {
|
|
13
|
-
set: (value: ValueOrContextRef<
|
|
14
|
-
};
|
|
12
|
+
import { Context, WritableContextPath, WritablePathValue } from "./context";
|
|
13
|
+
type ContextRefLocalSet<ContextType extends JsonObject, PathType extends string, SchemaType extends z.ZodObject | undefined> = PathType extends WritableContextPath<ContextType, SchemaType> ? {
|
|
14
|
+
set: (value: ValueOrContextRef<WritablePathValue<SchemaType, PathType>>, config?: ActionConfig) => SetContext<ContextType, SchemaType>;
|
|
15
|
+
} : {};
|
|
15
16
|
type ContextRefLocalToggle = {
|
|
16
17
|
toggle: (config?: ActionConfig) => ToggleContextValue;
|
|
17
18
|
};
|
|
@@ -20,26 +21,28 @@ type ContextRefLocalNumeric = {
|
|
|
20
21
|
dec: (step?: ValueOrContextRef<number>, config?: ActionConfig) => DecContextValue;
|
|
21
22
|
};
|
|
22
23
|
/** Локальные действия по ref; `toggle` / `inc` / `dec` — по типу значения по пути. */
|
|
23
|
-
export type ContextRefLocalActions<ContextType extends JsonObject, PathType extends string> = ContextRefLocalSet<ContextType, PathType> & (
|
|
24
|
-
export type
|
|
24
|
+
export type ContextRefLocalActions<ContextType extends JsonObject, PathType extends string, SchemaType extends z.ZodObject | undefined> = ContextRefLocalSet<ContextType, PathType, SchemaType> & (PathType extends WritableContextPath<ContextType, SchemaType> ? WritablePathValue<SchemaType, PathType> extends boolean | undefined ? ContextRefLocalToggle : {} : {}) & (PathType extends WritableContextPath<ContextType, SchemaType> ? WritablePathValue<SchemaType, PathType> extends number | undefined ? ContextRefLocalNumeric : {} : {});
|
|
25
|
+
export type AnySchemaContextRef<ContextType extends JsonObject = any, PathType extends string = any> = ContextRef<ContextType, PathType, undefined> | ContextRef<ContextType, PathType, z.ZodObject>;
|
|
26
|
+
export type ContextRefValueType<R extends AnySchemaContextRef> = R extends {
|
|
25
27
|
readonly __valueType?: infer ValueType;
|
|
26
|
-
} ? Exclude<ValueType, undefined> : R extends ContextRef<infer ContextType, infer PathType> ? PathValue<ContextType, PathType> : never;
|
|
27
|
-
export declare class ContextRef<ContextType extends JsonObject = JsonObject, PathType extends string = string> {
|
|
28
|
-
readonly context: Context<ContextType>;
|
|
28
|
+
} ? Exclude<ValueType, undefined> : R extends ContextRef<infer ContextType, infer PathType, any> ? PathValue<ContextType, PathType> : never;
|
|
29
|
+
export declare class ContextRef<ContextType extends JsonObject = JsonObject, PathType extends string = string, SchemaType extends z.ZodObject | undefined = any> {
|
|
30
|
+
readonly context: Context<ContextType, SchemaType>;
|
|
29
31
|
readonly path: PathType;
|
|
32
|
+
readonly __schemaType?: SchemaType;
|
|
30
33
|
/** Локальные (client-only) действия по этому ref. */
|
|
31
|
-
readonly local: ContextRefLocalActions<ContextType, PathType>;
|
|
32
|
-
constructor(context: Context<ContextType>, path: PathType);
|
|
34
|
+
readonly local: ContextRefLocalActions<ContextType, PathType, SchemaType>;
|
|
35
|
+
constructor(context: Context<ContextType, SchemaType>, path: PathType);
|
|
33
36
|
/**
|
|
34
37
|
* Продолжение пути в рамках того же контекста.
|
|
35
38
|
* Строго типизировано: K должен быть путём внутри значения по текущему PathType.
|
|
36
39
|
*/
|
|
37
|
-
ref<K extends Paths<PathValue<ContextType, PathType>>>(path: K): ContextRef<ContextType, `${PathType}.${K}
|
|
40
|
+
ref<K extends Paths<PathValue<ContextType, PathType>>>(path: K): ContextRef<ContextType, `${PathType}.${K}`, SchemaType>;
|
|
38
41
|
/**
|
|
39
42
|
* Продолжение пути, если передан другой ContextRef того же контекста.
|
|
40
43
|
* В этом случае итоговый путь становится `${PathType}.${P2}`.
|
|
41
44
|
*/
|
|
42
|
-
ref<P2 extends string>(path: ContextRef<ContextType, P2>): ContextRef<ContextType, `${PathType}.${P2}
|
|
45
|
+
ref<P2 extends string, OtherSchemaType extends z.ZodObject | undefined>(path: ContextRef<ContextType, P2, OtherSchemaType>): ContextRef<ContextType, `${PathType}.${P2}`, SchemaType>;
|
|
43
46
|
/**
|
|
44
47
|
* Дописывает к текущему пути **плейсхолдер** второго контекста: строку вида
|
|
45
48
|
* `@{<id контекста other>.<путь other>}` (через `other.toString()`), без подстановки
|
|
@@ -63,7 +66,7 @@ export declare class ContextRef<ContextType extends JsonObject = JsonObject, Pat
|
|
|
63
66
|
*
|
|
64
67
|
* @experimental
|
|
65
68
|
*/
|
|
66
|
-
strictRef<OtherContextType extends JsonObject, OtherPathType extends Paths<OtherContextType>>(other: ContextRef<OtherContextType, OtherPathType>): ContextRef<ContextType, `${PathType}.${PathValue<OtherContextType, OtherPathType> & string}
|
|
69
|
+
strictRef<OtherContextType extends JsonObject, OtherSchemaType extends z.ZodObject | undefined, OtherPathType extends Paths<OtherContextType>>(other: ContextRef<OtherContextType, OtherPathType, OtherSchemaType>): ContextRef<ContextType, `${PathType}.${PathValue<OtherContextType, OtherPathType> & string}`, SchemaType>;
|
|
67
70
|
/** Значение по текущему пути (делегирует {@link Context.get}). */
|
|
68
71
|
get(): PathValue<ContextType, PathType>;
|
|
69
72
|
/**
|
|
@@ -3,10 +3,13 @@ import { BehaviorSubject, Observable } from "rxjs";
|
|
|
3
3
|
import { Paths, PathValue } from "ts-essentials";
|
|
4
4
|
import { z } from "zod";
|
|
5
5
|
import { ActionConfig } from "../actions/action";
|
|
6
|
+
import { DecContextValue } from "../actions/dec-context-value";
|
|
7
|
+
import { IncContextValue } from "../actions/inc-context-value";
|
|
6
8
|
import { LocalContextPathPatch } from "../actions/set-context";
|
|
9
|
+
import { ToggleContextValue } from "../actions/toggle-context-value";
|
|
7
10
|
import type { Client } from "../client";
|
|
8
11
|
import { ContextUpdateDelivery } from "../types/context-update-delivery";
|
|
9
|
-
import { ValueOrContextRef } from "../types/context-value-ref";
|
|
12
|
+
import type { ValueOrContextRef } from "../types/context-value-ref";
|
|
10
13
|
import { ContextRef } from "./context-ref";
|
|
11
14
|
export type { ContextUpdateDelivery } from "../types/context-update-delivery";
|
|
12
15
|
export * from "./context-create";
|
|
@@ -14,6 +17,15 @@ export * from "./context-create";
|
|
|
14
17
|
export type ContextPathPatch<T extends JsonObject> = Partial<{
|
|
15
18
|
[K in Paths<T>]: PathValue<T, K>;
|
|
16
19
|
}>;
|
|
20
|
+
/** Входная форма данных, которые клиент может отправить в `context-values`. */
|
|
21
|
+
export type WritableSchemaInput<S extends z.ZodObject | undefined> = S extends z.ZodObject ? z.input<S> extends JsonObject ? z.input<S> : never : never;
|
|
22
|
+
/** Dotted-пути, разрешённые для клиентской записи (по `schema`). */
|
|
23
|
+
type IsAny<T> = 0 extends 1 & T ? true : false;
|
|
24
|
+
export type WritablePath<S extends z.ZodObject | undefined> = IsAny<S> extends true ? string : S extends z.ZodObject ? Paths<WritableSchemaInput<S>> : never;
|
|
25
|
+
/** Тип значения по writable-пути `P` (из `schema` input). */
|
|
26
|
+
export type WritablePathValue<S extends z.ZodObject | undefined, P extends string> = IsAny<S> extends true ? unknown : S extends z.ZodObject ? P extends Paths<WritableSchemaInput<S>> ? PathValue<WritableSchemaInput<S>, P> : never : never;
|
|
27
|
+
/** Пересечение путей контекста и путей `schema`, доступных для client write. */
|
|
28
|
+
export type WritableContextPath<T extends JsonObject, S extends z.ZodObject | undefined> = Extract<Paths<T>, WritablePath<S>>;
|
|
17
29
|
/**
|
|
18
30
|
* Пустая strict-схема: клиент не может менять данные контекста через `context-values`.
|
|
19
31
|
* Используется во внутренних контекстах (ForEach, ItemList).
|
|
@@ -23,9 +35,9 @@ export type ContextClientUpdatesForbiddenSchema = z.ZodObject<Record<string, nev
|
|
|
23
35
|
};
|
|
24
36
|
/** @see ContextClientUpdatesForbiddenSchema */
|
|
25
37
|
export declare const contextClientUpdatesForbiddenSchema: ContextClientUpdatesForbiddenSchema;
|
|
26
|
-
type ContextRuntimeInit<T extends JsonObject> = {
|
|
38
|
+
type ContextRuntimeInit<T extends JsonObject, S extends z.ZodObject | undefined> = {
|
|
27
39
|
data: () => Promise<T>;
|
|
28
|
-
schema?:
|
|
40
|
+
schema?: S;
|
|
29
41
|
preload?: boolean;
|
|
30
42
|
persistent?: boolean;
|
|
31
43
|
};
|
|
@@ -39,13 +51,13 @@ type ContextRuntimeInit<T extends JsonObject> = {
|
|
|
39
51
|
* Zod-схема клиентских изменений задаётся в {@link createContext} через поле `schema`,
|
|
40
52
|
* а не вторым type-параметром: так проще согласовать runtime-схему и тип данных.
|
|
41
53
|
*/
|
|
42
|
-
export declare class Context<T extends JsonObject> {
|
|
54
|
+
export declare class Context<T extends JsonObject, S extends z.ZodObject | undefined = any> {
|
|
43
55
|
/** Уникальный идентификатор контекста */
|
|
44
56
|
readonly id: `${string}-${string}-${string}-${string}-${string}`;
|
|
45
57
|
/** Реактивное хранилище данных контекста. */
|
|
46
58
|
protected data$?: BehaviorSubject<T>;
|
|
47
59
|
/** Схема валидации данных контекста */
|
|
48
|
-
readonly schema?:
|
|
60
|
+
readonly schema?: S;
|
|
49
61
|
/** Флаг, указывающий, что контекст должен быть инициализирован при авторизации клиента */
|
|
50
62
|
readonly preload: boolean;
|
|
51
63
|
/**
|
|
@@ -55,10 +67,10 @@ export declare class Context<T extends JsonObject> {
|
|
|
55
67
|
readonly persistent: boolean;
|
|
56
68
|
/** Локальные (client-only) действия над данными этого контекста. */
|
|
57
69
|
readonly local: {
|
|
58
|
-
set: (patch: LocalContextPathPatch<T>, config?: ActionConfig) => import("../actions/set-context").SetContext<T>;
|
|
59
|
-
toggle: <K extends
|
|
60
|
-
inc: <K extends
|
|
61
|
-
dec: <K extends
|
|
70
|
+
set: (patch: LocalContextPathPatch<T, S>, config?: ActionConfig) => import("../actions/set-context").SetContext<T, S>;
|
|
71
|
+
toggle: <K extends WritableContextPath<T, S>>(path: PathValue<T, K> extends boolean | undefined ? WritablePathValue<S, K> extends boolean | undefined ? K : never : never, config?: ActionConfig) => ToggleContextValue;
|
|
72
|
+
inc: <K extends WritableContextPath<T, S>>(path: PathValue<T, K> extends number | undefined ? WritablePathValue<S, K> extends number | undefined ? K : never : never, step?: ValueOrContextRef<number>, config?: ActionConfig) => IncContextValue;
|
|
73
|
+
dec: <K extends WritableContextPath<T, S>>(path: PathValue<T, K> extends number | undefined ? WritablePathValue<S, K> extends number | undefined ? K : never : never, step?: ValueOrContextRef<number>, config?: ActionConfig) => DecContextValue;
|
|
62
74
|
};
|
|
63
75
|
/** Реактивное хранилище инициализации контекста */
|
|
64
76
|
private _init$;
|
|
@@ -98,14 +110,14 @@ export declare class Context<T extends JsonObject> {
|
|
|
98
110
|
* @internal
|
|
99
111
|
* @deprecated Internal API. Use createContext(...) instead.
|
|
100
112
|
*/
|
|
101
|
-
static createRuntime<U extends JsonObject>(config: ContextRuntimeInit<U>): Context<U>;
|
|
113
|
+
static createRuntime<U extends JsonObject, SchemaType extends z.ZodObject | undefined>(config: ContextRuntimeInit<U, SchemaType>): Context<U, SchemaType>;
|
|
102
114
|
/**
|
|
103
115
|
* Создаёт экземпляр контекста, привязанный к конкретному клиенту.
|
|
104
116
|
*
|
|
105
117
|
* Подписывается на входящие сообщения от клиента и ошибки, связанные с этим контекстом.
|
|
106
118
|
|
|
107
119
|
*/
|
|
108
|
-
protected constructor(config: ContextRuntimeInit<T>);
|
|
120
|
+
protected constructor(config: ContextRuntimeInit<T, S>);
|
|
109
121
|
/** `data$` создан (init мог ещё выполняться — см. {@link init}). */
|
|
110
122
|
inited(): boolean;
|
|
111
123
|
/** Данные загружены: `initDataCallback` завершился. */
|
|
@@ -189,7 +201,7 @@ export declare class Context<T extends JsonObject> {
|
|
|
189
201
|
* @param path Путь до значения.
|
|
190
202
|
* @returns Плейсхолдер для использования в шаблонах и компонентах.
|
|
191
203
|
*/
|
|
192
|
-
ref<K extends Paths<T>>(path: K): ContextRef<T, K>;
|
|
204
|
+
ref<K extends Paths<T>>(path: K): ContextRef<T, K, S>;
|
|
193
205
|
/**
|
|
194
206
|
* Ссылка на значение в **этом** контексте по пути, который задаётся **во втором**
|
|
195
207
|
* контексте строкой и меняется во времени.
|
|
@@ -211,8 +223,9 @@ export declare class Context<T extends JsonObject> {
|
|
|
211
223
|
*
|
|
212
224
|
* @experimental
|
|
213
225
|
*/
|
|
214
|
-
strictRef<OtherContextType extends JsonObject, OtherPathType extends Paths<OtherContextType>>(other: ContextRef<OtherContextType, OtherPathType>): ContextRef<T, PathValue<OtherContextType, OtherPathType> & Paths<T
|
|
226
|
+
strictRef<OtherContextType extends JsonObject, OtherSchemaType extends z.ZodObject | undefined, OtherPathType extends Paths<OtherContextType>>(other: ContextRef<OtherContextType, OtherPathType, OtherSchemaType>): ContextRef<T, PathValue<OtherContextType, OtherPathType> & Paths<T>, S>;
|
|
215
227
|
toJSON(): `${string}-${string}-${string}-${string}-${string}`;
|
|
216
228
|
}
|
|
229
|
+
export type AnySchemaContext<T extends JsonObject = JsonObject> = Context<T, z.ZodObject | undefined>;
|
|
217
230
|
/** Любой зарегистрированный контекст (с Zod-схемой или без). */
|
|
218
|
-
export type AnyContext = Context<any>;
|
|
231
|
+
export type AnyContext = Context<any, any>;
|
|
@@ -1,4 +1,15 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { JsonObject } from "@matreshka/client-bff-protocol/types/json";
|
|
2
|
+
import type { Observable } from "rxjs";
|
|
3
|
+
import { z } from "zod";
|
|
4
|
+
import type { SetContext } from "../actions/set-context";
|
|
5
|
+
import { AnySchemaContextRef, ContextRef, ContextRefValueType } from "../context/context-ref";
|
|
6
|
+
import type { ContextUpdateDelivery } from "./context-update-delivery";
|
|
7
|
+
/** Общая часть ref-типов по значению: маркер типа и чтение. */
|
|
8
|
+
type ValueRefBase<ValueType> = {
|
|
9
|
+
readonly __valueType?: ValueType;
|
|
10
|
+
get(): ValueType;
|
|
11
|
+
set(value: ValueType): Observable<ContextUpdateDelivery>;
|
|
12
|
+
};
|
|
2
13
|
/**
|
|
3
14
|
* Ссылка на поле контекста с известным типом значения.
|
|
4
15
|
*
|
|
@@ -15,15 +26,47 @@ import { ContextRef, ContextRefValueType } from "../context/context-ref";
|
|
|
15
26
|
* bindAmount(pageContext.ref("amount"));
|
|
16
27
|
* ```
|
|
17
28
|
*/
|
|
18
|
-
export type ContextRefOfValue<ValueType> = ContextRef<any, any
|
|
19
|
-
readonly __valueType?: ValueType;
|
|
20
|
-
get(): ValueType;
|
|
21
|
-
set(value: ValueType): void;
|
|
22
|
-
};
|
|
29
|
+
export type ContextRefOfValue<ValueType> = ValueRefBase<ValueType> & ContextRef<any, any, any>;
|
|
23
30
|
/**
|
|
24
31
|
* Ref `R` совместим с ожидаемым типом значения `ValueType` (проверка на call site).
|
|
25
32
|
*/
|
|
26
|
-
export type CompatibleContextRefOfValue<ValueType, R extends
|
|
33
|
+
export type CompatibleContextRefOfValue<ValueType, R extends AnySchemaContextRef> = ValueType extends ContextRefValueType<R> ? R : never;
|
|
34
|
+
/**
|
|
35
|
+
* Эталонный writable ref для значения `ValueType`: путь `k` гарантированно есть
|
|
36
|
+
* в schema. Из него выводится `local`, так что при добавлении
|
|
37
|
+
* методов в `ContextRef.local` типы вручную переписывать не нужно.
|
|
38
|
+
*/
|
|
39
|
+
type WritableReferenceRef<ValueType> = ContextRef<{
|
|
40
|
+
k: Exclude<ValueType, undefined>;
|
|
41
|
+
} extends infer C extends JsonObject ? C : never, "k", z.ZodObject<{
|
|
42
|
+
k: z.ZodType<Exclude<ValueType, undefined>, Exclude<ValueType, undefined>>;
|
|
43
|
+
}>>;
|
|
44
|
+
/**
|
|
45
|
+
* Стирает привязку `SetContext` к конкретному контексту/schema, остальные
|
|
46
|
+
* сигнатуры `local` остаются как у `ContextRef.local`.
|
|
47
|
+
*/
|
|
48
|
+
type EraseLocalContext<Local> = {
|
|
49
|
+
[K in keyof Local]: Local[K] extends (...args: infer Args) => infer Result ? Result extends SetContext<any, any> ? (...args: Args) => SetContext<any, any> : Local[K] : Local[K];
|
|
50
|
+
};
|
|
51
|
+
/**
|
|
52
|
+
* Writable-ref с известным типом значения без generic по ref.
|
|
53
|
+
*
|
|
54
|
+
* Структурно совместим с `ContextRef` (остальные члены берутся из
|
|
55
|
+
* `ContextRef<any, any, any>`), а `local` берётся из `ContextRef.local`
|
|
56
|
+
* для эталонного writable ref, поэтому ref с путём вне schema не пройдёт
|
|
57
|
+
* проверку на call site.
|
|
58
|
+
*
|
|
59
|
+
* @example
|
|
60
|
+
* ```ts
|
|
61
|
+
* function setTrue(ref: WritableContextRefOfValue<boolean | undefined>) {
|
|
62
|
+
* ref.local.set(true);
|
|
63
|
+
* ref.local.toggle();
|
|
64
|
+
* }
|
|
65
|
+
* ```
|
|
66
|
+
*/
|
|
67
|
+
export type WritableContextRefOfValue<ValueType> = ContextRefOfValue<ValueType> & {
|
|
68
|
+
readonly local: EraseLocalContext<WritableReferenceRef<ValueType>["local"]>;
|
|
69
|
+
};
|
|
27
70
|
/** Статическое значение или ссылка на совместимое значение в контексте. */
|
|
28
71
|
export type ValueOrContextRef<ValueType> = ValueType | ContextRefOfValue<Exclude<ValueType, undefined>>;
|
|
29
72
|
/**
|
|
@@ -32,3 +75,4 @@ export type ValueOrContextRef<ValueType> = ValueType | ContextRefOfValue<Exclude
|
|
|
32
75
|
* Generic задаёт тип **элемента**, как в {@link CompatibleForEachRef} / `forEach`.
|
|
33
76
|
*/
|
|
34
77
|
export type ContextArrayValueRef<ItemType> = ContextRefOfValue<ItemType[] | undefined>;
|
|
78
|
+
export {};
|
package/package.json
CHANGED