@matreshka/bff 0.9.0 → 0.11.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/component.js +2 -2
- package/dist/components/enum/scroll-to-position.d.ts +1 -0
- package/dist/components/enum/scroll-to-position.js +5 -0
- package/dist/components/grid.d.ts +1 -1
- package/dist/components/index.d.ts +3 -2
- package/dist/components/index.js +5 -4
- package/dist/components/map.d.ts +1 -1
- package/dist/components/map.js +1 -1
- package/dist/components/outputs/image.d.ts +1 -1
- package/dist/components/outputs/text.js +1 -1
- package/dist/components/stack.d.ts +10 -4
- package/dist/components/stack.js +8 -2
- package/dist/core/client.d.ts +4 -4
- package/dist/core/client.js +7 -14
- package/dist/core/conditions/context-array-includes.d.ts +1 -1
- 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 +1 -1
- package/dist/core/conditions/context-value-equal.d.ts +1 -1
- package/dist/core/conditions/context-value-equal.js +1 -1
- package/dist/core/conditions/context-value-in.d.ts +1 -1
- package/dist/core/conditions/context-value-in.js +1 -1
- package/dist/core/conditions/context-value-not-equal.d.ts +1 -1
- package/dist/core/conditions/context-value-not-equal.js +1 -1
- package/dist/core/context/context.js +3 -1
- package/dist/core/types/component-instance.d.ts +2 -2
- package/dist/core/types/component-instance.js +1 -1
- package/dist/core/types/message.d.ts +2 -2
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/platforms/browser-platform.d.ts +21 -0
- package/dist/platforms/browser-platform.js +70 -2
- package/dist/platforms/max-mini-app-platform.js +2 -1
- package/dist/platforms/mobile-platform.js +9 -7
- package/dist/platforms/platform.js +2 -1
- package/dist/platforms/telegram-mini-app-platform.js +3 -2
- package/dist/webauthn/index.d.ts +2 -0
- package/dist/webauthn/index.js +8 -0
- package/dist/webauthn/stored-webauthn-credential.d.ts +14 -0
- package/dist/webauthn/stored-webauthn-credential.js +2 -0
- package/package.json +8 -2
|
@@ -321,9 +321,9 @@ class Component {
|
|
|
321
321
|
this.teardownClient(client);
|
|
322
322
|
}));
|
|
323
323
|
sub.add(client.incomingMessage$
|
|
324
|
-
.pipe((0, rxjs_1.filter)((message) => message instanceof component_interaction_message_1.ComponentInteractionMessage), (0, rxjs_1.filter)((message) => (0, shared_1.componentBaseId)(message.
|
|
324
|
+
.pipe((0, rxjs_1.filter)((message) => message instanceof component_interaction_message_1.ComponentInteractionMessage), (0, rxjs_1.filter)((message) => (0, shared_1.componentBaseId)(message.target) === this.id))
|
|
325
325
|
.subscribe((0, incoming_message_observer_1.incomingMessageObserver)(client, (message) => {
|
|
326
|
-
const instance = this.instances.find((x) => x.id === message.
|
|
326
|
+
const instance = this.instances.find((x) => x.id === message.target);
|
|
327
327
|
if (!instance) {
|
|
328
328
|
client.error$.next("Component interaction call, component instance not found");
|
|
329
329
|
return;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { ScrollToPosition } from "@matreshka/shared/enums/scroll-to-position";
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ScrollToPosition = void 0;
|
|
4
|
+
var scroll_to_position_1 = require("@matreshka/shared/enums/scroll-to-position");
|
|
5
|
+
Object.defineProperty(exports, "ScrollToPosition", { enumerable: true, get: function () { return scroll_to_position_1.ScrollToPosition; } });
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { GridColumnSize } from "@matreshka/shared/enums/grid-column-size";
|
|
2
2
|
import { GridTemplateColumns } from "@matreshka/shared/enums/grid-template-columns";
|
|
3
3
|
import { ServerComponentClass } from "@matreshka/shared/enums/server-component-class";
|
|
4
|
+
import { type FlexItemSpec } from "@matreshka/shared/types/flex-item";
|
|
4
5
|
import type { GridConfig } from "@matreshka/shared/types/grid-config";
|
|
5
6
|
import type { GridGap } from "@matreshka/shared/types/grid-gap";
|
|
6
|
-
import { type FlexItemSpec } from "@matreshka/shared/types/flex-item";
|
|
7
7
|
import { Componentable, ComponentTreeNode, StandaloneComponent } from "../core";
|
|
8
8
|
import { Component, ComponentInitConfig, ComponentProperties } from "./component";
|
|
9
9
|
import { ComponentSequence } from "./types/component-sequence";
|
|
@@ -6,6 +6,7 @@ export * from "./aliases/row";
|
|
|
6
6
|
export * from "./aliases/surface";
|
|
7
7
|
export * from "./enum/password-input-kind";
|
|
8
8
|
export * from "./enum/popover-position-area";
|
|
9
|
+
export * from "./enum/scroll-to-position";
|
|
9
10
|
export * from "./enum/text-input-kind";
|
|
10
11
|
export * from "./enum/textarea-resize";
|
|
11
12
|
export * from "./types/container-overlay";
|
|
@@ -31,13 +32,14 @@ export * from "./outputs/datetime";
|
|
|
31
32
|
export * from "./outputs/icon";
|
|
32
33
|
export * from "./outputs/iframe";
|
|
33
34
|
export * from "./outputs/image";
|
|
34
|
-
export * from "./outputs/vector";
|
|
35
35
|
export * from "./outputs/number";
|
|
36
36
|
export * from "./outputs/output-component";
|
|
37
37
|
export * from "./outputs/progress-bar";
|
|
38
38
|
export * from "./outputs/progress-spinner";
|
|
39
39
|
export * from "./outputs/qr-code";
|
|
40
40
|
export * from "./outputs/text";
|
|
41
|
+
export * from "./outputs/vector";
|
|
42
|
+
export { needsMore, scrollDistanceToEnd, } from "@matreshka/shared/utils/needs-more";
|
|
41
43
|
export * from "./board";
|
|
42
44
|
export * from "./boot";
|
|
43
45
|
export * from "./camera";
|
|
@@ -51,5 +53,4 @@ export * from "./line";
|
|
|
51
53
|
export * from "./map";
|
|
52
54
|
export * from "./popover";
|
|
53
55
|
export * from "./stack";
|
|
54
|
-
export { needsMore, scrollDistanceToEnd, } from "@matreshka/shared/utils/needs-more";
|
|
55
56
|
export { isStandaloneComponentLike } from "./utils/component-factory-shared";
|
package/dist/components/index.js
CHANGED
|
@@ -24,6 +24,7 @@ __exportStar(require("./aliases/row"), exports);
|
|
|
24
24
|
__exportStar(require("./aliases/surface"), exports);
|
|
25
25
|
__exportStar(require("./enum/password-input-kind"), exports);
|
|
26
26
|
__exportStar(require("./enum/popover-position-area"), exports);
|
|
27
|
+
__exportStar(require("./enum/scroll-to-position"), exports);
|
|
27
28
|
__exportStar(require("./enum/text-input-kind"), exports);
|
|
28
29
|
__exportStar(require("./enum/textarea-resize"), exports);
|
|
29
30
|
__exportStar(require("./types/container-overlay"), exports);
|
|
@@ -49,13 +50,16 @@ __exportStar(require("./outputs/datetime"), exports);
|
|
|
49
50
|
__exportStar(require("./outputs/icon"), exports);
|
|
50
51
|
__exportStar(require("./outputs/iframe"), exports);
|
|
51
52
|
__exportStar(require("./outputs/image"), exports);
|
|
52
|
-
__exportStar(require("./outputs/vector"), exports);
|
|
53
53
|
__exportStar(require("./outputs/number"), exports);
|
|
54
54
|
__exportStar(require("./outputs/output-component"), exports);
|
|
55
55
|
__exportStar(require("./outputs/progress-bar"), exports);
|
|
56
56
|
__exportStar(require("./outputs/progress-spinner"), exports);
|
|
57
57
|
__exportStar(require("./outputs/qr-code"), exports);
|
|
58
58
|
__exportStar(require("./outputs/text"), exports);
|
|
59
|
+
__exportStar(require("./outputs/vector"), exports);
|
|
60
|
+
var needs_more_1 = require("@matreshka/shared/utils/needs-more");
|
|
61
|
+
Object.defineProperty(exports, "needsMore", { enumerable: true, get: function () { return needs_more_1.needsMore; } });
|
|
62
|
+
Object.defineProperty(exports, "scrollDistanceToEnd", { enumerable: true, get: function () { return needs_more_1.scrollDistanceToEnd; } });
|
|
59
63
|
__exportStar(require("./board"), exports);
|
|
60
64
|
__exportStar(require("./boot"), exports);
|
|
61
65
|
__exportStar(require("./camera"), exports);
|
|
@@ -69,8 +73,5 @@ __exportStar(require("./line"), exports);
|
|
|
69
73
|
__exportStar(require("./map"), exports);
|
|
70
74
|
__exportStar(require("./popover"), exports);
|
|
71
75
|
__exportStar(require("./stack"), exports);
|
|
72
|
-
var needs_more_1 = require("@matreshka/shared/utils/needs-more");
|
|
73
|
-
Object.defineProperty(exports, "needsMore", { enumerable: true, get: function () { return needs_more_1.needsMore; } });
|
|
74
|
-
Object.defineProperty(exports, "scrollDistanceToEnd", { enumerable: true, get: function () { return needs_more_1.scrollDistanceToEnd; } });
|
|
75
76
|
var component_factory_shared_1 = require("./utils/component-factory-shared");
|
|
76
77
|
Object.defineProperty(exports, "isStandaloneComponentLike", { enumerable: true, get: function () { return component_factory_shared_1.isStandaloneComponentLike; } });
|
package/dist/components/map.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { MapMarkerHorizontalAnchor } from "@matreshka/shared/enums/map-marker-horizontal-anchor";
|
|
2
2
|
import { MapMarkerVerticalAnchor } from "@matreshka/shared/enums/map-marker-vertical-anchor";
|
|
3
3
|
import { ServerComponentClass } from "@matreshka/shared/enums/server-component-class";
|
|
4
|
+
import { type FlexItemSpec } from "@matreshka/shared/types/flex-item";
|
|
4
5
|
import type { MapConfig } from "@matreshka/shared/types/map-config";
|
|
5
6
|
import type { NestedItemBase } from "@matreshka/shared/types/nested-item-base";
|
|
6
|
-
import { type FlexItemSpec } from "@matreshka/shared/types/flex-item";
|
|
7
7
|
import { Componentable, ComponentInstance, ComponentTreeNode, StandaloneComponent } from "../core";
|
|
8
8
|
import { Component, ComponentInitConfig, ComponentProperties, ServerComponentAction } from "./component";
|
|
9
9
|
import type { ItemList } from "./item-list/item-list";
|
package/dist/components/map.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { RatioMode } from "@matreshka/shared/enums/ratio-mode";
|
|
2
2
|
import { ServerComponentClass } from "@matreshka/shared/enums/server-component-class";
|
|
3
|
-
import type { RadiusPx } from "@matreshka/shared/types/radius-px";
|
|
4
3
|
import { type FlexItemSpec } from "@matreshka/shared/types/flex-item";
|
|
4
|
+
import type { RadiusPx } from "@matreshka/shared/types/radius-px";
|
|
5
5
|
import { Componentable, ContextRef, StandaloneComponent } from "../../core";
|
|
6
6
|
import { ServerComponentAction } from "../component";
|
|
7
7
|
import { CompatibleOutputRef, OutputComponent, OutputInitConfig, OutputProperties } from "./output-component";
|
|
@@ -4,10 +4,10 @@ exports.Text = exports.TextOutputProcessor = exports.TextOutputAutolinkTarget =
|
|
|
4
4
|
exports.lineBreaks = lineBreaks;
|
|
5
5
|
exports.autolink = autolink;
|
|
6
6
|
exports.text = text;
|
|
7
|
+
const server_component_class_1 = require("@matreshka/shared/enums/server-component-class");
|
|
7
8
|
const text_output_autolink_scheme_1 = require("@matreshka/shared/enums/text-output-autolink-scheme");
|
|
8
9
|
const text_output_autolink_target_1 = require("@matreshka/shared/enums/text-output-autolink-target");
|
|
9
10
|
const text_output_processor_1 = require("@matreshka/shared/enums/text-output-processor");
|
|
10
|
-
const server_component_class_1 = require("@matreshka/shared/enums/server-component-class");
|
|
11
11
|
const core_1 = require("../../core");
|
|
12
12
|
const output_component_1 = require("./output-component");
|
|
13
13
|
var text_output_autolink_scheme_2 = require("@matreshka/shared/enums/text-output-autolink-scheme");
|
|
@@ -1,15 +1,16 @@
|
|
|
1
|
-
import { ComponentOutline } from "@matreshka/shared/enums/outline-type";
|
|
2
1
|
import { FlexWrap } from "@matreshka/shared/enums/flex-wrap";
|
|
2
|
+
import { ComponentOutline } from "@matreshka/shared/enums/outline-type";
|
|
3
3
|
import { Overflow } from "@matreshka/shared/enums/overflow";
|
|
4
4
|
import { SafeAreaSide } from "@matreshka/shared/enums/safe-area-side";
|
|
5
|
+
import { ScrollToPosition } from "@matreshka/shared/enums/scroll-to-position";
|
|
5
6
|
import { ServerComponentClass } from "@matreshka/shared/enums/server-component-class";
|
|
6
7
|
import { StackCrossAxisAlign, StackMainAxisAlign } from "@matreshka/shared/enums/stack-align";
|
|
7
8
|
import { StackDirection } from "@matreshka/shared/enums/stack-direction";
|
|
8
9
|
import type { ComponentScrollPayload } from "@matreshka/shared/messages/client-to-bff/components/component-scroll-message";
|
|
10
|
+
import { type FlexItemSpec } from "@matreshka/shared/types/flex-item";
|
|
9
11
|
import type { PaddingPx } from "@matreshka/shared/types/padding-px";
|
|
10
12
|
import type { RadiusPx } from "@matreshka/shared/types/radius-px";
|
|
11
13
|
import type { StackConfig } from "@matreshka/shared/types/stack-config";
|
|
12
|
-
import { type FlexItemSpec } from "@matreshka/shared/types/flex-item";
|
|
13
14
|
import { Componentable, ComponentInstance, ComponentTreeNode, MixedWithCallbacksArray, StandaloneComponent } from "../core";
|
|
14
15
|
import { Component, ComponentInitConfig, ComponentProperties, ServerComponentAction } from "./component";
|
|
15
16
|
import { Overlay } from "./types/container-overlay";
|
|
@@ -17,6 +18,7 @@ export { DimensionalUnit } from "@matreshka/shared/enums/dimensional-unit";
|
|
|
17
18
|
export { FlexWrap } from "@matreshka/shared/enums/flex-wrap";
|
|
18
19
|
export { Overflow } from "@matreshka/shared/enums/overflow";
|
|
19
20
|
export { SafeAreaSide } from "@matreshka/shared/enums/safe-area-side";
|
|
21
|
+
export { ScrollToPosition } from "@matreshka/shared/enums/scroll-to-position";
|
|
20
22
|
export { StackCrossAxisAlign, StackMainAxisAlign, } from "@matreshka/shared/enums/stack-align";
|
|
21
23
|
export { StackDirection } from "@matreshka/shared/enums/stack-direction";
|
|
22
24
|
export type { ComponentScrollPayload } from "@matreshka/shared/messages/client-to-bff/components/component-scroll-message";
|
|
@@ -150,9 +152,13 @@ export declare class Stack<InitConfigType extends StackInitConfig<any> = Default
|
|
|
150
152
|
/**
|
|
151
153
|
* Отправляет на клиент команду прокрутки контейнера до указанного значения.
|
|
152
154
|
*
|
|
153
|
-
*
|
|
155
|
+
* По направлению контейнера: при `direction: vertical` — `scrollTop`, при `horizontal` — `scrollLeft`.
|
|
156
|
+
*
|
|
157
|
+
* - {@link ScrollToPosition.Start} или другое неотрицательное `value` — от начала;
|
|
158
|
+
* - {@link ScrollToPosition.End} — в конец;
|
|
159
|
+
* - иное отрицательное `value` — отступ от конца (например `-16`).
|
|
154
160
|
*/
|
|
155
|
-
scrollTo(value: number, smooth?: boolean, instances?: ComponentInstance[]): this;
|
|
161
|
+
scrollTo(value: number | ScrollToPosition, smooth?: boolean, instances?: ComponentInstance[]): this;
|
|
156
162
|
protected serializeRuleOverrides(overrides: Partial<PropertiesType>): Record<string, unknown>;
|
|
157
163
|
serialize(instance?: ComponentInstance<this>): StackConfig;
|
|
158
164
|
}
|
package/dist/components/stack.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Stack = exports.StackDirection = exports.StackMainAxisAlign = exports.StackCrossAxisAlign = exports.SafeAreaSide = exports.Overflow = exports.FlexWrap = exports.DimensionalUnit = void 0;
|
|
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
5
|
const server_component_class_1 = require("@matreshka/shared/enums/server-component-class");
|
|
6
6
|
const component_scroll_to_message_1 = require("@matreshka/shared/messages/bff-to-client/components/component-scroll-to-message");
|
|
@@ -15,6 +15,8 @@ var overflow_1 = require("@matreshka/shared/enums/overflow");
|
|
|
15
15
|
Object.defineProperty(exports, "Overflow", { enumerable: true, get: function () { return overflow_1.Overflow; } });
|
|
16
16
|
var safe_area_side_1 = require("@matreshka/shared/enums/safe-area-side");
|
|
17
17
|
Object.defineProperty(exports, "SafeAreaSide", { enumerable: true, get: function () { return safe_area_side_1.SafeAreaSide; } });
|
|
18
|
+
var scroll_to_position_1 = require("@matreshka/shared/enums/scroll-to-position");
|
|
19
|
+
Object.defineProperty(exports, "ScrollToPosition", { enumerable: true, get: function () { return scroll_to_position_1.ScrollToPosition; } });
|
|
18
20
|
var stack_align_1 = require("@matreshka/shared/enums/stack-align");
|
|
19
21
|
Object.defineProperty(exports, "StackCrossAxisAlign", { enumerable: true, get: function () { return stack_align_1.StackCrossAxisAlign; } });
|
|
20
22
|
Object.defineProperty(exports, "StackMainAxisAlign", { enumerable: true, get: function () { return stack_align_1.StackMainAxisAlign; } });
|
|
@@ -95,7 +97,11 @@ class Stack extends component_1.Component {
|
|
|
95
97
|
/**
|
|
96
98
|
* Отправляет на клиент команду прокрутки контейнера до указанного значения.
|
|
97
99
|
*
|
|
98
|
-
*
|
|
100
|
+
* По направлению контейнера: при `direction: vertical` — `scrollTop`, при `horizontal` — `scrollLeft`.
|
|
101
|
+
*
|
|
102
|
+
* - {@link ScrollToPosition.Start} или другое неотрицательное `value` — от начала;
|
|
103
|
+
* - {@link ScrollToPosition.End} — в конец;
|
|
104
|
+
* - иное отрицательное `value` — отступ от конца (например `-16`).
|
|
99
105
|
*/
|
|
100
106
|
scrollTo(value, smooth = false, instances) {
|
|
101
107
|
if (instances) {
|
package/dist/core/client.d.ts
CHANGED
|
@@ -3,8 +3,8 @@ import { BrowserName } from "@matreshka/shared/enums/browser-name";
|
|
|
3
3
|
import { DeviceType } from "@matreshka/shared/enums/device-type";
|
|
4
4
|
import { OsName } from "@matreshka/shared/enums/os-name";
|
|
5
5
|
import { PlatformId } from "@matreshka/shared/enums/platform-id";
|
|
6
|
-
import { BffToClientMessage } from "@matreshka/shared/messages/bff-to-client/bff-to-client-message";
|
|
7
|
-
import {
|
|
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
8
|
import { ClientState } from "@matreshka/shared/types/client-state";
|
|
9
9
|
import { BehaviorSubject, Subject } from "rxjs";
|
|
10
10
|
import { z } from "zod/v4";
|
|
@@ -46,8 +46,8 @@ export declare const ClientStateSchema: z.ZodObject<{
|
|
|
46
46
|
}, z.core.$strict>;
|
|
47
47
|
}, z.core.$strict>;
|
|
48
48
|
export declare class Client {
|
|
49
|
-
incomingMessage$: Subject<
|
|
50
|
-
outcomingMessage$: Subject<
|
|
49
|
+
incomingMessage$: Subject<AnyClientToBffMessage>;
|
|
50
|
+
outcomingMessage$: Subject<AnyBffToClientMessage>;
|
|
51
51
|
ping$: BehaviorSubject<number | undefined>;
|
|
52
52
|
reconnect$: Subject<void>;
|
|
53
53
|
disconnect$: Subject<void>;
|
package/dist/core/client.js
CHANGED
|
@@ -147,20 +147,13 @@ class Client {
|
|
|
147
147
|
*/
|
|
148
148
|
newMessage(messageString) {
|
|
149
149
|
try {
|
|
150
|
-
const abstractMessageSchema = v4_1.z.
|
|
151
|
-
v4_1.z.
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
type: v4_1.z.string(),
|
|
158
|
-
payload: v4_1.z.unknown(),
|
|
159
|
-
scope: v4_1.z.string(),
|
|
160
|
-
id: v4_1.z.string(),
|
|
161
|
-
attempt: v4_1.z.number().int().positive(),
|
|
162
|
-
}),
|
|
163
|
-
]);
|
|
150
|
+
const abstractMessageSchema = v4_1.z.object({
|
|
151
|
+
type: v4_1.z.string(),
|
|
152
|
+
payload: v4_1.z.unknown().optional(),
|
|
153
|
+
target: v4_1.z.string().optional(),
|
|
154
|
+
id: v4_1.z.string().optional(),
|
|
155
|
+
attempt: v4_1.z.number().int().positive().optional(),
|
|
156
|
+
});
|
|
164
157
|
const message = abstractMessageSchema.parse(JSON.parse(messageString));
|
|
165
158
|
(0, client_context_1.runWithClient)(this, () => {
|
|
166
159
|
const nextMessage = this.reliableDelivery.handleIncoming((0, parse_client_to_bff_message_1.parseClientToBffMessage)(message));
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ContextRef, ContextRefValue } from "../context/context-ref";
|
|
2
|
-
import { UntypedConditionOperand } from "./condition-operand";
|
|
3
2
|
import { Condition } from "./condition";
|
|
3
|
+
import { UntypedConditionOperand } from "./condition-operand";
|
|
4
4
|
type ContextArrayValue = readonly unknown[] | unknown[];
|
|
5
5
|
type CompatibleArrayContextRef<R extends ContextRef<any, any>> = Extract<ContextRefValue<R>, ContextArrayValue> extends never ? never : R;
|
|
6
6
|
/**
|
|
@@ -4,8 +4,8 @@ exports.ContextArrayNotIncludes = exports.ContextArrayIncludes = void 0;
|
|
|
4
4
|
exports.contextArrayIncludes = contextArrayIncludes;
|
|
5
5
|
exports.contextArrayNotIncludes = contextArrayNotIncludes;
|
|
6
6
|
const condition_type_1 = require("@matreshka/shared/enums/condition-type");
|
|
7
|
-
const condition_operand_1 = require("./condition-operand");
|
|
8
7
|
const condition_1 = require("./condition");
|
|
8
|
+
const condition_operand_1 = require("./condition-operand");
|
|
9
9
|
/**
|
|
10
10
|
* Условие: в массиве из контекста есть элемент, у которого значение по
|
|
11
11
|
* `itemPath` равно операнду (литерал или `ContextRef`).
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ArrayLengthCompare } from "@matreshka/shared/enums/array-length-compare";
|
|
2
2
|
import { ContextRef, ContextRefValue } from "../context/context-ref";
|
|
3
|
-
import { ConditionLengthOperand } from "./condition-operand";
|
|
4
3
|
import { Condition } from "./condition";
|
|
4
|
+
import { ConditionLengthOperand } from "./condition-operand";
|
|
5
5
|
type ContextArrayValue = readonly unknown[] | unknown[];
|
|
6
6
|
type CompatibleArrayContextRef<R extends ContextRef<any, any>> = Extract<ContextRefValue<R>, ContextArrayValue> extends never ? never : R;
|
|
7
7
|
/**
|
|
@@ -10,8 +10,8 @@ exports.contextValueEmpty = contextValueEmpty;
|
|
|
10
10
|
exports.contextValueNotEmpty = contextValueNotEmpty;
|
|
11
11
|
const array_length_compare_1 = require("@matreshka/shared/enums/array-length-compare");
|
|
12
12
|
const condition_type_1 = require("@matreshka/shared/enums/condition-type");
|
|
13
|
-
const condition_operand_1 = require("./condition-operand");
|
|
14
13
|
const condition_1 = require("./condition");
|
|
14
|
+
const condition_operand_1 = require("./condition-operand");
|
|
15
15
|
/**
|
|
16
16
|
* Условие сравнения длины массива в контексте с операндом
|
|
17
17
|
* (число или значение по `ContextRef`).
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ContextRef } from "../context/context-ref";
|
|
2
|
-
import { ConditionOperand } from "./condition-operand";
|
|
3
2
|
import { Condition } from "./condition";
|
|
3
|
+
import { ConditionOperand } from "./condition-operand";
|
|
4
4
|
/**
|
|
5
5
|
* Условие: значение по `ref` строго равно операнду
|
|
6
6
|
* (литерал того же примитивного типа или значение по другой `ContextRef`).
|
|
@@ -3,8 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.ContextValueEqual = void 0;
|
|
4
4
|
exports.contextValueEqual = contextValueEqual;
|
|
5
5
|
const condition_type_1 = require("@matreshka/shared/enums/condition-type");
|
|
6
|
-
const condition_operand_1 = require("./condition-operand");
|
|
7
6
|
const condition_1 = require("./condition");
|
|
7
|
+
const condition_operand_1 = require("./condition-operand");
|
|
8
8
|
/**
|
|
9
9
|
* Условие: значение по `ref` строго равно операнду
|
|
10
10
|
* (литерал того же примитивного типа или значение по другой `ContextRef`).
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ContextRef } from "../context/context-ref";
|
|
2
|
-
import { ConditionOperand } from "./condition-operand";
|
|
3
2
|
import { ContextRefPrimitiveValue } from "../types/context-ref-primitive-value";
|
|
4
3
|
import { Condition } from "./condition";
|
|
4
|
+
import { ConditionOperand } from "./condition-operand";
|
|
5
5
|
type CompatiblePrimitiveContextRef<R extends ContextRef<any, any>> = ContextRefPrimitiveValue<R> extends never ? never : R;
|
|
6
6
|
/**
|
|
7
7
|
* Условие: значение по `ref` входит в список операндов
|
|
@@ -3,8 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.ContextValueIn = void 0;
|
|
4
4
|
exports.contextValueIn = contextValueIn;
|
|
5
5
|
const condition_type_1 = require("@matreshka/shared/enums/condition-type");
|
|
6
|
-
const condition_operand_1 = require("./condition-operand");
|
|
7
6
|
const condition_1 = require("./condition");
|
|
7
|
+
const condition_operand_1 = require("./condition-operand");
|
|
8
8
|
/**
|
|
9
9
|
* Условие: значение по `ref` входит в список операндов
|
|
10
10
|
* (каждый элемент — литерал или `ContextRef`).
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ContextRef } from "../context/context-ref";
|
|
2
|
-
import { ConditionOperand } from "./condition-operand";
|
|
3
2
|
import { Condition } from "./condition";
|
|
3
|
+
import { ConditionOperand } from "./condition-operand";
|
|
4
4
|
/**
|
|
5
5
|
* Условие: значение по `ref` не равно операнду
|
|
6
6
|
* (литерал того же примитивного типа или значение по другой `ContextRef`).
|
|
@@ -3,8 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.ContextValueNotEqual = void 0;
|
|
4
4
|
exports.contextValueNotEqual = contextValueNotEqual;
|
|
5
5
|
const condition_type_1 = require("@matreshka/shared/enums/condition-type");
|
|
6
|
-
const condition_operand_1 = require("./condition-operand");
|
|
7
6
|
const condition_1 = require("./condition");
|
|
7
|
+
const condition_operand_1 = require("./condition-operand");
|
|
8
8
|
/**
|
|
9
9
|
* Условие: значение по `ref` не равно операнду
|
|
10
10
|
* (литерал того же примитивного типа или значение по другой `ContextRef`).
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.Context = void 0;
|
|
4
4
|
const index_1 = require("@matreshka/shared/messages/bff-to-client/context/index");
|
|
5
5
|
const index_2 = require("@matreshka/shared/messages/client-to-bff/context/index");
|
|
6
|
+
const targeted_message_1 = require("@matreshka/shared/messages/targeted-message");
|
|
6
7
|
const fetch_from_object_1 = require("@matreshka/shared/utils/fetch-from-object");
|
|
7
8
|
const rxjs_1 = require("rxjs");
|
|
8
9
|
const v4_1 = require("zod/v4");
|
|
@@ -157,7 +158,8 @@ class Context {
|
|
|
157
158
|
}
|
|
158
159
|
}));
|
|
159
160
|
this.subscriptions.add(client.incomingMessage$
|
|
160
|
-
.pipe((0, rxjs_1.filter)((unsafeMessage) =>
|
|
161
|
+
.pipe((0, rxjs_1.filter)((unsafeMessage) => (0, targeted_message_1.isTargetedMessage)(unsafeMessage) &&
|
|
162
|
+
unsafeMessage.target === this.id))
|
|
161
163
|
.subscribe((0, incoming_message_observer_1.incomingMessageObserver)(client, (unsafeMessage) => {
|
|
162
164
|
if (this.destroyed) {
|
|
163
165
|
return;
|
|
@@ -6,14 +6,14 @@ import type { Componentable } from "./componentable";
|
|
|
6
6
|
* Один BFF-объект может быть сериализован несколько раз с разными id (`uuid-0`, `uuid-1`, …).
|
|
7
7
|
*/
|
|
8
8
|
export declare class ComponentInstance<ComponentType extends Componentable = Componentable> {
|
|
9
|
-
/** Id инстанса на клиенте (обычно `
|
|
9
|
+
/** Id инстанса на клиенте (обычно `target` входящего сообщения). */
|
|
10
10
|
readonly id: string;
|
|
11
11
|
readonly component: ComponentType;
|
|
12
12
|
private _client?;
|
|
13
13
|
private _entry?;
|
|
14
14
|
private _serialized;
|
|
15
15
|
constructor(
|
|
16
|
-
/** Id инстанса на клиенте (обычно `
|
|
16
|
+
/** Id инстанса на клиенте (обычно `target` входящего сообщения). */
|
|
17
17
|
id: string, component: ComponentType);
|
|
18
18
|
get client(): Client | undefined;
|
|
19
19
|
/** Entry-инстанс дерева, внутри которого сериализован этот компонент (`entry.component` — BFF entry). */
|
|
@@ -9,7 +9,7 @@ const entry_context_1 = require("../entry-context");
|
|
|
9
9
|
*/
|
|
10
10
|
class ComponentInstance {
|
|
11
11
|
constructor(
|
|
12
|
-
/** Id инстанса на клиенте (обычно `
|
|
12
|
+
/** Id инстанса на клиенте (обычно `target` входящего сообщения). */
|
|
13
13
|
id, component) {
|
|
14
14
|
this.id = id;
|
|
15
15
|
this.component = component;
|
|
@@ -6,10 +6,10 @@
|
|
|
6
6
|
*
|
|
7
7
|
* @property type Тип сообщения, служащий для идентификации действия.
|
|
8
8
|
* @property payload Полезная нагрузка сообщения.
|
|
9
|
-
* @property
|
|
9
|
+
* @property target Адрес получателя (instance id, context id, correlation key).
|
|
10
10
|
*/
|
|
11
11
|
export type Message<TYPE = string, PAYLOAD = unknown> = {
|
|
12
12
|
type: TYPE;
|
|
13
13
|
payload?: PAYLOAD;
|
|
14
|
-
|
|
14
|
+
target?: string;
|
|
15
15
|
};
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { AuthenticationResponseJSON, PublicKeyCredentialCreationOptionsJSON, PublicKeyCredentialRequestOptionsJSON, RegistrationResponseJSON } from "@simplewebauthn/types";
|
|
1
2
|
import { WebPlatform } from "./web-platform";
|
|
2
3
|
/**
|
|
3
4
|
* Платформа для браузерной версии клиента.
|
|
@@ -76,4 +77,24 @@ export declare class BrowserPlatform extends WebPlatform {
|
|
|
76
77
|
}) => void;
|
|
77
78
|
onError?: (text: string) => void;
|
|
78
79
|
}): void;
|
|
80
|
+
/**
|
|
81
|
+
* Регистрация WebAuthn credential (passkey / security key) в браузерном клиенте.
|
|
82
|
+
*
|
|
83
|
+
* @remarks Только `BrowserPlatform` / `PwaPlatform`. Mobile — не поддерживается.
|
|
84
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/Web_Authentication_API
|
|
85
|
+
*/
|
|
86
|
+
createWebAuthnCredential(config: {
|
|
87
|
+
optionsJSON: PublicKeyCredentialCreationOptionsJSON;
|
|
88
|
+
onSuccess: (credentialJSON: RegistrationResponseJSON) => void;
|
|
89
|
+
onError?: (text: string) => void;
|
|
90
|
+
}): void;
|
|
91
|
+
/**
|
|
92
|
+
* Аутентификация через WebAuthn credential в браузерном клиенте.
|
|
93
|
+
*/
|
|
94
|
+
getWebAuthnCredential(config: {
|
|
95
|
+
optionsJSON: PublicKeyCredentialRequestOptionsJSON;
|
|
96
|
+
onSuccess: (credentialJSON: AuthenticationResponseJSON) => void;
|
|
97
|
+
onError?: (text: string) => void;
|
|
98
|
+
}): void;
|
|
99
|
+
private runWebAuthnPlatformAction;
|
|
79
100
|
}
|
|
@@ -8,9 +8,14 @@ const browser_get_geolocation_message_1 = require("@matreshka/shared/messages/bf
|
|
|
8
8
|
const browser_open_file_message_1 = require("@matreshka/shared/messages/bff-to-client/platforms/browser/browser-open-file-message");
|
|
9
9
|
const browser_request_push_notifications_message_1 = require("@matreshka/shared/messages/bff-to-client/platforms/browser/browser-request-push-notifications-message");
|
|
10
10
|
const browser_share_message_1 = require("@matreshka/shared/messages/bff-to-client/platforms/browser/browser-share-message");
|
|
11
|
+
const platform_webauthn_create_credential_message_1 = require("@matreshka/shared/messages/bff-to-client/platforms/platform-webauthn-create-credential-message");
|
|
12
|
+
const platform_webauthn_get_credential_message_1 = require("@matreshka/shared/messages/bff-to-client/platforms/platform-webauthn-get-credential-message");
|
|
11
13
|
const error_message_1 = require("@matreshka/shared/messages/client-to-bff/error-message");
|
|
12
14
|
const browser_get_geolocation_success_message_1 = require("@matreshka/shared/messages/client-to-bff/platforms/browser/browser-get-geolocation-success-message");
|
|
13
15
|
const browser_request_push_notifications_action_granted_message_1 = require("@matreshka/shared/messages/client-to-bff/platforms/browser/browser-request-push-notifications-action-granted-message");
|
|
16
|
+
const platform_webauthn_create_credential_success_message_1 = require("@matreshka/shared/messages/client-to-bff/platforms/platform-webauthn-create-credential-success-message");
|
|
17
|
+
const platform_webauthn_get_credential_success_message_1 = require("@matreshka/shared/messages/client-to-bff/platforms/platform-webauthn-get-credential-success-message");
|
|
18
|
+
const targeted_message_1 = require("@matreshka/shared/messages/targeted-message");
|
|
14
19
|
const rxjs_1 = require("rxjs");
|
|
15
20
|
const v4_1 = require("zod/v4");
|
|
16
21
|
const incoming_message_observer_1 = require("../core/utils/incoming-message-observer");
|
|
@@ -42,7 +47,7 @@ class BrowserPlatform extends web_platform_1.WebPlatform {
|
|
|
42
47
|
getGeolocation(config) {
|
|
43
48
|
const scope = "platform-action-" + crypto.randomUUID();
|
|
44
49
|
const subscription = this.client.incomingMessage$
|
|
45
|
-
.pipe((0, rxjs_1.filter)((unsafeMessage) => unsafeMessage.
|
|
50
|
+
.pipe((0, rxjs_1.filter)((unsafeMessage) => (0, targeted_message_1.isTargetedMessage)(unsafeMessage) && unsafeMessage.target === scope))
|
|
46
51
|
.subscribe((0, incoming_message_observer_1.incomingMessageObserver)(this.client, (unsafeMessage) => {
|
|
47
52
|
subscription.unsubscribe();
|
|
48
53
|
if (unsafeMessage instanceof browser_get_geolocation_success_message_1.BrowserGetGeolocationSuccessMessage) {
|
|
@@ -119,7 +124,7 @@ class BrowserPlatform extends web_platform_1.WebPlatform {
|
|
|
119
124
|
registerPushNotifications(config) {
|
|
120
125
|
const scope = "platform-action-" + crypto.randomUUID();
|
|
121
126
|
const subscription = this.client.incomingMessage$
|
|
122
|
-
.pipe((0, rxjs_1.filter)((unsafeMessage) => unsafeMessage.
|
|
127
|
+
.pipe((0, rxjs_1.filter)((unsafeMessage) => (0, targeted_message_1.isTargetedMessage)(unsafeMessage) && unsafeMessage.target === scope))
|
|
123
128
|
.subscribe((0, incoming_message_observer_1.incomingMessageObserver)(this.client, (unsafeMessage) => {
|
|
124
129
|
subscription.unsubscribe();
|
|
125
130
|
if (unsafeMessage instanceof
|
|
@@ -139,5 +144,68 @@ class BrowserPlatform extends web_platform_1.WebPlatform {
|
|
|
139
144
|
publicKey: config.publicKey,
|
|
140
145
|
}));
|
|
141
146
|
}
|
|
147
|
+
/**
|
|
148
|
+
* Регистрация WebAuthn credential (passkey / security key) в браузерном клиенте.
|
|
149
|
+
*
|
|
150
|
+
* @remarks Только `BrowserPlatform` / `PwaPlatform`. Mobile — не поддерживается.
|
|
151
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/Web_Authentication_API
|
|
152
|
+
*/
|
|
153
|
+
createWebAuthnCredential(config) {
|
|
154
|
+
this.runWebAuthnPlatformAction({
|
|
155
|
+
target: "platform-action-" + crypto.randomUUID(),
|
|
156
|
+
successMessageType: platform_webauthn_create_credential_success_message_1.PlatformWebAuthnCreateCredentialSuccessMessage,
|
|
157
|
+
outgoingMessage: (target) => new platform_webauthn_create_credential_message_1.PlatformWebAuthnCreateCredentialMessage(target, {
|
|
158
|
+
optionsJSON: config.optionsJSON,
|
|
159
|
+
}),
|
|
160
|
+
parseSuccessPayload: (payload) => webAuthnRegistrationResponseSchema.parse(payload),
|
|
161
|
+
onSuccess: (payload) => config.onSuccess(payload.credentialJSON),
|
|
162
|
+
onError: config.onError,
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
/**
|
|
166
|
+
* Аутентификация через WebAuthn credential в браузерном клиенте.
|
|
167
|
+
*/
|
|
168
|
+
getWebAuthnCredential(config) {
|
|
169
|
+
this.runWebAuthnPlatformAction({
|
|
170
|
+
target: "platform-action-" + crypto.randomUUID(),
|
|
171
|
+
successMessageType: platform_webauthn_get_credential_success_message_1.PlatformWebAuthnGetCredentialSuccessMessage,
|
|
172
|
+
outgoingMessage: (target) => new platform_webauthn_get_credential_message_1.PlatformWebAuthnGetCredentialMessage(target, {
|
|
173
|
+
optionsJSON: config.optionsJSON,
|
|
174
|
+
}),
|
|
175
|
+
parseSuccessPayload: (payload) => webAuthnAuthenticationResponseSchema.parse(payload),
|
|
176
|
+
onSuccess: (payload) => config.onSuccess(payload.credentialJSON),
|
|
177
|
+
onError: config.onError,
|
|
178
|
+
});
|
|
179
|
+
}
|
|
180
|
+
runWebAuthnPlatformAction(config) {
|
|
181
|
+
const errorPayloadSchema = v4_1.z.strictObject({
|
|
182
|
+
message: v4_1.z.string(),
|
|
183
|
+
});
|
|
184
|
+
const subscription = this.client.incomingMessage$
|
|
185
|
+
.pipe((0, rxjs_1.filter)((unsafeMessage) => (0, targeted_message_1.isTargetedMessage)(unsafeMessage) &&
|
|
186
|
+
unsafeMessage.target === config.target))
|
|
187
|
+
.subscribe((0, incoming_message_observer_1.incomingMessageObserver)(this.client, (unsafeMessage) => {
|
|
188
|
+
subscription.unsubscribe();
|
|
189
|
+
if (unsafeMessage instanceof config.successMessageType) {
|
|
190
|
+
const payload = config.parseSuccessPayload(unsafeMessage.payload);
|
|
191
|
+
config.onSuccess(payload);
|
|
192
|
+
return;
|
|
193
|
+
}
|
|
194
|
+
if (unsafeMessage instanceof error_message_1.ErrorMessage) {
|
|
195
|
+
const payload = errorPayloadSchema.parse(unsafeMessage.payload);
|
|
196
|
+
if (typeof config.onError === "function") {
|
|
197
|
+
config.onError(payload.message);
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
}));
|
|
201
|
+
this.client.outcomingMessage$.next(config.outgoingMessage(config.target));
|
|
202
|
+
}
|
|
142
203
|
}
|
|
143
204
|
exports.BrowserPlatform = BrowserPlatform;
|
|
205
|
+
const webAuthnJsonObjectSchema = v4_1.z.record(v4_1.z.string(), v4_1.z.unknown());
|
|
206
|
+
const webAuthnRegistrationResponseSchema = v4_1.z.strictObject({
|
|
207
|
+
credentialJSON: webAuthnJsonObjectSchema,
|
|
208
|
+
});
|
|
209
|
+
const webAuthnAuthenticationResponseSchema = v4_1.z.strictObject({
|
|
210
|
+
credentialJSON: webAuthnJsonObjectSchema,
|
|
211
|
+
});
|
|
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.MaxMiniAppPlatform = void 0;
|
|
7
7
|
const max_mini_app_request_contact_message_1 = require("@matreshka/shared/messages/bff-to-client/platforms/max-mini-app/max-mini-app-request-contact-message");
|
|
8
8
|
const max_mini_app_request_contact_action_success_message_1 = require("@matreshka/shared/messages/client-to-bff/platforms/max-mini-app/max-mini-app-request-contact-action-success-message");
|
|
9
|
+
const targeted_message_1 = require("@matreshka/shared/messages/targeted-message");
|
|
9
10
|
const crypto_1 = __importDefault(require("crypto"));
|
|
10
11
|
const rxjs_1 = require("rxjs");
|
|
11
12
|
const v4_1 = require("zod/v4");
|
|
@@ -29,7 +30,7 @@ class MaxMiniAppPlatform extends web_platform_1.WebPlatform {
|
|
|
29
30
|
requestContact(config) {
|
|
30
31
|
const scope = "platform-action-" + crypto_1.default.randomUUID();
|
|
31
32
|
const subscription = this.client.incomingMessage$
|
|
32
|
-
.pipe((0, rxjs_1.filter)((unsafeMessage) => unsafeMessage.
|
|
33
|
+
.pipe((0, rxjs_1.filter)((unsafeMessage) => (0, targeted_message_1.isTargetedMessage)(unsafeMessage) && unsafeMessage.target === scope))
|
|
33
34
|
.subscribe((0, incoming_message_observer_1.incomingMessageObserver)(this.client, (unsafeMessage) => {
|
|
34
35
|
subscription.unsubscribe();
|
|
35
36
|
if (unsafeMessage instanceof
|
|
@@ -22,6 +22,7 @@ const mobile_ble_services_message_1 = require("@matreshka/shared/messages/client
|
|
|
22
22
|
const mobile_ble_value_message_1 = require("@matreshka/shared/messages/client-to-bff/platforms/mobile/mobile-ble-value-message");
|
|
23
23
|
const mobile_get_geolocation_success_message_1 = require("@matreshka/shared/messages/client-to-bff/platforms/mobile/mobile-get-geolocation-success-message");
|
|
24
24
|
const mobile_request_push_notifications_action_granted_message_1 = require("@matreshka/shared/messages/client-to-bff/platforms/mobile/mobile-request-push-notifications-action-granted-message");
|
|
25
|
+
const targeted_message_1 = require("@matreshka/shared/messages/targeted-message");
|
|
25
26
|
const rxjs_1 = require("rxjs");
|
|
26
27
|
const v4_1 = require("zod/v4");
|
|
27
28
|
const incoming_message_observer_1 = require("../core/utils/incoming-message-observer");
|
|
@@ -107,7 +108,7 @@ class MobilePlatform extends client_platform_1.ClientPlatform {
|
|
|
107
108
|
getGeolocation(config) {
|
|
108
109
|
const scope = "platform-action-" + crypto.randomUUID();
|
|
109
110
|
const subscription = this.client.incomingMessage$
|
|
110
|
-
.pipe((0, rxjs_1.filter)((unsafeMessage) => unsafeMessage.
|
|
111
|
+
.pipe((0, rxjs_1.filter)((unsafeMessage) => (0, targeted_message_1.isTargetedMessage)(unsafeMessage) && unsafeMessage.target === scope))
|
|
111
112
|
.subscribe((0, incoming_message_observer_1.incomingMessageObserver)(this.client, (unsafeMessage) => {
|
|
112
113
|
subscription.unsubscribe();
|
|
113
114
|
if (unsafeMessage instanceof mobile_get_geolocation_success_message_1.MobileGetGeolocationSuccessMessage) {
|
|
@@ -137,7 +138,7 @@ class MobilePlatform extends client_platform_1.ClientPlatform {
|
|
|
137
138
|
registerPushNotifications(config) {
|
|
138
139
|
const scope = "platform-action-" + crypto.randomUUID();
|
|
139
140
|
const subscription = this.client.incomingMessage$
|
|
140
|
-
.pipe((0, rxjs_1.filter)((unsafeMessage) => unsafeMessage.
|
|
141
|
+
.pipe((0, rxjs_1.filter)((unsafeMessage) => (0, targeted_message_1.isTargetedMessage)(unsafeMessage) && unsafeMessage.target === scope))
|
|
141
142
|
.subscribe((0, incoming_message_observer_1.incomingMessageObserver)(this.client, (unsafeMessage) => {
|
|
142
143
|
subscription.unsubscribe();
|
|
143
144
|
if (unsafeMessage instanceof
|
|
@@ -160,7 +161,7 @@ class MobilePlatform extends client_platform_1.ClientPlatform {
|
|
|
160
161
|
requestBLEScan(config) {
|
|
161
162
|
const scope = "platform-action-" + crypto.randomUUID();
|
|
162
163
|
const subscription = this.client.incomingMessage$
|
|
163
|
-
.pipe((0, rxjs_1.filter)((unsafeMessage) => unsafeMessage.
|
|
164
|
+
.pipe((0, rxjs_1.filter)((unsafeMessage) => (0, targeted_message_1.isTargetedMessage)(unsafeMessage) && unsafeMessage.target === scope))
|
|
164
165
|
.subscribe((0, incoming_message_observer_1.incomingMessageObserver)(this.client, (unsafeMessage) => {
|
|
165
166
|
if (unsafeMessage instanceof mobile_ble_receive_message_1.MobileBleReceiveMessage) {
|
|
166
167
|
const messagePayload = bleScanResultSchema.parse(unsafeMessage.payload);
|
|
@@ -198,7 +199,8 @@ class BLEDevice {
|
|
|
198
199
|
this.error$ = new rxjs_1.Subject();
|
|
199
200
|
this.disconnect$ = new rxjs_1.Subject();
|
|
200
201
|
this.client.incomingMessage$
|
|
201
|
-
.pipe((0, rxjs_1.filter)((unsafeMessage) =>
|
|
202
|
+
.pipe((0, rxjs_1.filter)((unsafeMessage) => (0, targeted_message_1.isTargetedMessage)(unsafeMessage) &&
|
|
203
|
+
unsafeMessage.target === this.scope), (0, rxjs_1.takeUntil)(this.disconnect$))
|
|
202
204
|
.subscribe((0, incoming_message_observer_1.incomingMessageObserver)(this.client, (unsafeMessage) => {
|
|
203
205
|
if (unsafeMessage instanceof mobile_ble_connect_message_1.MobileBleConnectMessage) {
|
|
204
206
|
this.connect$.next();
|
|
@@ -223,7 +225,7 @@ class BLEDevice {
|
|
|
223
225
|
read(serviceId, characteristicId, config) {
|
|
224
226
|
const scope = "platform-action-" + crypto.randomUUID();
|
|
225
227
|
const subscription = this.client.incomingMessage$
|
|
226
|
-
.pipe((0, rxjs_1.filter)((unsafeMessage) => unsafeMessage.
|
|
228
|
+
.pipe((0, rxjs_1.filter)((unsafeMessage) => (0, targeted_message_1.isTargetedMessage)(unsafeMessage) && unsafeMessage.target === scope), (0, rxjs_1.takeUntil)(this.disconnect$))
|
|
227
229
|
.subscribe((0, incoming_message_observer_1.incomingMessageObserver)(this.client, (unsafeMessage) => {
|
|
228
230
|
if (unsafeMessage instanceof mobile_ble_value_message_1.MobileBleValueMessage) {
|
|
229
231
|
const payload = v4_1.z
|
|
@@ -258,7 +260,7 @@ class BLEDevice {
|
|
|
258
260
|
getServices(config) {
|
|
259
261
|
const scope = "platform-action-" + crypto.randomUUID();
|
|
260
262
|
const subscription = this.client.incomingMessage$
|
|
261
|
-
.pipe((0, rxjs_1.filter)((unsafeMessage) => unsafeMessage.
|
|
263
|
+
.pipe((0, rxjs_1.filter)((unsafeMessage) => (0, targeted_message_1.isTargetedMessage)(unsafeMessage) && unsafeMessage.target === scope), (0, rxjs_1.takeUntil)(this.disconnect$))
|
|
262
264
|
.subscribe((0, incoming_message_observer_1.incomingMessageObserver)(this.client, (unsafeMessage) => {
|
|
263
265
|
if (unsafeMessage instanceof mobile_ble_services_message_1.MobileBleServicesMessage) {
|
|
264
266
|
const payload = v4_1.z
|
|
@@ -287,7 +289,7 @@ class BLEDevice {
|
|
|
287
289
|
discoverServices(config) {
|
|
288
290
|
const scope = "platform-action-" + crypto.randomUUID();
|
|
289
291
|
const subscription = this.client.incomingMessage$
|
|
290
|
-
.pipe((0, rxjs_1.filter)((unsafeMessage) => unsafeMessage.
|
|
292
|
+
.pipe((0, rxjs_1.filter)((unsafeMessage) => (0, targeted_message_1.isTargetedMessage)(unsafeMessage) && unsafeMessage.target === scope), (0, rxjs_1.takeUntil)(this.disconnect$))
|
|
291
293
|
.subscribe((0, incoming_message_observer_1.incomingMessageObserver)(this.client, (unsafeMessage) => {
|
|
292
294
|
if (unsafeMessage instanceof mobile_ble_services_message_1.MobileBleServicesMessage) {
|
|
293
295
|
const payload = v4_1.z
|
|
@@ -12,6 +12,7 @@ const platform_set_overlays_message_1 = require("@matreshka/shared/messages/bff-
|
|
|
12
12
|
const platform_show_native_picker_message_1 = require("@matreshka/shared/messages/bff-to-client/platforms/platform-show-native-picker-message");
|
|
13
13
|
const error_message_1 = require("@matreshka/shared/messages/client-to-bff/error-message");
|
|
14
14
|
const platform_enumerate_devices_success_message_1 = require("@matreshka/shared/messages/client-to-bff/platforms/platform-enumerate-devices-success-message");
|
|
15
|
+
const targeted_message_1 = require("@matreshka/shared/messages/targeted-message");
|
|
15
16
|
const rxjs_1 = require("rxjs");
|
|
16
17
|
const v4_1 = require("zod/v4");
|
|
17
18
|
const core_1 = require("../core");
|
|
@@ -161,7 +162,7 @@ class Platform {
|
|
|
161
162
|
message: v4_1.z.string(),
|
|
162
163
|
});
|
|
163
164
|
const subscription = this.client.incomingMessage$
|
|
164
|
-
.pipe((0, rxjs_1.filter)((unsafeMessage) => unsafeMessage.
|
|
165
|
+
.pipe((0, rxjs_1.filter)((unsafeMessage) => (0, targeted_message_1.isTargetedMessage)(unsafeMessage) && unsafeMessage.target === scope))
|
|
165
166
|
.subscribe((0, incoming_message_observer_1.incomingMessageObserver)(this.client, (unsafeMessage) => {
|
|
166
167
|
subscription.unsubscribe();
|
|
167
168
|
if (unsafeMessage instanceof platform_enumerate_devices_success_message_1.PlatformEnumerateDevicesSuccessMessage) {
|
|
@@ -12,6 +12,7 @@ const error_message_1 = require("@matreshka/shared/messages/client-to-bff/error-
|
|
|
12
12
|
const telegram_mini_app_get_geolocation_success_message_1 = require("@matreshka/shared/messages/client-to-bff/platforms/telegram-mini-app/telegram-mini-app-get-geolocation-success-message");
|
|
13
13
|
const telegram_mini_app_request_contact_action_cancel_message_1 = require("@matreshka/shared/messages/client-to-bff/platforms/telegram-mini-app/telegram-mini-app-request-contact-action-cancel-message");
|
|
14
14
|
const telegram_mini_app_request_contact_action_success_message_1 = require("@matreshka/shared/messages/client-to-bff/platforms/telegram-mini-app/telegram-mini-app-request-contact-action-success-message");
|
|
15
|
+
const targeted_message_1 = require("@matreshka/shared/messages/targeted-message");
|
|
15
16
|
const crypto_1 = __importDefault(require("crypto"));
|
|
16
17
|
const rxjs_1 = require("rxjs");
|
|
17
18
|
const v4_1 = require("zod/v4");
|
|
@@ -103,7 +104,7 @@ class TelegramMiniAppPlatform extends web_platform_1.WebPlatform {
|
|
|
103
104
|
getGeolocation(config) {
|
|
104
105
|
const scope = "platform-action-" + crypto_1.default.randomUUID();
|
|
105
106
|
const subscription = this.client.incomingMessage$
|
|
106
|
-
.pipe((0, rxjs_1.filter)((unsafeMessage) => unsafeMessage.
|
|
107
|
+
.pipe((0, rxjs_1.filter)((unsafeMessage) => (0, targeted_message_1.isTargetedMessage)(unsafeMessage) && unsafeMessage.target === scope))
|
|
107
108
|
.subscribe((0, incoming_message_observer_1.incomingMessageObserver)(this.client, (unsafeMessage) => {
|
|
108
109
|
subscription.unsubscribe();
|
|
109
110
|
if (unsafeMessage instanceof telegram_mini_app_get_geolocation_success_message_1.TelegramMiniAppGetGeolocationSuccessMessage) {
|
|
@@ -144,7 +145,7 @@ class TelegramMiniAppPlatform extends web_platform_1.WebPlatform {
|
|
|
144
145
|
requestContact(config) {
|
|
145
146
|
const scope = "platform-action-" + crypto_1.default.randomUUID();
|
|
146
147
|
const subscription = this.client.incomingMessage$
|
|
147
|
-
.pipe((0, rxjs_1.filter)((unsafeMessage) => unsafeMessage.
|
|
148
|
+
.pipe((0, rxjs_1.filter)((unsafeMessage) => (0, targeted_message_1.isTargetedMessage)(unsafeMessage) && unsafeMessage.target === scope))
|
|
148
149
|
.subscribe((0, incoming_message_observer_1.incomingMessageObserver)(this.client, (unsafeMessage) => {
|
|
149
150
|
subscription.unsubscribe();
|
|
150
151
|
if (unsafeMessage instanceof
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.verifyRegistrationResponse = exports.verifyAuthenticationResponse = exports.generateRegistrationOptions = exports.generateAuthenticationOptions = void 0;
|
|
4
|
+
var server_1 = require("@simplewebauthn/server");
|
|
5
|
+
Object.defineProperty(exports, "generateAuthenticationOptions", { enumerable: true, get: function () { return server_1.generateAuthenticationOptions; } });
|
|
6
|
+
Object.defineProperty(exports, "generateRegistrationOptions", { enumerable: true, get: function () { return server_1.generateRegistrationOptions; } });
|
|
7
|
+
Object.defineProperty(exports, "verifyAuthenticationResponse", { enumerable: true, get: function () { return server_1.verifyAuthenticationResponse; } });
|
|
8
|
+
Object.defineProperty(exports, "verifyRegistrationResponse", { enumerable: true, get: function () { return server_1.verifyRegistrationResponse; } });
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Минимальная запись WebAuthn credential для хранения в БД приложения.
|
|
3
|
+
*
|
|
4
|
+
* @see https://simplewebauthn.dev/docs/packages/server#2-post-registration-responsibilities
|
|
5
|
+
*/
|
|
6
|
+
export type StoredWebAuthnCredential = {
|
|
7
|
+
credentialID: string;
|
|
8
|
+
credentialPublicKey: Uint8Array;
|
|
9
|
+
counter: number;
|
|
10
|
+
credentialDeviceType: "singleDevice" | "multiDevice";
|
|
11
|
+
credentialBackedUp: boolean;
|
|
12
|
+
transports?: string[];
|
|
13
|
+
webauthnUserID: string;
|
|
14
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@matreshka/bff",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.11.0",
|
|
4
4
|
"description": "Matreshka BFF: server-driven UI runtime — routing, pages, context, component DSL, and platform APIs",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -62,7 +62,9 @@
|
|
|
62
62
|
"vitest": "^4.1.0"
|
|
63
63
|
},
|
|
64
64
|
"dependencies": {
|
|
65
|
-
"@matreshka/shared": "^0.
|
|
65
|
+
"@matreshka/shared": "^0.11.0",
|
|
66
|
+
"@simplewebauthn/server": "^13.1.1",
|
|
67
|
+
"@simplewebauthn/types": "^12.0.0",
|
|
66
68
|
"fast-xml-parser": "^5.3.3",
|
|
67
69
|
"rxjs": "^7.8.2",
|
|
68
70
|
"ws": "^8.14.2",
|
|
@@ -104,6 +106,10 @@
|
|
|
104
106
|
"./platforms/*": {
|
|
105
107
|
"types": "./dist/platforms/*.d.ts",
|
|
106
108
|
"default": "./dist/platforms/*.js"
|
|
109
|
+
},
|
|
110
|
+
"./webauthn": {
|
|
111
|
+
"types": "./dist/webauthn/index.d.ts",
|
|
112
|
+
"default": "./dist/webauthn/index.js"
|
|
107
113
|
}
|
|
108
114
|
}
|
|
109
115
|
}
|