@lemoncloud/chatic-apps-sdk 0.2.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/AGENTS.ko.md +82 -0
- package/AGENTS.md +34 -7
- package/GUIDE.ko.md +419 -0
- package/GUIDE.md +218 -6
- package/README.ko.md +582 -0
- package/README.md +364 -46
- package/chatic-apps-sdk.global.js +1 -1
- package/index.cjs +1 -1
- package/index.d.cts +1295 -6
- package/index.d.ts +1295 -6
- package/index.js +282 -196
- package/mock.cjs +1 -1
- package/mock.d.cts +1203 -3
- package/mock.d.ts +1203 -3
- package/mock.js +306 -118
- package/package.json +15 -2
- package/skill/SKILL.ko.md +263 -0
- package/skill/SKILL.md +275 -0
- package/storage-BXB76dd8.js +175 -0
- package/storage-C42PwRjA.cjs +1 -0
- package/storage-BuvWwLx2.js +0 -104
- package/storage-yeS4HWKZ.cjs +0 -1
package/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/** Every code the app itself can fail a call with. */
|
|
2
|
-
export declare type AppErrorCode = 'NOT_FOUND' | 'INTERNAL_ERROR' | 'TOO_LARGE' | 'INVALID' | 'INVALID_KIND' | 'NOT_OPEN' | 'LINK_NOT_ALLOWED' | 'OPEN_URL_FAILED' | 'CLIPBOARD_WRITE_ERROR' | 'SHARE_ERROR' | 'UNAVAILABLE' | 'QUOTA_EXCEEDED' | 'SETTINGS_ERROR';
|
|
2
|
+
export declare type AppErrorCode = 'NOT_FOUND' | 'INTERNAL_ERROR' | 'TOO_LARGE' | 'INVALID' | 'INVALID_KIND' | 'NOT_OPEN' | 'LINK_NOT_ALLOWED' | 'OPEN_URL_FAILED' | 'CLIPBOARD_WRITE_ERROR' | 'SHARE_ERROR' | 'UNAVAILABLE' | 'QUOTA_EXCEEDED' | 'SETTINGS_ERROR' | 'RUNTIME_NOT_ALLOWED' | 'CLOUD_CHANGED' | 'CONSENT_REFUSED' | 'RATE_LIMITED';
|
|
3
3
|
|
|
4
4
|
/** What the page can do. `supports` answers from the app's handshake; a browser tab has none. */
|
|
5
|
-
export declare type Capability = 'finish' | 'title' | 'haptic' | 'clipboard' | 'share' | 'openUrl' | 'userKey' | 'back' | 'closeGuard' | 'errorReport' | 'storage' | 'permissions';
|
|
5
|
+
export declare type Capability = 'finish' | 'title' | 'haptic' | 'clipboard' | 'share' | 'openUrl' | 'userKey' | 'back' | 'closeGuard' | 'errorReport' | 'storage' | 'permissions' | 'data';
|
|
6
6
|
|
|
7
7
|
export declare interface ChaticApps {
|
|
8
8
|
/** `true` inside the app; `false` in a browser tab, where the bridge calls fall back or fail. */
|
|
@@ -49,6 +49,12 @@ export declare interface ChaticApps {
|
|
|
49
49
|
onCloseRequest(handler: ((trigger: CloseTrigger) => boolean | Promise<boolean>) | null): void;
|
|
50
50
|
/** The camera and the microphone. */
|
|
51
51
|
readonly permissions: ChaticAppsPermissions;
|
|
52
|
+
/**
|
|
53
|
+
* The current cloud's data — its places, rooms, messages and members, read as DoU's own screens
|
|
54
|
+
* read them — as the page's manifest allows, and one text message. `supports('data')` says whether
|
|
55
|
+
* this app answers it here.
|
|
56
|
+
*/
|
|
57
|
+
readonly data: ChaticAppsData;
|
|
52
58
|
/** Opens the app's page in the OS settings, where a `blocked` permission can be turned back on. */
|
|
53
59
|
openSettings(): Promise<void>;
|
|
54
60
|
/** Hears a theme or language change while the page shows; returns the function that stops it. */
|
|
@@ -69,7 +75,7 @@ export declare type ChaticAppsContext = {
|
|
|
69
75
|
/** The protocol major the app speaks. */
|
|
70
76
|
protocolVersion: 1;
|
|
71
77
|
viewId: string;
|
|
72
|
-
platform: 'ios' | 'android';
|
|
78
|
+
platform: 'ios' | 'android' | 'desktop';
|
|
73
79
|
/** The app's own version. */
|
|
74
80
|
appVersion: string;
|
|
75
81
|
/** The language the user chose in the app (`ko`, `en`). */
|
|
@@ -82,12 +88,88 @@ export declare type ChaticAppsContext = {
|
|
|
82
88
|
};
|
|
83
89
|
/** The link that opens this page in the app; absent from older apps. */
|
|
84
90
|
appLink?: string;
|
|
91
|
+
/** The display the app shows the page in; absent from older apps and the desktop. */
|
|
92
|
+
display?: Display;
|
|
93
|
+
/**
|
|
94
|
+
* How far the system bars reach into the page, in CSS pixels; 0 on every edge unless `immersive`.
|
|
95
|
+
* Absent from older apps and the desktop: read `--chatic-safe-area-inset-*`, then `env()`. A change —
|
|
96
|
+
* a rotation — arrives through `onContextChange`.
|
|
97
|
+
*/
|
|
98
|
+
safeArea?: SafeArea;
|
|
85
99
|
};
|
|
86
100
|
|
|
101
|
+
export declare interface ChaticAppsData {
|
|
102
|
+
/** Opens the conversation; later calls answer the same. `CONSENT_REFUSED` if the user said no. */
|
|
103
|
+
connect(): Promise<DataConnection>;
|
|
104
|
+
/** Whether `method` is one this page may call or subscribe to; `false` before `connect`. */
|
|
105
|
+
can(method: DataCallName | DataStreamName | (string & {})): boolean;
|
|
106
|
+
/** Calls a read method and resolves with what it returned. */
|
|
107
|
+
call<M extends DataCallName>(method: M, ...args: DataCallArgs<M>): Promise<DataCallResult<M>>;
|
|
108
|
+
/**
|
|
109
|
+
* A method this library does not know, answered as `T` (`unknown` unless given). Passing `T`
|
|
110
|
+
* explicitly also reaches a known method untyped, as before types existed.
|
|
111
|
+
*/
|
|
112
|
+
call<T = unknown, N extends string = string>(method: N extends DataCallName | DataStreamName ? never : N, ...args: unknown[]): Promise<T>;
|
|
113
|
+
/**
|
|
114
|
+
* Subscribes to an `observe…` method: `listener` gets each event's arguments. `onEnd` hears a stream
|
|
115
|
+
* the app ended — the cloud changed (`CLOUD_CHANGED`), the event was too large, or the page was
|
|
116
|
+
* restored from the back-forward cache (`DISCONNECTED`; subscribe again).
|
|
117
|
+
*/
|
|
118
|
+
subscribe<M extends DataStreamName>(method: M, args: DataStreamArgs<M> | [...DataStreamArgs<M>, typeof LISTENER], listener: (...event: DataStreamEvent<M>) => void, onEnd?: (error: ChaticAppsError) => void): Promise<DataSubscription>;
|
|
119
|
+
/** A stream this library does not know: its events arrive as `unknown`. */
|
|
120
|
+
subscribe<N extends string>(method: N extends DataCallName | DataStreamName ? never : N, args: unknown[], listener: (...event: unknown[]) => void, onEnd?: (error: ChaticAppsError) => void): Promise<DataSubscription>;
|
|
121
|
+
/**
|
|
122
|
+
* Sends a plain text message, in the user's name, to a room of the place the view opened on — a
|
|
123
|
+
* write, with the `chatSend` permission. Resolves with the message as sent. Text only: nothing
|
|
124
|
+
* else a message can carry. `RUNTIME_NOT_ALLOWED` for a room of another place, blank text or text
|
|
125
|
+
* over 1000 characters; `RATE_LIMITED` past the view's send budget. The same as
|
|
126
|
+
* `call('chat.sendChat', { channelId, content: text })`.
|
|
127
|
+
*/
|
|
128
|
+
sendMessage(channelId: string, text: string): Promise<CloudChat>;
|
|
129
|
+
/**
|
|
130
|
+
* Adds (`on: true`) or removes (`on: false`) one emoji on a message, in the user's name — the other
|
|
131
|
+
* write, with the `chatReact` permission. Resolves with the message's row, the reaction applied.
|
|
132
|
+
* `emoji` is one character as a person sees it. Removing takes off the user's reaction with that
|
|
133
|
+
* emoji whoever set it, the user's own tap included. `RUNTIME_NOT_ALLOWED` for a message the device
|
|
134
|
+
* does not hold, one of another place, or one the app offers no reaction on; `RATE_LIMITED` past one
|
|
135
|
+
* reaction per 250 ms or 60 a minute. The same as
|
|
136
|
+
* `call('chat.setReaction', { chatId: messageId, emoji, action: on ? 'on' : 'off' })`.
|
|
137
|
+
*/
|
|
138
|
+
react(messageId: string, emoji: string, on: boolean): Promise<CloudChat>;
|
|
139
|
+
/**
|
|
140
|
+
* A member's place profile — what they are called in the place this view opened on: mostly the name
|
|
141
|
+
* shown there (`nick`) and a picture — as the device holds it; `null` when it holds none (they have
|
|
142
|
+
* not set one there; fall back to the member's own name). The app keys it `<place id>@<user id>`,
|
|
143
|
+
* and answers only the place the view opened on, while the session is still there. Needs `user` and
|
|
144
|
+
* `session` (for the place): `NOT_SUPPORTED` without `session` or before the session is on a place,
|
|
145
|
+
* `RUNTIME_NOT_ALLOWED` without `user` or once the user moved to another place.
|
|
146
|
+
*/
|
|
147
|
+
placeProfile(userId: string): Promise<CloudProfile | null>;
|
|
148
|
+
/** Every place profile the device holds for the place this view opened on — for naming its members. */
|
|
149
|
+
placeProfiles(): Promise<CloudList<CloudProfile> | null>;
|
|
150
|
+
/** Hears a member's place profile, as `placeProfile` reads it, and each change to it. */
|
|
151
|
+
observePlaceProfile(userId: string, listener: (profile: CloudProfile | null) => void, options?: DataStreamOptions): Promise<DataSubscription>;
|
|
152
|
+
/** The user's own place profile: `placeProfile` with the user's id, read off the session. */
|
|
153
|
+
myProfile(): Promise<CloudProfile | null>;
|
|
154
|
+
/** Hears the user's own place profile, as `myProfile` reads it. */
|
|
155
|
+
observeMyProfile(listener: (profile: CloudProfile | null) => void, options?: DataStreamOptions): Promise<DataSubscription>;
|
|
156
|
+
/** The session snapshot, with the `session` permission; `null` without it or before `connect`. */
|
|
157
|
+
session(): CloudSession | null;
|
|
158
|
+
/** Hears each session change, with the `session` permission. */
|
|
159
|
+
onSessionChange(listener: (session: CloudSession | null) => void): () => void;
|
|
160
|
+
/**
|
|
161
|
+
* Hears, once, that the cloud this view opened on is no longer the selected one. Nothing answers
|
|
162
|
+
* after it: the page has nothing more to read here.
|
|
163
|
+
*/
|
|
164
|
+
onCloudChanged(listener: () => void): () => void;
|
|
165
|
+
}
|
|
166
|
+
|
|
87
167
|
/** Every failure this library reports. Branch on `code`; `message` is English for a developer. */
|
|
88
168
|
export declare class ChaticAppsError extends Error {
|
|
89
169
|
readonly code: ChaticAppsErrorCode;
|
|
90
|
-
|
|
170
|
+
/** What the app sent with the failure, if anything: `{ retryAfterMs }` with `RATE_LIMITED`. */
|
|
171
|
+
readonly details?: unknown;
|
|
172
|
+
constructor(code: ChaticAppsErrorCode, message: string, details?: unknown);
|
|
91
173
|
}
|
|
92
174
|
|
|
93
175
|
/**
|
|
@@ -97,7 +179,8 @@ export declare class ChaticAppsError extends Error {
|
|
|
97
179
|
* - `TIMEOUT` — the app did not answer in time;
|
|
98
180
|
* - `UNSUPPORTED_PROTOCOL` — the app speaks a protocol major this library does not know;
|
|
99
181
|
* - `NOT_IN_APP` — the call needs the app and the page is in a browser tab;
|
|
100
|
-
* - `DISCONNECTED` — the connection was closed with `disconnect()` before the app answered
|
|
182
|
+
* - `DISCONNECTED` — the connection was closed with `disconnect()` before the app answered; or a
|
|
183
|
+
* cloud data stream ended because the page came back from the back-forward cache.
|
|
101
184
|
* A code this list does not name is still a failure of that call and nothing more.
|
|
102
185
|
*/
|
|
103
186
|
export declare type ChaticAppsErrorCode = AppErrorCode | 'NOT_SUPPORTED' | 'TIMEOUT' | 'UNSUPPORTED_PROTOCOL' | 'NOT_IN_APP' | 'DISCONNECTED' | (string & {});
|
|
@@ -150,6 +233,931 @@ export declare interface ChaticAppsStorage {
|
|
|
150
233
|
/** What the user did to ask for the close: the app's close control, or Android back. */
|
|
151
234
|
export declare type CloseTrigger = 'control' | 'back';
|
|
152
235
|
|
|
236
|
+
/** Account detail: the account a cloud is linked to, as the account server names it. */
|
|
237
|
+
export declare interface CloudAccountHead {
|
|
238
|
+
id?: string;
|
|
239
|
+
name?: string;
|
|
240
|
+
stereo?: '' | 'hash' | 'email' | 'business' | 'code' | 'device' | '#alias' | 'iid' | 'login' | 'phone' | 'social' | 'session';
|
|
241
|
+
openId?: string;
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
/**
|
|
245
|
+
* A user as the account server embeds one (a place's `owner$`) — not the chat server's user. Most of it
|
|
246
|
+
* is contact and account detail. The type lists every field the account server's view can have; which
|
|
247
|
+
* of them a given answer fills is the server's choice, and the app passes on what it got. Fields named
|
|
248
|
+
* after a secret (`loginPw`, `otp$`, `key$`) are not something a page should ever read, keep or send.
|
|
249
|
+
*/
|
|
250
|
+
export declare interface CloudAccountUserView {
|
|
251
|
+
id: string;
|
|
252
|
+
createdAt?: number;
|
|
253
|
+
updatedAt?: number;
|
|
254
|
+
deletedAt?: number;
|
|
255
|
+
error?: string;
|
|
256
|
+
$?: CloudCores;
|
|
257
|
+
role?: string;
|
|
258
|
+
stereo?: '' | '#alias' | 'session' | 'user' | '#code' | 'admin' | 'dummy';
|
|
259
|
+
alias$?: CloudAlias;
|
|
260
|
+
name?: string;
|
|
261
|
+
aliasId?: string;
|
|
262
|
+
alias?: string;
|
|
263
|
+
code?: string;
|
|
264
|
+
ns?: string;
|
|
265
|
+
type?: 'host' | 'site' | 'account' | 'user' | 'group' | 'role' | 'auth' | 'invite';
|
|
266
|
+
sid?: string;
|
|
267
|
+
uid?: string;
|
|
268
|
+
gid?: string;
|
|
269
|
+
lock?: number;
|
|
270
|
+
next?: number;
|
|
271
|
+
meta?: unknown;
|
|
272
|
+
_id?: string;
|
|
273
|
+
nick?: string;
|
|
274
|
+
photo?: string;
|
|
275
|
+
/** Contact detail. */
|
|
276
|
+
phone?: string;
|
|
277
|
+
text?: string;
|
|
278
|
+
/** Personal detail. */
|
|
279
|
+
gender?: '' | 'male' | 'female';
|
|
280
|
+
/** Personal detail. */
|
|
281
|
+
birth?: string;
|
|
282
|
+
/** Contact detail. */
|
|
283
|
+
address?: CloudAddress;
|
|
284
|
+
/** Contact detail. */
|
|
285
|
+
email?: string;
|
|
286
|
+
aliasType?: string;
|
|
287
|
+
siteId?: string;
|
|
288
|
+
site$?: {
|
|
289
|
+
id?: string;
|
|
290
|
+
name?: string;
|
|
291
|
+
};
|
|
292
|
+
loginType?: string;
|
|
293
|
+
/** Account detail: the sign-in id. */
|
|
294
|
+
loginId?: string;
|
|
295
|
+
/** Named after a secret. Never read, keep or send it. */
|
|
296
|
+
loginPw?: string;
|
|
297
|
+
identityId?: string;
|
|
298
|
+
lastAuthId?: string;
|
|
299
|
+
/** When the user agreed to each term, in epoch ms, by the term's name: `service`, `privacy`, `privacy3rd`, … */
|
|
300
|
+
agree$?: {
|
|
301
|
+
[term: string]: number;
|
|
302
|
+
};
|
|
303
|
+
parent?: string;
|
|
304
|
+
childs?: string[];
|
|
305
|
+
otpSentCount?: number;
|
|
306
|
+
otpSentDay?: string;
|
|
307
|
+
inviteNo?: number;
|
|
308
|
+
accountId?: string;
|
|
309
|
+
roles?: string[];
|
|
310
|
+
/** Account detail. */
|
|
311
|
+
$account?: CloudAccountView;
|
|
312
|
+
/** Account detail: the sign-in methods linked to the account. */
|
|
313
|
+
link$?: {
|
|
314
|
+
phone?: CloudLinkedAccount;
|
|
315
|
+
email?: CloudLinkedAccount;
|
|
316
|
+
social?: CloudLinkedAccount;
|
|
317
|
+
};
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
/** An account as the account server has it. Contact and account detail throughout. */
|
|
321
|
+
export declare interface CloudAccountView {
|
|
322
|
+
id?: string;
|
|
323
|
+
isPushNotice?: boolean;
|
|
324
|
+
isPushCommunity?: boolean;
|
|
325
|
+
isPushMarketing?: boolean;
|
|
326
|
+
createdAt?: number;
|
|
327
|
+
updatedAt?: number;
|
|
328
|
+
deletedAt?: number;
|
|
329
|
+
error?: string;
|
|
330
|
+
$?: CloudCores;
|
|
331
|
+
group?: string;
|
|
332
|
+
stereo?: '' | '#alias' | 'session' | 'code' | 'phone' | 'email' | 'business' | 'device' | 'hash' | 'iid' | 'login' | 'social';
|
|
333
|
+
name?: string;
|
|
334
|
+
aliasId?: string;
|
|
335
|
+
ns?: string;
|
|
336
|
+
type?: 'host' | 'site' | 'account' | 'user' | 'group' | 'role' | 'auth' | 'invite';
|
|
337
|
+
sid?: string;
|
|
338
|
+
uid?: string;
|
|
339
|
+
gid?: string;
|
|
340
|
+
lock?: number;
|
|
341
|
+
next?: number;
|
|
342
|
+
meta?: unknown;
|
|
343
|
+
_id?: string;
|
|
344
|
+
nick?: string;
|
|
345
|
+
photo?: string;
|
|
346
|
+
phone?: string;
|
|
347
|
+
email?: string;
|
|
348
|
+
identityId?: string;
|
|
349
|
+
otpSentCount?: number;
|
|
350
|
+
otpSentDay?: string;
|
|
351
|
+
accountId?: string;
|
|
352
|
+
kind?: string;
|
|
353
|
+
hint?: string;
|
|
354
|
+
verifiedAt?: number;
|
|
355
|
+
/** Named after a secret (a one-time code). Never read, keep or send it. */
|
|
356
|
+
otp$?: {
|
|
357
|
+
code?: string;
|
|
358
|
+
expiredAt?: number;
|
|
359
|
+
hash?: string;
|
|
360
|
+
sentAt?: number;
|
|
361
|
+
};
|
|
362
|
+
otpTryCount?: number;
|
|
363
|
+
openId?: string;
|
|
364
|
+
/** Named after a secret (an account key). Never read, keep or send it. */
|
|
365
|
+
key$?: {
|
|
366
|
+
_id: string;
|
|
367
|
+
key: string;
|
|
368
|
+
len: string;
|
|
369
|
+
prefix: string;
|
|
370
|
+
alias?: string;
|
|
371
|
+
};
|
|
372
|
+
userId?: string;
|
|
373
|
+
identityPoolId?: string;
|
|
374
|
+
accountNo?: string;
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
export declare interface CloudAddress {
|
|
378
|
+
addrPost?: string;
|
|
379
|
+
addrStreet?: string;
|
|
380
|
+
addrDetail?: string;
|
|
381
|
+
addrExtra?: string;
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
/** An alias a record is also known by. */
|
|
385
|
+
export declare interface CloudAlias {
|
|
386
|
+
type?: string;
|
|
387
|
+
alias?: string;
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
/** When the device cache last filled a row and when it stops trusting it, in epoch ms. */
|
|
391
|
+
export declare interface CloudCacheMeta {
|
|
392
|
+
lastSyncedAt: number;
|
|
393
|
+
expiresAt: number;
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
/** A room (`channel`), as the device cache holds it. */
|
|
397
|
+
export declare interface CloudChannel {
|
|
398
|
+
id: string;
|
|
399
|
+
/** The cloud the row belongs to. */
|
|
400
|
+
cid: string;
|
|
401
|
+
/** The place the room is in. */
|
|
402
|
+
sid: string;
|
|
403
|
+
isNotificationEnabled: boolean;
|
|
404
|
+
createdAt?: number;
|
|
405
|
+
updatedAt?: number;
|
|
406
|
+
deletedAt?: number;
|
|
407
|
+
error?: string;
|
|
408
|
+
$?: CloudCores;
|
|
409
|
+
/** `dm` a one-to-one room, `self` the user's own notes room. */
|
|
410
|
+
stereo?: '' | 'public' | 'private' | 'dm' | 'self';
|
|
411
|
+
name?: string;
|
|
412
|
+
desc?: string;
|
|
413
|
+
inviteRule?: '' | 'owner' | 'all';
|
|
414
|
+
thumbnail?: string;
|
|
415
|
+
memberNo?: number;
|
|
416
|
+
memberIds?: string[];
|
|
417
|
+
/** The room's latest message number. */
|
|
418
|
+
chatNo?: number;
|
|
419
|
+
/** How many of its numbers are not people's messages (joins, edits, reactions). */
|
|
420
|
+
metaNo?: number;
|
|
421
|
+
ownerId?: string;
|
|
422
|
+
ns?: string;
|
|
423
|
+
type?: 'channel' | 'chat' | 'join';
|
|
424
|
+
uid?: string;
|
|
425
|
+
gid?: string;
|
|
426
|
+
lock?: number;
|
|
427
|
+
next?: number;
|
|
428
|
+
meta?: unknown;
|
|
429
|
+
_id?: string;
|
|
430
|
+
openFeed?: boolean;
|
|
431
|
+
unreadCount?: number;
|
|
432
|
+
owner$?: CloudUserView;
|
|
433
|
+
lastChat$?: CloudChatView;
|
|
434
|
+
/** The user's own join of the room. */
|
|
435
|
+
$join?: CloudJoinView;
|
|
436
|
+
$joins?: CloudJoinView[];
|
|
437
|
+
/** Not filled by anything today. */
|
|
438
|
+
lastActivityAt?: number;
|
|
439
|
+
__cacheMeta?: CloudCacheMeta;
|
|
440
|
+
}
|
|
441
|
+
|
|
442
|
+
/** Which rooms: the place's (`sid`), one page of them. */
|
|
443
|
+
export declare interface CloudChannelListQuery {
|
|
444
|
+
sid?: string;
|
|
445
|
+
page?: number;
|
|
446
|
+
limit?: number;
|
|
447
|
+
detail?: boolean;
|
|
448
|
+
hasSite?: boolean;
|
|
449
|
+
}
|
|
450
|
+
|
|
451
|
+
/** A room as the server embeds one. */
|
|
452
|
+
export declare interface CloudChannelView {
|
|
453
|
+
id?: string;
|
|
454
|
+
createdAt?: number;
|
|
455
|
+
updatedAt?: number;
|
|
456
|
+
deletedAt?: number;
|
|
457
|
+
error?: string;
|
|
458
|
+
$?: CloudCores;
|
|
459
|
+
stereo?: '' | 'public' | 'private' | 'dm' | 'self';
|
|
460
|
+
chatNo?: number;
|
|
461
|
+
metaNo?: number;
|
|
462
|
+
memberNo?: number;
|
|
463
|
+
ownerId?: string;
|
|
464
|
+
ns?: string;
|
|
465
|
+
type?: 'channel' | 'chat' | 'join';
|
|
466
|
+
sid?: string;
|
|
467
|
+
uid?: string;
|
|
468
|
+
gid?: string;
|
|
469
|
+
lock?: number;
|
|
470
|
+
next?: number;
|
|
471
|
+
meta?: unknown;
|
|
472
|
+
_id?: string;
|
|
473
|
+
cid?: string;
|
|
474
|
+
name?: string;
|
|
475
|
+
thumbnail?: string;
|
|
476
|
+
desc?: string;
|
|
477
|
+
inviteRule?: '' | 'owner' | 'all';
|
|
478
|
+
memberIds?: string[];
|
|
479
|
+
openFeed?: boolean;
|
|
480
|
+
unreadCount?: number;
|
|
481
|
+
owner$?: CloudUserView;
|
|
482
|
+
lastChat$?: CloudChatView;
|
|
483
|
+
$join?: CloudJoinView;
|
|
484
|
+
$joins?: CloudJoinView[];
|
|
485
|
+
}
|
|
486
|
+
|
|
487
|
+
/** A message (`chat`), as the device cache holds it. */
|
|
488
|
+
export declare interface CloudChat {
|
|
489
|
+
id: string;
|
|
490
|
+
cid: string;
|
|
491
|
+
channelId: string;
|
|
492
|
+
/** Its number in the room; `0` while it is still being sent. */
|
|
493
|
+
chatNo: number;
|
|
494
|
+
/** Still on its way to the server. */
|
|
495
|
+
isPending: boolean;
|
|
496
|
+
/** Its send failed on this device. */
|
|
497
|
+
isFailed: boolean;
|
|
498
|
+
createdAtMs: number;
|
|
499
|
+
updatedAtMs: number;
|
|
500
|
+
createdAt?: number;
|
|
501
|
+
updatedAt?: number;
|
|
502
|
+
deletedAt?: number;
|
|
503
|
+
error?: string;
|
|
504
|
+
$?: CloudCores;
|
|
505
|
+
stereo?: '' | 'user' | 'system' | 'webhook';
|
|
506
|
+
subType?: '' | 'join' | 'leave' | 'reaction' | 'edit';
|
|
507
|
+
contentType?: string;
|
|
508
|
+
content?: string;
|
|
509
|
+
memberNo?: number;
|
|
510
|
+
metaNo?: number;
|
|
511
|
+
ownerId?: string;
|
|
512
|
+
readCount?: number;
|
|
513
|
+
editedAt?: number;
|
|
514
|
+
parentId?: string;
|
|
515
|
+
hidden?: boolean;
|
|
516
|
+
uploadIds?: string[];
|
|
517
|
+
ns?: string;
|
|
518
|
+
type?: 'channel' | 'chat' | 'join';
|
|
519
|
+
sid?: string;
|
|
520
|
+
uid?: string;
|
|
521
|
+
gid?: string;
|
|
522
|
+
lock?: number;
|
|
523
|
+
next?: number;
|
|
524
|
+
meta?: unknown;
|
|
525
|
+
_id?: string;
|
|
526
|
+
owner$?: CloudUserView;
|
|
527
|
+
channel$?: CloudChannelView;
|
|
528
|
+
parent$?: CloudChatView;
|
|
529
|
+
mention$?: CloudChatMention;
|
|
530
|
+
reaction$?: CloudChatReaction;
|
|
531
|
+
edit$?: CloudChatEdit;
|
|
532
|
+
attach$?: CloudChatAttachment;
|
|
533
|
+
blocks$?: CloudChatBlock[];
|
|
534
|
+
source$?: CloudChatSource;
|
|
535
|
+
/** The server's files once sent; this device's pending slots while it is still sending. */
|
|
536
|
+
upload$$?: (CloudUpload | CloudPendingUpload)[];
|
|
537
|
+
tempId?: string;
|
|
538
|
+
/** Hidden by this device because a page of the feed left it out, not by a delete. */
|
|
539
|
+
hiddenByFeed?: boolean;
|
|
540
|
+
mediaEntries?: CloudChatMediaEntry[];
|
|
541
|
+
mediaEntriesVersion?: number;
|
|
542
|
+
__cacheMeta?: CloudCacheMeta;
|
|
543
|
+
}
|
|
544
|
+
|
|
545
|
+
/** An attachment card, as a webhook posts one. */
|
|
546
|
+
export declare interface CloudChatAttachment {
|
|
547
|
+
pretext?: string;
|
|
548
|
+
title?: string;
|
|
549
|
+
text?: string;
|
|
550
|
+
color?: string;
|
|
551
|
+
username?: string;
|
|
552
|
+
ts?: number;
|
|
553
|
+
footer?: string;
|
|
554
|
+
sourceUrl?: string;
|
|
555
|
+
fields?: {
|
|
556
|
+
title?: string;
|
|
557
|
+
value: string | number;
|
|
558
|
+
}[];
|
|
559
|
+
channel?: string;
|
|
560
|
+
}
|
|
561
|
+
|
|
562
|
+
/** One block of a message laid out in blocks, as a webhook posts one. */
|
|
563
|
+
export declare type CloudChatBlock = {
|
|
564
|
+
type: 'header';
|
|
565
|
+
text: CloudChatBlockText;
|
|
566
|
+
} | {
|
|
567
|
+
type: 'section';
|
|
568
|
+
text?: CloudChatBlockText;
|
|
569
|
+
fields?: CloudChatBlockText[];
|
|
570
|
+
} | {
|
|
571
|
+
type: 'divider';
|
|
572
|
+
} | {
|
|
573
|
+
type: 'context';
|
|
574
|
+
elements: CloudChatBlockText[];
|
|
575
|
+
};
|
|
576
|
+
|
|
577
|
+
export declare interface CloudChatBlockText {
|
|
578
|
+
type: 'mrkdwn' | 'plain_text';
|
|
579
|
+
text: string;
|
|
580
|
+
}
|
|
581
|
+
|
|
582
|
+
/** On an `edit` message: the message it changed. */
|
|
583
|
+
export declare interface CloudChatEdit {
|
|
584
|
+
action: 'update' | 'delete';
|
|
585
|
+
chatId: string;
|
|
586
|
+
hash?: string;
|
|
587
|
+
}
|
|
588
|
+
|
|
589
|
+
/** One room's messages, `limit` of them below `cursorNo` (from the newest when absent). */
|
|
590
|
+
export declare interface CloudChatFeedQuery {
|
|
591
|
+
channelId: string;
|
|
592
|
+
cursorNo?: number;
|
|
593
|
+
limit?: number;
|
|
594
|
+
}
|
|
595
|
+
|
|
596
|
+
/** One entry of a message's media index: an attachment or a link it carries. */
|
|
597
|
+
export declare interface CloudChatMediaEntry {
|
|
598
|
+
kind: 'image' | 'video' | 'file' | 'audio' | 'link';
|
|
599
|
+
idx: number;
|
|
600
|
+
/** An attachment's upload id, or a link's URL. */
|
|
601
|
+
ref: string;
|
|
602
|
+
}
|
|
603
|
+
|
|
604
|
+
/** Who a message mentions. */
|
|
605
|
+
export declare interface CloudChatMention {
|
|
606
|
+
userIds?: string[];
|
|
607
|
+
all?: boolean;
|
|
608
|
+
}
|
|
609
|
+
|
|
610
|
+
/** What `chat.observeFeedCoverage` and others mean by a `[low, high]` range of message numbers. */
|
|
611
|
+
export declare type CloudChatNumberRange = readonly [low: number, high: number];
|
|
612
|
+
|
|
613
|
+
/** `CloudChatFeedQuery`, and whether messages still being sent are listed too. */
|
|
614
|
+
export declare interface CloudChatObserveQuery extends CloudChatFeedQuery {
|
|
615
|
+
includeUnsent?: boolean;
|
|
616
|
+
}
|
|
617
|
+
|
|
618
|
+
/** On a `reaction` message: the reaction it records. */
|
|
619
|
+
export declare interface CloudChatReaction {
|
|
620
|
+
action?: string;
|
|
621
|
+
emoji?: string;
|
|
622
|
+
chatId?: string;
|
|
623
|
+
}
|
|
624
|
+
|
|
625
|
+
/** Where a webhook message came from. */
|
|
626
|
+
export declare interface CloudChatSource {
|
|
627
|
+
key?: string;
|
|
628
|
+
url?: string;
|
|
629
|
+
color?: string;
|
|
630
|
+
}
|
|
631
|
+
|
|
632
|
+
/** A message as the server embeds one. */
|
|
633
|
+
export declare interface CloudChatView {
|
|
634
|
+
id?: string;
|
|
635
|
+
createdAt?: number;
|
|
636
|
+
updatedAt?: number;
|
|
637
|
+
deletedAt?: number;
|
|
638
|
+
error?: string;
|
|
639
|
+
$?: CloudCores;
|
|
640
|
+
stereo?: '' | 'user' | 'webhook' | 'system';
|
|
641
|
+
subType?: '' | 'join' | 'leave' | 'reaction' | 'edit';
|
|
642
|
+
contentType?: string;
|
|
643
|
+
content?: string;
|
|
644
|
+
chatNo?: number;
|
|
645
|
+
metaNo?: number;
|
|
646
|
+
readCount?: number;
|
|
647
|
+
memberNo?: number;
|
|
648
|
+
editedAt?: number;
|
|
649
|
+
parentId?: string;
|
|
650
|
+
channelId?: string;
|
|
651
|
+
ownerId?: string;
|
|
652
|
+
uploadIds?: string[];
|
|
653
|
+
ns?: string;
|
|
654
|
+
type?: 'channel' | 'chat' | 'join';
|
|
655
|
+
sid?: string;
|
|
656
|
+
uid?: string;
|
|
657
|
+
gid?: string;
|
|
658
|
+
lock?: number;
|
|
659
|
+
next?: number;
|
|
660
|
+
meta?: unknown;
|
|
661
|
+
_id?: string;
|
|
662
|
+
cid?: string;
|
|
663
|
+
hidden?: boolean;
|
|
664
|
+
mention$?: CloudChatMention;
|
|
665
|
+
owner$?: CloudUserView;
|
|
666
|
+
channel$?: CloudChannelView;
|
|
667
|
+
parent$?: CloudChatView;
|
|
668
|
+
upload$$?: CloudUpload[];
|
|
669
|
+
reaction$?: CloudChatReaction;
|
|
670
|
+
edit$?: CloudChatEdit;
|
|
671
|
+
attach$?: CloudChatAttachment;
|
|
672
|
+
blocks$?: CloudChatBlock[];
|
|
673
|
+
source$?: CloudChatSource;
|
|
674
|
+
}
|
|
675
|
+
|
|
676
|
+
/**
|
|
677
|
+
* What `apps.data` reads, typed: every method the app opens to a page, under the name the
|
|
678
|
+
* app gives it, with its arguments and what it answers. The rows are the app's own rows, field for
|
|
679
|
+
* field — this library does not rename, reshape or filter them.
|
|
680
|
+
*
|
|
681
|
+
* Declared here rather than imported: the app's types live in private packages a published library
|
|
682
|
+
* cannot point at. The app's contract tests hold each declaration to the app's real one, so a field the
|
|
683
|
+
* app adds, drops or retypes fails there before a page meets it.
|
|
684
|
+
*
|
|
685
|
+
* About the fields:
|
|
686
|
+
* - A field marked optional is there only when the server or the app filled it. Most of a row is
|
|
687
|
+
* optional, because the same row is filled from different answers over time; read each with a
|
|
688
|
+
* fallback.
|
|
689
|
+
* - Some fields are contact or account details — an email, an account number, a login id. The app
|
|
690
|
+
* hands them over exactly as its own screens read them. Use them only where the page needs them, keep
|
|
691
|
+
* them on the device, and say so to the user if they leave it: what a page does with what it read is
|
|
692
|
+
* its author's responsibility.
|
|
693
|
+
* - `meta` is whatever the server keeps beside a record, in no fixed shape.
|
|
694
|
+
* - A type ending in `View` (`CloudUserView`, `CloudChatView`, …) is a record as the server embeds it
|
|
695
|
+
* inside another row — every field optional — not the row a read answers (`CloudUser`, `CloudChat`).
|
|
696
|
+
*/
|
|
697
|
+
/** A server record's owner ids, as the server stamps them. */
|
|
698
|
+
export declare interface CloudCores {
|
|
699
|
+
sid?: string;
|
|
700
|
+
uid?: string;
|
|
701
|
+
gid?: string;
|
|
702
|
+
}
|
|
703
|
+
|
|
704
|
+
/** The current cloud's row. Much of it is account and billing detail: read only what the page needs. */
|
|
705
|
+
export declare interface CloudInfo {
|
|
706
|
+
id: string;
|
|
707
|
+
cid: string;
|
|
708
|
+
name?: string;
|
|
709
|
+
/** Service detail: the cloud's server address. */
|
|
710
|
+
backend?: string;
|
|
711
|
+
/** Service detail: the cloud's socket address. */
|
|
712
|
+
wss?: string;
|
|
713
|
+
/** `owner` a cloud the user owns, `invited` one they joined. */
|
|
714
|
+
cloudType?: 'invited' | 'owner';
|
|
715
|
+
/** Account detail: the device user ids that accepted an invite into this cloud. */
|
|
716
|
+
acceptedBy?: string[];
|
|
717
|
+
/** Service detail: the cloud's server endpoints. */
|
|
718
|
+
$envs?: CloudServiceEndpoints;
|
|
719
|
+
createdAt?: number;
|
|
720
|
+
updatedAt?: number;
|
|
721
|
+
deletedAt?: number;
|
|
722
|
+
error?: string;
|
|
723
|
+
$?: CloudCores;
|
|
724
|
+
owner$?: {
|
|
725
|
+
id?: string;
|
|
726
|
+
name?: string;
|
|
727
|
+
};
|
|
728
|
+
stereo?: '' | '#alias' | '#root';
|
|
729
|
+
ownerId?: string;
|
|
730
|
+
ns?: string;
|
|
731
|
+
type?: 'cloud' | 'membership' | 'product';
|
|
732
|
+
sid?: string;
|
|
733
|
+
uid?: string;
|
|
734
|
+
gid?: string;
|
|
735
|
+
lock?: number;
|
|
736
|
+
next?: number;
|
|
737
|
+
meta?: unknown;
|
|
738
|
+
_id?: string;
|
|
739
|
+
/** Contact detail: the cloud's email address. */
|
|
740
|
+
email?: string;
|
|
741
|
+
/** Account detail. */
|
|
742
|
+
accountId?: string;
|
|
743
|
+
/** Account detail. */
|
|
744
|
+
account$?: CloudAccountHead;
|
|
745
|
+
aliasId?: string;
|
|
746
|
+
alias$?: CloudAlias;
|
|
747
|
+
/** Billing detail. */
|
|
748
|
+
subscriptionId?: string;
|
|
749
|
+
status?: 'error' | 'init' | 'reserved' | 'active' | 'suspended' | 'expired';
|
|
750
|
+
expiresAt?: number;
|
|
751
|
+
assignedAt?: number;
|
|
752
|
+
activedAt?: number;
|
|
753
|
+
/** Account detail: the cloud's account number. */
|
|
754
|
+
accountNo?: string;
|
|
755
|
+
region?: string;
|
|
756
|
+
stage?: string;
|
|
757
|
+
cloudNo?: number;
|
|
758
|
+
state$?: CloudState;
|
|
759
|
+
suspendedAt?: number;
|
|
760
|
+
plannedAt?: number;
|
|
761
|
+
suspendReason?: 'expired' | 'downgrade' | 'cancel' | 'release';
|
|
762
|
+
retainUntil?: number;
|
|
763
|
+
releasedAt?: number;
|
|
764
|
+
enqueueId?: string;
|
|
765
|
+
workspaceId?: string;
|
|
766
|
+
slotId?: string;
|
|
767
|
+
__cacheMeta?: CloudCacheMeta;
|
|
768
|
+
}
|
|
769
|
+
|
|
770
|
+
/** A user's membership of a room (`join`): their role, read position and notification setting. */
|
|
771
|
+
export declare interface CloudJoin {
|
|
772
|
+
id: string;
|
|
773
|
+
cid: string;
|
|
774
|
+
channelId: string;
|
|
775
|
+
userId: string;
|
|
776
|
+
joined: number;
|
|
777
|
+
/** The last message number this member has read. */
|
|
778
|
+
readNo: number;
|
|
779
|
+
createdAt?: number;
|
|
780
|
+
updatedAt?: number;
|
|
781
|
+
deletedAt?: number;
|
|
782
|
+
error?: string;
|
|
783
|
+
$?: CloudCores;
|
|
784
|
+
stereo?: '' | 'owner' | 'admin' | 'member';
|
|
785
|
+
chatNo?: number;
|
|
786
|
+
metaNo?: number;
|
|
787
|
+
ns?: string;
|
|
788
|
+
type?: 'channel' | 'chat' | 'join';
|
|
789
|
+
sid?: string;
|
|
790
|
+
uid?: string;
|
|
791
|
+
gid?: string;
|
|
792
|
+
lock?: number;
|
|
793
|
+
next?: number;
|
|
794
|
+
meta?: unknown;
|
|
795
|
+
_id?: string;
|
|
796
|
+
joinedNo?: number;
|
|
797
|
+
nick?: string;
|
|
798
|
+
role?: string;
|
|
799
|
+
notify?: '' | 'all' | 'mention' | 'none';
|
|
800
|
+
reason?: string;
|
|
801
|
+
__cacheMeta?: CloudCacheMeta;
|
|
802
|
+
}
|
|
803
|
+
|
|
804
|
+
/** Which joins: one room's, or only active ones. */
|
|
805
|
+
export declare interface CloudJoinListQuery {
|
|
806
|
+
channelId?: string;
|
|
807
|
+
activeOnly?: boolean;
|
|
808
|
+
}
|
|
809
|
+
|
|
810
|
+
/** A join (a user's membership of a room) as the server embeds one. */
|
|
811
|
+
export declare interface CloudJoinView {
|
|
812
|
+
id?: string;
|
|
813
|
+
createdAt?: number;
|
|
814
|
+
updatedAt?: number;
|
|
815
|
+
deletedAt?: number;
|
|
816
|
+
error?: string;
|
|
817
|
+
$?: CloudCores;
|
|
818
|
+
stereo?: '' | 'admin' | 'owner' | 'member';
|
|
819
|
+
chatNo?: number;
|
|
820
|
+
metaNo?: number;
|
|
821
|
+
channelId?: string;
|
|
822
|
+
ns?: string;
|
|
823
|
+
type?: 'channel' | 'chat' | 'join';
|
|
824
|
+
sid?: string;
|
|
825
|
+
uid?: string;
|
|
826
|
+
gid?: string;
|
|
827
|
+
lock?: number;
|
|
828
|
+
next?: number;
|
|
829
|
+
meta?: unknown;
|
|
830
|
+
_id?: string;
|
|
831
|
+
cid?: string;
|
|
832
|
+
nick?: string;
|
|
833
|
+
userId?: string;
|
|
834
|
+
joinedNo?: number;
|
|
835
|
+
role?: string;
|
|
836
|
+
notify?: '' | 'all' | 'mention' | 'none';
|
|
837
|
+
reason?: string;
|
|
838
|
+
joined?: number;
|
|
839
|
+
}
|
|
840
|
+
|
|
841
|
+
/** One room's latest message, as the room list shows it. */
|
|
842
|
+
export declare interface CloudLastChat {
|
|
843
|
+
channelId: string;
|
|
844
|
+
/** The highest message number cached for the room. */
|
|
845
|
+
lastNo: number;
|
|
846
|
+
/** The latest message a room list previews; `null` when none. */
|
|
847
|
+
chat: CloudChat | null;
|
|
848
|
+
/** The latest message that counts as activity, thread replies included; `null` when none. */
|
|
849
|
+
activity: CloudChat | null;
|
|
850
|
+
}
|
|
851
|
+
|
|
852
|
+
export declare interface CloudLinkedAccount {
|
|
853
|
+
hint?: string;
|
|
854
|
+
provider?: string;
|
|
855
|
+
linkedAt?: number;
|
|
856
|
+
}
|
|
857
|
+
|
|
858
|
+
/** A list read: its rows and the paging around them. */
|
|
859
|
+
export declare interface CloudList<Row> {
|
|
860
|
+
list: Row[];
|
|
861
|
+
meta: CloudListMeta;
|
|
862
|
+
}
|
|
863
|
+
|
|
864
|
+
export declare interface CloudListMeta {
|
|
865
|
+
total: number;
|
|
866
|
+
limit?: number;
|
|
867
|
+
page?: number;
|
|
868
|
+
cursorNo?: number;
|
|
869
|
+
readNo?: number;
|
|
870
|
+
/** Where the list came from: the device cache, the server, or the cache standing in for the server. */
|
|
871
|
+
source?: 'local' | 'remote' | 'fallback';
|
|
872
|
+
}
|
|
873
|
+
|
|
874
|
+
/** A file of a message this device has not finished sending. */
|
|
875
|
+
export declare interface CloudPendingUpload {
|
|
876
|
+
localStatus: 'sending' | 'failed';
|
|
877
|
+
/** An object URL of the app's own page: it does not open in another page. */
|
|
878
|
+
localThumbUrl: string;
|
|
879
|
+
localName?: string;
|
|
880
|
+
localContentType?: string;
|
|
881
|
+
localSize?: number;
|
|
882
|
+
}
|
|
883
|
+
|
|
884
|
+
/** A place (`site`) of the current cloud. */
|
|
885
|
+
export declare interface CloudPlace {
|
|
886
|
+
id: string;
|
|
887
|
+
cid: string;
|
|
888
|
+
/** Its position in the user's list. */
|
|
889
|
+
order: number;
|
|
890
|
+
ownerId?: string;
|
|
891
|
+
thumbnail?: string;
|
|
892
|
+
desc?: string;
|
|
893
|
+
isOwner?: boolean;
|
|
894
|
+
/** Service detail: the place's server endpoints. */
|
|
895
|
+
$envs?: CloudServiceEndpoints;
|
|
896
|
+
legacy?: boolean;
|
|
897
|
+
isPublic?: boolean;
|
|
898
|
+
/** The place's owner, as the account server has them: much of it is contact and account detail. */
|
|
899
|
+
owner$?: CloudAccountUserView;
|
|
900
|
+
createdAt?: number;
|
|
901
|
+
updatedAt?: number;
|
|
902
|
+
deletedAt?: number;
|
|
903
|
+
error?: string;
|
|
904
|
+
$?: CloudCores;
|
|
905
|
+
stereo?: '' | '#alias' | 'mine' | 'place' | 'work' | 'domain' | 'session';
|
|
906
|
+
name?: string;
|
|
907
|
+
ns?: string;
|
|
908
|
+
type?: 'user' | 'role' | 'host' | 'site' | 'account' | 'group' | 'auth' | 'invite';
|
|
909
|
+
sid?: string;
|
|
910
|
+
uid?: string;
|
|
911
|
+
gid?: string;
|
|
912
|
+
lock?: number;
|
|
913
|
+
next?: number;
|
|
914
|
+
meta?: unknown;
|
|
915
|
+
_id?: string;
|
|
916
|
+
aliasId?: string;
|
|
917
|
+
alias$?: CloudAlias;
|
|
918
|
+
domain?: string;
|
|
919
|
+
host?: string;
|
|
920
|
+
alias?: string;
|
|
921
|
+
base?: string;
|
|
922
|
+
code?: string;
|
|
923
|
+
linked?: number;
|
|
924
|
+
typeCode?: string;
|
|
925
|
+
__cacheMeta?: CloudCacheMeta;
|
|
926
|
+
}
|
|
927
|
+
|
|
928
|
+
/**
|
|
929
|
+
* The places list takes no filter: pass `{}`. Always pass it — the app takes the stream's listener from
|
|
930
|
+
* the argument after it.
|
|
931
|
+
*/
|
|
932
|
+
export declare type CloudPlaceListQuery = Record<string, never>;
|
|
933
|
+
|
|
934
|
+
/** A member of one place, as `user.listPlaceMembers` lists them. */
|
|
935
|
+
export declare interface CloudPlaceMember {
|
|
936
|
+
id: string;
|
|
937
|
+
cid: string;
|
|
938
|
+
name?: string;
|
|
939
|
+
nick?: string;
|
|
940
|
+
thumbnail?: string;
|
|
941
|
+
/** Owns this place. */
|
|
942
|
+
isOwner?: boolean;
|
|
943
|
+
}
|
|
944
|
+
|
|
945
|
+
/** What `user.listPlaceMembers` answers. */
|
|
946
|
+
export declare interface CloudPlaceMembers {
|
|
947
|
+
members: CloudPlaceMember[];
|
|
948
|
+
/** The cloud and place the list is of. */
|
|
949
|
+
context: {
|
|
950
|
+
cid: string;
|
|
951
|
+
sid: string;
|
|
952
|
+
};
|
|
953
|
+
/** Whether the members' place profiles were loaded into the device cache along the way. */
|
|
954
|
+
profiles: 'loaded' | 'skipped' | 'failed';
|
|
955
|
+
}
|
|
956
|
+
|
|
957
|
+
/** The current place's members. Both ids must be the place the session is on. */
|
|
958
|
+
export declare interface CloudPlaceMembersQuery {
|
|
959
|
+
placeId: string;
|
|
960
|
+
sessionPlaceId: string;
|
|
961
|
+
}
|
|
962
|
+
|
|
963
|
+
/** A user's profile in one place: the name and picture they show there. */
|
|
964
|
+
export declare interface CloudProfile {
|
|
965
|
+
/** `<place id>@<user id>`. */
|
|
966
|
+
id: string;
|
|
967
|
+
cid: string;
|
|
968
|
+
/** The place. */
|
|
969
|
+
sid: string;
|
|
970
|
+
uid: string;
|
|
971
|
+
userId: string;
|
|
972
|
+
updatedAtMs: number;
|
|
973
|
+
active?: boolean;
|
|
974
|
+
createdAt?: number;
|
|
975
|
+
updatedAt?: number;
|
|
976
|
+
deletedAt?: number;
|
|
977
|
+
error?: string;
|
|
978
|
+
$?: CloudCores;
|
|
979
|
+
stereo?: string;
|
|
980
|
+
thumbnail?: string;
|
|
981
|
+
nick?: string;
|
|
982
|
+
siteId?: string;
|
|
983
|
+
ns?: string;
|
|
984
|
+
type?: 'user' | 'site' | 'profile';
|
|
985
|
+
gid?: string;
|
|
986
|
+
lock?: number;
|
|
987
|
+
next?: number;
|
|
988
|
+
meta?: unknown;
|
|
989
|
+
_id?: string;
|
|
990
|
+
__cacheMeta?: CloudCacheMeta;
|
|
991
|
+
}
|
|
992
|
+
|
|
993
|
+
/** Whose profiles: a place's, a user's, or one user's in one place. `siteId`/`userId` are older names. */
|
|
994
|
+
export declare interface CloudProfileListQuery {
|
|
995
|
+
sid?: string;
|
|
996
|
+
uid?: string;
|
|
997
|
+
siteId?: string;
|
|
998
|
+
userId?: string;
|
|
999
|
+
}
|
|
1000
|
+
|
|
1001
|
+
/** One emoji added to (`on`) or removed from (`off`) a message, in the user's name. */
|
|
1002
|
+
export declare interface CloudReactionInput {
|
|
1003
|
+
chatId: string;
|
|
1004
|
+
emoji: string;
|
|
1005
|
+
action: 'on' | 'off';
|
|
1006
|
+
}
|
|
1007
|
+
|
|
1008
|
+
/** A plain text message to a room of the place the view opened on. */
|
|
1009
|
+
export declare interface CloudSendChatInput {
|
|
1010
|
+
channelId: string;
|
|
1011
|
+
/** Something besides white space, at most 1000 UTF-16 code units. */
|
|
1012
|
+
content: string;
|
|
1013
|
+
}
|
|
1014
|
+
|
|
1015
|
+
/** Service detail: the addresses of a cloud's or a place's own servers. */
|
|
1016
|
+
export declare interface CloudServiceEndpoints {
|
|
1017
|
+
accountNo?: string;
|
|
1018
|
+
backend?: string;
|
|
1019
|
+
wss?: string;
|
|
1020
|
+
}
|
|
1021
|
+
|
|
1022
|
+
/**
|
|
1023
|
+
* The session as a page with the `session` permission gets it: the current cloud's half and who the
|
|
1024
|
+
* user is in it. Nothing of the user's other clouds, and no server address or token.
|
|
1025
|
+
*/
|
|
1026
|
+
export declare interface CloudSession {
|
|
1027
|
+
context: {
|
|
1028
|
+
cloud: {
|
|
1029
|
+
cloudId: string | null;
|
|
1030
|
+
/** The place selected; it moves before a switch is done. */
|
|
1031
|
+
siteId: string | null;
|
|
1032
|
+
isActive: boolean;
|
|
1033
|
+
};
|
|
1034
|
+
identity: {
|
|
1035
|
+
/** The user's id in this cloud. */
|
|
1036
|
+
userId: string | null;
|
|
1037
|
+
isAuthenticated: boolean;
|
|
1038
|
+
};
|
|
1039
|
+
};
|
|
1040
|
+
/** The place the session is really on. */
|
|
1041
|
+
committedSiteId: string | null;
|
|
1042
|
+
}
|
|
1043
|
+
|
|
1044
|
+
/** The cloud's lifecycle (`CloudInfo.state$`): set-up, holds, release and plan changes. */
|
|
1045
|
+
export declare interface CloudState {
|
|
1046
|
+
provision?: 'init' | 'reserved' | 'active';
|
|
1047
|
+
hold?: '' | 'downgrade' | 'expired';
|
|
1048
|
+
life?: '' | 'released';
|
|
1049
|
+
plan?: '' | 'drop';
|
|
1050
|
+
}
|
|
1051
|
+
|
|
1052
|
+
/** A file a sent message carries. */
|
|
1053
|
+
export declare interface CloudUpload {
|
|
1054
|
+
status: 'pending' | 'stored' | 'failed';
|
|
1055
|
+
id?: string;
|
|
1056
|
+
createdAt?: number;
|
|
1057
|
+
updatedAt?: number;
|
|
1058
|
+
deletedAt?: number;
|
|
1059
|
+
error?: string;
|
|
1060
|
+
$?: CloudCores;
|
|
1061
|
+
stereo?: 'image' | 'video' | 'audio' | 'file';
|
|
1062
|
+
contentType?: string;
|
|
1063
|
+
ns?: string;
|
|
1064
|
+
type?: 'upload';
|
|
1065
|
+
sid?: string;
|
|
1066
|
+
uid?: string;
|
|
1067
|
+
gid?: string;
|
|
1068
|
+
lock?: number;
|
|
1069
|
+
next?: number;
|
|
1070
|
+
meta?: unknown;
|
|
1071
|
+
_id?: string;
|
|
1072
|
+
contentSize?: number;
|
|
1073
|
+
width?: number;
|
|
1074
|
+
height?: number;
|
|
1075
|
+
hash?: string;
|
|
1076
|
+
name?: string;
|
|
1077
|
+
url?: string;
|
|
1078
|
+
thumbnail?: CloudUploadResource;
|
|
1079
|
+
orgUrl?: string;
|
|
1080
|
+
thumbUrl?: string;
|
|
1081
|
+
}
|
|
1082
|
+
|
|
1083
|
+
/** A stored file's resource: its preview. */
|
|
1084
|
+
export declare interface CloudUploadResource {
|
|
1085
|
+
url: string;
|
|
1086
|
+
contentType?: string;
|
|
1087
|
+
contentSize?: number;
|
|
1088
|
+
width?: number;
|
|
1089
|
+
height?: number;
|
|
1090
|
+
hash?: string;
|
|
1091
|
+
}
|
|
1092
|
+
|
|
1093
|
+
/** A user of the current cloud. */
|
|
1094
|
+
export declare interface CloudUser {
|
|
1095
|
+
id: string;
|
|
1096
|
+
cid: string;
|
|
1097
|
+
createdAt?: number;
|
|
1098
|
+
updatedAt?: number;
|
|
1099
|
+
deletedAt?: number;
|
|
1100
|
+
error?: string;
|
|
1101
|
+
$?: CloudCores;
|
|
1102
|
+
stereo?: '' | 'user' | 'system' | 'admin' | 'dummy';
|
|
1103
|
+
name?: string;
|
|
1104
|
+
thumbnail?: string;
|
|
1105
|
+
nick?: string;
|
|
1106
|
+
ns?: string;
|
|
1107
|
+
type?: 'user' | 'site' | 'profile';
|
|
1108
|
+
sid?: string;
|
|
1109
|
+
uid?: string;
|
|
1110
|
+
gid?: string;
|
|
1111
|
+
lock?: number;
|
|
1112
|
+
next?: number;
|
|
1113
|
+
meta?: unknown;
|
|
1114
|
+
_id?: string;
|
|
1115
|
+
/** Account detail: the user's sign-in id. */
|
|
1116
|
+
loginId?: string;
|
|
1117
|
+
/** Account detail: the user's identity id with the sign-in provider. */
|
|
1118
|
+
identityId?: string;
|
|
1119
|
+
channelIds?: string[];
|
|
1120
|
+
$join?: CloudJoinView;
|
|
1121
|
+
__cacheMeta?: CloudCacheMeta;
|
|
1122
|
+
}
|
|
1123
|
+
|
|
1124
|
+
/** One room's members. */
|
|
1125
|
+
export declare interface CloudUserListQuery {
|
|
1126
|
+
channelId: string;
|
|
1127
|
+
limit?: number;
|
|
1128
|
+
page?: number;
|
|
1129
|
+
detail?: boolean;
|
|
1130
|
+
}
|
|
1131
|
+
|
|
1132
|
+
/** A user as the server embeds one in another record. */
|
|
1133
|
+
export declare interface CloudUserView {
|
|
1134
|
+
id?: string;
|
|
1135
|
+
createdAt?: number;
|
|
1136
|
+
updatedAt?: number;
|
|
1137
|
+
deletedAt?: number;
|
|
1138
|
+
error?: string;
|
|
1139
|
+
$?: CloudCores;
|
|
1140
|
+
stereo?: '' | 'user' | 'admin' | 'dummy' | 'system';
|
|
1141
|
+
ns?: string;
|
|
1142
|
+
type?: 'profile' | 'user' | 'site';
|
|
1143
|
+
sid?: string;
|
|
1144
|
+
uid?: string;
|
|
1145
|
+
gid?: string;
|
|
1146
|
+
lock?: number;
|
|
1147
|
+
next?: number;
|
|
1148
|
+
meta?: unknown;
|
|
1149
|
+
_id?: string;
|
|
1150
|
+
name?: string;
|
|
1151
|
+
thumbnail?: string;
|
|
1152
|
+
nick?: string;
|
|
1153
|
+
/** Account detail: the user's sign-in id. */
|
|
1154
|
+
loginId?: string;
|
|
1155
|
+
/** Account detail: the user's identity id with the sign-in provider. */
|
|
1156
|
+
identityId?: string;
|
|
1157
|
+
channelIds?: string[];
|
|
1158
|
+
$join?: CloudJoinView;
|
|
1159
|
+
}
|
|
1160
|
+
|
|
153
1161
|
/**
|
|
154
1162
|
* Connects to the app, or — in a browser tab — to nothing, returning the same interface with browser
|
|
155
1163
|
* fallbacks, so one page runs in both. In the app it shakes hands first: what the app answers, and the
|
|
@@ -171,9 +1179,241 @@ export declare interface ConnectOptions {
|
|
|
171
1179
|
reportErrors?: boolean;
|
|
172
1180
|
}
|
|
173
1181
|
|
|
1182
|
+
/** The read methods this page may use: `<repository>.<method>` names, as the app reported them. */
|
|
1183
|
+
export declare interface DataAllowed {
|
|
1184
|
+
calls: string[];
|
|
1185
|
+
streams: string[];
|
|
1186
|
+
}
|
|
1187
|
+
|
|
1188
|
+
export declare type DataCallArgs<M extends DataCallName> = DataCalls[M]['args'];
|
|
1189
|
+
|
|
1190
|
+
export declare type DataCallName = keyof DataCalls;
|
|
1191
|
+
|
|
1192
|
+
export declare type DataCallResult<M extends DataCallName> = DataCalls[M]['result'];
|
|
1193
|
+
|
|
1194
|
+
/**
|
|
1195
|
+
* Every method `apps.data.call` reaches, by the app's own `<repository>.<method>` name: the
|
|
1196
|
+
* permission that opens it, its arguments and what it resolves with. `can(method)` still says whether it
|
|
1197
|
+
* is open now — this says only what it would be.
|
|
1198
|
+
*/
|
|
1199
|
+
export declare interface DataCalls {
|
|
1200
|
+
'channel.cacheRead': {
|
|
1201
|
+
permission: 'channel';
|
|
1202
|
+
args: [id: string];
|
|
1203
|
+
result: CloudChannel | null;
|
|
1204
|
+
};
|
|
1205
|
+
'channel.cacheReadList': {
|
|
1206
|
+
permission: 'channel';
|
|
1207
|
+
args: [query: CloudChannelListQuery];
|
|
1208
|
+
result: CloudList<CloudChannel> | null;
|
|
1209
|
+
};
|
|
1210
|
+
/** Asks the server; counts against the view's server reads. */
|
|
1211
|
+
'channel.fetchList': {
|
|
1212
|
+
permission: 'channel';
|
|
1213
|
+
args: [query: CloudChannelListQuery];
|
|
1214
|
+
result: CloudList<CloudChannel>;
|
|
1215
|
+
};
|
|
1216
|
+
'join.cacheReadList': {
|
|
1217
|
+
permission: 'channel';
|
|
1218
|
+
args: [query: CloudJoinListQuery];
|
|
1219
|
+
result: CloudList<CloudJoin> | null;
|
|
1220
|
+
};
|
|
1221
|
+
'chat.cacheRead': {
|
|
1222
|
+
permission: 'chat';
|
|
1223
|
+
args: [id: string];
|
|
1224
|
+
result: CloudChat | null;
|
|
1225
|
+
};
|
|
1226
|
+
'chat.cacheReadList': {
|
|
1227
|
+
permission: 'chat';
|
|
1228
|
+
args: [query: CloudChatFeedQuery];
|
|
1229
|
+
result: CloudList<CloudChat> | null;
|
|
1230
|
+
};
|
|
1231
|
+
'chat.listPendingImageChats': {
|
|
1232
|
+
permission: 'chat';
|
|
1233
|
+
args: [channelId: string];
|
|
1234
|
+
result: CloudChat[];
|
|
1235
|
+
};
|
|
1236
|
+
/** A write, the message. `apps.data.sendMessage` calls it; prefer that. */
|
|
1237
|
+
'chat.sendChat': {
|
|
1238
|
+
permission: 'chatSend';
|
|
1239
|
+
args: [input: CloudSendChatInput];
|
|
1240
|
+
result: CloudChat;
|
|
1241
|
+
};
|
|
1242
|
+
/** A write, the reaction; answers the message's row with it applied. `apps.data.react` calls it. */
|
|
1243
|
+
'chat.setReaction': {
|
|
1244
|
+
permission: 'chatReact';
|
|
1245
|
+
args: [input: CloudReactionInput];
|
|
1246
|
+
result: CloudChat;
|
|
1247
|
+
};
|
|
1248
|
+
/** `id` must be the current cloud's. */
|
|
1249
|
+
'cloud.cacheRead': {
|
|
1250
|
+
permission: 'cloud';
|
|
1251
|
+
args: [id: string];
|
|
1252
|
+
result: CloudInfo | null;
|
|
1253
|
+
};
|
|
1254
|
+
/** Asks the server. `id` must be the current cloud's, and `cache: false` is required. */
|
|
1255
|
+
'cloud.getCloud': {
|
|
1256
|
+
permission: 'cloud';
|
|
1257
|
+
args: [input: {
|
|
1258
|
+
id: string;
|
|
1259
|
+
}, options: {
|
|
1260
|
+
cache: false;
|
|
1261
|
+
}];
|
|
1262
|
+
result: CloudInfo;
|
|
1263
|
+
};
|
|
1264
|
+
'place.cacheReadList': {
|
|
1265
|
+
permission: 'place';
|
|
1266
|
+
args: [query?: CloudPlaceListQuery];
|
|
1267
|
+
result: CloudList<CloudPlace> | null;
|
|
1268
|
+
};
|
|
1269
|
+
/** Asks the server. */
|
|
1270
|
+
'place.isPlaceDeleted': {
|
|
1271
|
+
permission: 'place';
|
|
1272
|
+
args: [id: string];
|
|
1273
|
+
result: boolean;
|
|
1274
|
+
};
|
|
1275
|
+
'user.cacheReadList': {
|
|
1276
|
+
permission: 'user';
|
|
1277
|
+
args: [query: CloudUserListQuery];
|
|
1278
|
+
result: CloudList<CloudUser> | null;
|
|
1279
|
+
};
|
|
1280
|
+
/** Asks the server, for the place the session is on only. */
|
|
1281
|
+
'user.listPlaceMembers': {
|
|
1282
|
+
permission: 'user';
|
|
1283
|
+
args: [query: CloudPlaceMembersQuery];
|
|
1284
|
+
result: CloudPlaceMembers;
|
|
1285
|
+
};
|
|
1286
|
+
'profile.cacheRead': {
|
|
1287
|
+
permission: 'user';
|
|
1288
|
+
args: [id: string];
|
|
1289
|
+
result: CloudProfile | null;
|
|
1290
|
+
};
|
|
1291
|
+
'profile.cacheReadList': {
|
|
1292
|
+
permission: 'user';
|
|
1293
|
+
args: [query?: CloudProfileListQuery];
|
|
1294
|
+
result: CloudList<CloudProfile> | null;
|
|
1295
|
+
};
|
|
1296
|
+
}
|
|
1297
|
+
|
|
1298
|
+
/** What the app answered `connect()` with. */
|
|
1299
|
+
export declare interface DataConnection {
|
|
1300
|
+
/** The cloud data contract version this page and the app speak. */
|
|
1301
|
+
contract: number;
|
|
1302
|
+
allowed: DataAllowed;
|
|
1303
|
+
}
|
|
1304
|
+
|
|
1305
|
+
/** The manifest permissions that open cloud data methods. */
|
|
1306
|
+
export declare type DataPermission = 'session' | 'cloud' | 'place' | 'channel' | 'chat' | 'user' | 'chatSend' | 'chatReact';
|
|
1307
|
+
|
|
1308
|
+
export declare type DataStreamArgs<M extends DataStreamName> = DataStreams[M]['args'];
|
|
1309
|
+
|
|
1310
|
+
export declare type DataStreamEvent<M extends DataStreamName> = DataStreams[M]['event'];
|
|
1311
|
+
|
|
1312
|
+
export declare type DataStreamName = keyof DataStreams;
|
|
1313
|
+
|
|
1314
|
+
/**
|
|
1315
|
+
* The current cloud's data — its places, rooms, messages and members, exactly as DoU's own screens
|
|
1316
|
+
* read them — and two writes, a text message and a reaction. Only what the page's manifest asks for
|
|
1317
|
+
* (`session`, `cloud`, `place`, `channel`, `chat`, `user`, `chatSend`, `chatReact`): the app
|
|
1318
|
+
* refuses every other method with `RUNTIME_NOT_ALLOWED`. The app asks the user once, at `connect`,
|
|
1319
|
+
* whether this page may read this cloud.
|
|
1320
|
+
*
|
|
1321
|
+
* Only in the app, and only where the app holds the session itself: `apps.supports('data')`
|
|
1322
|
+
* says whether this one does.
|
|
1323
|
+
*
|
|
1324
|
+
* A method `DataCalls` / `DataStreams` names is typed: its arguments and its answer. Any other
|
|
1325
|
+
* name still goes through, answered as `unknown` — an app newer than this library may open more.
|
|
1326
|
+
*/
|
|
1327
|
+
/** Hears a stream the app ended, as `subscribe`'s `onEnd`. */
|
|
1328
|
+
export declare interface DataStreamOptions {
|
|
1329
|
+
onEnd?: (error: ChaticAppsError) => void;
|
|
1330
|
+
}
|
|
1331
|
+
|
|
1332
|
+
/**
|
|
1333
|
+
* Every stream `apps.data.subscribe` reaches: the permission that opens it, the arguments the page
|
|
1334
|
+
* passes, and what each event carries. The app's method takes its listener right after these arguments,
|
|
1335
|
+
* which is where `subscribe` puts it — so a typed call needs no `LISTENER`.
|
|
1336
|
+
*/
|
|
1337
|
+
export declare interface DataStreams {
|
|
1338
|
+
'channel.observeList': {
|
|
1339
|
+
permission: 'channel';
|
|
1340
|
+
args: [query: CloudChannelListQuery];
|
|
1341
|
+
event: [result: CloudList<CloudChannel> | null];
|
|
1342
|
+
};
|
|
1343
|
+
'channel.observeItem': {
|
|
1344
|
+
permission: 'channel';
|
|
1345
|
+
args: [id: string];
|
|
1346
|
+
event: [item: CloudChannel | null];
|
|
1347
|
+
};
|
|
1348
|
+
'join.observeList': {
|
|
1349
|
+
permission: 'channel';
|
|
1350
|
+
args: [query: CloudJoinListQuery];
|
|
1351
|
+
event: [result: CloudList<CloudJoin> | null];
|
|
1352
|
+
};
|
|
1353
|
+
'chat.observeList': {
|
|
1354
|
+
permission: 'chat';
|
|
1355
|
+
args: [query: CloudChatObserveQuery];
|
|
1356
|
+
event: [result: CloudList<CloudChat> | null];
|
|
1357
|
+
};
|
|
1358
|
+
'chat.observeLastList': {
|
|
1359
|
+
permission: 'chat';
|
|
1360
|
+
args: [channelIds: string[]];
|
|
1361
|
+
event: [result: CloudLastChat[]];
|
|
1362
|
+
};
|
|
1363
|
+
/** The message-number ranges a feed read has answered for; a gap inside one is a deleted message. */
|
|
1364
|
+
'chat.observeFeedCoverage': {
|
|
1365
|
+
permission: 'chat';
|
|
1366
|
+
args: [channelId: string];
|
|
1367
|
+
event: [covered: CloudChatNumberRange[]];
|
|
1368
|
+
};
|
|
1369
|
+
/** `id` must be the current cloud's. */
|
|
1370
|
+
'cloud.observeItem': {
|
|
1371
|
+
permission: 'cloud';
|
|
1372
|
+
args: [id: string];
|
|
1373
|
+
event: [item: CloudInfo | null];
|
|
1374
|
+
};
|
|
1375
|
+
'place.observeList': {
|
|
1376
|
+
permission: 'place';
|
|
1377
|
+
args: [query: CloudPlaceListQuery];
|
|
1378
|
+
event: [result: CloudList<CloudPlace> | null];
|
|
1379
|
+
};
|
|
1380
|
+
'place.observeItem': {
|
|
1381
|
+
permission: 'place';
|
|
1382
|
+
args: [id: string];
|
|
1383
|
+
event: [item: CloudPlace | null];
|
|
1384
|
+
};
|
|
1385
|
+
'user.observeList': {
|
|
1386
|
+
permission: 'user';
|
|
1387
|
+
args: [query: CloudUserListQuery];
|
|
1388
|
+
event: [result: CloudList<CloudUser> | null];
|
|
1389
|
+
};
|
|
1390
|
+
'profile.observeList': {
|
|
1391
|
+
permission: 'user';
|
|
1392
|
+
args: [query: CloudProfileListQuery];
|
|
1393
|
+
event: [result: CloudList<CloudProfile> | null];
|
|
1394
|
+
};
|
|
1395
|
+
'profile.observeItem': {
|
|
1396
|
+
permission: 'user';
|
|
1397
|
+
args: [id: string];
|
|
1398
|
+
event: [item: CloudProfile | null];
|
|
1399
|
+
};
|
|
1400
|
+
}
|
|
1401
|
+
|
|
1402
|
+
/** An open stream. */
|
|
1403
|
+
export declare interface DataSubscription {
|
|
1404
|
+
/** Stops it. Stopping one that already ended is no error. */
|
|
1405
|
+
stop(): Promise<void>;
|
|
1406
|
+
}
|
|
1407
|
+
|
|
174
1408
|
/** A device a page captures from with `getUserMedia`. */
|
|
175
1409
|
export declare type DeviceKind = 'camera' | 'microphone';
|
|
176
1410
|
|
|
1411
|
+
/**
|
|
1412
|
+
* How the app shows the page: `titled` under its bar, `clean` with no bar, `immersive` across the whole
|
|
1413
|
+
* screen, under the system bars. The one the app actually uses, which may differ from the manifest's.
|
|
1414
|
+
*/
|
|
1415
|
+
export declare type Display = 'titled' | 'clean' | 'immersive';
|
|
1416
|
+
|
|
177
1417
|
/** The feel of a haptic: a tick, a tap, or the outcome of something the user did. */
|
|
178
1418
|
export declare type HapticKind = 'selection' | 'impact' | 'success' | 'warning' | 'error';
|
|
179
1419
|
|
|
@@ -183,6 +1423,44 @@ export declare const isInApp: () => boolean;
|
|
|
183
1423
|
/** What a link hands the page it opens, as its query: `{ level: 3 }` opens the page at `/?level=3`. */
|
|
184
1424
|
export declare type LinkParams = Readonly<Record<string, string | number | boolean>>;
|
|
185
1425
|
|
|
1426
|
+
/**
|
|
1427
|
+
* Where a stream's listener goes among its arguments. Left out, it goes last — which, for every method
|
|
1428
|
+
* `DataStreams` names, is where the app's method takes it, so a typed `subscribe` never needs it. For
|
|
1429
|
+
* a method this library does not know yet, put it where that method takes its callback.
|
|
1430
|
+
*/
|
|
1431
|
+
export declare const LISTENER: Readonly<{
|
|
1432
|
+
$listener: true;
|
|
1433
|
+
}>;
|
|
1434
|
+
|
|
1435
|
+
/**
|
|
1436
|
+
* The `params` DoU's own web opens a mini app with (`context.params`): who is looking, in which cloud
|
|
1437
|
+
* and place. Ids and display names only — nothing that proves who the user is, so a page's server must
|
|
1438
|
+
* not treat them as a sign-in. `user.id` is the user's id in that cloud. `user.isOwner` and
|
|
1439
|
+
* `miniApps` reach the DoU hub alone; any other page never receives them. A page opened some other way
|
|
1440
|
+
* may get other `params`, so read them as unknown until they have this shape.
|
|
1441
|
+
*/
|
|
1442
|
+
export declare type MiniAppLaunchParams = {
|
|
1443
|
+
cloud: {
|
|
1444
|
+
id: string;
|
|
1445
|
+
name: string;
|
|
1446
|
+
};
|
|
1447
|
+
place: {
|
|
1448
|
+
id: string;
|
|
1449
|
+
name: string;
|
|
1450
|
+
} | null;
|
|
1451
|
+
user: {
|
|
1452
|
+
id: string;
|
|
1453
|
+
name: string;
|
|
1454
|
+
isOwner?: boolean;
|
|
1455
|
+
};
|
|
1456
|
+
/** The cloud's mini apps in the owner's order: a name and the host, never the address itself. */
|
|
1457
|
+
miniApps?: {
|
|
1458
|
+
id: string;
|
|
1459
|
+
name: string;
|
|
1460
|
+
host: string;
|
|
1461
|
+
}[];
|
|
1462
|
+
};
|
|
1463
|
+
|
|
186
1464
|
/**
|
|
187
1465
|
* Where the app stands with the OS for one device:
|
|
188
1466
|
* - `granted` — `getUserMedia` for it asks nothing further;
|
|
@@ -192,8 +1470,19 @@ export declare type LinkParams = Readonly<Record<string, string | number | boole
|
|
|
192
1470
|
declare type PermissionState_2 = 'granted' | 'prompt' | 'blocked';
|
|
193
1471
|
export { PermissionState_2 as PermissionState }
|
|
194
1472
|
|
|
1473
|
+
/** How far each system bar reaches into the page, in CSS pixels. */
|
|
1474
|
+
export declare type SafeArea = {
|
|
1475
|
+
top: number;
|
|
1476
|
+
right: number;
|
|
1477
|
+
bottom: number;
|
|
1478
|
+
left: number;
|
|
1479
|
+
};
|
|
1480
|
+
|
|
195
1481
|
/** The bridge version this library is written against, sent as each request's `version`. */
|
|
196
|
-
export declare const SDK_BRIDGE_VERSION = "2.
|
|
1482
|
+
export declare const SDK_BRIDGE_VERSION = "2.33.0";
|
|
1483
|
+
|
|
1484
|
+
/** The versions of the app's cloud data contract this library speaks, lowest first. */
|
|
1485
|
+
export declare const SDK_DATA_CONTRACTS: readonly number[];
|
|
197
1486
|
|
|
198
1487
|
export declare interface ShareContent {
|
|
199
1488
|
title?: string;
|