@novasamatech/host-api 0.5.4 → 0.6.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/README.md +27 -2
- package/dist/hostApi.d.ts +2 -1
- package/dist/hostApi.js +117 -34
- package/dist/index.d.ts +8 -2
- package/dist/index.js +8 -2
- package/dist/protocol/impl.d.ts +80 -59
- package/dist/protocol/impl.js +64 -36
- package/dist/protocol/messageCodec.d.ts +307 -177
- package/dist/protocol/v1/accounts.d.ts +3 -0
- package/dist/protocol/v1/accounts.js +5 -1
- package/dist/protocol/v1/chat.d.ts +72 -31
- package/dist/protocol/v1/chat.js +9 -0
- package/dist/protocol/v1/customRenderer.d.ts +143 -0
- package/dist/protocol/v1/customRenderer.js +82 -0
- package/dist/protocol/v1/devicePermission.d.ts +5 -0
- package/dist/protocol/v1/devicePermission.js +6 -0
- package/dist/protocol/v1/localStorage.d.ts +31 -0
- package/dist/protocol/v1/localStorage.js +17 -0
- package/dist/protocol/v1/navigation.d.ts +21 -0
- package/dist/protocol/v1/navigation.js +9 -0
- package/dist/protocol/v1/notification.d.ts +11 -0
- package/dist/protocol/v1/notification.js +8 -0
- package/dist/protocol/v1/preimage.d.ts +24 -0
- package/dist/protocol/v1/preimage.js +12 -0
- package/dist/protocol/v1/remotePermission.d.ts +17 -0
- package/dist/protocol/v1/remotePermission.js +9 -0
- package/dist/protocol/v1/sign.js +5 -4
- package/dist/protocol/v1/statementStore.d.ts +0 -36
- package/dist/protocol/v1/statementStore.js +1 -3
- package/dist/transport.js +12 -4
- package/package.json +3 -3
|
@@ -60,6 +60,9 @@ export declare const CreateProofErr: [import("scale-ts").Encoder<import("@novasa
|
|
|
60
60
|
reason: string;
|
|
61
61
|
}, "CreateProofErr::Unknown">;
|
|
62
62
|
};
|
|
63
|
+
export declare const AccountConnectionStatus: import("scale-ts").Codec<"disconnected" | "connected">;
|
|
64
|
+
export declare const AccountConnectionStatusV1_start: import("scale-ts").Codec<undefined>;
|
|
65
|
+
export declare const AccountConnectionStatusV1_receive: import("scale-ts").Codec<"disconnected" | "connected">;
|
|
63
66
|
export declare const AccountGetV1_request: import("scale-ts").Codec<[string, number]>;
|
|
64
67
|
export declare const AccountGetV1_response: import("scale-ts").Codec<import("scale-ts").ResultPayload<{
|
|
65
68
|
publicKey: Uint8Array<ArrayBufferLike>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ErrEnum, Hex } from '@novasamatech/scale';
|
|
1
|
+
import { ErrEnum, Hex, Status } from '@novasamatech/scale';
|
|
2
2
|
import { Bytes, Option, Result, Struct, Tuple, Vector, _void, str, u32 } from 'scale-ts';
|
|
3
3
|
import { GenericErr, GenesisHash } from '../commonCodecs.js';
|
|
4
4
|
// common types
|
|
@@ -38,6 +38,10 @@ export const CreateProofErr = ErrEnum('CreateProofErr', {
|
|
|
38
38
|
Rejected: [_void, 'CreateProof: rejected'],
|
|
39
39
|
Unknown: [GenericErr, 'CreateProof: unknown error'],
|
|
40
40
|
});
|
|
41
|
+
// account connection status
|
|
42
|
+
export const AccountConnectionStatus = Status('disconnected', 'connected');
|
|
43
|
+
export const AccountConnectionStatusV1_start = _void;
|
|
44
|
+
export const AccountConnectionStatusV1_receive = AccountConnectionStatus;
|
|
41
45
|
// account_get
|
|
42
46
|
export const AccountGetV1_request = ProductAccountId;
|
|
43
47
|
export const AccountGetV1_response = Result(Account, RequestCredentialsErr);
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import type { Codec } from 'scale-ts';
|
|
2
|
+
import type { CustomRendererNodeType } from './customRenderer.js';
|
|
1
3
|
export declare const ChatRoomRegistrationErr: [import("scale-ts").Encoder<import("@novasamatech/scale").CodecError<{
|
|
2
4
|
reason: string;
|
|
3
5
|
}, "ChatRoomRegistrationErr::Unknown"> | import("@novasamatech/scale").CodecError<undefined, "ChatRoomRegistrationErr::PermissionDenied">>, import("scale-ts").Decoder<import("@novasamatech/scale").CodecError<{
|
|
@@ -15,21 +17,21 @@ export declare const ChatRoomRegistrationErr: [import("scale-ts").Encoder<import
|
|
|
15
17
|
reason: string;
|
|
16
18
|
}, "ChatRoomRegistrationErr::Unknown">;
|
|
17
19
|
};
|
|
18
|
-
export declare const ChatRoomRequest:
|
|
20
|
+
export declare const ChatRoomRequest: Codec<{
|
|
19
21
|
roomId: string;
|
|
20
22
|
name: string;
|
|
21
23
|
icon: string;
|
|
22
24
|
}>;
|
|
23
|
-
export declare const ChatRoomRegistrationStatus:
|
|
24
|
-
export declare const ChatRoomRegistrationResult:
|
|
25
|
+
export declare const ChatRoomRegistrationStatus: Codec<"New" | "Exists">;
|
|
26
|
+
export declare const ChatRoomRegistrationResult: Codec<{
|
|
25
27
|
status: "New" | "Exists";
|
|
26
28
|
}>;
|
|
27
|
-
export declare const ChatCreateRoomV1_request:
|
|
29
|
+
export declare const ChatCreateRoomV1_request: Codec<{
|
|
28
30
|
roomId: string;
|
|
29
31
|
name: string;
|
|
30
32
|
icon: string;
|
|
31
33
|
}>;
|
|
32
|
-
export declare const ChatCreateRoomV1_response:
|
|
34
|
+
export declare const ChatCreateRoomV1_response: Codec<import("scale-ts").ResultPayload<{
|
|
33
35
|
status: "New" | "Exists";
|
|
34
36
|
}, import("@novasamatech/scale").CodecError<{
|
|
35
37
|
reason: string;
|
|
@@ -51,41 +53,41 @@ export declare const ChatBotRegistrationErr: [import("scale-ts").Encoder<import(
|
|
|
51
53
|
reason: string;
|
|
52
54
|
}, "ChatBotRegistrationErr::Unknown">;
|
|
53
55
|
};
|
|
54
|
-
export declare const ChatBotRequest:
|
|
56
|
+
export declare const ChatBotRequest: Codec<{
|
|
55
57
|
botId: string;
|
|
56
58
|
name: string;
|
|
57
59
|
icon: string;
|
|
58
60
|
}>;
|
|
59
|
-
export declare const ChatBotRegistrationStatus:
|
|
60
|
-
export declare const ChatBotRegistrationResult:
|
|
61
|
+
export declare const ChatBotRegistrationStatus: Codec<"New" | "Exists">;
|
|
62
|
+
export declare const ChatBotRegistrationResult: Codec<{
|
|
61
63
|
status: "New" | "Exists";
|
|
62
64
|
}>;
|
|
63
|
-
export declare const ChatRegisterBotV1_request:
|
|
65
|
+
export declare const ChatRegisterBotV1_request: Codec<{
|
|
64
66
|
botId: string;
|
|
65
67
|
name: string;
|
|
66
68
|
icon: string;
|
|
67
69
|
}>;
|
|
68
|
-
export declare const ChatRegisterBotV1_response:
|
|
70
|
+
export declare const ChatRegisterBotV1_response: Codec<import("scale-ts").ResultPayload<{
|
|
69
71
|
status: "New" | "Exists";
|
|
70
72
|
}, import("@novasamatech/scale").CodecError<{
|
|
71
73
|
reason: string;
|
|
72
74
|
}, "ChatBotRegistrationErr::Unknown"> | import("@novasamatech/scale").CodecError<undefined, "ChatBotRegistrationErr::PermissionDenied">>>;
|
|
73
|
-
export declare const ChatRoomParticipation:
|
|
74
|
-
export declare const ChatRoom:
|
|
75
|
+
export declare const ChatRoomParticipation: Codec<"RoomHost" | "Bot">;
|
|
76
|
+
export declare const ChatRoom: Codec<{
|
|
75
77
|
roomId: string;
|
|
76
78
|
participatingAs: "RoomHost" | "Bot";
|
|
77
79
|
}>;
|
|
78
|
-
export declare const ChatListSubscribeV1_start:
|
|
79
|
-
export declare const ChatListSubscribeV1_receive:
|
|
80
|
+
export declare const ChatListSubscribeV1_start: Codec<undefined>;
|
|
81
|
+
export declare const ChatListSubscribeV1_receive: Codec<{
|
|
80
82
|
roomId: string;
|
|
81
83
|
participatingAs: "RoomHost" | "Bot";
|
|
82
84
|
}[]>;
|
|
83
|
-
export declare const ChatAction:
|
|
85
|
+
export declare const ChatAction: Codec<{
|
|
84
86
|
actionId: string;
|
|
85
87
|
title: string;
|
|
86
88
|
}>;
|
|
87
|
-
export declare const ChatActionLayout:
|
|
88
|
-
export declare const ChatActions:
|
|
89
|
+
export declare const ChatActionLayout: Codec<"Column" | "Grid">;
|
|
90
|
+
export declare const ChatActions: Codec<{
|
|
89
91
|
text: string | undefined;
|
|
90
92
|
actions: {
|
|
91
93
|
actionId: string;
|
|
@@ -93,27 +95,31 @@ export declare const ChatActions: import("scale-ts").Codec<{
|
|
|
93
95
|
}[];
|
|
94
96
|
layout: "Column" | "Grid";
|
|
95
97
|
}>;
|
|
96
|
-
export declare const ChatMedia:
|
|
98
|
+
export declare const ChatMedia: Codec<{
|
|
97
99
|
url: string;
|
|
98
100
|
}>;
|
|
99
|
-
export declare const ChatRichText:
|
|
101
|
+
export declare const ChatRichText: Codec<{
|
|
100
102
|
text: string | undefined;
|
|
101
103
|
media: {
|
|
102
104
|
url: string;
|
|
103
105
|
}[];
|
|
104
106
|
}>;
|
|
105
|
-
export declare const ChatFile:
|
|
107
|
+
export declare const ChatFile: Codec<{
|
|
106
108
|
url: string;
|
|
107
109
|
fileName: string;
|
|
108
110
|
mimeType: string;
|
|
109
111
|
sizeBytes: bigint;
|
|
110
112
|
text: string | undefined;
|
|
111
113
|
}>;
|
|
112
|
-
export declare const ChatReaction:
|
|
114
|
+
export declare const ChatReaction: Codec<{
|
|
113
115
|
messageId: string;
|
|
114
116
|
emoji: string;
|
|
115
117
|
}>;
|
|
116
|
-
export declare const
|
|
118
|
+
export declare const ChatCustomMessage: Codec<{
|
|
119
|
+
messageType: string;
|
|
120
|
+
payload: Uint8Array<ArrayBufferLike>;
|
|
121
|
+
}>;
|
|
122
|
+
export declare const ChatMessageContent: Codec<{
|
|
117
123
|
tag: "Text";
|
|
118
124
|
value: string;
|
|
119
125
|
} | {
|
|
@@ -155,6 +161,12 @@ export declare const ChatMessageContent: import("scale-ts").Codec<{
|
|
|
155
161
|
messageId: string;
|
|
156
162
|
emoji: string;
|
|
157
163
|
};
|
|
164
|
+
} | {
|
|
165
|
+
tag: "Custom";
|
|
166
|
+
value: {
|
|
167
|
+
messageType: string;
|
|
168
|
+
payload: Uint8Array<ArrayBufferLike>;
|
|
169
|
+
};
|
|
158
170
|
}>;
|
|
159
171
|
export declare const ChatMessagePostingErr: [import("scale-ts").Encoder<import("@novasamatech/scale").CodecError<{
|
|
160
172
|
reason: string;
|
|
@@ -173,10 +185,10 @@ export declare const ChatMessagePostingErr: [import("scale-ts").Encoder<import("
|
|
|
173
185
|
reason: string;
|
|
174
186
|
}, "ChatMessagePostingErr::Unknown">;
|
|
175
187
|
};
|
|
176
|
-
export declare const ChatPostMessageResult:
|
|
188
|
+
export declare const ChatPostMessageResult: Codec<{
|
|
177
189
|
messageId: string;
|
|
178
190
|
}>;
|
|
179
|
-
export declare const ChatPostMessageV1_request:
|
|
191
|
+
export declare const ChatPostMessageV1_request: Codec<{
|
|
180
192
|
roomId: string;
|
|
181
193
|
payload: {
|
|
182
194
|
tag: "Text";
|
|
@@ -220,23 +232,29 @@ export declare const ChatPostMessageV1_request: import("scale-ts").Codec<{
|
|
|
220
232
|
messageId: string;
|
|
221
233
|
emoji: string;
|
|
222
234
|
};
|
|
235
|
+
} | {
|
|
236
|
+
tag: "Custom";
|
|
237
|
+
value: {
|
|
238
|
+
messageType: string;
|
|
239
|
+
payload: Uint8Array<ArrayBufferLike>;
|
|
240
|
+
};
|
|
223
241
|
};
|
|
224
242
|
}>;
|
|
225
|
-
export declare const ChatPostMessageV1_response:
|
|
243
|
+
export declare const ChatPostMessageV1_response: Codec<import("scale-ts").ResultPayload<{
|
|
226
244
|
messageId: string;
|
|
227
245
|
}, import("@novasamatech/scale").CodecError<{
|
|
228
246
|
reason: string;
|
|
229
247
|
}, "ChatMessagePostingErr::Unknown"> | import("@novasamatech/scale").CodecError<undefined, "ChatMessagePostingErr::MessageTooLarge">>>;
|
|
230
|
-
export declare const ActionTrigger:
|
|
248
|
+
export declare const ActionTrigger: Codec<{
|
|
231
249
|
messageId: string;
|
|
232
250
|
actionId: string;
|
|
233
251
|
payload: Uint8Array<ArrayBufferLike> | undefined;
|
|
234
252
|
}>;
|
|
235
|
-
export declare const ChatCommand:
|
|
253
|
+
export declare const ChatCommand: Codec<{
|
|
236
254
|
command: string;
|
|
237
255
|
payload: string;
|
|
238
256
|
}>;
|
|
239
|
-
export declare const ChatActionPayload:
|
|
257
|
+
export declare const ChatActionPayload: Codec<{
|
|
240
258
|
tag: "MessagePosted";
|
|
241
259
|
value: {
|
|
242
260
|
tag: "Text";
|
|
@@ -280,6 +298,12 @@ export declare const ChatActionPayload: import("scale-ts").Codec<{
|
|
|
280
298
|
messageId: string;
|
|
281
299
|
emoji: string;
|
|
282
300
|
};
|
|
301
|
+
} | {
|
|
302
|
+
tag: "Custom";
|
|
303
|
+
value: {
|
|
304
|
+
messageType: string;
|
|
305
|
+
payload: Uint8Array<ArrayBufferLike>;
|
|
306
|
+
};
|
|
283
307
|
};
|
|
284
308
|
} | {
|
|
285
309
|
tag: "ActionTriggered";
|
|
@@ -295,7 +319,7 @@ export declare const ChatActionPayload: import("scale-ts").Codec<{
|
|
|
295
319
|
payload: string;
|
|
296
320
|
};
|
|
297
321
|
}>;
|
|
298
|
-
export declare const ReceivedChatAction:
|
|
322
|
+
export declare const ReceivedChatAction: Codec<{
|
|
299
323
|
roomId: string;
|
|
300
324
|
peer: string;
|
|
301
325
|
payload: {
|
|
@@ -342,6 +366,12 @@ export declare const ReceivedChatAction: import("scale-ts").Codec<{
|
|
|
342
366
|
messageId: string;
|
|
343
367
|
emoji: string;
|
|
344
368
|
};
|
|
369
|
+
} | {
|
|
370
|
+
tag: "Custom";
|
|
371
|
+
value: {
|
|
372
|
+
messageType: string;
|
|
373
|
+
payload: Uint8Array<ArrayBufferLike>;
|
|
374
|
+
};
|
|
345
375
|
};
|
|
346
376
|
} | {
|
|
347
377
|
tag: "ActionTriggered";
|
|
@@ -358,8 +388,8 @@ export declare const ReceivedChatAction: import("scale-ts").Codec<{
|
|
|
358
388
|
};
|
|
359
389
|
};
|
|
360
390
|
}>;
|
|
361
|
-
export declare const ChatActionSubscribeV1_start:
|
|
362
|
-
export declare const ChatActionSubscribeV1_receive:
|
|
391
|
+
export declare const ChatActionSubscribeV1_start: Codec<undefined>;
|
|
392
|
+
export declare const ChatActionSubscribeV1_receive: Codec<{
|
|
363
393
|
roomId: string;
|
|
364
394
|
peer: string;
|
|
365
395
|
payload: {
|
|
@@ -406,6 +436,12 @@ export declare const ChatActionSubscribeV1_receive: import("scale-ts").Codec<{
|
|
|
406
436
|
messageId: string;
|
|
407
437
|
emoji: string;
|
|
408
438
|
};
|
|
439
|
+
} | {
|
|
440
|
+
tag: "Custom";
|
|
441
|
+
value: {
|
|
442
|
+
messageType: string;
|
|
443
|
+
payload: Uint8Array<ArrayBufferLike>;
|
|
444
|
+
};
|
|
409
445
|
};
|
|
410
446
|
} | {
|
|
411
447
|
tag: "ActionTriggered";
|
|
@@ -422,3 +458,8 @@ export declare const ChatActionSubscribeV1_receive: import("scale-ts").Codec<{
|
|
|
422
458
|
};
|
|
423
459
|
};
|
|
424
460
|
}>;
|
|
461
|
+
export declare const ChatCustomMessageRenderingV1_start: Codec<{
|
|
462
|
+
messageType: string;
|
|
463
|
+
payload: Uint8Array<ArrayBufferLike>;
|
|
464
|
+
}>;
|
|
465
|
+
export declare const ChatCustomMessageRenderingV1_receive: Codec<CustomRendererNodeType>;
|
package/dist/protocol/v1/chat.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Enum, ErrEnum, Status } from '@novasamatech/scale';
|
|
2
2
|
import { Bytes, Option, Result, Struct, Vector, _void, str, u64 } from 'scale-ts';
|
|
3
3
|
import { GenericErr } from '../commonCodecs.js';
|
|
4
|
+
import { CustomRendererNode } from './customRenderer.js';
|
|
4
5
|
// room registration
|
|
5
6
|
export const ChatRoomRegistrationErr = ErrEnum('ChatRoomRegistrationErr', {
|
|
6
7
|
PermissionDenied: [_void, 'Permission denied'],
|
|
@@ -70,6 +71,10 @@ export const ChatReaction = Struct({
|
|
|
70
71
|
messageId: str,
|
|
71
72
|
emoji: str,
|
|
72
73
|
});
|
|
74
|
+
export const ChatCustomMessage = Struct({
|
|
75
|
+
messageType: str,
|
|
76
|
+
payload: Bytes(),
|
|
77
|
+
});
|
|
73
78
|
export const ChatMessageContent = Enum({
|
|
74
79
|
Text: str,
|
|
75
80
|
RichText: ChatRichText,
|
|
@@ -77,6 +82,7 @@ export const ChatMessageContent = Enum({
|
|
|
77
82
|
File: ChatFile,
|
|
78
83
|
Reaction: ChatReaction,
|
|
79
84
|
ReactionRemoved: ChatReaction,
|
|
85
|
+
Custom: ChatCustomMessage,
|
|
80
86
|
});
|
|
81
87
|
// sending message
|
|
82
88
|
export const ChatMessagePostingErr = ErrEnum('ChatMessagePostingErr', {
|
|
@@ -113,3 +119,6 @@ export const ReceivedChatAction = Struct({
|
|
|
113
119
|
});
|
|
114
120
|
export const ChatActionSubscribeV1_start = _void;
|
|
115
121
|
export const ChatActionSubscribeV1_receive = ReceivedChatAction;
|
|
122
|
+
// custom message rendering
|
|
123
|
+
export const ChatCustomMessageRenderingV1_start = Struct({ messageType: str, payload: Bytes() });
|
|
124
|
+
export const ChatCustomMessageRenderingV1_receive = CustomRendererNode;
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
import type { Codec, CodecType } from 'scale-ts';
|
|
2
|
+
import { _void } from 'scale-ts';
|
|
3
|
+
export declare const Size: Codec<number | bigint>;
|
|
4
|
+
export declare const Dimensions: Codec<[number | bigint, number | bigint, number | bigint | undefined, number | bigint | undefined]>;
|
|
5
|
+
export declare const TypographyStyle: Codec<"titleXL" | "headline" | "bodyM" | "bodyS" | "caption">;
|
|
6
|
+
export declare const ButtonVariant: Codec<"primary" | "secondary" | "text">;
|
|
7
|
+
export declare const ColorToken: Codec<"textPrimary" | "textSecondary" | "textTertiary" | "backgroundPrimary" | "backgroundSecondary" | "backgroundTertiary" | "success" | "error" | "warning">;
|
|
8
|
+
export declare const ContentAlignment: Codec<"topStart" | "topCenter" | "topEnd" | "centerStart" | "center" | "centerEnd" | "bottomStart" | "bottomCenter" | "bottomEnd">;
|
|
9
|
+
export declare const HorizontalAlignment: Codec<"center" | "start" | "end">;
|
|
10
|
+
export declare const VerticalAlignment: Codec<"center" | "top" | "bottom">;
|
|
11
|
+
export declare const Arrangement: Codec<"center" | "start" | "end" | "spaceBetween" | "spaceAround" | "spaceEvenly">;
|
|
12
|
+
export declare const Shape: Codec<{
|
|
13
|
+
tag: "Rounded";
|
|
14
|
+
value: number | bigint;
|
|
15
|
+
} | {
|
|
16
|
+
tag: "Circle";
|
|
17
|
+
value: undefined;
|
|
18
|
+
}>;
|
|
19
|
+
export declare const BorderStyle: Codec<{
|
|
20
|
+
width: number | bigint;
|
|
21
|
+
color: "textPrimary" | "textSecondary" | "textTertiary" | "backgroundPrimary" | "backgroundSecondary" | "backgroundTertiary" | "success" | "error" | "warning";
|
|
22
|
+
shape: {
|
|
23
|
+
tag: "Rounded";
|
|
24
|
+
value: number | bigint;
|
|
25
|
+
} | {
|
|
26
|
+
tag: "Circle";
|
|
27
|
+
value: undefined;
|
|
28
|
+
} | undefined;
|
|
29
|
+
}>;
|
|
30
|
+
export declare const Modifiers: Codec<{
|
|
31
|
+
margin: [number | bigint, number | bigint, number | bigint | undefined, number | bigint | undefined] | undefined;
|
|
32
|
+
padding: [number | bigint, number | bigint, number | bigint | undefined, number | bigint | undefined] | undefined;
|
|
33
|
+
background: {
|
|
34
|
+
color: "textPrimary" | "textSecondary" | "textTertiary" | "backgroundPrimary" | "backgroundSecondary" | "backgroundTertiary" | "success" | "error" | "warning";
|
|
35
|
+
shape: {
|
|
36
|
+
tag: "Rounded";
|
|
37
|
+
value: number | bigint;
|
|
38
|
+
} | {
|
|
39
|
+
tag: "Circle";
|
|
40
|
+
value: undefined;
|
|
41
|
+
} | undefined;
|
|
42
|
+
} | undefined;
|
|
43
|
+
border: {
|
|
44
|
+
width: number | bigint;
|
|
45
|
+
color: "textPrimary" | "textSecondary" | "textTertiary" | "backgroundPrimary" | "backgroundSecondary" | "backgroundTertiary" | "success" | "error" | "warning";
|
|
46
|
+
shape: {
|
|
47
|
+
tag: "Rounded";
|
|
48
|
+
value: number | bigint;
|
|
49
|
+
} | {
|
|
50
|
+
tag: "Circle";
|
|
51
|
+
value: undefined;
|
|
52
|
+
} | undefined;
|
|
53
|
+
} | undefined;
|
|
54
|
+
height: number | bigint | undefined;
|
|
55
|
+
width: number | bigint | undefined;
|
|
56
|
+
minWidth: number | bigint | undefined;
|
|
57
|
+
minHeight: number | bigint | undefined;
|
|
58
|
+
fillWidth: boolean | undefined;
|
|
59
|
+
fillHeight: boolean | undefined;
|
|
60
|
+
}>;
|
|
61
|
+
type EnumVariants<T> = {
|
|
62
|
+
[K in keyof T]: {
|
|
63
|
+
tag: K;
|
|
64
|
+
value: T[K];
|
|
65
|
+
};
|
|
66
|
+
}[keyof T];
|
|
67
|
+
type ComponentType<Props extends Codec<any>> = CodecType<ReturnType<typeof Component<Props>>>;
|
|
68
|
+
declare function Component<Props extends Codec<any>>(props: Props): Codec<{
|
|
69
|
+
modifiers: {
|
|
70
|
+
margin: [number | bigint, number | bigint, number | bigint | undefined, number | bigint | undefined] | undefined;
|
|
71
|
+
padding: [number | bigint, number | bigint, number | bigint | undefined, number | bigint | undefined] | undefined;
|
|
72
|
+
background: {
|
|
73
|
+
color: "textPrimary" | "textSecondary" | "textTertiary" | "backgroundPrimary" | "backgroundSecondary" | "backgroundTertiary" | "success" | "error" | "warning";
|
|
74
|
+
shape: {
|
|
75
|
+
tag: "Rounded";
|
|
76
|
+
value: number | bigint;
|
|
77
|
+
} | {
|
|
78
|
+
tag: "Circle";
|
|
79
|
+
value: undefined;
|
|
80
|
+
} | undefined;
|
|
81
|
+
} | undefined;
|
|
82
|
+
border: {
|
|
83
|
+
width: number | bigint;
|
|
84
|
+
color: "textPrimary" | "textSecondary" | "textTertiary" | "backgroundPrimary" | "backgroundSecondary" | "backgroundTertiary" | "success" | "error" | "warning";
|
|
85
|
+
shape: {
|
|
86
|
+
tag: "Rounded";
|
|
87
|
+
value: number | bigint;
|
|
88
|
+
} | {
|
|
89
|
+
tag: "Circle";
|
|
90
|
+
value: undefined;
|
|
91
|
+
} | undefined;
|
|
92
|
+
} | undefined;
|
|
93
|
+
height: number | bigint | undefined;
|
|
94
|
+
width: number | bigint | undefined;
|
|
95
|
+
minWidth: number | bigint | undefined;
|
|
96
|
+
minHeight: number | bigint | undefined;
|
|
97
|
+
fillWidth: boolean | undefined;
|
|
98
|
+
fillHeight: boolean | undefined;
|
|
99
|
+
} | undefined;
|
|
100
|
+
props: CodecType<Props>;
|
|
101
|
+
children: CustomRendererNodeType[];
|
|
102
|
+
}>;
|
|
103
|
+
export declare const BoxProps: Codec<{
|
|
104
|
+
contentAlignment: "topStart" | "topCenter" | "topEnd" | "centerStart" | "center" | "centerEnd" | "bottomStart" | "bottomCenter" | "bottomEnd" | undefined;
|
|
105
|
+
}>;
|
|
106
|
+
export declare const ColumnProps: Codec<{
|
|
107
|
+
horizontalAlignment: "center" | "start" | "end" | undefined;
|
|
108
|
+
verticalArrangement: "center" | "start" | "end" | "spaceBetween" | "spaceAround" | "spaceEvenly" | undefined;
|
|
109
|
+
}>;
|
|
110
|
+
export declare const RowProps: Codec<{
|
|
111
|
+
verticalAlignment: "center" | "top" | "bottom" | undefined;
|
|
112
|
+
horizontalArrangement: "center" | "start" | "end" | "spaceBetween" | "spaceAround" | "spaceEvenly" | undefined;
|
|
113
|
+
}>;
|
|
114
|
+
export declare const TextProps: Codec<{
|
|
115
|
+
style: "titleXL" | "headline" | "bodyM" | "bodyS" | "caption" | undefined;
|
|
116
|
+
color: "textPrimary" | "textSecondary" | "textTertiary" | "backgroundPrimary" | "backgroundSecondary" | "backgroundTertiary" | "success" | "error" | "warning" | undefined;
|
|
117
|
+
}>;
|
|
118
|
+
export declare const ButtonProps: Codec<{
|
|
119
|
+
variant: "primary" | "secondary" | "text" | undefined;
|
|
120
|
+
enabled: boolean | undefined;
|
|
121
|
+
loading: boolean | undefined;
|
|
122
|
+
clickAction: string | undefined;
|
|
123
|
+
}>;
|
|
124
|
+
export declare const TextFieldProps: Codec<{
|
|
125
|
+
value: string | undefined;
|
|
126
|
+
placeholder: string | undefined;
|
|
127
|
+
label: string | undefined;
|
|
128
|
+
enabled: boolean | undefined;
|
|
129
|
+
valueChangeAction: string | undefined;
|
|
130
|
+
}>;
|
|
131
|
+
export type CustomRendererNodeType = EnumVariants<{
|
|
132
|
+
Nil: undefined;
|
|
133
|
+
String: string;
|
|
134
|
+
Box: ComponentType<typeof BoxProps>;
|
|
135
|
+
Column: ComponentType<typeof ColumnProps>;
|
|
136
|
+
Row: ComponentType<typeof RowProps>;
|
|
137
|
+
Spacer: ComponentType<typeof _void>;
|
|
138
|
+
Text: ComponentType<typeof TextProps>;
|
|
139
|
+
Button: ComponentType<typeof ButtonProps>;
|
|
140
|
+
TextField: ComponentType<typeof TextFieldProps>;
|
|
141
|
+
}>;
|
|
142
|
+
export declare const CustomRendererNode: Codec<CustomRendererNodeType>;
|
|
143
|
+
export {};
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { Enum, Status, lazy } from '@novasamatech/scale';
|
|
2
|
+
import { Option, Struct, Tuple, Vector, _void, bool, compact, str } from 'scale-ts';
|
|
3
|
+
export const Size = compact;
|
|
4
|
+
export const Dimensions = Tuple(Size, Size, Option(Size), Option(Size));
|
|
5
|
+
export const TypographyStyle = Status('titleXL', 'headline', 'bodyM', 'bodyS', 'caption');
|
|
6
|
+
export const ButtonVariant = Status('primary', 'secondary', 'text');
|
|
7
|
+
export const ColorToken = Status('textPrimary', 'textSecondary', 'textTertiary', 'backgroundPrimary', 'backgroundSecondary', 'backgroundTertiary', 'success', 'error', 'warning');
|
|
8
|
+
export const ContentAlignment = Status('topStart', 'topCenter', 'topEnd', 'centerStart', 'center', 'centerEnd', 'bottomStart', 'bottomCenter', 'bottomEnd');
|
|
9
|
+
export const HorizontalAlignment = Status('start', 'center', 'end');
|
|
10
|
+
export const VerticalAlignment = Status('top', 'center', 'bottom');
|
|
11
|
+
export const Arrangement = Status('start', 'end', 'center', 'spaceBetween', 'spaceAround', 'spaceEvenly');
|
|
12
|
+
export const Shape = Enum({
|
|
13
|
+
Rounded: Size,
|
|
14
|
+
Circle: _void,
|
|
15
|
+
});
|
|
16
|
+
export const BorderStyle = Struct({
|
|
17
|
+
width: Size,
|
|
18
|
+
color: ColorToken,
|
|
19
|
+
shape: Option(Shape),
|
|
20
|
+
});
|
|
21
|
+
export const Modifiers = Struct({
|
|
22
|
+
margin: Option(Dimensions),
|
|
23
|
+
padding: Option(Dimensions),
|
|
24
|
+
background: Option(Struct({
|
|
25
|
+
color: ColorToken,
|
|
26
|
+
shape: Option(Shape),
|
|
27
|
+
})),
|
|
28
|
+
border: Option(BorderStyle),
|
|
29
|
+
height: Option(Size),
|
|
30
|
+
width: Option(Size),
|
|
31
|
+
minWidth: Option(Size),
|
|
32
|
+
minHeight: Option(Size),
|
|
33
|
+
fillWidth: Option(bool),
|
|
34
|
+
fillHeight: Option(bool),
|
|
35
|
+
});
|
|
36
|
+
const Children = lazy(() => CustomRendererNode);
|
|
37
|
+
function Component(props) {
|
|
38
|
+
return Struct({
|
|
39
|
+
modifiers: Option(Modifiers),
|
|
40
|
+
props: props,
|
|
41
|
+
children: Vector(Children),
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
export const BoxProps = Struct({
|
|
45
|
+
contentAlignment: Option(ContentAlignment),
|
|
46
|
+
});
|
|
47
|
+
export const ColumnProps = Struct({
|
|
48
|
+
horizontalAlignment: Option(HorizontalAlignment),
|
|
49
|
+
verticalArrangement: Option(Arrangement),
|
|
50
|
+
});
|
|
51
|
+
export const RowProps = Struct({
|
|
52
|
+
verticalAlignment: Option(VerticalAlignment),
|
|
53
|
+
horizontalArrangement: Option(Arrangement),
|
|
54
|
+
});
|
|
55
|
+
export const TextProps = Struct({
|
|
56
|
+
style: Option(TypographyStyle),
|
|
57
|
+
color: Option(ColorToken),
|
|
58
|
+
});
|
|
59
|
+
export const ButtonProps = Struct({
|
|
60
|
+
variant: Option(ButtonVariant),
|
|
61
|
+
enabled: Option(bool),
|
|
62
|
+
loading: Option(bool),
|
|
63
|
+
clickAction: Option(str),
|
|
64
|
+
});
|
|
65
|
+
export const TextFieldProps = Struct({
|
|
66
|
+
value: Option(str),
|
|
67
|
+
placeholder: Option(str),
|
|
68
|
+
label: Option(str),
|
|
69
|
+
enabled: Option(bool),
|
|
70
|
+
valueChangeAction: Option(str),
|
|
71
|
+
});
|
|
72
|
+
export const CustomRendererNode = Enum({
|
|
73
|
+
Nil: _void,
|
|
74
|
+
String: str,
|
|
75
|
+
Box: Component(BoxProps),
|
|
76
|
+
Column: Component(ColumnProps),
|
|
77
|
+
Row: Component(RowProps),
|
|
78
|
+
Spacer: Component(_void),
|
|
79
|
+
Text: Component(TextProps),
|
|
80
|
+
Button: Component(ButtonProps),
|
|
81
|
+
TextField: Component(TextFieldProps),
|
|
82
|
+
});
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare const DevicePermissionRequest: import("scale-ts").Codec<"Camera" | "Microphone" | "Bluetooth" | "Location">;
|
|
2
|
+
export declare const DevicePermissionV1_request: import("scale-ts").Codec<"Camera" | "Microphone" | "Bluetooth" | "Location">;
|
|
3
|
+
export declare const DevicePermissionV1_response: import("scale-ts").Codec<import("scale-ts").ResultPayload<boolean, import("@novasamatech/scale").CodecError<{
|
|
4
|
+
reason: string;
|
|
5
|
+
}, "GenericError">>>;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { Status } from '@novasamatech/scale';
|
|
2
|
+
import { Result, bool } from 'scale-ts';
|
|
3
|
+
import { GenericError } from '../commonCodecs.js';
|
|
4
|
+
export const DevicePermissionRequest = Status('Camera', 'Microphone', 'Bluetooth', 'Location');
|
|
5
|
+
export const DevicePermissionV1_request = DevicePermissionRequest;
|
|
6
|
+
export const DevicePermissionV1_response = Result(bool, GenericError);
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
export declare const StorageErr: [import("scale-ts").Encoder<import("@novasamatech/scale").CodecError<{
|
|
2
|
+
reason: string;
|
|
3
|
+
}, "StorageErr::Unknown"> | import("@novasamatech/scale").CodecError<undefined, "StorageErr::Full">>, import("scale-ts").Decoder<import("@novasamatech/scale").CodecError<{
|
|
4
|
+
reason: string;
|
|
5
|
+
}, "StorageErr::Unknown"> | import("@novasamatech/scale").CodecError<undefined, "StorageErr::Full">>] & {
|
|
6
|
+
enc: import("scale-ts").Encoder<import("@novasamatech/scale").CodecError<{
|
|
7
|
+
reason: string;
|
|
8
|
+
}, "StorageErr::Unknown"> | import("@novasamatech/scale").CodecError<undefined, "StorageErr::Full">>;
|
|
9
|
+
dec: import("scale-ts").Decoder<import("@novasamatech/scale").CodecError<{
|
|
10
|
+
reason: string;
|
|
11
|
+
}, "StorageErr::Unknown"> | import("@novasamatech/scale").CodecError<undefined, "StorageErr::Full">>;
|
|
12
|
+
} & {
|
|
13
|
+
readonly Full: import("@novasamatech/scale").ErrCodec<undefined, "StorageErr::Full">;
|
|
14
|
+
readonly Unknown: import("@novasamatech/scale").ErrCodec<{
|
|
15
|
+
reason: string;
|
|
16
|
+
}, "StorageErr::Unknown">;
|
|
17
|
+
};
|
|
18
|
+
export declare const StorageKey: import("scale-ts").Codec<string>;
|
|
19
|
+
export declare const StorageValue: import("scale-ts").Codec<Uint8Array<ArrayBufferLike>>;
|
|
20
|
+
export declare const StorageReadV1_request: import("scale-ts").Codec<string>;
|
|
21
|
+
export declare const StorageReadV1_response: import("scale-ts").Codec<import("scale-ts").ResultPayload<Uint8Array<ArrayBufferLike> | undefined, import("@novasamatech/scale").CodecError<{
|
|
22
|
+
reason: string;
|
|
23
|
+
}, "StorageErr::Unknown"> | import("@novasamatech/scale").CodecError<undefined, "StorageErr::Full">>>;
|
|
24
|
+
export declare const StorageWriteV1_request: import("scale-ts").Codec<[string, Uint8Array<ArrayBufferLike>]>;
|
|
25
|
+
export declare const StorageWriteV1_response: import("scale-ts").Codec<import("scale-ts").ResultPayload<undefined, import("@novasamatech/scale").CodecError<{
|
|
26
|
+
reason: string;
|
|
27
|
+
}, "StorageErr::Unknown"> | import("@novasamatech/scale").CodecError<undefined, "StorageErr::Full">>>;
|
|
28
|
+
export declare const StorageClearV1_request: import("scale-ts").Codec<string>;
|
|
29
|
+
export declare const StorageClearV1_response: import("scale-ts").Codec<import("scale-ts").ResultPayload<undefined, import("@novasamatech/scale").CodecError<{
|
|
30
|
+
reason: string;
|
|
31
|
+
}, "StorageErr::Unknown"> | import("@novasamatech/scale").CodecError<undefined, "StorageErr::Full">>>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { ErrEnum } from '@novasamatech/scale';
|
|
2
|
+
import { Bytes, Option, Result, Tuple, _void, str } from 'scale-ts';
|
|
3
|
+
import { GenericErr } from '../commonCodecs.js';
|
|
4
|
+
// common structures
|
|
5
|
+
export const StorageErr = ErrEnum('StorageErr', {
|
|
6
|
+
Full: [_void, 'Storage is full'],
|
|
7
|
+
Unknown: [GenericErr, 'Unknown storage error'],
|
|
8
|
+
});
|
|
9
|
+
export const StorageKey = str;
|
|
10
|
+
export const StorageValue = Bytes();
|
|
11
|
+
// actions
|
|
12
|
+
export const StorageReadV1_request = StorageKey;
|
|
13
|
+
export const StorageReadV1_response = Result(Option(StorageValue), StorageErr);
|
|
14
|
+
export const StorageWriteV1_request = Tuple(StorageKey, StorageValue);
|
|
15
|
+
export const StorageWriteV1_response = Result(_void, StorageErr);
|
|
16
|
+
export const StorageClearV1_request = StorageKey;
|
|
17
|
+
export const StorageClearV1_response = Result(_void, StorageErr);
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export declare const NavigateToErr: [import("scale-ts").Encoder<import("@novasamatech/scale").CodecError<{
|
|
2
|
+
reason: string;
|
|
3
|
+
}, "NavigateToErr::Unknown"> | import("@novasamatech/scale").CodecError<undefined, "NavigateToErr::PermissionDenied">>, import("scale-ts").Decoder<import("@novasamatech/scale").CodecError<{
|
|
4
|
+
reason: string;
|
|
5
|
+
}, "NavigateToErr::Unknown"> | import("@novasamatech/scale").CodecError<undefined, "NavigateToErr::PermissionDenied">>] & {
|
|
6
|
+
enc: import("scale-ts").Encoder<import("@novasamatech/scale").CodecError<{
|
|
7
|
+
reason: string;
|
|
8
|
+
}, "NavigateToErr::Unknown"> | import("@novasamatech/scale").CodecError<undefined, "NavigateToErr::PermissionDenied">>;
|
|
9
|
+
dec: import("scale-ts").Decoder<import("@novasamatech/scale").CodecError<{
|
|
10
|
+
reason: string;
|
|
11
|
+
}, "NavigateToErr::Unknown"> | import("@novasamatech/scale").CodecError<undefined, "NavigateToErr::PermissionDenied">>;
|
|
12
|
+
} & {
|
|
13
|
+
readonly PermissionDenied: import("@novasamatech/scale").ErrCodec<undefined, "NavigateToErr::PermissionDenied">;
|
|
14
|
+
readonly Unknown: import("@novasamatech/scale").ErrCodec<{
|
|
15
|
+
reason: string;
|
|
16
|
+
}, "NavigateToErr::Unknown">;
|
|
17
|
+
};
|
|
18
|
+
export declare const NavigateToV1_request: import("scale-ts").Codec<string>;
|
|
19
|
+
export declare const NavigateToV1_response: import("scale-ts").Codec<import("scale-ts").ResultPayload<undefined, import("@novasamatech/scale").CodecError<{
|
|
20
|
+
reason: string;
|
|
21
|
+
}, "NavigateToErr::Unknown"> | import("@novasamatech/scale").CodecError<undefined, "NavigateToErr::PermissionDenied">>>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ErrEnum } from '@novasamatech/scale';
|
|
2
|
+
import { Result, _void, str } from 'scale-ts';
|
|
3
|
+
import { GenericErr } from '../commonCodecs.js';
|
|
4
|
+
export const NavigateToErr = ErrEnum('NavigateToErr', {
|
|
5
|
+
PermissionDenied: [_void, 'Permission denied'],
|
|
6
|
+
Unknown: [GenericErr, 'Unknown error'],
|
|
7
|
+
});
|
|
8
|
+
export const NavigateToV1_request = str;
|
|
9
|
+
export const NavigateToV1_response = Result(_void, NavigateToErr);
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export declare const PushNotification: import("scale-ts").Codec<{
|
|
2
|
+
text: string;
|
|
3
|
+
deeplink: string | undefined;
|
|
4
|
+
}>;
|
|
5
|
+
export declare const PushNotificationV1_request: import("scale-ts").Codec<{
|
|
6
|
+
text: string;
|
|
7
|
+
deeplink: string | undefined;
|
|
8
|
+
}>;
|
|
9
|
+
export declare const PushNotificationV1_response: import("scale-ts").Codec<import("scale-ts").ResultPayload<undefined, import("packages/scale/dist/err.js").CodecError<{
|
|
10
|
+
reason: string;
|
|
11
|
+
}, "GenericError">>>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Option, Result, Struct, _void, str } from 'scale-ts';
|
|
2
|
+
import { GenericError } from '../commonCodecs.js';
|
|
3
|
+
export const PushNotification = Struct({
|
|
4
|
+
text: str,
|
|
5
|
+
deeplink: Option(str),
|
|
6
|
+
});
|
|
7
|
+
export const PushNotificationV1_request = PushNotification;
|
|
8
|
+
export const PushNotificationV1_response = Result(_void, GenericError);
|