@novasamatech/host-api 0.7.1-1 → 0.7.2-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/hostApi.d.ts +1 -1
- package/dist/hostApi.js +2 -11
- package/dist/protocol/impl.d.ts +155 -128
- package/dist/protocol/impl.js +50 -63
- package/dist/protocol/messageCodec.d.ts +446 -402
- package/dist/protocol/messageCodec.js +1 -1
- package/dist/protocol/v1/accounts.d.ts +1 -0
- package/dist/protocol/v1/accounts.js +1 -0
- package/dist/protocol/v1/chainInteraction.d.ts +1 -0
- package/dist/protocol/v1/chainInteraction.js +1 -0
- package/dist/protocol/v1/chat.d.ts +3 -0
- package/dist/protocol/v1/chat.js +3 -0
- package/dist/protocol/v1/jsonRpc.d.ts +1 -0
- package/dist/protocol/v1/jsonRpc.js +1 -0
- package/dist/protocol/v1/payments.d.ts +36 -2
- package/dist/protocol/v1/payments.js +4 -2
- package/dist/protocol/v1/preimage.d.ts +1 -0
- package/dist/protocol/v1/preimage.js +2 -1
- package/dist/protocol/v1/remotePermission.d.ts +2 -2
- package/dist/protocol/v1/remotePermission.js +1 -1
- package/dist/protocol/v1/statementStore.d.ts +1 -0
- package/dist/protocol/v1/statementStore.js +1 -0
- package/dist/protocol/v1/theme.d.ts +1 -0
- package/dist/protocol/v1/theme.js +1 -0
- package/dist/transport.js +4 -4
- package/dist/types.d.ts +5 -4
- package/package.json +2 -2
|
@@ -11,7 +11,7 @@ const createPayload = (hostApi) => {
|
|
|
11
11
|
if (payload.method === 'subscribe') {
|
|
12
12
|
fields[`${method}_start`] = payload.start;
|
|
13
13
|
fields[`${method}_stop`] = _void;
|
|
14
|
-
fields[`${method}_interrupt`] =
|
|
14
|
+
fields[`${method}_interrupt`] = payload.interrupt;
|
|
15
15
|
fields[`${method}_receive`] = payload.receive;
|
|
16
16
|
}
|
|
17
17
|
}
|
|
@@ -63,6 +63,7 @@ export declare const CreateProofErr: [import("scale-ts").Encoder<import("@novasa
|
|
|
63
63
|
export declare const AccountConnectionStatus: import("scale-ts").Codec<"disconnected" | "connected">;
|
|
64
64
|
export declare const AccountConnectionStatusV1_start: import("scale-ts").Codec<undefined>;
|
|
65
65
|
export declare const AccountConnectionStatusV1_receive: import("scale-ts").Codec<"disconnected" | "connected">;
|
|
66
|
+
export declare const AccountConnectionStatusV1_interrupt: import("scale-ts").Codec<undefined>;
|
|
66
67
|
export declare const AccountGetRootV1_request: import("scale-ts").Codec<undefined>;
|
|
67
68
|
export declare const AccountGetRootV1_response: import("scale-ts").Codec<import("scale-ts").ResultPayload<{
|
|
68
69
|
publicKey: Uint8Array<ArrayBufferLike>;
|
|
@@ -42,6 +42,7 @@ export const CreateProofErr = ErrEnum('CreateProofErr', {
|
|
|
42
42
|
export const AccountConnectionStatus = Status('disconnected', 'connected');
|
|
43
43
|
export const AccountConnectionStatusV1_start = _void;
|
|
44
44
|
export const AccountConnectionStatusV1_receive = AccountConnectionStatus;
|
|
45
|
+
export const AccountConnectionStatusV1_interrupt = _void;
|
|
45
46
|
// account_get_root
|
|
46
47
|
export const AccountGetRootV1_request = _void;
|
|
47
48
|
export const AccountGetRootV1_response = Result(Account, RequestCredentialsErr);
|
|
@@ -242,6 +242,7 @@ export declare const ChainHeadFollowV1_receive: import("scale-ts").Codec<{
|
|
|
242
242
|
tag: "Stop";
|
|
243
243
|
value: undefined;
|
|
244
244
|
}>;
|
|
245
|
+
export declare const ChainHeadFollowV1_interrupt: import("scale-ts").Codec<undefined>;
|
|
245
246
|
export declare const ChainHeadHeaderV1_request: import("scale-ts").Codec<{
|
|
246
247
|
genesisHash: `0x${string}`;
|
|
247
248
|
followSubscriptionId: string;
|
|
@@ -85,6 +85,7 @@ export const ChainHeadEvent = Enum({
|
|
|
85
85
|
Stop: _void,
|
|
86
86
|
});
|
|
87
87
|
export const ChainHeadFollowV1_receive = ChainHeadEvent;
|
|
88
|
+
export const ChainHeadFollowV1_interrupt = _void;
|
|
88
89
|
// === ChainHead Header ===
|
|
89
90
|
export const ChainHeadHeaderV1_request = Struct({
|
|
90
91
|
genesisHash: GenesisHash,
|
|
@@ -82,6 +82,7 @@ export declare const ChatListSubscribeV1_receive: Codec<{
|
|
|
82
82
|
roomId: string;
|
|
83
83
|
participatingAs: "RoomHost" | "Bot";
|
|
84
84
|
}[]>;
|
|
85
|
+
export declare const ChatListSubscribeV1_interrupt: Codec<undefined>;
|
|
85
86
|
export declare const ChatAction: Codec<{
|
|
86
87
|
actionId: string;
|
|
87
88
|
title: string;
|
|
@@ -458,9 +459,11 @@ export declare const ChatActionSubscribeV1_receive: Codec<{
|
|
|
458
459
|
};
|
|
459
460
|
};
|
|
460
461
|
}>;
|
|
462
|
+
export declare const ChatActionSubscribeV1_interrupt: Codec<undefined>;
|
|
461
463
|
export declare const ChatCustomMessageRenderingV1_start: Codec<{
|
|
462
464
|
messageId: string;
|
|
463
465
|
messageType: string;
|
|
464
466
|
payload: Uint8Array<ArrayBufferLike>;
|
|
465
467
|
}>;
|
|
466
468
|
export declare const ChatCustomMessageRenderingV1_receive: Codec<CustomRendererNodeType>;
|
|
469
|
+
export declare const ChatCustomMessageRenderingV1_interrupt: Codec<undefined>;
|
package/dist/protocol/v1/chat.js
CHANGED
|
@@ -42,6 +42,7 @@ export const ChatRoom = Struct({
|
|
|
42
42
|
});
|
|
43
43
|
export const ChatListSubscribeV1_start = _void;
|
|
44
44
|
export const ChatListSubscribeV1_receive = Vector(ChatRoom);
|
|
45
|
+
export const ChatListSubscribeV1_interrupt = _void;
|
|
45
46
|
// message format
|
|
46
47
|
export const ChatAction = Struct({
|
|
47
48
|
actionId: str,
|
|
@@ -119,6 +120,8 @@ export const ReceivedChatAction = Struct({
|
|
|
119
120
|
});
|
|
120
121
|
export const ChatActionSubscribeV1_start = _void;
|
|
121
122
|
export const ChatActionSubscribeV1_receive = ReceivedChatAction;
|
|
123
|
+
export const ChatActionSubscribeV1_interrupt = _void;
|
|
122
124
|
// custom message rendering
|
|
123
125
|
export const ChatCustomMessageRenderingV1_start = Struct({ messageId: str, messageType: str, payload: Bytes() });
|
|
124
126
|
export const ChatCustomMessageRenderingV1_receive = CustomRendererNode;
|
|
127
|
+
export const ChatCustomMessageRenderingV1_interrupt = _void;
|
|
@@ -4,3 +4,4 @@ export declare const JsonRpcMessageSendV1_response: import("scale-ts").Codec<imp
|
|
|
4
4
|
}, "GenericError">>>;
|
|
5
5
|
export declare const JsonRpcMessageSubscribeV1_start: import("scale-ts").Codec<`0x${string}`>;
|
|
6
6
|
export declare const JsonRpcMessageSubscribeV1_receive: import("scale-ts").Codec<string>;
|
|
7
|
+
export declare const JsonRpcMessageSubscribeV1_interrupt: import("scale-ts").Codec<undefined>;
|
|
@@ -4,3 +4,4 @@ export const JsonRpcMessageSendV1_request = Tuple(GenesisHash, str);
|
|
|
4
4
|
export const JsonRpcMessageSendV1_response = Result(_void, GenericError);
|
|
5
5
|
export const JsonRpcMessageSubscribeV1_start = GenesisHash;
|
|
6
6
|
export const JsonRpcMessageSubscribeV1_receive = str;
|
|
7
|
+
export const JsonRpcMessageSubscribeV1_interrupt = _void;
|
|
@@ -2,7 +2,7 @@ export declare const Ed25519PrivateKey: import("scale-ts").Codec<Uint8Array<Arra
|
|
|
2
2
|
export declare const PaymentId: import("scale-ts").Codec<string>;
|
|
3
3
|
export declare const PaymentTopUpSource: import("scale-ts").Codec<{
|
|
4
4
|
tag: "ProductAccount";
|
|
5
|
-
value:
|
|
5
|
+
value: number;
|
|
6
6
|
} | {
|
|
7
7
|
tag: "PrivateKey";
|
|
8
8
|
value: Uint8Array<ArrayBufferLike>;
|
|
@@ -97,11 +97,28 @@ export declare const PaymentBalanceSubscribeV1_start: import("scale-ts").Codec<u
|
|
|
97
97
|
export declare const PaymentBalanceSubscribeV1_receive: import("scale-ts").Codec<{
|
|
98
98
|
available: bigint;
|
|
99
99
|
}>;
|
|
100
|
+
export declare const PaymentBalanceSubscribeV1_interrupt: [import("scale-ts").Encoder<import("@novasamatech/scale").CodecError<{
|
|
101
|
+
reason: string;
|
|
102
|
+
}, "PaymentBalanceErr::Unknown"> | import("@novasamatech/scale").CodecError<undefined, "PaymentBalanceErr::PermissionDenied">>, import("scale-ts").Decoder<import("@novasamatech/scale").CodecError<{
|
|
103
|
+
reason: string;
|
|
104
|
+
}, "PaymentBalanceErr::Unknown"> | import("@novasamatech/scale").CodecError<undefined, "PaymentBalanceErr::PermissionDenied">>] & {
|
|
105
|
+
enc: import("scale-ts").Encoder<import("@novasamatech/scale").CodecError<{
|
|
106
|
+
reason: string;
|
|
107
|
+
}, "PaymentBalanceErr::Unknown"> | import("@novasamatech/scale").CodecError<undefined, "PaymentBalanceErr::PermissionDenied">>;
|
|
108
|
+
dec: import("scale-ts").Decoder<import("@novasamatech/scale").CodecError<{
|
|
109
|
+
reason: string;
|
|
110
|
+
}, "PaymentBalanceErr::Unknown"> | import("@novasamatech/scale").CodecError<undefined, "PaymentBalanceErr::PermissionDenied">>;
|
|
111
|
+
} & {
|
|
112
|
+
readonly PermissionDenied: import("@novasamatech/scale").ErrCodec<undefined, "PaymentBalanceErr::PermissionDenied">;
|
|
113
|
+
readonly Unknown: import("@novasamatech/scale").ErrCodec<{
|
|
114
|
+
reason: string;
|
|
115
|
+
}, "PaymentBalanceErr::Unknown">;
|
|
116
|
+
};
|
|
100
117
|
export declare const PaymentTopUpV1_request: import("scale-ts").Codec<{
|
|
101
118
|
amount: bigint;
|
|
102
119
|
source: {
|
|
103
120
|
tag: "ProductAccount";
|
|
104
|
-
value:
|
|
121
|
+
value: number;
|
|
105
122
|
} | {
|
|
106
123
|
tag: "PrivateKey";
|
|
107
124
|
value: Uint8Array<ArrayBufferLike>;
|
|
@@ -130,3 +147,20 @@ export declare const PaymentStatusSubscribeV1_receive: import("scale-ts").Codec<
|
|
|
130
147
|
tag: "Failed";
|
|
131
148
|
value: string;
|
|
132
149
|
}>;
|
|
150
|
+
export declare const PaymentStatusSubscribeV1_interrupt: [import("scale-ts").Encoder<import("@novasamatech/scale").CodecError<{
|
|
151
|
+
reason: string;
|
|
152
|
+
}, "PaymentStatusErr::Unknown"> | import("@novasamatech/scale").CodecError<undefined, "PaymentStatusErr::PaymentNotFound">>, import("scale-ts").Decoder<import("@novasamatech/scale").CodecError<{
|
|
153
|
+
reason: string;
|
|
154
|
+
}, "PaymentStatusErr::Unknown"> | import("@novasamatech/scale").CodecError<undefined, "PaymentStatusErr::PaymentNotFound">>] & {
|
|
155
|
+
enc: import("scale-ts").Encoder<import("@novasamatech/scale").CodecError<{
|
|
156
|
+
reason: string;
|
|
157
|
+
}, "PaymentStatusErr::Unknown"> | import("@novasamatech/scale").CodecError<undefined, "PaymentStatusErr::PaymentNotFound">>;
|
|
158
|
+
dec: import("scale-ts").Decoder<import("@novasamatech/scale").CodecError<{
|
|
159
|
+
reason: string;
|
|
160
|
+
}, "PaymentStatusErr::Unknown"> | import("@novasamatech/scale").CodecError<undefined, "PaymentStatusErr::PaymentNotFound">>;
|
|
161
|
+
} & {
|
|
162
|
+
readonly PaymentNotFound: import("@novasamatech/scale").ErrCodec<undefined, "PaymentStatusErr::PaymentNotFound">;
|
|
163
|
+
readonly Unknown: import("@novasamatech/scale").ErrCodec<{
|
|
164
|
+
reason: string;
|
|
165
|
+
}, "PaymentStatusErr::Unknown">;
|
|
166
|
+
};
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { Enum, ErrEnum } from '@novasamatech/scale';
|
|
2
2
|
import { Bytes, Result, Struct, _void, str, u128 } from 'scale-ts';
|
|
3
3
|
import { GenericErr } from '../commonCodecs.js';
|
|
4
|
-
import {
|
|
4
|
+
import { DerivationIndex } from './accounts.js';
|
|
5
5
|
// common types
|
|
6
6
|
export const Ed25519PrivateKey = Bytes(32);
|
|
7
7
|
export const PaymentId = str;
|
|
8
8
|
export const PaymentTopUpSource = Enum({
|
|
9
|
-
ProductAccount:
|
|
9
|
+
ProductAccount: DerivationIndex,
|
|
10
10
|
PrivateKey: Ed25519PrivateKey,
|
|
11
11
|
});
|
|
12
12
|
export const PaymentBalance = Struct({
|
|
@@ -42,6 +42,7 @@ export const PaymentStatusErr = ErrEnum('PaymentStatusErr', {
|
|
|
42
42
|
// host_payment_balance_subscribe
|
|
43
43
|
export const PaymentBalanceSubscribeV1_start = _void;
|
|
44
44
|
export const PaymentBalanceSubscribeV1_receive = PaymentBalance;
|
|
45
|
+
export const PaymentBalanceSubscribeV1_interrupt = PaymentBalanceErr;
|
|
45
46
|
// host_payment_top_up
|
|
46
47
|
export const PaymentTopUpV1_request = Struct({
|
|
47
48
|
amount: u128,
|
|
@@ -57,3 +58,4 @@ export const PaymentRequestV1_response = Result(PaymentReceipt, PaymentRequestEr
|
|
|
57
58
|
// host_payment_status_subscribe
|
|
58
59
|
export const PaymentStatusSubscribeV1_start = PaymentId;
|
|
59
60
|
export const PaymentStatusSubscribeV1_receive = PaymentStatus;
|
|
61
|
+
export const PaymentStatusSubscribeV1_interrupt = PaymentStatusErr;
|
|
@@ -2,6 +2,7 @@ export declare const PreimageKey: import("scale-ts").Codec<`0x${string}`>;
|
|
|
2
2
|
export declare const PreimageValue: import("scale-ts").Codec<Uint8Array<ArrayBufferLike>>;
|
|
3
3
|
export declare const PreimageLookupSubscribeV1_start: import("scale-ts").Codec<`0x${string}`>;
|
|
4
4
|
export declare const PreimageLookupSubscribeV1_receive: import("scale-ts").Codec<Uint8Array<ArrayBufferLike> | null>;
|
|
5
|
+
export declare const PreimageLookupSubscribeV1_interrupt: import("scale-ts").Codec<undefined>;
|
|
5
6
|
export declare const PreimageSubmitErr: [import("scale-ts").Encoder<import("@novasamatech/scale").CodecError<{
|
|
6
7
|
reason: string;
|
|
7
8
|
}, "PreimageSubmitErr::Unknown">>, import("scale-ts").Decoder<import("@novasamatech/scale").CodecError<{
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { ErrEnum, Hex, Nullable } from '@novasamatech/scale';
|
|
2
|
-
import { Bytes, Result } from 'scale-ts';
|
|
2
|
+
import { Bytes, Result, _void } from 'scale-ts';
|
|
3
3
|
import { GenericErr } from '../commonCodecs.js';
|
|
4
4
|
export const PreimageKey = Hex();
|
|
5
5
|
export const PreimageValue = Bytes();
|
|
6
6
|
export const PreimageLookupSubscribeV1_start = PreimageKey;
|
|
7
7
|
export const PreimageLookupSubscribeV1_receive = Nullable(PreimageValue);
|
|
8
|
+
export const PreimageLookupSubscribeV1_interrupt = _void;
|
|
8
9
|
export const PreimageSubmitErr = ErrEnum('PreimageSubmitErr', {
|
|
9
10
|
Unknown: [GenericErr, 'Unknown error'],
|
|
10
11
|
});
|
|
@@ -14,7 +14,7 @@ export declare const RemotePermission: import("scale-ts").Codec<{
|
|
|
14
14
|
tag: "StatementSubmit";
|
|
15
15
|
value: undefined;
|
|
16
16
|
}>;
|
|
17
|
-
export declare const RemotePermissionV1_request: import("scale-ts").Codec<
|
|
17
|
+
export declare const RemotePermissionV1_request: import("scale-ts").Codec<{
|
|
18
18
|
tag: "Remote";
|
|
19
19
|
value: string[];
|
|
20
20
|
} | {
|
|
@@ -29,7 +29,7 @@ export declare const RemotePermissionV1_request: import("scale-ts").Codec<({
|
|
|
29
29
|
} | {
|
|
30
30
|
tag: "StatementSubmit";
|
|
31
31
|
value: undefined;
|
|
32
|
-
}
|
|
32
|
+
}>;
|
|
33
33
|
export declare const RemotePermissionV1_response: import("scale-ts").Codec<import("scale-ts").ResultPayload<boolean, import("@novasamatech/scale").CodecError<{
|
|
34
34
|
reason: string;
|
|
35
35
|
}, "GenericError">>>;
|
|
@@ -8,5 +8,5 @@ export const RemotePermission = Enum({
|
|
|
8
8
|
PreimageSubmit: _void,
|
|
9
9
|
StatementSubmit: _void,
|
|
10
10
|
});
|
|
11
|
-
export const RemotePermissionV1_request =
|
|
11
|
+
export const RemotePermissionV1_request = RemotePermission;
|
|
12
12
|
export const RemotePermissionV1_response = Result(bool, GenericError);
|
|
@@ -153,6 +153,7 @@ export declare const StatementStoreSubscribeV1_receive: import("scale-ts").Codec
|
|
|
153
153
|
}[];
|
|
154
154
|
isComplete: boolean;
|
|
155
155
|
}>;
|
|
156
|
+
export declare const StatementStoreSubscribeV1_interrupt: import("scale-ts").Codec<undefined>;
|
|
156
157
|
export declare const StatementProofErr: [import("scale-ts").Encoder<import("@novasamatech/scale").CodecError<{
|
|
157
158
|
reason: string;
|
|
158
159
|
}, "StatementProofErr::Unknown"> | import("@novasamatech/scale").CodecError<undefined, "StatementProofErr::UnableToSign"> | import("@novasamatech/scale").CodecError<undefined, "StatementProofErr::UnknownAccount">>, import("scale-ts").Decoder<import("@novasamatech/scale").CodecError<{
|
|
@@ -57,6 +57,7 @@ export const SignedStatementsPage = Struct({
|
|
|
57
57
|
});
|
|
58
58
|
export const StatementStoreSubscribeV1_start = TopicFilter;
|
|
59
59
|
export const StatementStoreSubscribeV1_receive = SignedStatementsPage;
|
|
60
|
+
export const StatementStoreSubscribeV1_interrupt = _void;
|
|
60
61
|
// creating proof
|
|
61
62
|
export const StatementProofErr = ErrEnum('StatementProofErr', {
|
|
62
63
|
UnableToSign: [_void, 'StatementProof: unable to sign'],
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
export declare const Theme: import("scale-ts").Codec<"light" | "dark">;
|
|
2
2
|
export declare const ThemeSubscribeV1_start: import("scale-ts").Codec<undefined>;
|
|
3
3
|
export declare const ThemeSubscribeV1_receive: import("scale-ts").Codec<"light" | "dark">;
|
|
4
|
+
export declare const ThemeSubscribeV1_interrupt: import("scale-ts").Codec<undefined>;
|
package/dist/transport.js
CHANGED
|
@@ -187,9 +187,9 @@ export function createTransport(provider) {
|
|
|
187
187
|
}
|
|
188
188
|
}
|
|
189
189
|
});
|
|
190
|
-
const unsubscribeInterrupt = transport.listenMessages(interruptAction, receivedId => {
|
|
190
|
+
const unsubscribeInterrupt = transport.listenMessages(interruptAction, (receivedId, data) => {
|
|
191
191
|
if (receivedId === requestId) {
|
|
192
|
-
events.emit('interrupt');
|
|
192
|
+
events.emit('interrupt', data.value);
|
|
193
193
|
stopSubscription();
|
|
194
194
|
}
|
|
195
195
|
});
|
|
@@ -230,10 +230,10 @@ export function createTransport(provider) {
|
|
|
230
230
|
const unsubscribe = handler(payload.value, value => {
|
|
231
231
|
const receivePayload = enumValue(receiveAction, value);
|
|
232
232
|
transport.postMessage(requestId, receivePayload);
|
|
233
|
-
},
|
|
233
|
+
}, value => {
|
|
234
234
|
interrupted = true;
|
|
235
235
|
subscriptions.delete(requestId);
|
|
236
|
-
transport.postMessage(requestId, enumValue(interruptAction,
|
|
236
|
+
transport.postMessage(requestId, enumValue(interruptAction, value));
|
|
237
237
|
});
|
|
238
238
|
if (interrupted) {
|
|
239
239
|
unsubscribe();
|
package/dist/types.d.ts
CHANGED
|
@@ -7,11 +7,12 @@ export type Logger = Record<'info' | 'warn' | 'error' | 'log', (...args: unknown
|
|
|
7
7
|
};
|
|
8
8
|
export type ConnectionStatus = 'connecting' | 'connected' | 'disconnected';
|
|
9
9
|
export type RequestHandler<Method extends string> = (message: PickMessagePayloadValue<ComposeMessageAction<Method, 'request'>>) => PromiseLike<PickMessagePayloadValue<ComposeMessageAction<Method, 'response'>>>;
|
|
10
|
-
export type SubscriptionHandler<Method extends string> = (params: PickMessagePayloadValue<ComposeMessageAction<Method, 'start'>>, send: (value: PickMessagePayloadValue<ComposeMessageAction<Method, 'receive'>>) => void, interrupt: () => void) => VoidFunction;
|
|
11
|
-
export type Subscription = {
|
|
10
|
+
export type SubscriptionHandler<Method extends string> = (params: PickMessagePayloadValue<ComposeMessageAction<Method, 'start'>>, send: (value: PickMessagePayloadValue<ComposeMessageAction<Method, 'receive'>>) => void, interrupt: (value: PickMessagePayloadValue<ComposeMessageAction<Method, 'interrupt'>>) => void) => VoidFunction;
|
|
11
|
+
export type Subscription<InterruptPayload = unknown> = {
|
|
12
12
|
unsubscribe: VoidFunction;
|
|
13
|
-
onInterrupt(callback:
|
|
13
|
+
onInterrupt(callback: (payload: InterruptPayload) => void): VoidFunction;
|
|
14
14
|
};
|
|
15
|
+
export type SubscriptionFor<Method extends HostApiMethod> = Subscription<PickMessagePayloadValue<ComposeMessageAction<Method, 'interrupt'>>>;
|
|
15
16
|
export type Transport = {
|
|
16
17
|
readonly provider: Provider;
|
|
17
18
|
isCorrectEnvironment(): boolean;
|
|
@@ -21,7 +22,7 @@ export type Transport = {
|
|
|
21
22
|
onDestroy(callback: VoidFunction): VoidFunction;
|
|
22
23
|
request<const Method extends HostApiMethod>(method: Method, payload: PickMessagePayloadValue<ComposeMessageAction<Method, 'request'>>, signal?: AbortSignal): Promise<PickMessagePayloadValue<ComposeMessageAction<Method, 'response'>>>;
|
|
23
24
|
handleRequest<const Method extends HostApiMethod>(method: Method, handler: RequestHandler<Method>): VoidFunction;
|
|
24
|
-
subscribe<const Method extends HostApiMethod>(method: Method, payload: PickMessagePayloadValue<ComposeMessageAction<Method, 'start'>>, callback: (payload: PickMessagePayloadValue<ComposeMessageAction<Method, 'receive'>>) => void):
|
|
25
|
+
subscribe<const Method extends HostApiMethod>(method: Method, payload: PickMessagePayloadValue<ComposeMessageAction<Method, 'start'>>, callback: (payload: PickMessagePayloadValue<ComposeMessageAction<Method, 'receive'>>) => void): SubscriptionFor<Method>;
|
|
25
26
|
handleSubscription<const Method extends HostApiMethod>(method: Method, handler: SubscriptionHandler<Method>): VoidFunction;
|
|
26
27
|
postMessage(requestId: string, payload: MessagePayloadSchema): void;
|
|
27
28
|
listenMessages<const Action extends MessageAction>(action: Action, callback: (requestId: string, data: PickMessagePayload<Action>) => void, onError?: (error: unknown) => void): VoidFunction;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@novasamatech/host-api",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.7.
|
|
4
|
+
"version": "0.7.2-0",
|
|
5
5
|
"description": "Host API: transport implementation for host - product integration.",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"repository": {
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"README.md"
|
|
23
23
|
],
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@novasamatech/scale": "0.7.
|
|
25
|
+
"@novasamatech/scale": "0.7.2-0",
|
|
26
26
|
"nanoevents": "9.1.0",
|
|
27
27
|
"nanoid": "5.1.9",
|
|
28
28
|
"neverthrow": "^8.2.0",
|