@lemoncloud/chatic-apps-sdk 0.1.0 → 0.3.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/mock.d.cts CHANGED
@@ -3,7 +3,7 @@ declare type ChaticAppsContext = {
3
3
  /** The protocol major the app speaks. */
4
4
  protocolVersion: 1;
5
5
  viewId: string;
6
- platform: 'ios' | 'android';
6
+ platform: 'ios' | 'android' | 'desktop';
7
7
  /** The app's own version. */
8
8
  appVersion: string;
9
9
  /** The language the user chose in the app (`ko`, `en`). */
@@ -16,11 +16,1139 @@ declare type ChaticAppsContext = {
16
16
  };
17
17
  /** The link that opens this page in the app; absent from older apps. */
18
18
  appLink?: string;
19
+ /** The display the app shows the page in; absent from older apps and the desktop. */
20
+ display?: Display;
21
+ /**
22
+ * How far the system bars reach into the page, in CSS pixels; 0 on every edge unless `immersive`.
23
+ * Absent from older apps and the desktop: read `--chatic-safe-area-inset-*`, then `env()`. A change —
24
+ * a rotation — arrives through `onContextChange`.
25
+ */
26
+ safeArea?: SafeArea;
19
27
  };
20
28
 
21
29
  /** What the user did to ask for the close: the app's close control, or Android back. */
22
30
  declare type CloseTrigger = 'control' | 'back';
23
31
 
32
+ /** Account detail: the account a cloud is linked to, as the account server names it. */
33
+ declare interface CloudAccountHead {
34
+ id?: string;
35
+ name?: string;
36
+ stereo?: '' | 'hash' | 'email' | 'business' | 'code' | 'device' | '#alias' | 'iid' | 'login' | 'phone' | 'social' | 'session';
37
+ openId?: string;
38
+ }
39
+
40
+ /**
41
+ * A user as the account server embeds one (a place's `owner$`) — not the chat server's user. Most of it
42
+ * is contact and account detail. The type lists every field the account server's view can have; which
43
+ * of them a given answer fills is the server's choice, and the app passes on what it got. Fields named
44
+ * after a secret (`loginPw`, `otp$`, `key$`) are not something a page should ever read, keep or send.
45
+ */
46
+ declare interface CloudAccountUserView {
47
+ id: string;
48
+ createdAt?: number;
49
+ updatedAt?: number;
50
+ deletedAt?: number;
51
+ error?: string;
52
+ $?: CloudCores;
53
+ role?: string;
54
+ stereo?: '' | '#alias' | 'session' | 'user' | '#code' | 'admin' | 'dummy';
55
+ alias$?: CloudAlias;
56
+ name?: string;
57
+ aliasId?: string;
58
+ alias?: string;
59
+ code?: string;
60
+ ns?: string;
61
+ type?: 'host' | 'site' | 'account' | 'user' | 'group' | 'role' | 'auth' | 'invite';
62
+ sid?: string;
63
+ uid?: string;
64
+ gid?: string;
65
+ lock?: number;
66
+ next?: number;
67
+ meta?: unknown;
68
+ _id?: string;
69
+ nick?: string;
70
+ photo?: string;
71
+ /** Contact detail. */
72
+ phone?: string;
73
+ text?: string;
74
+ /** Personal detail. */
75
+ gender?: '' | 'male' | 'female';
76
+ /** Personal detail. */
77
+ birth?: string;
78
+ /** Contact detail. */
79
+ address?: CloudAddress;
80
+ /** Contact detail. */
81
+ email?: string;
82
+ aliasType?: string;
83
+ siteId?: string;
84
+ site$?: {
85
+ id?: string;
86
+ name?: string;
87
+ };
88
+ loginType?: string;
89
+ /** Account detail: the sign-in id. */
90
+ loginId?: string;
91
+ /** Named after a secret. Never read, keep or send it. */
92
+ loginPw?: string;
93
+ identityId?: string;
94
+ lastAuthId?: string;
95
+ /** When the user agreed to each term, in epoch ms, by the term's name: `service`, `privacy`, `privacy3rd`, … */
96
+ agree$?: {
97
+ [term: string]: number;
98
+ };
99
+ parent?: string;
100
+ childs?: string[];
101
+ otpSentCount?: number;
102
+ otpSentDay?: string;
103
+ inviteNo?: number;
104
+ accountId?: string;
105
+ roles?: string[];
106
+ /** Account detail. */
107
+ $account?: CloudAccountView;
108
+ /** Account detail: the sign-in methods linked to the account. */
109
+ link$?: {
110
+ phone?: CloudLinkedAccount;
111
+ email?: CloudLinkedAccount;
112
+ social?: CloudLinkedAccount;
113
+ };
114
+ }
115
+
116
+ /** An account as the account server has it. Contact and account detail throughout. */
117
+ declare interface CloudAccountView {
118
+ id?: string;
119
+ isPushNotice?: boolean;
120
+ isPushCommunity?: boolean;
121
+ isPushMarketing?: boolean;
122
+ createdAt?: number;
123
+ updatedAt?: number;
124
+ deletedAt?: number;
125
+ error?: string;
126
+ $?: CloudCores;
127
+ group?: string;
128
+ stereo?: '' | '#alias' | 'session' | 'code' | 'phone' | 'email' | 'business' | 'device' | 'hash' | 'iid' | 'login' | 'social';
129
+ name?: string;
130
+ aliasId?: string;
131
+ ns?: string;
132
+ type?: 'host' | 'site' | 'account' | 'user' | 'group' | 'role' | 'auth' | 'invite';
133
+ sid?: string;
134
+ uid?: string;
135
+ gid?: string;
136
+ lock?: number;
137
+ next?: number;
138
+ meta?: unknown;
139
+ _id?: string;
140
+ nick?: string;
141
+ photo?: string;
142
+ phone?: string;
143
+ email?: string;
144
+ identityId?: string;
145
+ otpSentCount?: number;
146
+ otpSentDay?: string;
147
+ accountId?: string;
148
+ kind?: string;
149
+ hint?: string;
150
+ verifiedAt?: number;
151
+ /** Named after a secret (a one-time code). Never read, keep or send it. */
152
+ otp$?: {
153
+ code?: string;
154
+ expiredAt?: number;
155
+ hash?: string;
156
+ sentAt?: number;
157
+ };
158
+ otpTryCount?: number;
159
+ openId?: string;
160
+ /** Named after a secret (an account key). Never read, keep or send it. */
161
+ key$?: {
162
+ _id: string;
163
+ key: string;
164
+ len: string;
165
+ prefix: string;
166
+ alias?: string;
167
+ };
168
+ userId?: string;
169
+ identityPoolId?: string;
170
+ accountNo?: string;
171
+ }
172
+
173
+ declare interface CloudAddress {
174
+ addrPost?: string;
175
+ addrStreet?: string;
176
+ addrDetail?: string;
177
+ addrExtra?: string;
178
+ }
179
+
180
+ /** An alias a record is also known by. */
181
+ declare interface CloudAlias {
182
+ type?: string;
183
+ alias?: string;
184
+ }
185
+
186
+ /** When the device cache last filled a row and when it stops trusting it, in epoch ms. */
187
+ declare interface CloudCacheMeta {
188
+ lastSyncedAt: number;
189
+ expiresAt: number;
190
+ }
191
+
192
+ /** A room (`channel`), as the device cache holds it. */
193
+ declare interface CloudChannel {
194
+ id: string;
195
+ /** The cloud the row belongs to. */
196
+ cid: string;
197
+ /** The place the room is in. */
198
+ sid: string;
199
+ isNotificationEnabled: boolean;
200
+ createdAt?: number;
201
+ updatedAt?: number;
202
+ deletedAt?: number;
203
+ error?: string;
204
+ $?: CloudCores;
205
+ /** `dm` a one-to-one room, `self` the user's own notes room. */
206
+ stereo?: '' | 'public' | 'private' | 'dm' | 'self';
207
+ name?: string;
208
+ desc?: string;
209
+ inviteRule?: '' | 'owner' | 'all';
210
+ thumbnail?: string;
211
+ memberNo?: number;
212
+ memberIds?: string[];
213
+ /** The room's latest message number. */
214
+ chatNo?: number;
215
+ /** How many of its numbers are not people's messages (joins, edits, reactions). */
216
+ metaNo?: number;
217
+ ownerId?: string;
218
+ ns?: string;
219
+ type?: 'channel' | 'chat' | 'join';
220
+ uid?: string;
221
+ gid?: string;
222
+ lock?: number;
223
+ next?: number;
224
+ meta?: unknown;
225
+ _id?: string;
226
+ openFeed?: boolean;
227
+ unreadCount?: number;
228
+ owner$?: CloudUserView;
229
+ lastChat$?: CloudChatView;
230
+ /** The user's own join of the room. */
231
+ $join?: CloudJoinView;
232
+ $joins?: CloudJoinView[];
233
+ /** Not filled by anything today. */
234
+ lastActivityAt?: number;
235
+ __cacheMeta?: CloudCacheMeta;
236
+ }
237
+
238
+ /** Which rooms: the place's (`sid`), one page of them. */
239
+ declare interface CloudChannelListQuery {
240
+ sid?: string;
241
+ page?: number;
242
+ limit?: number;
243
+ detail?: boolean;
244
+ hasSite?: boolean;
245
+ }
246
+
247
+ /** A room as the server embeds one. */
248
+ declare interface CloudChannelView {
249
+ id?: string;
250
+ createdAt?: number;
251
+ updatedAt?: number;
252
+ deletedAt?: number;
253
+ error?: string;
254
+ $?: CloudCores;
255
+ stereo?: '' | 'public' | 'private' | 'dm' | 'self';
256
+ chatNo?: number;
257
+ metaNo?: number;
258
+ memberNo?: number;
259
+ ownerId?: string;
260
+ ns?: string;
261
+ type?: 'channel' | 'chat' | 'join';
262
+ sid?: string;
263
+ uid?: string;
264
+ gid?: string;
265
+ lock?: number;
266
+ next?: number;
267
+ meta?: unknown;
268
+ _id?: string;
269
+ cid?: string;
270
+ name?: string;
271
+ thumbnail?: string;
272
+ desc?: string;
273
+ inviteRule?: '' | 'owner' | 'all';
274
+ memberIds?: string[];
275
+ openFeed?: boolean;
276
+ unreadCount?: number;
277
+ owner$?: CloudUserView;
278
+ lastChat$?: CloudChatView;
279
+ $join?: CloudJoinView;
280
+ $joins?: CloudJoinView[];
281
+ }
282
+
283
+ /** A message (`chat`), as the device cache holds it. */
284
+ declare interface CloudChat {
285
+ id: string;
286
+ cid: string;
287
+ channelId: string;
288
+ /** Its number in the room; `0` while it is still being sent. */
289
+ chatNo: number;
290
+ /** Still on its way to the server. */
291
+ isPending: boolean;
292
+ /** Its send failed on this device. */
293
+ isFailed: boolean;
294
+ createdAtMs: number;
295
+ updatedAtMs: number;
296
+ createdAt?: number;
297
+ updatedAt?: number;
298
+ deletedAt?: number;
299
+ error?: string;
300
+ $?: CloudCores;
301
+ stereo?: '' | 'user' | 'system' | 'webhook';
302
+ subType?: '' | 'join' | 'leave' | 'reaction' | 'edit';
303
+ contentType?: string;
304
+ content?: string;
305
+ memberNo?: number;
306
+ metaNo?: number;
307
+ ownerId?: string;
308
+ readCount?: number;
309
+ editedAt?: number;
310
+ parentId?: string;
311
+ hidden?: boolean;
312
+ uploadIds?: string[];
313
+ ns?: string;
314
+ type?: 'channel' | 'chat' | 'join';
315
+ sid?: string;
316
+ uid?: string;
317
+ gid?: string;
318
+ lock?: number;
319
+ next?: number;
320
+ meta?: unknown;
321
+ _id?: string;
322
+ owner$?: CloudUserView;
323
+ channel$?: CloudChannelView;
324
+ parent$?: CloudChatView;
325
+ mention$?: CloudChatMention;
326
+ reaction$?: CloudChatReaction;
327
+ edit$?: CloudChatEdit;
328
+ attach$?: CloudChatAttachment;
329
+ blocks$?: CloudChatBlock[];
330
+ source$?: CloudChatSource;
331
+ /** The server's files once sent; this device's pending slots while it is still sending. */
332
+ upload$$?: (CloudUpload | CloudPendingUpload)[];
333
+ tempId?: string;
334
+ /** Hidden by this device because a page of the feed left it out, not by a delete. */
335
+ hiddenByFeed?: boolean;
336
+ mediaEntries?: CloudChatMediaEntry[];
337
+ mediaEntriesVersion?: number;
338
+ __cacheMeta?: CloudCacheMeta;
339
+ }
340
+
341
+ /** An attachment card, as a webhook posts one. */
342
+ declare interface CloudChatAttachment {
343
+ pretext?: string;
344
+ title?: string;
345
+ text?: string;
346
+ color?: string;
347
+ username?: string;
348
+ ts?: number;
349
+ footer?: string;
350
+ sourceUrl?: string;
351
+ fields?: {
352
+ title?: string;
353
+ value: string | number;
354
+ }[];
355
+ channel?: string;
356
+ }
357
+
358
+ /** One block of a message laid out in blocks, as a webhook posts one. */
359
+ declare type CloudChatBlock = {
360
+ type: 'header';
361
+ text: CloudChatBlockText;
362
+ } | {
363
+ type: 'section';
364
+ text?: CloudChatBlockText;
365
+ fields?: CloudChatBlockText[];
366
+ } | {
367
+ type: 'divider';
368
+ } | {
369
+ type: 'context';
370
+ elements: CloudChatBlockText[];
371
+ };
372
+
373
+ declare interface CloudChatBlockText {
374
+ type: 'mrkdwn' | 'plain_text';
375
+ text: string;
376
+ }
377
+
378
+ /** On an `edit` message: the message it changed. */
379
+ declare interface CloudChatEdit {
380
+ action: 'update' | 'delete';
381
+ chatId: string;
382
+ hash?: string;
383
+ }
384
+
385
+ /** One room's messages, `limit` of them below `cursorNo` (from the newest when absent). */
386
+ declare interface CloudChatFeedQuery {
387
+ channelId: string;
388
+ cursorNo?: number;
389
+ limit?: number;
390
+ }
391
+
392
+ /** One entry of a message's media index: an attachment or a link it carries. */
393
+ declare interface CloudChatMediaEntry {
394
+ kind: 'image' | 'video' | 'file' | 'audio' | 'link';
395
+ idx: number;
396
+ /** An attachment's upload id, or a link's URL. */
397
+ ref: string;
398
+ }
399
+
400
+ /** Who a message mentions. */
401
+ declare interface CloudChatMention {
402
+ userIds?: string[];
403
+ all?: boolean;
404
+ }
405
+
406
+ /** What `chat.observeFeedCoverage` and others mean by a `[low, high]` range of message numbers. */
407
+ declare type CloudChatNumberRange = readonly [low: number, high: number];
408
+
409
+ /** `CloudChatFeedQuery`, and whether messages still being sent are listed too. */
410
+ declare interface CloudChatObserveQuery extends CloudChatFeedQuery {
411
+ includeUnsent?: boolean;
412
+ }
413
+
414
+ /** On a `reaction` message: the reaction it records. */
415
+ declare interface CloudChatReaction {
416
+ action?: string;
417
+ emoji?: string;
418
+ chatId?: string;
419
+ }
420
+
421
+ /** Where a webhook message came from. */
422
+ declare interface CloudChatSource {
423
+ key?: string;
424
+ url?: string;
425
+ color?: string;
426
+ }
427
+
428
+ /** A message as the server embeds one. */
429
+ declare interface CloudChatView {
430
+ id?: string;
431
+ createdAt?: number;
432
+ updatedAt?: number;
433
+ deletedAt?: number;
434
+ error?: string;
435
+ $?: CloudCores;
436
+ stereo?: '' | 'user' | 'webhook' | 'system';
437
+ subType?: '' | 'join' | 'leave' | 'reaction' | 'edit';
438
+ contentType?: string;
439
+ content?: string;
440
+ chatNo?: number;
441
+ metaNo?: number;
442
+ readCount?: number;
443
+ memberNo?: number;
444
+ editedAt?: number;
445
+ parentId?: string;
446
+ channelId?: string;
447
+ ownerId?: string;
448
+ uploadIds?: string[];
449
+ ns?: string;
450
+ type?: 'channel' | 'chat' | 'join';
451
+ sid?: string;
452
+ uid?: string;
453
+ gid?: string;
454
+ lock?: number;
455
+ next?: number;
456
+ meta?: unknown;
457
+ _id?: string;
458
+ cid?: string;
459
+ hidden?: boolean;
460
+ mention$?: CloudChatMention;
461
+ owner$?: CloudUserView;
462
+ channel$?: CloudChannelView;
463
+ parent$?: CloudChatView;
464
+ upload$$?: CloudUpload[];
465
+ reaction$?: CloudChatReaction;
466
+ edit$?: CloudChatEdit;
467
+ attach$?: CloudChatAttachment;
468
+ blocks$?: CloudChatBlock[];
469
+ source$?: CloudChatSource;
470
+ }
471
+
472
+ /**
473
+ * What `apps.data` reads, typed: every method the app opens to a page, under the name the
474
+ * app gives it, with its arguments and what it answers. The rows are the app's own rows, field for
475
+ * field — this library does not rename, reshape or filter them.
476
+ *
477
+ * Declared here rather than imported: the app's types live in private packages a published library
478
+ * cannot point at. The app's contract tests hold each declaration to the app's real one, so a field the
479
+ * app adds, drops or retypes fails there before a page meets it.
480
+ *
481
+ * About the fields:
482
+ * - A field marked optional is there only when the server or the app filled it. Most of a row is
483
+ * optional, because the same row is filled from different answers over time; read each with a
484
+ * fallback.
485
+ * - Some fields are contact or account details — an email, an account number, a login id. The app
486
+ * hands them over exactly as its own screens read them. Use them only where the page needs them, keep
487
+ * them on the device, and say so to the user if they leave it: what a page does with what it read is
488
+ * its author's responsibility.
489
+ * - `meta` is whatever the server keeps beside a record, in no fixed shape.
490
+ * - A type ending in `View` (`CloudUserView`, `CloudChatView`, …) is a record as the server embeds it
491
+ * inside another row — every field optional — not the row a read answers (`CloudUser`, `CloudChat`).
492
+ */
493
+ /** A server record's owner ids, as the server stamps them. */
494
+ declare interface CloudCores {
495
+ sid?: string;
496
+ uid?: string;
497
+ gid?: string;
498
+ }
499
+
500
+ /** The current cloud's row. Much of it is account and billing detail: read only what the page needs. */
501
+ declare interface CloudInfo {
502
+ id: string;
503
+ cid: string;
504
+ name?: string;
505
+ /** Service detail: the cloud's server address. */
506
+ backend?: string;
507
+ /** Service detail: the cloud's socket address. */
508
+ wss?: string;
509
+ /** `owner` a cloud the user owns, `invited` one they joined. */
510
+ cloudType?: 'invited' | 'owner';
511
+ /** Account detail: the device user ids that accepted an invite into this cloud. */
512
+ acceptedBy?: string[];
513
+ /** Service detail: the cloud's server endpoints. */
514
+ $envs?: CloudServiceEndpoints;
515
+ createdAt?: number;
516
+ updatedAt?: number;
517
+ deletedAt?: number;
518
+ error?: string;
519
+ $?: CloudCores;
520
+ owner$?: {
521
+ id?: string;
522
+ name?: string;
523
+ };
524
+ stereo?: '' | '#alias' | '#root';
525
+ ownerId?: string;
526
+ ns?: string;
527
+ type?: 'cloud' | 'membership' | 'product';
528
+ sid?: string;
529
+ uid?: string;
530
+ gid?: string;
531
+ lock?: number;
532
+ next?: number;
533
+ meta?: unknown;
534
+ _id?: string;
535
+ /** Contact detail: the cloud's email address. */
536
+ email?: string;
537
+ /** Account detail. */
538
+ accountId?: string;
539
+ /** Account detail. */
540
+ account$?: CloudAccountHead;
541
+ aliasId?: string;
542
+ alias$?: CloudAlias;
543
+ /** Billing detail. */
544
+ subscriptionId?: string;
545
+ status?: 'error' | 'init' | 'reserved' | 'active' | 'suspended' | 'expired';
546
+ expiresAt?: number;
547
+ assignedAt?: number;
548
+ activedAt?: number;
549
+ /** Account detail: the cloud's account number. */
550
+ accountNo?: string;
551
+ region?: string;
552
+ stage?: string;
553
+ cloudNo?: number;
554
+ state$?: CloudState;
555
+ suspendedAt?: number;
556
+ plannedAt?: number;
557
+ suspendReason?: 'expired' | 'downgrade' | 'cancel' | 'release';
558
+ retainUntil?: number;
559
+ releasedAt?: number;
560
+ enqueueId?: string;
561
+ workspaceId?: string;
562
+ slotId?: string;
563
+ __cacheMeta?: CloudCacheMeta;
564
+ }
565
+
566
+ /** A user's membership of a room (`join`): their role, read position and notification setting. */
567
+ declare interface CloudJoin {
568
+ id: string;
569
+ cid: string;
570
+ channelId: string;
571
+ userId: string;
572
+ joined: number;
573
+ /** The last message number this member has read. */
574
+ readNo: number;
575
+ createdAt?: number;
576
+ updatedAt?: number;
577
+ deletedAt?: number;
578
+ error?: string;
579
+ $?: CloudCores;
580
+ stereo?: '' | 'owner' | 'admin' | 'member';
581
+ chatNo?: number;
582
+ metaNo?: number;
583
+ ns?: string;
584
+ type?: 'channel' | 'chat' | 'join';
585
+ sid?: string;
586
+ uid?: string;
587
+ gid?: string;
588
+ lock?: number;
589
+ next?: number;
590
+ meta?: unknown;
591
+ _id?: string;
592
+ joinedNo?: number;
593
+ nick?: string;
594
+ role?: string;
595
+ notify?: '' | 'all' | 'mention' | 'none';
596
+ reason?: string;
597
+ __cacheMeta?: CloudCacheMeta;
598
+ }
599
+
600
+ /** Which joins: one room's, or only active ones. */
601
+ declare interface CloudJoinListQuery {
602
+ channelId?: string;
603
+ activeOnly?: boolean;
604
+ }
605
+
606
+ /** A join (a user's membership of a room) as the server embeds one. */
607
+ declare interface CloudJoinView {
608
+ id?: string;
609
+ createdAt?: number;
610
+ updatedAt?: number;
611
+ deletedAt?: number;
612
+ error?: string;
613
+ $?: CloudCores;
614
+ stereo?: '' | 'admin' | 'owner' | 'member';
615
+ chatNo?: number;
616
+ metaNo?: number;
617
+ channelId?: string;
618
+ ns?: string;
619
+ type?: 'channel' | 'chat' | 'join';
620
+ sid?: string;
621
+ uid?: string;
622
+ gid?: string;
623
+ lock?: number;
624
+ next?: number;
625
+ meta?: unknown;
626
+ _id?: string;
627
+ cid?: string;
628
+ nick?: string;
629
+ userId?: string;
630
+ joinedNo?: number;
631
+ role?: string;
632
+ notify?: '' | 'all' | 'mention' | 'none';
633
+ reason?: string;
634
+ joined?: number;
635
+ }
636
+
637
+ /** One room's latest message, as the room list shows it. */
638
+ declare interface CloudLastChat {
639
+ channelId: string;
640
+ /** The highest message number cached for the room. */
641
+ lastNo: number;
642
+ /** The latest message a room list previews; `null` when none. */
643
+ chat: CloudChat | null;
644
+ /** The latest message that counts as activity, thread replies included; `null` when none. */
645
+ activity: CloudChat | null;
646
+ }
647
+
648
+ declare interface CloudLinkedAccount {
649
+ hint?: string;
650
+ provider?: string;
651
+ linkedAt?: number;
652
+ }
653
+
654
+ /** A list read: its rows and the paging around them. */
655
+ declare interface CloudList<Row> {
656
+ list: Row[];
657
+ meta: CloudListMeta;
658
+ }
659
+
660
+ declare interface CloudListMeta {
661
+ total: number;
662
+ limit?: number;
663
+ page?: number;
664
+ cursorNo?: number;
665
+ readNo?: number;
666
+ /** Where the list came from: the device cache, the server, or the cache standing in for the server. */
667
+ source?: 'local' | 'remote' | 'fallback';
668
+ }
669
+
670
+ /** A file of a message this device has not finished sending. */
671
+ declare interface CloudPendingUpload {
672
+ localStatus: 'sending' | 'failed';
673
+ /** An object URL of the app's own page: it does not open in another page. */
674
+ localThumbUrl: string;
675
+ localName?: string;
676
+ localContentType?: string;
677
+ localSize?: number;
678
+ }
679
+
680
+ /** A place (`site`) of the current cloud. */
681
+ declare interface CloudPlace {
682
+ id: string;
683
+ cid: string;
684
+ /** Its position in the user's list. */
685
+ order: number;
686
+ ownerId?: string;
687
+ thumbnail?: string;
688
+ desc?: string;
689
+ isOwner?: boolean;
690
+ /** Service detail: the place's server endpoints. */
691
+ $envs?: CloudServiceEndpoints;
692
+ legacy?: boolean;
693
+ isPublic?: boolean;
694
+ /** The place's owner, as the account server has them: much of it is contact and account detail. */
695
+ owner$?: CloudAccountUserView;
696
+ createdAt?: number;
697
+ updatedAt?: number;
698
+ deletedAt?: number;
699
+ error?: string;
700
+ $?: CloudCores;
701
+ stereo?: '' | '#alias' | 'mine' | 'place' | 'work' | 'domain' | 'session';
702
+ name?: string;
703
+ ns?: string;
704
+ type?: 'user' | 'role' | 'host' | 'site' | 'account' | 'group' | 'auth' | 'invite';
705
+ sid?: string;
706
+ uid?: string;
707
+ gid?: string;
708
+ lock?: number;
709
+ next?: number;
710
+ meta?: unknown;
711
+ _id?: string;
712
+ aliasId?: string;
713
+ alias$?: CloudAlias;
714
+ domain?: string;
715
+ host?: string;
716
+ alias?: string;
717
+ base?: string;
718
+ code?: string;
719
+ linked?: number;
720
+ typeCode?: string;
721
+ __cacheMeta?: CloudCacheMeta;
722
+ }
723
+
724
+ /**
725
+ * The places list takes no filter: pass `{}`. Always pass it — the app takes the stream's listener from
726
+ * the argument after it.
727
+ */
728
+ declare type CloudPlaceListQuery = Record<string, never>;
729
+
730
+ /** A member of one place, as `user.listPlaceMembers` lists them. */
731
+ declare interface CloudPlaceMember {
732
+ id: string;
733
+ cid: string;
734
+ name?: string;
735
+ nick?: string;
736
+ thumbnail?: string;
737
+ /** Owns this place. */
738
+ isOwner?: boolean;
739
+ }
740
+
741
+ /** What `user.listPlaceMembers` answers. */
742
+ declare interface CloudPlaceMembers {
743
+ members: CloudPlaceMember[];
744
+ /** The cloud and place the list is of. */
745
+ context: {
746
+ cid: string;
747
+ sid: string;
748
+ };
749
+ /** Whether the members' place profiles were loaded into the device cache along the way. */
750
+ profiles: 'loaded' | 'skipped' | 'failed';
751
+ }
752
+
753
+ /** The current place's members. Both ids must be the place the session is on. */
754
+ declare interface CloudPlaceMembersQuery {
755
+ placeId: string;
756
+ sessionPlaceId: string;
757
+ }
758
+
759
+ /** A user's profile in one place: the name and picture they show there. */
760
+ declare interface CloudProfile {
761
+ /** `<place id>@<user id>`. */
762
+ id: string;
763
+ cid: string;
764
+ /** The place. */
765
+ sid: string;
766
+ uid: string;
767
+ userId: string;
768
+ updatedAtMs: number;
769
+ active?: boolean;
770
+ createdAt?: number;
771
+ updatedAt?: number;
772
+ deletedAt?: number;
773
+ error?: string;
774
+ $?: CloudCores;
775
+ stereo?: string;
776
+ thumbnail?: string;
777
+ nick?: string;
778
+ siteId?: string;
779
+ ns?: string;
780
+ type?: 'user' | 'site' | 'profile';
781
+ gid?: string;
782
+ lock?: number;
783
+ next?: number;
784
+ meta?: unknown;
785
+ _id?: string;
786
+ __cacheMeta?: CloudCacheMeta;
787
+ }
788
+
789
+ /** Whose profiles: a place's, a user's, or one user's in one place. `siteId`/`userId` are older names. */
790
+ declare interface CloudProfileListQuery {
791
+ sid?: string;
792
+ uid?: string;
793
+ siteId?: string;
794
+ userId?: string;
795
+ }
796
+
797
+ /** One emoji added to (`on`) or removed from (`off`) a message, in the user's name. */
798
+ declare interface CloudReactionInput {
799
+ chatId: string;
800
+ emoji: string;
801
+ action: 'on' | 'off';
802
+ }
803
+
804
+ /** A plain text message to a room of the place the view opened on. */
805
+ declare interface CloudSendChatInput {
806
+ channelId: string;
807
+ /** Something besides white space, at most 1000 UTF-16 code units. */
808
+ content: string;
809
+ }
810
+
811
+ /** Service detail: the addresses of a cloud's or a place's own servers. */
812
+ declare interface CloudServiceEndpoints {
813
+ accountNo?: string;
814
+ backend?: string;
815
+ wss?: string;
816
+ }
817
+
818
+ /**
819
+ * The session as a page with the `session` permission gets it: the current cloud's half and who the
820
+ * user is in it. Nothing of the user's other clouds, and no server address or token.
821
+ */
822
+ declare interface CloudSession {
823
+ context: {
824
+ cloud: {
825
+ cloudId: string | null;
826
+ /** The place selected; it moves before a switch is done. */
827
+ siteId: string | null;
828
+ isActive: boolean;
829
+ };
830
+ identity: {
831
+ /** The user's id in this cloud. */
832
+ userId: string | null;
833
+ isAuthenticated: boolean;
834
+ };
835
+ };
836
+ /** The place the session is really on. */
837
+ committedSiteId: string | null;
838
+ }
839
+
840
+ /** The cloud's lifecycle (`CloudInfo.state$`): set-up, holds, release and plan changes. */
841
+ declare interface CloudState {
842
+ provision?: 'init' | 'reserved' | 'active';
843
+ hold?: '' | 'downgrade' | 'expired';
844
+ life?: '' | 'released';
845
+ plan?: '' | 'drop';
846
+ }
847
+
848
+ /** A file a sent message carries. */
849
+ declare interface CloudUpload {
850
+ status: 'pending' | 'stored' | 'failed';
851
+ id?: string;
852
+ createdAt?: number;
853
+ updatedAt?: number;
854
+ deletedAt?: number;
855
+ error?: string;
856
+ $?: CloudCores;
857
+ stereo?: 'image' | 'video' | 'audio' | 'file';
858
+ contentType?: string;
859
+ ns?: string;
860
+ type?: 'upload';
861
+ sid?: string;
862
+ uid?: string;
863
+ gid?: string;
864
+ lock?: number;
865
+ next?: number;
866
+ meta?: unknown;
867
+ _id?: string;
868
+ contentSize?: number;
869
+ width?: number;
870
+ height?: number;
871
+ hash?: string;
872
+ name?: string;
873
+ url?: string;
874
+ thumbnail?: CloudUploadResource;
875
+ orgUrl?: string;
876
+ thumbUrl?: string;
877
+ }
878
+
879
+ /** A stored file's resource: its preview. */
880
+ declare interface CloudUploadResource {
881
+ url: string;
882
+ contentType?: string;
883
+ contentSize?: number;
884
+ width?: number;
885
+ height?: number;
886
+ hash?: string;
887
+ }
888
+
889
+ /** A user of the current cloud. */
890
+ declare interface CloudUser {
891
+ id: string;
892
+ cid: string;
893
+ createdAt?: number;
894
+ updatedAt?: number;
895
+ deletedAt?: number;
896
+ error?: string;
897
+ $?: CloudCores;
898
+ stereo?: '' | 'user' | 'system' | 'admin' | 'dummy';
899
+ name?: string;
900
+ thumbnail?: string;
901
+ nick?: string;
902
+ ns?: string;
903
+ type?: 'user' | 'site' | 'profile';
904
+ sid?: string;
905
+ uid?: string;
906
+ gid?: string;
907
+ lock?: number;
908
+ next?: number;
909
+ meta?: unknown;
910
+ _id?: string;
911
+ /** Account detail: the user's sign-in id. */
912
+ loginId?: string;
913
+ /** Account detail: the user's identity id with the sign-in provider. */
914
+ identityId?: string;
915
+ channelIds?: string[];
916
+ $join?: CloudJoinView;
917
+ __cacheMeta?: CloudCacheMeta;
918
+ }
919
+
920
+ /** One room's members. */
921
+ declare interface CloudUserListQuery {
922
+ channelId: string;
923
+ limit?: number;
924
+ page?: number;
925
+ detail?: boolean;
926
+ }
927
+
928
+ /** A user as the server embeds one in another record. */
929
+ declare interface CloudUserView {
930
+ id?: string;
931
+ createdAt?: number;
932
+ updatedAt?: number;
933
+ deletedAt?: number;
934
+ error?: string;
935
+ $?: CloudCores;
936
+ stereo?: '' | 'user' | 'admin' | 'dummy' | 'system';
937
+ ns?: string;
938
+ type?: 'profile' | 'user' | 'site';
939
+ sid?: string;
940
+ uid?: string;
941
+ gid?: string;
942
+ lock?: number;
943
+ next?: number;
944
+ meta?: unknown;
945
+ _id?: string;
946
+ name?: string;
947
+ thumbnail?: string;
948
+ nick?: string;
949
+ /** Account detail: the user's sign-in id. */
950
+ loginId?: string;
951
+ /** Account detail: the user's identity id with the sign-in provider. */
952
+ identityId?: string;
953
+ channelIds?: string[];
954
+ $join?: CloudJoinView;
955
+ }
956
+
957
+ declare type DataCallArgs<M extends DataCallName> = DataCalls[M]['args'];
958
+
959
+ declare type DataCallName = keyof DataCalls;
960
+
961
+ declare type DataCallResult<M extends DataCallName> = DataCalls[M]['result'];
962
+
963
+ /**
964
+ * Every method `apps.data.call` reaches, by the app's own `<repository>.<method>` name: the
965
+ * permission that opens it, its arguments and what it resolves with. `can(method)` still says whether it
966
+ * is open now — this says only what it would be.
967
+ */
968
+ declare interface DataCalls {
969
+ 'channel.cacheRead': {
970
+ permission: 'channel';
971
+ args: [id: string];
972
+ result: CloudChannel | null;
973
+ };
974
+ 'channel.cacheReadList': {
975
+ permission: 'channel';
976
+ args: [query: CloudChannelListQuery];
977
+ result: CloudList<CloudChannel> | null;
978
+ };
979
+ /** Asks the server; counts against the view's server reads. */
980
+ 'channel.fetchList': {
981
+ permission: 'channel';
982
+ args: [query: CloudChannelListQuery];
983
+ result: CloudList<CloudChannel>;
984
+ };
985
+ 'join.cacheReadList': {
986
+ permission: 'channel';
987
+ args: [query: CloudJoinListQuery];
988
+ result: CloudList<CloudJoin> | null;
989
+ };
990
+ 'chat.cacheRead': {
991
+ permission: 'chat';
992
+ args: [id: string];
993
+ result: CloudChat | null;
994
+ };
995
+ 'chat.cacheReadList': {
996
+ permission: 'chat';
997
+ args: [query: CloudChatFeedQuery];
998
+ result: CloudList<CloudChat> | null;
999
+ };
1000
+ 'chat.listPendingImageChats': {
1001
+ permission: 'chat';
1002
+ args: [channelId: string];
1003
+ result: CloudChat[];
1004
+ };
1005
+ /** A write, the message. `apps.data.sendMessage` calls it; prefer that. */
1006
+ 'chat.sendChat': {
1007
+ permission: 'chatSend';
1008
+ args: [input: CloudSendChatInput];
1009
+ result: CloudChat;
1010
+ };
1011
+ /** A write, the reaction; answers the message's row with it applied. `apps.data.react` calls it. */
1012
+ 'chat.setReaction': {
1013
+ permission: 'chatReact';
1014
+ args: [input: CloudReactionInput];
1015
+ result: CloudChat;
1016
+ };
1017
+ /** `id` must be the current cloud's. */
1018
+ 'cloud.cacheRead': {
1019
+ permission: 'cloud';
1020
+ args: [id: string];
1021
+ result: CloudInfo | null;
1022
+ };
1023
+ /** Asks the server. `id` must be the current cloud's, and `cache: false` is required. */
1024
+ 'cloud.getCloud': {
1025
+ permission: 'cloud';
1026
+ args: [input: {
1027
+ id: string;
1028
+ }, options: {
1029
+ cache: false;
1030
+ }];
1031
+ result: CloudInfo;
1032
+ };
1033
+ 'place.cacheReadList': {
1034
+ permission: 'place';
1035
+ args: [query?: CloudPlaceListQuery];
1036
+ result: CloudList<CloudPlace> | null;
1037
+ };
1038
+ /** Asks the server. */
1039
+ 'place.isPlaceDeleted': {
1040
+ permission: 'place';
1041
+ args: [id: string];
1042
+ result: boolean;
1043
+ };
1044
+ 'user.cacheReadList': {
1045
+ permission: 'user';
1046
+ args: [query: CloudUserListQuery];
1047
+ result: CloudList<CloudUser> | null;
1048
+ };
1049
+ /** Asks the server, for the place the session is on only. */
1050
+ 'user.listPlaceMembers': {
1051
+ permission: 'user';
1052
+ args: [query: CloudPlaceMembersQuery];
1053
+ result: CloudPlaceMembers;
1054
+ };
1055
+ 'profile.cacheRead': {
1056
+ permission: 'user';
1057
+ args: [id: string];
1058
+ result: CloudProfile | null;
1059
+ };
1060
+ 'profile.cacheReadList': {
1061
+ permission: 'user';
1062
+ args: [query?: CloudProfileListQuery];
1063
+ result: CloudList<CloudProfile> | null;
1064
+ };
1065
+ }
1066
+
1067
+ declare type DataStreamArgs<M extends DataStreamName> = DataStreams[M]['args'];
1068
+
1069
+ declare type DataStreamEvent<M extends DataStreamName> = DataStreams[M]['event'];
1070
+
1071
+ declare type DataStreamName = keyof DataStreams;
1072
+
1073
+ /**
1074
+ * Every stream `apps.data.subscribe` reaches: the permission that opens it, the arguments the page
1075
+ * passes, and what each event carries. The app's method takes its listener right after these arguments,
1076
+ * which is where `subscribe` puts it — so a typed call needs no `LISTENER`.
1077
+ */
1078
+ declare interface DataStreams {
1079
+ 'channel.observeList': {
1080
+ permission: 'channel';
1081
+ args: [query: CloudChannelListQuery];
1082
+ event: [result: CloudList<CloudChannel> | null];
1083
+ };
1084
+ 'channel.observeItem': {
1085
+ permission: 'channel';
1086
+ args: [id: string];
1087
+ event: [item: CloudChannel | null];
1088
+ };
1089
+ 'join.observeList': {
1090
+ permission: 'channel';
1091
+ args: [query: CloudJoinListQuery];
1092
+ event: [result: CloudList<CloudJoin> | null];
1093
+ };
1094
+ 'chat.observeList': {
1095
+ permission: 'chat';
1096
+ args: [query: CloudChatObserveQuery];
1097
+ event: [result: CloudList<CloudChat> | null];
1098
+ };
1099
+ 'chat.observeLastList': {
1100
+ permission: 'chat';
1101
+ args: [channelIds: string[]];
1102
+ event: [result: CloudLastChat[]];
1103
+ };
1104
+ /** The message-number ranges a feed read has answered for; a gap inside one is a deleted message. */
1105
+ 'chat.observeFeedCoverage': {
1106
+ permission: 'chat';
1107
+ args: [channelId: string];
1108
+ event: [covered: CloudChatNumberRange[]];
1109
+ };
1110
+ /** `id` must be the current cloud's. */
1111
+ 'cloud.observeItem': {
1112
+ permission: 'cloud';
1113
+ args: [id: string];
1114
+ event: [item: CloudInfo | null];
1115
+ };
1116
+ 'place.observeList': {
1117
+ permission: 'place';
1118
+ args: [query: CloudPlaceListQuery];
1119
+ event: [result: CloudList<CloudPlace> | null];
1120
+ };
1121
+ 'place.observeItem': {
1122
+ permission: 'place';
1123
+ args: [id: string];
1124
+ event: [item: CloudPlace | null];
1125
+ };
1126
+ 'user.observeList': {
1127
+ permission: 'user';
1128
+ args: [query: CloudUserListQuery];
1129
+ event: [result: CloudList<CloudUser> | null];
1130
+ };
1131
+ 'profile.observeList': {
1132
+ permission: 'user';
1133
+ args: [query: CloudProfileListQuery];
1134
+ event: [result: CloudList<CloudProfile> | null];
1135
+ };
1136
+ 'profile.observeItem': {
1137
+ permission: 'user';
1138
+ args: [id: string];
1139
+ event: [item: CloudProfile | null];
1140
+ };
1141
+ }
1142
+
1143
+ /** A device a page captures from with `getUserMedia`. */
1144
+ declare type DeviceKind = 'camera' | 'microphone';
1145
+
1146
+ /**
1147
+ * How the app shows the page: `titled` under its bar, `clean` with no bar, `immersive` across the whole
1148
+ * screen, under the system bars. The one the app actually uses, which may differ from the manifest's.
1149
+ */
1150
+ declare type Display = 'titled' | 'clean' | 'immersive';
1151
+
24
1152
  /**
25
1153
  * Turns a browser tab into a stand-in for the app, so a page can be built and tried without it. Call
26
1154
  * it before `connect`, in development only. It answers as the app does — the base set, plus what
@@ -44,20 +1172,77 @@ export declare interface MockController {
44
1172
  readonly storage: {
45
1173
  [key: string]: unknown;
46
1174
  };
1175
+ /** Where the app stands with the OS for each device. */
1176
+ readonly devices: Record<DeviceKind, PermissionState_2>;
47
1177
  /** Android's back button: to the page if it took back, else back in history, else a close. */
48
1178
  pressBack(): void;
49
1179
  /** The user asks to close: to the page if it guards closing (a second ask within 3 s closes). */
50
1180
  requestClose(trigger?: CloseTrigger): void;
51
1181
  /** A theme or language change while the page shows. */
52
1182
  changeContext(change: Partial<Pick<ChaticAppsContext, 'theme' | 'locale'>>): void;
1183
+ /**
1184
+ * The user turns the phone. An `immersive` page gets the other orientation's insets, in `safeArea`
1185
+ * through `onContextChange` and in the CSS properties; a padded page's safe area stays 0, so nothing
1186
+ * reaches it.
1187
+ */
1188
+ rotate(): void;
1189
+ /** The user moves to another cloud under the view: every stream ends, and nothing answers after. */
1190
+ changeCloud(): void;
1191
+ /** The messages the page sent and the mock answered, in the order they went through. */
1192
+ readonly sentMessages: readonly MockSentMessage[];
1193
+ /** The reactions the page set and took off, in the order they went through. */
1194
+ readonly reactions: readonly MockReaction[];
53
1195
  /** Removes the fake app. */
54
1196
  uninstall(): void;
55
1197
  }
56
1198
 
1199
+ /**
1200
+ * The app's data, as the mock answers `apps.data`: each method the page may call, and each stream it
1201
+ * may subscribe to, by its `<repository>.<method>` name. The mock does not know the app's whitelist —
1202
+ * it answers what is given here and refuses the rest — so read the real `allowed` in the app. The one
1203
+ * exceptions are the two writes: with `chatSend` the mock opens `chat.sendChat` itself and records each
1204
+ * message (`MockController.sentMessages`), and with `chatReact` it opens `chat.setReaction` and records
1205
+ * each reaction (`MockController.reactions`).
1206
+ */
1207
+ export declare interface MockData {
1208
+ /** The session snapshot, given to a page with the `session` permission. */
1209
+ session?: CloudSession | null;
1210
+ calls?: MockDataCalls;
1211
+ /** Each gets `emit`, which sends one event, and the page's arguments; it returns how to stop. */
1212
+ streams?: MockDataStreams;
1213
+ /** How the user answers the app's question about this cloud; `allow` by default. */
1214
+ consent?: 'allow' | 'refuse';
1215
+ }
1216
+
1217
+ /**
1218
+ * What a known method answers in the mock: the same shape the app answers with, so an answer of the
1219
+ * wrong shape fails the type check here rather than the page in the app.
1220
+ */
1221
+ export declare type MockDataCalls = {
1222
+ [M in DataCallName]?: (...args: DataCallArgs<M>) => DataCallResult<M> | Promise<DataCallResult<M>>;
1223
+ } & {
1224
+ /** A method this library does not know: answered with whatever it returns. */
1225
+ [method: string]: ((...args: never[]) => unknown) | undefined;
1226
+ };
1227
+
1228
+ /** A known stream in the mock: `emit` sends one event of the app's shape. */
1229
+ export declare type MockDataStreams = {
1230
+ [M in DataStreamName]?: (emit: (...event: DataStreamEvent<M>) => void, ...args: DataStreamArgs<M>) => (() => void) | void;
1231
+ } & {
1232
+ [method: string]: ((emit: (...event: unknown[]) => void, ...args: never[]) => (() => void) | void) | undefined;
1233
+ };
1234
+
1235
+ /** How the user answers when the page asks for a device: allows it, refuses it, or the OS blocks it. */
1236
+ export declare type MockDeviceAnswer = 'allow' | 'deny' | 'blocked' | 'unavailable';
1237
+
57
1238
  export declare interface MockOptions {
58
1239
  /** What the page's manifest would grant. None by default, as for a page with no manifest. */
59
1240
  permissions?: MockPermission[];
60
- /** Overrides for the context the page gets; the rest is filled in. */
1241
+ /**
1242
+ * Overrides for the context the page gets; the rest is filled in. `display` is `clean` by default;
1243
+ * with `immersive` the page gets a phone's insets in `safeArea` and in the
1244
+ * `--chatic-safe-area-inset-*` properties, as the app sets them, and `rotate()` turns the phone.
1245
+ */
61
1246
  context?: Partial<ChaticAppsContext>;
62
1247
  /** The key `getUserKey` answers; a stable one derived from the page's origin by default. */
63
1248
  userKey?: string;
@@ -66,16 +1251,53 @@ export declare interface MockOptions {
66
1251
  by: 'page' | 'user';
67
1252
  result?: unknown;
68
1253
  }) => void;
1254
+ /**
1255
+ * How the user answers each device the page asks for; `allow` by default, `unavailable` for a device
1256
+ * the phone does not have. A `deny` leaves the device `prompt`, as on Android; iOS reports a refusal as
1257
+ * `blocked`. Only the answer is played: the page's `getUserMedia` still meets the browser's own prompt.
1258
+ */
1259
+ deviceAnswers?: Partial<Record<DeviceKind, MockDeviceAnswer>>;
69
1260
  /** What the page's storage holds when the mock starts; empty by default. Kept in memory only. */
70
1261
  storage?: {
71
1262
  [key: string]: unknown;
72
1263
  };
73
1264
  /** Log each request and reply to the console. On by default. */
74
1265
  log?: boolean;
1266
+ /** The cloud's data, for a page with a cloud data permission (`apps.data`). */
1267
+ data?: MockData;
75
1268
  }
76
1269
 
77
1270
  /** A manifest permission, as the page would declare it in `/.well-known/chatic-app.json`. */
78
- export declare type MockPermission = 'clipboard' | 'share' | 'openUrl' | 'userKey';
1271
+ export declare type MockPermission = 'clipboard' | 'share' | 'openUrl' | 'userKey' | 'session' | 'cloud' | 'place' | 'channel' | 'chat' | 'user' | 'chatSend' | 'chatReact';
1272
+
1273
+ /** A reaction the page set or took off through `apps.data.react` (or `chat.setReaction`) in the mock. */
1274
+ export declare interface MockReaction {
1275
+ messageId: string;
1276
+ emoji: string;
1277
+ on: boolean;
1278
+ }
1279
+
1280
+ /** A message the page sent through `apps.data.sendMessage` (or `chat.sendChat`) in the mock. */
1281
+ export declare interface MockSentMessage {
1282
+ channelId: string;
1283
+ text: string;
1284
+ }
1285
+
1286
+ /**
1287
+ * Where the app stands with the OS for one device:
1288
+ * - `granted` — `getUserMedia` for it asks nothing further;
1289
+ * - `prompt` — the OS has not been asked, or was refused and may be asked again;
1290
+ * - `blocked` — only the OS settings can change it (`openSettings()`).
1291
+ */
1292
+ declare type PermissionState_2 = 'granted' | 'prompt' | 'blocked';
1293
+
1294
+ /** How far each system bar reaches into the page, in CSS pixels. */
1295
+ declare type SafeArea = {
1296
+ top: number;
1297
+ right: number;
1298
+ bottom: number;
1299
+ left: number;
1300
+ };
79
1301
 
80
1302
  /**
81
1303
  * The shapes a page sees, declared here rather than imported: the app's message definitions are a