@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.
- package/dist/components/aliases/button.js +1 -1
- package/dist/components/aliases/column.js +1 -1
- package/dist/components/aliases/row.js +1 -1
- package/dist/components/app.d.ts +1 -1
- package/dist/components/app.js +1 -1
- package/dist/components/board.d.ts +4 -4
- package/dist/components/board.js +6 -6
- package/dist/components/boot.js +1 -1
- package/dist/components/camera.d.ts +5 -5
- package/dist/components/camera.js +3 -3
- package/dist/components/charts/chart.d.ts +3 -3
- package/dist/components/charts/chart.js +2 -2
- package/dist/components/component.d.ts +10 -10
- package/dist/components/component.js +1 -1
- package/dist/components/container.d.ts +2 -2
- package/dist/components/container.js +1 -1
- package/dist/components/dialog.d.ts +4 -4
- package/dist/components/dialog.js +2 -2
- package/dist/components/entry-component.d.ts +1 -1
- package/dist/components/entry-component.js +1 -1
- package/dist/components/enum/password-input-kind.d.ts +1 -1
- package/dist/components/enum/password-input-kind.js +1 -1
- package/dist/components/enum/popover-position-area.d.ts +1 -1
- package/dist/components/enum/popover-position-area.js +1 -1
- package/dist/components/enum/scroll-to-position.d.ts +1 -1
- package/dist/components/enum/scroll-to-position.js +1 -1
- package/dist/components/enum/text-input-kind.d.ts +1 -1
- package/dist/components/enum/text-input-kind.js +1 -1
- package/dist/components/enum/textarea-resize.d.ts +1 -1
- package/dist/components/enum/textarea-resize.js +1 -1
- package/dist/components/file-upload-area.d.ts +2 -2
- package/dist/components/file-upload-area.js +19 -19
- package/dist/components/for-each.d.ts +2 -2
- package/dist/components/for-each.js +4 -4
- package/dist/components/form.d.ts +2 -2
- package/dist/components/form.js +1 -1
- package/dist/components/grid.d.ts +6 -6
- package/dist/components/grid.js +2 -2
- package/dist/components/index.d.ts +1 -1
- package/dist/components/index.js +1 -1
- package/dist/components/inputs/number-input.d.ts +1 -1
- package/dist/components/inputs/number-input.js +1 -1
- package/dist/components/inputs/password-input.d.ts +2 -2
- package/dist/components/inputs/password-input.js +1 -1
- package/dist/components/inputs/text-editor.d.ts +1 -1
- package/dist/components/inputs/text-editor.js +15 -15
- package/dist/components/inputs/text-input.d.ts +2 -2
- package/dist/components/inputs/text-input.js +1 -1
- package/dist/components/inputs/textarea.d.ts +2 -2
- package/dist/components/inputs/textarea.js +1 -1
- package/dist/components/item-list/flatten-nested-items.d.ts +1 -1
- package/dist/components/item-list/item-list-host.d.ts +1 -1
- package/dist/components/item-list/item-list.d.ts +1 -1
- package/dist/components/item-list/list-from-ref-context.js +2 -2
- package/dist/components/item-list/nested-items-host-support.js +1 -1
- package/dist/components/line.d.ts +1 -1
- package/dist/components/line.js +1 -1
- package/dist/components/map.d.ts +6 -6
- package/dist/components/map.js +6 -6
- package/dist/components/outputs/currency.d.ts +1 -1
- package/dist/components/outputs/currency.js +1 -1
- package/dist/components/outputs/datetime.d.ts +1 -1
- package/dist/components/outputs/datetime.js +1 -1
- package/dist/components/outputs/icon.d.ts +1 -1
- package/dist/components/outputs/icon.js +1 -1
- package/dist/components/outputs/iframe.d.ts +3 -3
- package/dist/components/outputs/iframe.js +2 -2
- package/dist/components/outputs/image.d.ts +6 -6
- package/dist/components/outputs/image.js +4 -4
- package/dist/components/outputs/number.d.ts +1 -1
- package/dist/components/outputs/number.js +1 -1
- package/dist/components/outputs/progress-bar.d.ts +1 -1
- package/dist/components/outputs/progress-bar.js +1 -1
- package/dist/components/outputs/progress-spinner.d.ts +1 -1
- package/dist/components/outputs/progress-spinner.js +1 -1
- package/dist/components/outputs/qr-code.d.ts +1 -1
- package/dist/components/outputs/qr-code.js +1 -1
- package/dist/components/outputs/text.d.ts +5 -5
- package/dist/components/outputs/text.js +7 -7
- package/dist/components/outputs/vector.d.ts +7 -7
- package/dist/components/outputs/vector.js +6 -6
- package/dist/components/page.d.ts +3 -3
- package/dist/components/page.js +1 -1
- package/dist/components/popover.d.ts +2 -2
- package/dist/components/popover.js +2 -2
- package/dist/components/stack.d.ts +25 -25
- package/dist/components/stack.js +10 -10
- package/dist/components/types/container-overlay.d.ts +1 -1
- package/dist/components/utils/targeted-client-component-action.d.ts +1 -1
- package/dist/components/webmcp/web-mcp-tool.d.ts +4 -4
- package/dist/components/webmcp/web-mcp-tool.js +10 -7
- package/dist/core/actions/action.d.ts +1 -1
- package/dist/core/actions/animate-component.d.ts +6 -6
- package/dist/core/actions/animate-component.js +3 -3
- package/dist/core/actions/component-local-actions.d.ts +2 -2
- package/dist/core/actions/set-context.d.ts +1 -1
- package/dist/core/boot.js +1 -1
- package/dist/core/client-storage.js +2 -2
- package/dist/core/client.d.ts +10 -9
- package/dist/core/client.js +32 -31
- package/dist/core/conditions/condition-group.d.ts +1 -1
- package/dist/core/conditions/condition-group.js +2 -2
- package/dist/core/conditions/condition-operand.d.ts +2 -2
- package/dist/core/conditions/condition.d.ts +2 -2
- package/dist/core/conditions/context-array-includes.js +1 -1
- package/dist/core/conditions/context-array-length.d.ts +1 -1
- package/dist/core/conditions/context-array-length.js +2 -2
- package/dist/core/conditions/context-value-defined.d.ts +9 -3
- package/dist/core/conditions/context-value-defined.js +7 -1
- package/dist/core/conditions/context-value-equal.js +1 -1
- package/dist/core/conditions/context-value-in.js +1 -1
- package/dist/core/conditions/context-value-not-equal.js +1 -1
- package/dist/core/conditions/context-value-undefined.d.ts +9 -3
- package/dist/core/conditions/context-value-undefined.js +7 -1
- package/dist/core/conditions/desktop-device.js +1 -1
- package/dist/core/conditions/mobile-device.js +1 -1
- package/dist/core/conditions/not-desktop-device.js +1 -1
- package/dist/core/conditions/not-mobile-device.js +1 -1
- package/dist/core/conditions/not-tablet-device.js +1 -1
- package/dist/core/conditions/tablet-device.js +1 -1
- package/dist/core/context/context-ref.d.ts +1 -1
- package/dist/core/context/context.d.ts +2 -2
- package/dist/core/context/context.js +7 -7
- package/dist/core/gateway-connection.js +8 -8
- package/dist/core/index.d.ts +2 -2
- package/dist/core/index.js +1 -1
- package/dist/core/local/index.d.ts +2 -2
- package/dist/core/local/index.js +1 -1
- package/dist/core/matreshka.js +2 -2
- package/dist/core/types/client-settings.d.ts +3 -3
- package/dist/core/types/componentable.d.ts +2 -2
- package/dist/core/types/pageable.d.ts +1 -1
- package/dist/core/utils/color-roles-to-ids.d.ts +2 -2
- package/dist/core/utils/color-token-id.d.ts +1 -1
- package/dist/core/utils/deep-pick.d.ts +1 -1
- package/dist/core/utils/deep-pick.js +3 -3
- package/dist/core/utils/replace-context-keys.d.ts +3 -3
- package/dist/core/utils/replace-context-keys.js +6 -67
- package/dist/core/utils/serialize-client-settings-colors-for-handshake.d.ts +2 -2
- package/dist/core/utils/serialize-component-tree.d.ts +2 -2
- package/dist/core/utils/targeted-client-action.d.ts +1 -1
- package/dist/core/utils/targeted-client-action.js +8 -7
- package/dist/platforms/browser-platform.js +27 -27
- package/dist/platforms/max-mini-app-platform.d.ts +1 -1
- package/dist/platforms/max-mini-app-platform.js +5 -5
- package/dist/platforms/mobile-platform.d.ts +2 -2
- package/dist/platforms/mobile-platform.js +42 -42
- package/dist/platforms/platform.d.ts +1 -1
- package/dist/platforms/platform.js +21 -21
- package/dist/platforms/telegram-mini-app-platform.d.ts +1 -1
- package/dist/platforms/telegram-mini-app-platform.js +23 -23
- package/dist/platforms/utils/client-back-platform-action.js +1 -1
- package/dist/platforms/utils/client-navigate-platform-action.js +1 -1
- package/dist/platforms/utils/client-platform.js +1 -1
- package/dist/platforms/utils/client-reload-platform-action.js +1 -1
- package/dist/platforms/utils/client-route-page-wait.d.ts +1 -1
- package/dist/platforms/utils/client-route-page-wait.js +2 -2
- package/dist/platforms/utils/mobile-ble-services.d.ts +2 -2
- package/dist/platforms/utils/mobile-ble-services.js +19 -19
- package/dist/platforms/utils/targeted-client-platform-action.d.ts +2 -2
- package/dist/platforms/utils/targeted-client-platform-stream.d.ts +2 -2
- package/dist/platforms/utils/targeted-client-platform-stream.js +8 -7
- package/package.json +5 -3
- package/dist/core/utils/hex-to-hsl.d.ts +0 -14
- package/dist/core/utils/hex-to-hsl.js +0 -49
- package/dist/core/utils/merge-deep.d.ts +0 -8
- package/dist/core/utils/merge-deep.js +0 -39
- package/dist/core/utils/parse-context-path.d.ts +0 -4
- package/dist/core/utils/parse-context-path.js +0 -16
- package/dist/core/utils/set-object-property.d.ts +0 -2
- package/dist/core/utils/set-object-property.js +0 -29
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Context = void 0;
|
|
4
|
-
const index_1 = require("@matreshka/
|
|
5
|
-
const index_2 = require("@matreshka/
|
|
6
|
-
const targeted_message_1 = require("@matreshka/
|
|
4
|
+
const index_1 = require("@matreshka/client-bff-protocol/messages/bff-to-client/context/index");
|
|
5
|
+
const index_2 = require("@matreshka/client-bff-protocol/messages/client-to-bff/context/index");
|
|
6
|
+
const targeted_message_1 = require("@matreshka/client-bff-protocol/messages/targeted-message");
|
|
7
7
|
const fetch_from_object_1 = require("@matreshka/shared/utils/fetch-from-object");
|
|
8
|
+
const set_object_property_1 = require("@matreshka/shared/utils/set-object-property");
|
|
8
9
|
const rxjs_1 = require("rxjs");
|
|
9
|
-
const
|
|
10
|
+
const zod_1 = require("zod");
|
|
10
11
|
const dec_context_value_1 = require("../actions/dec-context-value");
|
|
11
12
|
const inc_context_value_1 = require("../actions/inc-context-value");
|
|
12
13
|
const set_context_1 = require("../actions/set-context");
|
|
@@ -16,7 +17,6 @@ const deep_pick_1 = require("../utils/deep-pick");
|
|
|
16
17
|
const incoming_message_observer_1 = require("../utils/incoming-message-observer");
|
|
17
18
|
const objects_diff_1 = require("../utils/objects-diff");
|
|
18
19
|
const replace_context_keys_1 = require("../utils/replace-context-keys");
|
|
19
|
-
const set_object_property_1 = require("../utils/set-object-property");
|
|
20
20
|
const context_ref_1 = require("./context-ref");
|
|
21
21
|
/** Отделяет чтение через {@link Context.get} от живого дерева в хранилище. */
|
|
22
22
|
function cloneGetResult(value) {
|
|
@@ -196,7 +196,7 @@ class Context {
|
|
|
196
196
|
}
|
|
197
197
|
}));
|
|
198
198
|
clientSubscription.add(client.incomingMessage$
|
|
199
|
-
.pipe((0, rxjs_1.filter)((unsafeMessage) =>
|
|
199
|
+
.pipe((0, rxjs_1.filter)((unsafeMessage) => unsafeMessage instanceof targeted_message_1.TargetedMessage &&
|
|
200
200
|
unsafeMessage.target === this.id))
|
|
201
201
|
.subscribe((0, incoming_message_observer_1.incomingMessageObserver)(client, (unsafeMessage) => {
|
|
202
202
|
if (this.destroyed) {
|
|
@@ -215,7 +215,7 @@ class Context {
|
|
|
215
215
|
return;
|
|
216
216
|
}
|
|
217
217
|
if (unsafeMessage instanceof index_2.ContextValuesMessage) {
|
|
218
|
-
const payloadSchema =
|
|
218
|
+
const payloadSchema = zod_1.z.array(zod_1.z.strictObject({ key: zod_1.z.string(), value: zod_1.z.unknown() }));
|
|
219
219
|
const changes = payloadSchema.parse(unsafeMessage.payload);
|
|
220
220
|
const patch = {};
|
|
221
221
|
changes.forEach((change) => {
|
|
@@ -5,14 +5,14 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.GatewayConnection = void 0;
|
|
7
7
|
exports.buildGatewayWebSocketUrl = buildGatewayWebSocketUrl;
|
|
8
|
-
const bff_message_1 = require("@matreshka/
|
|
9
|
-
const client_message_1 = require("@matreshka/
|
|
10
|
-
const connected_message_1 = require("@matreshka/
|
|
11
|
-
const error_message_1 = require("@matreshka/
|
|
12
|
-
const parse_gateway_to_bff_message_1 = require("@matreshka/
|
|
13
|
-
const session_close_message_1 = require("@matreshka/
|
|
14
|
-
const session_open_message_1 = require("@matreshka/
|
|
15
|
-
const register_gateway_messages_1 = require("@matreshka/
|
|
8
|
+
const bff_message_1 = require("@matreshka/gateway-bff-protocol/messages/bff-to-gateway/bff-message");
|
|
9
|
+
const client_message_1 = require("@matreshka/gateway-bff-protocol/messages/gateway-to-bff/client-message");
|
|
10
|
+
const connected_message_1 = require("@matreshka/gateway-bff-protocol/messages/gateway-to-bff/connected-message");
|
|
11
|
+
const error_message_1 = require("@matreshka/gateway-bff-protocol/messages/gateway-to-bff/error-message");
|
|
12
|
+
const parse_gateway_to_bff_message_1 = require("@matreshka/gateway-bff-protocol/messages/gateway-to-bff/parse-gateway-to-bff-message");
|
|
13
|
+
const session_close_message_1 = require("@matreshka/gateway-bff-protocol/messages/gateway-to-bff/session-close-message");
|
|
14
|
+
const session_open_message_1 = require("@matreshka/gateway-bff-protocol/messages/gateway-to-bff/session-open-message");
|
|
15
|
+
const register_gateway_messages_1 = require("@matreshka/gateway-bff-protocol/messages/register-gateway-messages");
|
|
16
16
|
const rxjs_1 = require("rxjs");
|
|
17
17
|
const ws_1 = __importDefault(require("ws"));
|
|
18
18
|
const version_1 = require("./version");
|
package/dist/core/index.d.ts
CHANGED
|
@@ -9,7 +9,7 @@ export * from "./matreshka";
|
|
|
9
9
|
export * from "./conditions";
|
|
10
10
|
export * from "./context/context";
|
|
11
11
|
export * from "./context/context-ref";
|
|
12
|
-
export type { DimensionalValue } from "@matreshka/
|
|
12
|
+
export type { DimensionalValue } from "@matreshka/client-bff-protocol/types/dimensional-value";
|
|
13
13
|
export { ComponentAnimationEffect, DimensionalUnit, TimingFunction, local, } from "./local";
|
|
14
14
|
export type { ActionConfig, AnimateComponentConfig, ComponentAnimationEffects, DimensionalKeyframeStops, OpacityKeyframeStops, } from "./local";
|
|
15
15
|
export * from "./types/client-settings";
|
|
@@ -17,7 +17,7 @@ export * from "./utils/calculate-components";
|
|
|
17
17
|
export * from "./utils/color-roles-to-ids";
|
|
18
18
|
export * from "./utils/color-token-id";
|
|
19
19
|
export * from "./utils/serialize-component-tree";
|
|
20
|
-
export * from "@matreshka/
|
|
20
|
+
export * from "@matreshka/client-bff-protocol/types/json";
|
|
21
21
|
export * from "./types/component-instance";
|
|
22
22
|
export * from "./types/component-tree-node";
|
|
23
23
|
export * from "./types/componentable";
|
package/dist/core/index.js
CHANGED
|
@@ -36,7 +36,7 @@ __exportStar(require("./utils/calculate-components"), exports);
|
|
|
36
36
|
__exportStar(require("./utils/color-roles-to-ids"), exports);
|
|
37
37
|
__exportStar(require("./utils/color-token-id"), exports);
|
|
38
38
|
__exportStar(require("./utils/serialize-component-tree"), exports);
|
|
39
|
-
__exportStar(require("@matreshka/
|
|
39
|
+
__exportStar(require("@matreshka/client-bff-protocol/types/json"), exports);
|
|
40
40
|
__exportStar(require("./types/component-instance"), exports);
|
|
41
41
|
__exportStar(require("./types/component-tree-node"), exports);
|
|
42
42
|
__exportStar(require("./types/componentable"), exports);
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { animate } from "../actions/animate-component";
|
|
2
2
|
import { writeTextToClipboard } from "../actions/write-text-to-clipboard";
|
|
3
3
|
export type { ActionConfig } from "../actions/action";
|
|
4
|
-
export { DimensionalUnit } from "@matreshka/
|
|
5
|
-
export type { DimensionalValue } from "@matreshka/
|
|
4
|
+
export { DimensionalUnit } from "@matreshka/client-bff-protocol/enums/dimensional-unit";
|
|
5
|
+
export type { DimensionalValue } from "@matreshka/client-bff-protocol/types/dimensional-value";
|
|
6
6
|
export { animate, ComponentAnimationEffect, TimingFunction, } from "../actions/animate-component";
|
|
7
7
|
export type { AnimateComponentConfig, ComponentAnimationEffects, DimensionalKeyframeStops, OpacityKeyframeStops, } from "../actions/animate-component";
|
|
8
8
|
/**
|
package/dist/core/local/index.js
CHANGED
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.local = exports.TimingFunction = exports.ComponentAnimationEffect = exports.animate = exports.DimensionalUnit = void 0;
|
|
4
4
|
const animate_component_1 = require("../actions/animate-component");
|
|
5
5
|
const write_text_to_clipboard_1 = require("../actions/write-text-to-clipboard");
|
|
6
|
-
var dimensional_unit_1 = require("@matreshka/
|
|
6
|
+
var dimensional_unit_1 = require("@matreshka/client-bff-protocol/enums/dimensional-unit");
|
|
7
7
|
Object.defineProperty(exports, "DimensionalUnit", { enumerable: true, get: function () { return dimensional_unit_1.DimensionalUnit; } });
|
|
8
8
|
var animate_component_2 = require("../actions/animate-component");
|
|
9
9
|
Object.defineProperty(exports, "animate", { enumerable: true, get: function () { return animate_component_2.animate; } });
|
package/dist/core/matreshka.js
CHANGED
|
@@ -34,8 +34,8 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
34
34
|
})();
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
36
|
exports.Matreshka = void 0;
|
|
37
|
-
const index_1 = require("@matreshka/
|
|
38
|
-
const handshake_message_1 = require("@matreshka/
|
|
37
|
+
const index_1 = require("@matreshka/client-bff-protocol/messages/bff-to-client/app/index");
|
|
38
|
+
const handshake_message_1 = require("@matreshka/client-bff-protocol/messages/client-to-bff/app/handshake-message");
|
|
39
39
|
const crypto = __importStar(require("crypto"));
|
|
40
40
|
const rxjs_1 = require("rxjs");
|
|
41
41
|
const client_1 = require("./client");
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ColorRole } from "@matreshka/
|
|
2
|
-
import { ColorToken } from "@matreshka/
|
|
3
|
-
import { AppFontsConfig } from "@matreshka/
|
|
1
|
+
import { ColorRole } from "@matreshka/client-bff-protocol/enums/color-role";
|
|
2
|
+
import { ColorToken } from "@matreshka/client-bff-protocol/types/color-token";
|
|
3
|
+
import { AppFontsConfig } from "@matreshka/client-bff-protocol/types/fonts";
|
|
4
4
|
export type ClientSettingsColors = {
|
|
5
5
|
/** Реестр определений токенов для handshake и резолва id в UI. */
|
|
6
6
|
registry: ColorToken[];
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { Condition as SerializedCondition } from "@matreshka/
|
|
2
|
-
import type { ServerComponentConfig } from "@matreshka/
|
|
1
|
+
import type { Condition as SerializedCondition } from "@matreshka/client-bff-protocol/types/condition";
|
|
2
|
+
import type { ServerComponentConfig } from "@matreshka/client-bff-protocol/types/server-component-config";
|
|
3
3
|
export type SerializedComponentRule<TOverrides extends Record<string, unknown> = Record<string, unknown>> = {
|
|
4
4
|
conditions: SerializedCondition[];
|
|
5
5
|
overrides: TOverrides;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { ColorRole } from "@matreshka/
|
|
2
|
-
import { ColorToken } from "@matreshka/
|
|
1
|
+
import { ColorRole } from "@matreshka/client-bff-protocol/enums/color-role";
|
|
2
|
+
import { ColorToken } from "@matreshka/client-bff-protocol/types/color-token";
|
|
3
3
|
export declare function resolvePartialColorsToIds(colors: Partial<Record<ColorRole, ColorToken>>): Partial<Record<ColorRole, string>>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { z } from "zod
|
|
1
|
+
import { z } from "zod";
|
|
2
2
|
export declare function zodDeepPick(schema: z.ZodTypeAny, propertyPath: string): z.ZodTypeAny;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.zodDeepPick = zodDeepPick;
|
|
4
|
-
const
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
5
|
function isZodObject(schema) {
|
|
6
|
-
return schema instanceof
|
|
6
|
+
return schema instanceof zod_1.z.ZodObject;
|
|
7
7
|
}
|
|
8
8
|
function isZodArray(schema) {
|
|
9
|
-
return schema instanceof
|
|
9
|
+
return schema instanceof zod_1.z.ZodArray;
|
|
10
10
|
}
|
|
11
11
|
function pickObject(schema, path) {
|
|
12
12
|
if (!isZodObject(schema))
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { Context } from "../context/context";
|
|
1
|
+
import type { Context } from "../context/context";
|
|
2
2
|
/**
|
|
3
|
-
* Заменяет плейсхолдеры вида
|
|
3
|
+
* Заменяет плейсхолдеры вида `@{ключ}` в строке значениями из объекта контекста.
|
|
4
4
|
*
|
|
5
|
-
* Поддерживает значения по умолчанию через `=` внутри плейсхолдера, например:
|
|
5
|
+
* Поддерживает значения по умолчанию через `=` внутри плейсхолдера, например: `@{name=Гость}`.
|
|
6
6
|
* Рекурсивно обрабатывает случаи, когда после замены появляются новые плейсхолдеры.
|
|
7
7
|
*
|
|
8
8
|
* @param str Строка с плейсхолдерами.
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.replaceContextKeys = replaceContextKeys;
|
|
4
|
-
const parse_context_path_1 = require("
|
|
4
|
+
const parse_context_path_1 = require("@matreshka/shared/utils/parse-context-path");
|
|
5
|
+
const replace_context_placeholders_1 = require("@matreshka/shared/utils/replace-context-placeholders");
|
|
5
6
|
/**
|
|
6
|
-
* Заменяет плейсхолдеры вида
|
|
7
|
+
* Заменяет плейсхолдеры вида `@{ключ}` в строке значениями из объекта контекста.
|
|
7
8
|
*
|
|
8
|
-
* Поддерживает значения по умолчанию через `=` внутри плейсхолдера, например:
|
|
9
|
+
* Поддерживает значения по умолчанию через `=` внутри плейсхолдера, например: `@{name=Гость}`.
|
|
9
10
|
* Рекурсивно обрабатывает случаи, когда после замены появляются новые плейсхолдеры.
|
|
10
11
|
*
|
|
11
12
|
* @param str Строка с плейсхолдерами.
|
|
@@ -13,11 +14,7 @@ const parse_context_path_1 = require("./parse-context-path");
|
|
|
13
14
|
* @returns Строка с заменёнными плейсхолдерами.
|
|
14
15
|
*/
|
|
15
16
|
function replaceContextKeys(str, resolveContext) {
|
|
16
|
-
|
|
17
|
-
contextKeys.forEach((rule) => {
|
|
18
|
-
const parts = rule.split("="); // Может быть значение по умолчанию, например {name=Иван}
|
|
19
|
-
const path = parts[0];
|
|
20
|
-
const defaultValue = parts[1] ?? "";
|
|
17
|
+
return (0, replace_context_placeholders_1.replaceContextPlaceholders)(str, (path) => {
|
|
21
18
|
const pathInfo = (0, parse_context_path_1.parseContextPath)(path);
|
|
22
19
|
const context = resolveContext(pathInfo.contextId);
|
|
23
20
|
if (!context) {
|
|
@@ -26,64 +23,6 @@ function replaceContextKeys(str, resolveContext) {
|
|
|
26
23
|
if (!context.inited()) {
|
|
27
24
|
throw new Error(`Context ${pathInfo.contextId} not initialized`);
|
|
28
25
|
}
|
|
29
|
-
|
|
30
|
-
str = replaceAll(str, `@{${path}}`, value ?? defaultValue);
|
|
26
|
+
return context.get(pathInfo.key);
|
|
31
27
|
});
|
|
32
|
-
const restContextKeys = findContextKeys(str);
|
|
33
|
-
if (restContextKeys.length) {
|
|
34
|
-
// После замены появились новые замены
|
|
35
|
-
return replaceContextKeys(str, resolveContext);
|
|
36
|
-
}
|
|
37
|
-
return str;
|
|
38
|
-
}
|
|
39
|
-
/**
|
|
40
|
-
* Находит все плейсхолдеры вида `@{ключ}` в строке, исключая уже обработанные.
|
|
41
|
-
*
|
|
42
|
-
* Плейсхолдеры с подстрокой `%%%` игнорируются, чтобы избежать повторной обработки.
|
|
43
|
-
*
|
|
44
|
-
* @param str Строка для анализа.
|
|
45
|
-
* @returns Массив уникальных ключей, найденных в строке.
|
|
46
|
-
*/
|
|
47
|
-
function findContextKeys(str) {
|
|
48
|
-
const result = new Set();
|
|
49
|
-
let start_pos, end_pos;
|
|
50
|
-
do {
|
|
51
|
-
end_pos = str.indexOf("}");
|
|
52
|
-
if (end_pos !== -1) {
|
|
53
|
-
start_pos = str.substring(0, end_pos).lastIndexOf("{");
|
|
54
|
-
if (start_pos !== -1) {
|
|
55
|
-
const contextKey = str.substring(start_pos + 1, end_pos);
|
|
56
|
-
if (contextKey.indexOf("%%%") === -1) {
|
|
57
|
-
result.add(contextKey);
|
|
58
|
-
str = replaceAll(str, `{${contextKey}}`, `%%%`);
|
|
59
|
-
}
|
|
60
|
-
else {
|
|
61
|
-
start_pos = -1;
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
} while (start_pos !== -1 && end_pos !== -1);
|
|
66
|
-
return [...result];
|
|
67
|
-
}
|
|
68
|
-
/**
|
|
69
|
-
* Заменяет все вхождения подстроки в строке на заданное значение.
|
|
70
|
-
*
|
|
71
|
-
* Использует регулярное выражение с экранированием.
|
|
72
|
-
*
|
|
73
|
-
* @param str Исходная строка.
|
|
74
|
-
* @param find Подстрока для поиска.
|
|
75
|
-
* @param replace Подстрока для замены.
|
|
76
|
-
* @returns Строка с произведённой заменой.
|
|
77
|
-
*/
|
|
78
|
-
function replaceAll(str, find, replace) {
|
|
79
|
-
return str.replace(new RegExp(escapeRegExp(find), "g"), replace);
|
|
80
|
-
}
|
|
81
|
-
/**
|
|
82
|
-
* Экранирует специальные символы в строке для безопасного использования в RegExp.
|
|
83
|
-
*
|
|
84
|
-
* @param string Строка, подготавливаемая к использованию в регулярном выражении.
|
|
85
|
-
* @returns Экранированная строка.
|
|
86
|
-
*/
|
|
87
|
-
function escapeRegExp(string) {
|
|
88
|
-
return string.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"); // $& means the whole matched string
|
|
89
28
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ColorRole } from "@matreshka/
|
|
2
|
-
import { ColorToken } from "@matreshka/
|
|
1
|
+
import { ColorRole } from "@matreshka/client-bff-protocol/enums/color-role";
|
|
2
|
+
import { ColorToken } from "@matreshka/client-bff-protocol/types/color-token";
|
|
3
3
|
import type { ClientSettingsColors } from "../types/client-settings";
|
|
4
4
|
export type HandshakeClientSettingsColors = {
|
|
5
5
|
registry: Record<string, ColorToken>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { Overlay as SharedOverlay } from "@matreshka/
|
|
2
|
-
import type { ServerComponentConfig } from "@matreshka/
|
|
1
|
+
import type { Overlay as SharedOverlay } from "@matreshka/client-bff-protocol/types/container-overlay";
|
|
2
|
+
import type { ServerComponentConfig } from "@matreshka/client-bff-protocol/types/server-component-config";
|
|
3
3
|
import type { Overlay } from "../../components/types/container-overlay";
|
|
4
4
|
import { type ComponentTreeNode } from "../types/component-tree-node";
|
|
5
5
|
export type SerializedComponentPayload = ServerComponentConfig;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AnyClientToBffMessage } from "@matreshka/
|
|
1
|
+
import { AnyClientToBffMessage } from "@matreshka/client-bff-protocol/messages/client-to-bff/client-to-bff-message";
|
|
2
2
|
import { Client } from "../client";
|
|
3
3
|
export type TargetedClientActionTerminal<T> = {
|
|
4
4
|
next: (value: T) => void;
|
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.createTargetedActionScope = createTargetedActionScope;
|
|
4
4
|
exports.startTargetedClientAction = startTargetedClientAction;
|
|
5
|
-
const action_completed_message_1 = require("@matreshka/
|
|
6
|
-
const error_message_1 = require("@matreshka/
|
|
7
|
-
const targeted_message_1 = require("@matreshka/
|
|
5
|
+
const action_completed_message_1 = require("@matreshka/client-bff-protocol/messages/client-to-bff/action-completed-message");
|
|
6
|
+
const error_message_1 = require("@matreshka/client-bff-protocol/messages/client-to-bff/error-message");
|
|
7
|
+
const targeted_message_1 = require("@matreshka/client-bff-protocol/messages/targeted-message");
|
|
8
8
|
const rxjs_1 = require("rxjs");
|
|
9
|
-
const
|
|
9
|
+
const zod_1 = require("zod");
|
|
10
10
|
const incoming_message_observer_1 = require("./incoming-message-observer");
|
|
11
|
-
const errorMessagePayloadSchema =
|
|
12
|
-
message:
|
|
11
|
+
const errorMessagePayloadSchema = zod_1.z.strictObject({
|
|
12
|
+
message: zod_1.z.string(),
|
|
13
13
|
});
|
|
14
14
|
function createTargetedActionScope(prefix) {
|
|
15
15
|
return prefix + crypto.randomUUID();
|
|
@@ -30,7 +30,8 @@ function startTargetedClientAction(client, config, terminal) {
|
|
|
30
30
|
teardown();
|
|
31
31
|
};
|
|
32
32
|
const subscription = client.incomingMessage$
|
|
33
|
-
.pipe((0, rxjs_1.filter)((unsafeMessage) =>
|
|
33
|
+
.pipe((0, rxjs_1.filter)((unsafeMessage) => unsafeMessage instanceof targeted_message_1.TargetedMessage &&
|
|
34
|
+
unsafeMessage.target === scope), (0, rxjs_1.take)(1))
|
|
34
35
|
.subscribe((0, incoming_message_observer_1.incomingMessageObserver)(client, (unsafeMessage) => {
|
|
35
36
|
if (unsafeMessage instanceof error_message_1.ErrorMessage) {
|
|
36
37
|
const messagePayload = errorMessagePayloadSchema.parse(unsafeMessage.payload);
|
|
@@ -1,29 +1,29 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.BrowserPlatform = void 0;
|
|
4
|
-
const browser_add_event_to_calendar_message_1 = require("@matreshka/
|
|
5
|
-
const browser_download_csv_content_message_1 = require("@matreshka/
|
|
6
|
-
const browser_download_file_message_1 = require("@matreshka/
|
|
7
|
-
const browser_get_geolocation_message_1 = require("@matreshka/
|
|
8
|
-
const browser_open_file_message_1 = require("@matreshka/
|
|
9
|
-
const browser_request_push_notifications_message_1 = require("@matreshka/
|
|
10
|
-
const browser_share_message_1 = require("@matreshka/
|
|
11
|
-
const platform_webauthn_create_credential_message_1 = require("@matreshka/
|
|
12
|
-
const platform_webauthn_get_credential_message_1 = require("@matreshka/
|
|
13
|
-
const browser_get_geolocation_success_message_1 = require("@matreshka/
|
|
14
|
-
const browser_request_push_notifications_action_granted_message_1 = require("@matreshka/
|
|
15
|
-
const platform_webauthn_create_credential_success_message_1 = require("@matreshka/
|
|
16
|
-
const platform_webauthn_get_credential_success_message_1 = require("@matreshka/
|
|
17
|
-
const
|
|
4
|
+
const browser_add_event_to_calendar_message_1 = require("@matreshka/client-bff-protocol/messages/bff-to-client/platforms/browser/browser-add-event-to-calendar-message");
|
|
5
|
+
const browser_download_csv_content_message_1 = require("@matreshka/client-bff-protocol/messages/bff-to-client/platforms/browser/browser-download-csv-content-message");
|
|
6
|
+
const browser_download_file_message_1 = require("@matreshka/client-bff-protocol/messages/bff-to-client/platforms/browser/browser-download-file-message");
|
|
7
|
+
const browser_get_geolocation_message_1 = require("@matreshka/client-bff-protocol/messages/bff-to-client/platforms/browser/browser-get-geolocation-message");
|
|
8
|
+
const browser_open_file_message_1 = require("@matreshka/client-bff-protocol/messages/bff-to-client/platforms/browser/browser-open-file-message");
|
|
9
|
+
const browser_request_push_notifications_message_1 = require("@matreshka/client-bff-protocol/messages/bff-to-client/platforms/browser/browser-request-push-notifications-message");
|
|
10
|
+
const browser_share_message_1 = require("@matreshka/client-bff-protocol/messages/bff-to-client/platforms/browser/browser-share-message");
|
|
11
|
+
const platform_webauthn_create_credential_message_1 = require("@matreshka/client-bff-protocol/messages/bff-to-client/platforms/platform-webauthn-create-credential-message");
|
|
12
|
+
const platform_webauthn_get_credential_message_1 = require("@matreshka/client-bff-protocol/messages/bff-to-client/platforms/platform-webauthn-get-credential-message");
|
|
13
|
+
const browser_get_geolocation_success_message_1 = require("@matreshka/client-bff-protocol/messages/client-to-bff/platforms/browser/browser-get-geolocation-success-message");
|
|
14
|
+
const browser_request_push_notifications_action_granted_message_1 = require("@matreshka/client-bff-protocol/messages/client-to-bff/platforms/browser/browser-request-push-notifications-action-granted-message");
|
|
15
|
+
const platform_webauthn_create_credential_success_message_1 = require("@matreshka/client-bff-protocol/messages/client-to-bff/platforms/platform-webauthn-create-credential-success-message");
|
|
16
|
+
const platform_webauthn_get_credential_success_message_1 = require("@matreshka/client-bff-protocol/messages/client-to-bff/platforms/platform-webauthn-get-credential-success-message");
|
|
17
|
+
const zod_1 = require("zod");
|
|
18
18
|
const targeted_client_platform_action_1 = require("./utils/targeted-client-platform-action");
|
|
19
19
|
const web_platform_1 = require("./web-platform");
|
|
20
|
-
const pushSubscriptionGrantedMessageSchema =
|
|
21
|
-
subscription:
|
|
22
|
-
endpoint:
|
|
23
|
-
expirationTime:
|
|
24
|
-
keys:
|
|
25
|
-
auth:
|
|
26
|
-
p256dh:
|
|
20
|
+
const pushSubscriptionGrantedMessageSchema = zod_1.z.strictObject({
|
|
21
|
+
subscription: zod_1.z.strictObject({
|
|
22
|
+
endpoint: zod_1.z.string(),
|
|
23
|
+
expirationTime: zod_1.z.number().nullable().optional(),
|
|
24
|
+
keys: zod_1.z.strictObject({
|
|
25
|
+
auth: zod_1.z.string(),
|
|
26
|
+
p256dh: zod_1.z.string(),
|
|
27
27
|
}),
|
|
28
28
|
}),
|
|
29
29
|
});
|
|
@@ -42,10 +42,10 @@ class BrowserPlatform extends web_platform_1.WebPlatform {
|
|
|
42
42
|
outgoingMessage: (scope) => new browser_get_geolocation_message_1.BrowserGetGeolocationMessage(scope),
|
|
43
43
|
parseSuccess: (unsafeMessage) => {
|
|
44
44
|
if (unsafeMessage instanceof browser_get_geolocation_success_message_1.BrowserGetGeolocationSuccessMessage) {
|
|
45
|
-
return
|
|
45
|
+
return zod_1.z
|
|
46
46
|
.strictObject({
|
|
47
|
-
latitude:
|
|
48
|
-
longitude:
|
|
47
|
+
latitude: zod_1.z.number(),
|
|
48
|
+
longitude: zod_1.z.number(),
|
|
49
49
|
})
|
|
50
50
|
.parse(unsafeMessage.payload);
|
|
51
51
|
}
|
|
@@ -159,10 +159,10 @@ class BrowserPlatform extends web_platform_1.WebPlatform {
|
|
|
159
159
|
}
|
|
160
160
|
}
|
|
161
161
|
exports.BrowserPlatform = BrowserPlatform;
|
|
162
|
-
const webAuthnJsonObjectSchema =
|
|
163
|
-
const webAuthnRegistrationResponseSchema =
|
|
162
|
+
const webAuthnJsonObjectSchema = zod_1.z.record(zod_1.z.string(), zod_1.z.unknown());
|
|
163
|
+
const webAuthnRegistrationResponseSchema = zod_1.z.strictObject({
|
|
164
164
|
credentialJSON: webAuthnJsonObjectSchema,
|
|
165
165
|
});
|
|
166
|
-
const webAuthnAuthenticationResponseSchema =
|
|
166
|
+
const webAuthnAuthenticationResponseSchema = zod_1.z.strictObject({
|
|
167
167
|
credentialJSON: webAuthnJsonObjectSchema,
|
|
168
168
|
});
|
|
@@ -4,17 +4,17 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.MaxMiniAppPlatform = void 0;
|
|
7
|
-
const max_mini_app_request_contact_message_1 = require("@matreshka/
|
|
8
|
-
const max_mini_app_request_contact_action_success_message_1 = require("@matreshka/
|
|
7
|
+
const max_mini_app_request_contact_message_1 = require("@matreshka/client-bff-protocol/messages/bff-to-client/platforms/max-mini-app/max-mini-app-request-contact-message");
|
|
8
|
+
const max_mini_app_request_contact_action_success_message_1 = require("@matreshka/client-bff-protocol/messages/client-to-bff/platforms/max-mini-app/max-mini-app-request-contact-action-success-message");
|
|
9
9
|
const crypto_1 = __importDefault(require("crypto"));
|
|
10
|
-
const
|
|
10
|
+
const zod_1 = require("zod");
|
|
11
11
|
const targeted_client_platform_action_1 = require("./utils/targeted-client-platform-action");
|
|
12
12
|
const web_platform_1 = require("./web-platform");
|
|
13
13
|
/**
|
|
14
14
|
* Входящее сообщение с данными пользователя после успешного запроса контакта.
|
|
15
15
|
*/
|
|
16
|
-
const requestContactSuccessMessageSchema =
|
|
17
|
-
phone:
|
|
16
|
+
const requestContactSuccessMessageSchema = zod_1.z.strictObject({
|
|
17
|
+
phone: zod_1.z.string(),
|
|
18
18
|
});
|
|
19
19
|
/**
|
|
20
20
|
* Платформа для Max Mini App.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { MobileBleService } from "@matreshka/
|
|
1
|
+
import type { MobileBleService } from "@matreshka/client-bff-protocol/types/mobile-ble-services";
|
|
2
2
|
import { Observable, Subject } from "rxjs";
|
|
3
|
-
import { z } from "zod
|
|
3
|
+
import { z } from "zod";
|
|
4
4
|
import { Client } from "../core";
|
|
5
5
|
import { ClientPlatform } from "./client-platform";
|
|
6
6
|
/**
|