@matreshka/bff 0.25.1 → 0.26.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (171) hide show
  1. package/dist/components/aliases/button.js +1 -1
  2. package/dist/components/aliases/column.js +1 -1
  3. package/dist/components/aliases/row.js +1 -1
  4. package/dist/components/app.d.ts +1 -1
  5. package/dist/components/app.js +1 -1
  6. package/dist/components/board.d.ts +4 -4
  7. package/dist/components/board.js +6 -6
  8. package/dist/components/boot.js +1 -1
  9. package/dist/components/camera.d.ts +5 -5
  10. package/dist/components/camera.js +3 -3
  11. package/dist/components/charts/chart.d.ts +3 -3
  12. package/dist/components/charts/chart.js +2 -2
  13. package/dist/components/component.d.ts +10 -10
  14. package/dist/components/component.js +1 -1
  15. package/dist/components/container.d.ts +2 -2
  16. package/dist/components/container.js +1 -1
  17. package/dist/components/dialog.d.ts +4 -4
  18. package/dist/components/dialog.js +2 -2
  19. package/dist/components/entry-component.d.ts +1 -1
  20. package/dist/components/entry-component.js +1 -1
  21. package/dist/components/enum/password-input-kind.d.ts +1 -1
  22. package/dist/components/enum/password-input-kind.js +1 -1
  23. package/dist/components/enum/popover-position-area.d.ts +1 -1
  24. package/dist/components/enum/popover-position-area.js +1 -1
  25. package/dist/components/enum/scroll-to-position.d.ts +1 -1
  26. package/dist/components/enum/scroll-to-position.js +1 -1
  27. package/dist/components/enum/text-input-kind.d.ts +1 -1
  28. package/dist/components/enum/text-input-kind.js +1 -1
  29. package/dist/components/enum/textarea-resize.d.ts +1 -1
  30. package/dist/components/enum/textarea-resize.js +1 -1
  31. package/dist/components/file-upload-area.d.ts +2 -2
  32. package/dist/components/file-upload-area.js +19 -19
  33. package/dist/components/for-each.d.ts +2 -2
  34. package/dist/components/for-each.js +4 -4
  35. package/dist/components/form.d.ts +2 -2
  36. package/dist/components/form.js +1 -1
  37. package/dist/components/grid.d.ts +6 -6
  38. package/dist/components/grid.js +2 -2
  39. package/dist/components/index.d.ts +1 -1
  40. package/dist/components/index.js +1 -1
  41. package/dist/components/inputs/number-input.d.ts +1 -1
  42. package/dist/components/inputs/number-input.js +1 -1
  43. package/dist/components/inputs/password-input.d.ts +2 -2
  44. package/dist/components/inputs/password-input.js +1 -1
  45. package/dist/components/inputs/text-editor.d.ts +1 -1
  46. package/dist/components/inputs/text-editor.js +15 -15
  47. package/dist/components/inputs/text-input.d.ts +2 -2
  48. package/dist/components/inputs/text-input.js +1 -1
  49. package/dist/components/inputs/textarea.d.ts +2 -2
  50. package/dist/components/inputs/textarea.js +1 -1
  51. package/dist/components/item-list/flatten-nested-items.d.ts +1 -1
  52. package/dist/components/item-list/item-list-host.d.ts +1 -1
  53. package/dist/components/item-list/item-list.d.ts +1 -1
  54. package/dist/components/item-list/list-from-ref-context.js +2 -2
  55. package/dist/components/item-list/nested-items-host-support.js +1 -1
  56. package/dist/components/line.d.ts +1 -1
  57. package/dist/components/line.js +1 -1
  58. package/dist/components/map.d.ts +6 -6
  59. package/dist/components/map.js +6 -6
  60. package/dist/components/outputs/currency.d.ts +1 -1
  61. package/dist/components/outputs/currency.js +1 -1
  62. package/dist/components/outputs/datetime.d.ts +1 -1
  63. package/dist/components/outputs/datetime.js +1 -1
  64. package/dist/components/outputs/icon.d.ts +1 -1
  65. package/dist/components/outputs/icon.js +1 -1
  66. package/dist/components/outputs/iframe.d.ts +3 -3
  67. package/dist/components/outputs/iframe.js +2 -2
  68. package/dist/components/outputs/image.d.ts +6 -6
  69. package/dist/components/outputs/image.js +4 -4
  70. package/dist/components/outputs/number.d.ts +1 -1
  71. package/dist/components/outputs/number.js +1 -1
  72. package/dist/components/outputs/progress-bar.d.ts +1 -1
  73. package/dist/components/outputs/progress-bar.js +1 -1
  74. package/dist/components/outputs/progress-spinner.d.ts +1 -1
  75. package/dist/components/outputs/progress-spinner.js +1 -1
  76. package/dist/components/outputs/qr-code.d.ts +1 -1
  77. package/dist/components/outputs/qr-code.js +1 -1
  78. package/dist/components/outputs/text.d.ts +5 -5
  79. package/dist/components/outputs/text.js +7 -7
  80. package/dist/components/outputs/vector.d.ts +7 -7
  81. package/dist/components/outputs/vector.js +6 -6
  82. package/dist/components/page.d.ts +3 -3
  83. package/dist/components/page.js +1 -1
  84. package/dist/components/popover.d.ts +2 -2
  85. package/dist/components/popover.js +2 -2
  86. package/dist/components/stack.d.ts +25 -25
  87. package/dist/components/stack.js +10 -10
  88. package/dist/components/types/container-overlay.d.ts +1 -1
  89. package/dist/components/utils/targeted-client-component-action.d.ts +1 -1
  90. package/dist/components/webmcp/web-mcp-tool.d.ts +4 -4
  91. package/dist/components/webmcp/web-mcp-tool.js +10 -7
  92. package/dist/core/actions/action.d.ts +1 -1
  93. package/dist/core/actions/animate-component.d.ts +6 -6
  94. package/dist/core/actions/animate-component.js +3 -3
  95. package/dist/core/actions/component-local-actions.d.ts +2 -2
  96. package/dist/core/actions/set-context.d.ts +1 -1
  97. package/dist/core/boot.js +1 -1
  98. package/dist/core/client-storage.js +2 -2
  99. package/dist/core/client.d.ts +10 -9
  100. package/dist/core/client.js +32 -31
  101. package/dist/core/conditions/condition-group.d.ts +1 -1
  102. package/dist/core/conditions/condition-group.js +2 -2
  103. package/dist/core/conditions/condition-operand.d.ts +2 -2
  104. package/dist/core/conditions/condition.d.ts +2 -2
  105. package/dist/core/conditions/context-array-includes.js +1 -1
  106. package/dist/core/conditions/context-array-length.d.ts +1 -1
  107. package/dist/core/conditions/context-array-length.js +2 -2
  108. package/dist/core/conditions/context-value-defined.d.ts +9 -3
  109. package/dist/core/conditions/context-value-defined.js +7 -1
  110. package/dist/core/conditions/context-value-equal.js +1 -1
  111. package/dist/core/conditions/context-value-in.js +1 -1
  112. package/dist/core/conditions/context-value-not-equal.js +1 -1
  113. package/dist/core/conditions/context-value-undefined.d.ts +9 -3
  114. package/dist/core/conditions/context-value-undefined.js +7 -1
  115. package/dist/core/conditions/desktop-device.js +1 -1
  116. package/dist/core/conditions/mobile-device.js +1 -1
  117. package/dist/core/conditions/not-desktop-device.js +1 -1
  118. package/dist/core/conditions/not-mobile-device.js +1 -1
  119. package/dist/core/conditions/not-tablet-device.js +1 -1
  120. package/dist/core/conditions/tablet-device.js +1 -1
  121. package/dist/core/context/context-ref.d.ts +1 -1
  122. package/dist/core/context/context.d.ts +2 -2
  123. package/dist/core/context/context.js +7 -7
  124. package/dist/core/gateway-connection.js +8 -8
  125. package/dist/core/index.d.ts +2 -2
  126. package/dist/core/index.js +1 -1
  127. package/dist/core/local/index.d.ts +2 -2
  128. package/dist/core/local/index.js +1 -1
  129. package/dist/core/matreshka.js +2 -2
  130. package/dist/core/types/client-settings.d.ts +3 -3
  131. package/dist/core/types/componentable.d.ts +2 -2
  132. package/dist/core/types/pageable.d.ts +1 -1
  133. package/dist/core/utils/color-roles-to-ids.d.ts +2 -2
  134. package/dist/core/utils/color-token-id.d.ts +1 -1
  135. package/dist/core/utils/deep-pick.d.ts +1 -1
  136. package/dist/core/utils/deep-pick.js +3 -3
  137. package/dist/core/utils/replace-context-keys.d.ts +3 -3
  138. package/dist/core/utils/replace-context-keys.js +6 -67
  139. package/dist/core/utils/serialize-client-settings-colors-for-handshake.d.ts +2 -2
  140. package/dist/core/utils/serialize-component-tree.d.ts +2 -2
  141. package/dist/core/utils/targeted-client-action.d.ts +1 -1
  142. package/dist/core/utils/targeted-client-action.js +8 -7
  143. package/dist/platforms/browser-platform.js +27 -27
  144. package/dist/platforms/max-mini-app-platform.d.ts +1 -1
  145. package/dist/platforms/max-mini-app-platform.js +5 -5
  146. package/dist/platforms/mobile-platform.d.ts +2 -2
  147. package/dist/platforms/mobile-platform.js +42 -42
  148. package/dist/platforms/platform.d.ts +1 -1
  149. package/dist/platforms/platform.js +21 -21
  150. package/dist/platforms/telegram-mini-app-platform.d.ts +1 -1
  151. package/dist/platforms/telegram-mini-app-platform.js +23 -23
  152. package/dist/platforms/utils/client-back-platform-action.js +1 -1
  153. package/dist/platforms/utils/client-navigate-platform-action.js +1 -1
  154. package/dist/platforms/utils/client-platform.js +1 -1
  155. package/dist/platforms/utils/client-reload-platform-action.js +1 -1
  156. package/dist/platforms/utils/client-route-page-wait.d.ts +1 -1
  157. package/dist/platforms/utils/client-route-page-wait.js +2 -2
  158. package/dist/platforms/utils/mobile-ble-services.d.ts +2 -2
  159. package/dist/platforms/utils/mobile-ble-services.js +19 -19
  160. package/dist/platforms/utils/targeted-client-platform-action.d.ts +2 -2
  161. package/dist/platforms/utils/targeted-client-platform-stream.d.ts +2 -2
  162. package/dist/platforms/utils/targeted-client-platform-stream.js +8 -7
  163. package/package.json +5 -3
  164. package/dist/core/utils/hex-to-hsl.d.ts +0 -14
  165. package/dist/core/utils/hex-to-hsl.js +0 -49
  166. package/dist/core/utils/merge-deep.d.ts +0 -8
  167. package/dist/core/utils/merge-deep.js +0 -39
  168. package/dist/core/utils/parse-context-path.d.ts +0 -4
  169. package/dist/core/utils/parse-context-path.js +0 -16
  170. package/dist/core/utils/set-object-property.d.ts +0 -2
  171. package/dist/core/utils/set-object-property.js +0 -29
@@ -2,26 +2,26 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Stack = exports.StackDirection = exports.StackMainAxisAlign = exports.StackCrossAxisAlign = exports.ScrollToPosition = exports.SafeAreaSide = exports.Overflow = exports.FlexWrap = exports.DimensionalUnit = void 0;
4
4
  exports.stack = stack;
5
- const server_component_class_1 = require("@matreshka/shared/enums/server-component-class");
6
- const component_scroll_to_message_1 = require("@matreshka/shared/messages/bff-to-client/components/component-scroll-to-message");
7
- const flex_item_1 = require("@matreshka/shared/types/flex-item");
5
+ const server_component_class_1 = require("@matreshka/client-bff-protocol/enums/server-component-class");
6
+ const component_scroll_to_message_1 = require("@matreshka/client-bff-protocol/messages/bff-to-client/components/component-scroll-to-message");
7
+ const flex_item_1 = require("@matreshka/client-bff-protocol/types/flex-item");
8
8
  const core_1 = require("../core");
9
9
  const component_local_actions_1 = require("../core/actions/component-local-actions");
10
10
  const component_1 = require("./component");
11
- var dimensional_unit_1 = require("@matreshka/shared/enums/dimensional-unit");
11
+ var dimensional_unit_1 = require("@matreshka/client-bff-protocol/enums/dimensional-unit");
12
12
  Object.defineProperty(exports, "DimensionalUnit", { enumerable: true, get: function () { return dimensional_unit_1.DimensionalUnit; } });
13
- var flex_wrap_1 = require("@matreshka/shared/enums/flex-wrap");
13
+ var flex_wrap_1 = require("@matreshka/client-bff-protocol/enums/flex-wrap");
14
14
  Object.defineProperty(exports, "FlexWrap", { enumerable: true, get: function () { return flex_wrap_1.FlexWrap; } });
15
- var overflow_1 = require("@matreshka/shared/enums/overflow");
15
+ var overflow_1 = require("@matreshka/client-bff-protocol/enums/overflow");
16
16
  Object.defineProperty(exports, "Overflow", { enumerable: true, get: function () { return overflow_1.Overflow; } });
17
- var safe_area_side_1 = require("@matreshka/shared/enums/safe-area-side");
17
+ var safe_area_side_1 = require("@matreshka/client-bff-protocol/enums/safe-area-side");
18
18
  Object.defineProperty(exports, "SafeAreaSide", { enumerable: true, get: function () { return safe_area_side_1.SafeAreaSide; } });
19
- var scroll_to_position_1 = require("@matreshka/shared/enums/scroll-to-position");
19
+ var scroll_to_position_1 = require("@matreshka/client-bff-protocol/enums/scroll-to-position");
20
20
  Object.defineProperty(exports, "ScrollToPosition", { enumerable: true, get: function () { return scroll_to_position_1.ScrollToPosition; } });
21
- var stack_align_1 = require("@matreshka/shared/enums/stack-align");
21
+ var stack_align_1 = require("@matreshka/client-bff-protocol/enums/stack-align");
22
22
  Object.defineProperty(exports, "StackCrossAxisAlign", { enumerable: true, get: function () { return stack_align_1.StackCrossAxisAlign; } });
23
23
  Object.defineProperty(exports, "StackMainAxisAlign", { enumerable: true, get: function () { return stack_align_1.StackMainAxisAlign; } });
24
- var stack_direction_1 = require("@matreshka/shared/enums/stack-direction");
24
+ var stack_direction_1 = require("@matreshka/client-bff-protocol/enums/stack-direction");
25
25
  Object.defineProperty(exports, "StackDirection", { enumerable: true, get: function () { return stack_direction_1.StackDirection; } });
26
26
  function stack(arg0, arg1) {
27
27
  if (arg1 !== undefined) {
@@ -1,3 +1,3 @@
1
1
  import type { ComponentTreeNode } from "@matreshka/bff/core";
2
- import type { Overlay as OverlayShape } from "@matreshka/shared/types/container-overlay";
2
+ import type { Overlay as OverlayShape } from "@matreshka/client-bff-protocol/types/container-overlay";
3
3
  export type Overlay = OverlayShape<ComponentTreeNode>;
@@ -1,4 +1,4 @@
1
- import { ComponentCommandMessage } from "@matreshka/shared/messages/bff-to-client/component-command-message";
1
+ import { ComponentCommandMessage } from "@matreshka/client-bff-protocol/messages/bff-to-client/component-command-message";
2
2
  import { Observable } from "rxjs";
3
3
  import { Client } from "../../core";
4
4
  export declare const COMPONENT_ACTION_SCOPE_PREFIX = "component-action-";
@@ -1,7 +1,7 @@
1
- import { WebMcpToolAnnotation } from "@matreshka/shared/enums/web-mcp-tool-annotation";
2
- import type { Condition as SerializedCondition } from "@matreshka/shared/types/condition";
3
- import type { WebMcpToolConfig } from "@matreshka/shared/types/web-mcp-tool-config";
4
- import { z } from "zod/v4";
1
+ import { WebMcpToolAnnotation } from "@matreshka/client-bff-protocol/enums/web-mcp-tool-annotation";
2
+ import type { Condition as SerializedCondition } from "@matreshka/client-bff-protocol/types/condition";
3
+ import type { WebMcpToolConfig } from "@matreshka/client-bff-protocol/types/web-mcp-tool-config";
4
+ import { z } from "zod";
5
5
  import type { Client } from "../../core/client";
6
6
  import { Condition } from "../../core/conditions/condition";
7
7
  export { WebMcpToolAnnotation };
@@ -38,18 +38,21 @@ exports.webMcpTool = webMcpTool;
38
38
  exports.webMcpInputJsonSchema = webMcpInputJsonSchema;
39
39
  exports.dispatchWebMcpToolCall = dispatchWebMcpToolCall;
40
40
  exports.webMcpToolErrorText = webMcpToolErrorText;
41
- const web_mcp_tool_annotation_1 = require("@matreshka/shared/enums/web-mcp-tool-annotation");
41
+ const web_mcp_tool_annotation_1 = require("@matreshka/client-bff-protocol/enums/web-mcp-tool-annotation");
42
42
  Object.defineProperty(exports, "WebMcpToolAnnotation", { enumerable: true, get: function () { return web_mcp_tool_annotation_1.WebMcpToolAnnotation; } });
43
- const web_mcp_tool_error_message_1 = require("@matreshka/shared/messages/bff-to-client/webmcp/web-mcp-tool-error-message");
44
- const web_mcp_tool_result_message_1 = require("@matreshka/shared/messages/bff-to-client/webmcp/web-mcp-tool-result-message");
43
+ const web_mcp_tool_error_message_1 = require("@matreshka/client-bff-protocol/messages/bff-to-client/webmcp/web-mcp-tool-error-message");
44
+ const web_mcp_tool_result_message_1 = require("@matreshka/client-bff-protocol/messages/bff-to-client/webmcp/web-mcp-tool-result-message");
45
45
  const crypto = __importStar(require("node:crypto"));
46
46
  const zod_1 = require("zod");
47
- const v4_1 = require("zod/v4");
47
+ /** MCP: латиница, цифры, `-`, `_` (после trim). */
48
+ const WEB_MCP_TOOL_NAME_PATTERN = /^[A-Za-z0-9_-]+$/;
48
49
  const webMcpToolSchema = zod_1.z.object({
49
- name: zod_1.z.string().trim().min(1),
50
+ name: zod_1.z.string().trim().min(1).regex(WEB_MCP_TOOL_NAME_PATTERN, {
51
+ message: "Tool name must contain only Latin letters, digits, hyphens (-), and underscores (_)",
52
+ }),
50
53
  description: zod_1.z.string().trim().min(1),
51
54
  annotations: zod_1.z
52
- .array(zod_1.z.custom(() => true))
55
+ .array(zod_1.z.enum(web_mcp_tool_annotation_1.WebMcpToolAnnotation))
53
56
  .refine((items) => new Set(items).size === items.length, {
54
57
  message: "Annotations must be unique",
55
58
  })
@@ -106,7 +109,7 @@ function resolveWebMcpToolConditions(conditions) {
106
109
  return list.map((condition) => condition.toJSON());
107
110
  }
108
111
  function webMcpInputJsonSchema(schema) {
109
- return v4_1.z.toJSONSchema(schema);
112
+ return zod_1.z.toJSONSchema(schema);
110
113
  }
111
114
  /** Проверяет input, вызывает execute и отвечает клиенту результатом или ошибкой. */
112
115
  async function dispatchWebMcpToolCall(client, tool, callId, input) {
@@ -1,4 +1,4 @@
1
- import type { Condition as SerializedCondition } from "@matreshka/shared/types/condition";
1
+ import type { Condition as SerializedCondition } from "@matreshka/client-bff-protocol/types/condition";
2
2
  import { Condition } from "../conditions/condition";
3
3
  export type ActionConditions = Condition[] | (() => Condition[]);
4
4
  export type ActionConfig = {
@@ -1,11 +1,11 @@
1
- import { ComponentAnimationEffect } from "@matreshka/shared/enums/component-animation-effect";
2
- import { TimingFunction } from "@matreshka/shared/enums/timing-function";
3
- import type { ComponentAnimationEffects } from "@matreshka/shared/types/component-animation";
1
+ import { ComponentAnimationEffect } from "@matreshka/client-bff-protocol/enums/component-animation-effect";
2
+ import { TimingFunction } from "@matreshka/client-bff-protocol/enums/timing-function";
3
+ import type { ComponentAnimationEffects } from "@matreshka/client-bff-protocol/types/component-animation";
4
4
  import { ActionConditions } from "./action";
5
5
  import { LocalAction } from "./local-action";
6
- export { DimensionalUnit } from "@matreshka/shared/enums/dimensional-unit";
7
- export type { ComponentAnimationEffects, DimensionalKeyframeStops, OpacityKeyframeStops, } from "@matreshka/shared/types/component-animation";
8
- export type { DimensionalValue } from "@matreshka/shared/types/dimensional-value";
6
+ export { DimensionalUnit } from "@matreshka/client-bff-protocol/enums/dimensional-unit";
7
+ export type { ComponentAnimationEffects, DimensionalKeyframeStops, OpacityKeyframeStops, } from "@matreshka/client-bff-protocol/types/component-animation";
8
+ export type { DimensionalValue } from "@matreshka/client-bff-protocol/types/dimensional-value";
9
9
  export { ComponentAnimationEffect, TimingFunction };
10
10
  /**
11
11
  * Конфигурация действия анимации компонента.
@@ -3,12 +3,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.AnimateComponent = exports.TimingFunction = exports.ComponentAnimationEffect = exports.DimensionalUnit = void 0;
4
4
  exports.animate = animate;
5
5
  exports.animateComponent = animateComponent;
6
- const component_animation_effect_1 = require("@matreshka/shared/enums/component-animation-effect");
6
+ const component_animation_effect_1 = require("@matreshka/client-bff-protocol/enums/component-animation-effect");
7
7
  Object.defineProperty(exports, "ComponentAnimationEffect", { enumerable: true, get: function () { return component_animation_effect_1.ComponentAnimationEffect; } });
8
- const timing_function_1 = require("@matreshka/shared/enums/timing-function");
8
+ const timing_function_1 = require("@matreshka/client-bff-protocol/enums/timing-function");
9
9
  Object.defineProperty(exports, "TimingFunction", { enumerable: true, get: function () { return timing_function_1.TimingFunction; } });
10
10
  const local_action_1 = require("./local-action");
11
- var dimensional_unit_1 = require("@matreshka/shared/enums/dimensional-unit");
11
+ var dimensional_unit_1 = require("@matreshka/client-bff-protocol/enums/dimensional-unit");
12
12
  Object.defineProperty(exports, "DimensionalUnit", { enumerable: true, get: function () { return dimensional_unit_1.DimensionalUnit; } });
13
13
  /**
14
14
  * Локальное действие: анимация над компонентом на клиенте.
@@ -1,5 +1,5 @@
1
- import { ScrollToPosition } from "@matreshka/shared/enums/scroll-to-position";
2
- import type { BoardPoint } from "@matreshka/shared/types/board-config";
1
+ import { ScrollToPosition } from "@matreshka/client-bff-protocol/enums/scroll-to-position";
2
+ import type { BoardPoint } from "@matreshka/client-bff-protocol/types/board-config";
3
3
  import type { VideoInputDevice } from "../../platforms/platform";
4
4
  import type { Componentable } from "../types/componentable";
5
5
  import type { ActionConfig } from "./action";
@@ -1,4 +1,4 @@
1
- import { JsonObject } from "@matreshka/shared/types/json";
1
+ import { JsonObject } from "@matreshka/client-bff-protocol/types/json";
2
2
  import { Context, ContextPathPatch } from "../context/context";
3
3
  import { ContextValueOrRef } from "../types/context-value-ref";
4
4
  import { ActionConfig } from "./action";
package/dist/core/boot.js CHANGED
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.bootCore = void 0;
4
- const register_messages_1 = require("@matreshka/shared/messages/client-to-bff/register-messages");
4
+ const register_messages_1 = require("@matreshka/client-bff-protocol/messages/client-to-bff/register-messages");
5
5
  const bootCore = (_matreshka) => {
6
6
  (0, register_messages_1.registerClientToBffMessages)(); // Чтобы парсить сообщения от клиента
7
7
  };
@@ -1,9 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ClientStorage = void 0;
4
- const index_1 = require("@matreshka/shared/messages/bff-to-client/app/index");
4
+ const index_1 = require("@matreshka/client-bff-protocol/messages/bff-to-client/app/index");
5
5
  const fetch_from_object_1 = require("@matreshka/shared/utils/fetch-from-object");
6
- const set_object_property_1 = require("./utils/set-object-property");
6
+ const set_object_property_1 = require("@matreshka/shared/utils/set-object-property");
7
7
  /**
8
8
  * Доступ к клиентскому key-value хранилищу из {@link ClientState.storage}.
9
9
  */
@@ -1,13 +1,13 @@
1
- import { BrowserEngine } from "@matreshka/shared/enums/browser-engine";
2
- import { BrowserName } from "@matreshka/shared/enums/browser-name";
3
- import { DeviceType } from "@matreshka/shared/enums/device-type";
4
- import { OsName } from "@matreshka/shared/enums/os-name";
5
- import { PlatformId } from "@matreshka/shared/enums/platform-id";
6
- import { AnyBffToClientMessage, BffToClientMessage } from "@matreshka/shared/messages/bff-to-client/bff-to-client-message";
7
- import { AnyClientToBffMessage } from "@matreshka/shared/messages/client-to-bff/client-to-bff-message";
8
- import { ClientState } from "@matreshka/shared/types/client-state";
1
+ import { BrowserEngine } from "@matreshka/client-bff-protocol/enums/browser-engine";
2
+ import { BrowserName } from "@matreshka/client-bff-protocol/enums/browser-name";
3
+ import { DeviceType } from "@matreshka/client-bff-protocol/enums/device-type";
4
+ import { OsName } from "@matreshka/client-bff-protocol/enums/os-name";
5
+ import { PlatformId } from "@matreshka/client-bff-protocol/enums/platform-id";
6
+ import { AnyBffToClientMessage, BffToClientMessage } from "@matreshka/client-bff-protocol/messages/bff-to-client/bff-to-client-message";
7
+ import { AnyClientToBffMessage } from "@matreshka/client-bff-protocol/messages/client-to-bff/client-to-bff-message";
8
+ import { ClientState } from "@matreshka/client-bff-protocol/types/client-state";
9
9
  import { BehaviorSubject, Observable, Subject } from "rxjs";
10
- import { z } from "zod/v4";
10
+ import { z } from "zod";
11
11
  import { Page } from "../components";
12
12
  import { App } from "../components/app";
13
13
  import { ClientStorage } from "./client-storage";
@@ -30,6 +30,7 @@ import { type ComponentTreeNode } from "./types/component-tree-node";
30
30
  */
31
31
  export declare const ClientHandshakePayloadSchema: z.ZodObject<{
32
32
  applicationId: z.ZodString;
33
+ protocolVersion: z.ZodString;
33
34
  }, z.core.$strict>;
34
35
  export declare const ClientStateSchema: z.ZodObject<{
35
36
  route: z.ZodObject<{
@@ -1,18 +1,18 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Client = exports.ClientStateSchema = exports.ClientHandshakePayloadSchema = void 0;
4
+ const browser_engine_1 = require("@matreshka/client-bff-protocol/enums/browser-engine");
5
+ const browser_name_1 = require("@matreshka/client-bff-protocol/enums/browser-name");
6
+ const platform_id_1 = require("@matreshka/client-bff-protocol/enums/platform-id");
7
+ const message_received_message_1 = require("@matreshka/client-bff-protocol/messages/bff-to-client/message-received-message");
8
+ const app_client_state_message_1 = require("@matreshka/client-bff-protocol/messages/client-to-bff/app/app-client-state-message");
9
+ const handshake_message_1 = require("@matreshka/client-bff-protocol/messages/client-to-bff/app/handshake-message");
10
+ const message_received_message_2 = require("@matreshka/client-bff-protocol/messages/client-to-bff/message-received-message");
11
+ const parse_client_to_bff_message_1 = require("@matreshka/client-bff-protocol/messages/client-to-bff/parse-client-to-bff-message");
12
+ const reliable_delivery_1 = require("@matreshka/client-bff-protocol/messages/reliable-delivery");
4
13
  const shared_1 = require("@matreshka/shared");
5
- const browser_engine_1 = require("@matreshka/shared/enums/browser-engine");
6
- const browser_name_1 = require("@matreshka/shared/enums/browser-name");
7
- const platform_id_1 = require("@matreshka/shared/enums/platform-id");
8
- const message_received_message_1 = require("@matreshka/shared/messages/bff-to-client/message-received-message");
9
- const app_client_state_message_1 = require("@matreshka/shared/messages/client-to-bff/app/app-client-state-message");
10
- const handshake_message_1 = require("@matreshka/shared/messages/client-to-bff/app/handshake-message");
11
- const message_received_message_2 = require("@matreshka/shared/messages/client-to-bff/message-received-message");
12
- const parse_client_to_bff_message_1 = require("@matreshka/shared/messages/client-to-bff/parse-client-to-bff-message");
13
- const reliable_delivery_1 = require("@matreshka/shared/messages/reliable-delivery");
14
14
  const rxjs_1 = require("rxjs");
15
- const v4_1 = require("zod/v4");
15
+ const zod_1 = require("zod");
16
16
  const app_1 = require("../components/app");
17
17
  const component_1 = require("../components/component");
18
18
  const client_context_1 = require("./client-context");
@@ -36,22 +36,23 @@ const resolveDeviceTypeFromUserAgent = shared_1.getDeviceTypeFromUserAgent;
36
36
  * @property platform.id Идентификатор платформы.
37
37
  * @property platform.payload Дополнительные данные о платформе.
38
38
  */
39
- exports.ClientHandshakePayloadSchema = v4_1.z.strictObject({
40
- applicationId: v4_1.z.string(),
39
+ exports.ClientHandshakePayloadSchema = zod_1.z.strictObject({
40
+ applicationId: zod_1.z.string(),
41
+ protocolVersion: zod_1.z.string(),
41
42
  });
42
- exports.ClientStateSchema = v4_1.z.strictObject({
43
- route: v4_1.z.strictObject({
44
- visitedAt: v4_1.z.number(),
45
- path: v4_1.z.string(),
46
- query: v4_1.z.record(v4_1.z.string(), v4_1.z.string()),
43
+ exports.ClientStateSchema = zod_1.z.strictObject({
44
+ route: zod_1.z.strictObject({
45
+ visitedAt: zod_1.z.number(),
46
+ path: zod_1.z.string(),
47
+ query: zod_1.z.record(zod_1.z.string(), zod_1.z.string()),
47
48
  }),
48
- storage: v4_1.z.record(v4_1.z.string(), v4_1.z.string()),
49
- language: v4_1.z.string(),
50
- userAgent: v4_1.z.string(),
51
- prefersColorScheme: v4_1.z.literal(["light", "dark", "system"]),
52
- platform: v4_1.z.strictObject({
53
- id: v4_1.z.enum(platform_id_1.PlatformId),
54
- payload: v4_1.z.unknown(),
49
+ storage: zod_1.z.record(zod_1.z.string(), zod_1.z.string()),
50
+ language: zod_1.z.string(),
51
+ userAgent: zod_1.z.string(),
52
+ prefersColorScheme: zod_1.z.literal(["light", "dark", "system"]),
53
+ platform: zod_1.z.strictObject({
54
+ id: zod_1.z.enum(platform_id_1.PlatformId),
55
+ payload: zod_1.z.unknown(),
55
56
  }),
56
57
  });
57
58
  class Client {
@@ -174,13 +175,13 @@ class Client {
174
175
  */
175
176
  newMessage(messageString) {
176
177
  try {
177
- const abstractMessageSchema = v4_1.z.object({
178
- type: v4_1.z.string(),
179
- payload: v4_1.z.unknown().optional(),
180
- target: v4_1.z.string().optional(),
181
- id: v4_1.z.string().optional(),
182
- attempt: v4_1.z.number().int().positive().optional(),
183
- handlers: v4_1.z.array(v4_1.z.number().int().nonnegative()).optional(),
178
+ const abstractMessageSchema = zod_1.z.object({
179
+ type: zod_1.z.string(),
180
+ payload: zod_1.z.unknown().optional(),
181
+ target: zod_1.z.string().optional(),
182
+ id: zod_1.z.string().optional(),
183
+ attempt: zod_1.z.number().int().positive().optional(),
184
+ handlers: zod_1.z.array(zod_1.z.number().int().nonnegative()).optional(),
184
185
  });
185
186
  const message = abstractMessageSchema.parse(JSON.parse(messageString));
186
187
  (0, client_context_1.runWithClient)(this, () => {
@@ -1,4 +1,4 @@
1
- import { ConditionGroupOperator } from "@matreshka/shared/enums/condition-group-operator";
1
+ import { ConditionGroupOperator } from "@matreshka/client-bff-protocol/enums/condition-group-operator";
2
2
  import { Condition } from "./condition";
3
3
  /**
4
4
  * Составное условие: все (`and`) или хотя бы одно (`or`) из вложенных условий.
@@ -3,8 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ConditionGroup = void 0;
4
4
  exports.conditionAny = conditionAny;
5
5
  exports.conditionAll = conditionAll;
6
- const condition_group_operator_1 = require("@matreshka/shared/enums/condition-group-operator");
7
- const condition_type_1 = require("@matreshka/shared/enums/condition-type");
6
+ const condition_group_operator_1 = require("@matreshka/client-bff-protocol/enums/condition-group-operator");
7
+ const condition_type_1 = require("@matreshka/client-bff-protocol/enums/condition-type");
8
8
  const condition_1 = require("./condition");
9
9
  /**
10
10
  * Составное условие: все (`and`) или хотя бы одно (`or`) из вложенных условий.
@@ -1,5 +1,5 @@
1
- import type { Json, JsonObject, JsonPrimitive } from "@matreshka/shared/types/json";
2
- import type { SerializedOperand } from "@matreshka/shared/types/serialized-operand";
1
+ import type { Json, JsonObject, JsonPrimitive } from "@matreshka/client-bff-protocol/types/json";
2
+ import type { SerializedOperand } from "@matreshka/client-bff-protocol/types/serialized-operand";
3
3
  import { Paths, PathValue } from "ts-essentials";
4
4
  import { ContextRef, ContextRefValue } from "../context/context-ref";
5
5
  import type { CompatibleContextValueRef } from "../types/context-value-ref";
@@ -1,5 +1,5 @@
1
- import { ConditionType } from "@matreshka/shared/enums/condition-type";
2
- import type { Condition as SerializedCondition } from "@matreshka/shared/types/condition";
1
+ import { ConditionType } from "@matreshka/client-bff-protocol/enums/condition-type";
2
+ import type { Condition as SerializedCondition } from "@matreshka/client-bff-protocol/types/condition";
3
3
  /**
4
4
  * Абстрактный класс, представляющий условие с типом и дополнительными данными.
5
5
  *
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ContextArrayNotIncludes = exports.ContextArrayIncludes = void 0;
4
4
  exports.contextArrayIncludes = contextArrayIncludes;
5
5
  exports.contextArrayNotIncludes = contextArrayNotIncludes;
6
- const condition_type_1 = require("@matreshka/shared/enums/condition-type");
6
+ const condition_type_1 = require("@matreshka/client-bff-protocol/enums/condition-type");
7
7
  const condition_1 = require("./condition");
8
8
  const condition_operand_1 = require("./condition-operand");
9
9
  /**
@@ -1,4 +1,4 @@
1
- import { ArrayLengthCompare } from "@matreshka/shared/enums/array-length-compare";
1
+ import { ArrayLengthCompare } from "@matreshka/client-bff-protocol/enums/array-length-compare";
2
2
  import { ContextRef } from "../context/context-ref";
3
3
  import { Condition } from "./condition";
4
4
  import { CompatibleArrayContextRef, ConditionLengthOperand } from "./condition-operand";
@@ -8,8 +8,8 @@ exports.contextArrayLengthGreaterThan = contextArrayLengthGreaterThan;
8
8
  exports.contextArrayLengthGreaterOrEqual = contextArrayLengthGreaterOrEqual;
9
9
  exports.contextValueEmpty = contextValueEmpty;
10
10
  exports.contextValueNotEmpty = contextValueNotEmpty;
11
- const array_length_compare_1 = require("@matreshka/shared/enums/array-length-compare");
12
- const condition_type_1 = require("@matreshka/shared/enums/condition-type");
11
+ const array_length_compare_1 = require("@matreshka/client-bff-protocol/enums/array-length-compare");
12
+ const condition_type_1 = require("@matreshka/client-bff-protocol/enums/condition-type");
13
13
  const condition_1 = require("./condition");
14
14
  const condition_operand_1 = require("./condition-operand");
15
15
  /**
@@ -3,10 +3,16 @@ import { Condition } from "./condition";
3
3
  /**
4
4
  * Условие, означающее, что в контексте определено значение по заданному ключу.
5
5
  *
6
+ * Параметр — `R extends ContextRef<any, any>`. Голый `ContextRef` раскрывается
7
+ * в `ContextRef<JsonObject, string>`. Метод `local.set` принимает значение по пути,
8
+ * поэтому ссылка инвариантна: при `strictFunctionTypes` конкретный ref страницы
9
+ * в этот параметр не входит. `any` в ограничении выводит `R` из аргумента
10
+ * и сохраняет его тип. Тот же приём у {@link contextValueEqual} и {@link contextValueIn}.
11
+ *
6
12
  * @internal Используйте {@link contextValueDefined} / {@link when.defined}.
7
13
  */
8
- export declare class ContextValueDefined extends Condition {
9
- constructor(ref: ContextRef);
14
+ export declare class ContextValueDefined<R extends ContextRef<any, any>> extends Condition {
15
+ constructor(ref: R);
10
16
  }
11
17
  /** Функциональная форма {@link ContextValueDefined}. */
12
- export declare function contextValueDefined(ref: ContextRef): ContextValueDefined;
18
+ export declare function contextValueDefined<R extends ContextRef<any, any>>(ref: R): ContextValueDefined<R>;
@@ -2,11 +2,17 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ContextValueDefined = void 0;
4
4
  exports.contextValueDefined = contextValueDefined;
5
- const condition_type_1 = require("@matreshka/shared/enums/condition-type");
5
+ const condition_type_1 = require("@matreshka/client-bff-protocol/enums/condition-type");
6
6
  const condition_1 = require("./condition");
7
7
  /**
8
8
  * Условие, означающее, что в контексте определено значение по заданному ключу.
9
9
  *
10
+ * Параметр — `R extends ContextRef<any, any>`. Голый `ContextRef` раскрывается
11
+ * в `ContextRef<JsonObject, string>`. Метод `local.set` принимает значение по пути,
12
+ * поэтому ссылка инвариантна: при `strictFunctionTypes` конкретный ref страницы
13
+ * в этот параметр не входит. `any` в ограничении выводит `R` из аргумента
14
+ * и сохраняет его тип. Тот же приём у {@link contextValueEqual} и {@link contextValueIn}.
15
+ *
10
16
  * @internal Используйте {@link contextValueDefined} / {@link when.defined}.
11
17
  */
12
18
  class ContextValueDefined extends condition_1.Condition {
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ContextValueEqual = void 0;
4
4
  exports.contextValueEqual = contextValueEqual;
5
- const condition_type_1 = require("@matreshka/shared/enums/condition-type");
5
+ const condition_type_1 = require("@matreshka/client-bff-protocol/enums/condition-type");
6
6
  const condition_1 = require("./condition");
7
7
  const condition_operand_1 = require("./condition-operand");
8
8
  /**
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ContextValueIn = void 0;
4
4
  exports.contextValueIn = contextValueIn;
5
- const condition_type_1 = require("@matreshka/shared/enums/condition-type");
5
+ const condition_type_1 = require("@matreshka/client-bff-protocol/enums/condition-type");
6
6
  const condition_1 = require("./condition");
7
7
  const condition_operand_1 = require("./condition-operand");
8
8
  /**
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ContextValueNotEqual = void 0;
4
4
  exports.contextValueNotEqual = contextValueNotEqual;
5
- const condition_type_1 = require("@matreshka/shared/enums/condition-type");
5
+ const condition_type_1 = require("@matreshka/client-bff-protocol/enums/condition-type");
6
6
  const condition_1 = require("./condition");
7
7
  const condition_operand_1 = require("./condition-operand");
8
8
  /**
@@ -3,10 +3,16 @@ import { Condition } from "./condition";
3
3
  /**
4
4
  * Условие, означающее, что значение в контексте по заданному ключу не определено.
5
5
  *
6
+ * Параметр — `R extends ContextRef<any, any>`. Голый `ContextRef` раскрывается
7
+ * в `ContextRef<JsonObject, string>`. Метод `local.set` принимает значение по пути,
8
+ * поэтому ссылка инвариантна: при `strictFunctionTypes` конкретный ref страницы
9
+ * в этот параметр не входит. `any` в ограничении выводит `R` из аргумента
10
+ * и сохраняет его тип. Тот же приём у {@link contextValueEqual} и {@link contextValueIn}.
11
+ *
6
12
  * @internal Используйте {@link contextValueUndefined} / {@link when.notDefined}.
7
13
  */
8
- export declare class ContextValueUndefined extends Condition {
9
- constructor(ref: ContextRef);
14
+ export declare class ContextValueUndefined<R extends ContextRef<any, any>> extends Condition {
15
+ constructor(ref: R);
10
16
  }
11
17
  /** Функциональная форма {@link ContextValueUndefined}. */
12
- export declare function contextValueUndefined(ref: ContextRef): ContextValueUndefined;
18
+ export declare function contextValueUndefined<R extends ContextRef<any, any>>(ref: R): ContextValueUndefined<R>;
@@ -2,11 +2,17 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ContextValueUndefined = void 0;
4
4
  exports.contextValueUndefined = contextValueUndefined;
5
- const condition_type_1 = require("@matreshka/shared/enums/condition-type");
5
+ const condition_type_1 = require("@matreshka/client-bff-protocol/enums/condition-type");
6
6
  const condition_1 = require("./condition");
7
7
  /**
8
8
  * Условие, означающее, что значение в контексте по заданному ключу не определено.
9
9
  *
10
+ * Параметр — `R extends ContextRef<any, any>`. Голый `ContextRef` раскрывается
11
+ * в `ContextRef<JsonObject, string>`. Метод `local.set` принимает значение по пути,
12
+ * поэтому ссылка инвариантна: при `strictFunctionTypes` конкретный ref страницы
13
+ * в этот параметр не входит. `any` в ограничении выводит `R` из аргумента
14
+ * и сохраняет его тип. Тот же приём у {@link contextValueEqual} и {@link contextValueIn}.
15
+ *
10
16
  * @internal Используйте {@link contextValueUndefined} / {@link when.notDefined}.
11
17
  */
12
18
  class ContextValueUndefined extends condition_1.Condition {
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.DesktopDevice = void 0;
4
4
  exports.desktopDevice = desktopDevice;
5
- const condition_type_1 = require("@matreshka/shared/enums/condition-type");
5
+ const condition_type_1 = require("@matreshka/client-bff-protocol/enums/condition-type");
6
6
  const condition_1 = require("./condition");
7
7
  /**
8
8
  * Условие: устройство клиента — десктоп.
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.MobileDevice = void 0;
4
4
  exports.mobileDevice = mobileDevice;
5
- const condition_type_1 = require("@matreshka/shared/enums/condition-type");
5
+ const condition_type_1 = require("@matreshka/client-bff-protocol/enums/condition-type");
6
6
  const condition_1 = require("./condition");
7
7
  /**
8
8
  * Условие: устройство клиента — мобильный телефон.
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.NotDesktopDevice = void 0;
4
4
  exports.notDesktopDevice = notDesktopDevice;
5
- const condition_type_1 = require("@matreshka/shared/enums/condition-type");
5
+ const condition_type_1 = require("@matreshka/client-bff-protocol/enums/condition-type");
6
6
  const condition_1 = require("./condition");
7
7
  /**
8
8
  * Условие: устройство клиента не десктоп.
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.NotMobileDevice = void 0;
4
4
  exports.notMobileDevice = notMobileDevice;
5
- const condition_type_1 = require("@matreshka/shared/enums/condition-type");
5
+ const condition_type_1 = require("@matreshka/client-bff-protocol/enums/condition-type");
6
6
  const condition_1 = require("./condition");
7
7
  /**
8
8
  * Условие: устройство клиента не мобильный телефон.
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.NotTabletDevice = void 0;
4
4
  exports.notTabletDevice = notTabletDevice;
5
- const condition_type_1 = require("@matreshka/shared/enums/condition-type");
5
+ const condition_type_1 = require("@matreshka/client-bff-protocol/enums/condition-type");
6
6
  const condition_1 = require("./condition");
7
7
  /**
8
8
  * Условие: устройство клиента не планшет.
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.TabletDevice = void 0;
4
4
  exports.tabletDevice = tabletDevice;
5
- const condition_type_1 = require("@matreshka/shared/enums/condition-type");
5
+ const condition_type_1 = require("@matreshka/client-bff-protocol/enums/condition-type");
6
6
  const condition_1 = require("./condition");
7
7
  /**
8
8
  * Условие: устройство клиента — планшет.
@@ -1,4 +1,4 @@
1
- import { JsonObject } from "@matreshka/shared/types/json";
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
4
  import { ActionConfig } from "../actions/action";
@@ -1,7 +1,7 @@
1
- import { JsonObject } from "@matreshka/shared/types/json";
1
+ import { JsonObject } from "@matreshka/client-bff-protocol/types/json";
2
2
  import { BehaviorSubject, Observable } from "rxjs";
3
3
  import { Paths, PathValue } from "ts-essentials";
4
- import { ZodObject } from "zod/v4";
4
+ import { ZodObject } from "zod";
5
5
  import { ActionConfig } from "../actions/action";
6
6
  import { LocalContextPathPatch } from "../actions/set-context";
7
7
  import type { Client } from "../client";