palbase 0.34.0 → 0.36.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +10 -4
- package/dist/ai/index.js +2 -2
- package/dist/backend/engine.js +2 -2
- package/dist/backend/env.js +1 -1
- package/dist/backend/index.js +3 -3
- package/dist/backend/stack.js +1 -1
- package/dist/backend/test.js +2 -2
- package/dist/chunks/{TGGBNVFF.js → 46OHFRCO.js} +1 -1
- package/dist/chunks/{TSZBPILF.js → 7H437WNH.js} +1 -1
- package/dist/chunks/{VYJZI4ZF.js → CG4MLOSS.js} +2 -2
- package/dist/chunks/{JNARDSKO.js → D4FVVF3V.js} +2 -2
- package/dist/chunks/{TXPV2FZL.js → E4CI4NNS.js} +2 -2
- package/dist/chunks/{WFXZMNDL.js → FTSLUVFM.js} +2 -2
- package/dist/chunks/{56CR6XQX.js → H56DM2K7.js} +1 -1
- package/dist/chunks/{TO7DBGJO.js → IHV64CIO.js} +2 -2
- package/dist/chunks/{CVZYB52V.js → JWCGOXP2.js} +2 -2
- package/dist/chunks/{3WO4MSQK.js → KYDXOXBY.js} +2 -2
- package/dist/chunks/{BORV4XQE.js → M5AWMRKL.js} +2 -2
- package/dist/chunks/{23NFADPH.js → MIGVS67R.js} +1 -1
- package/dist/chunks/{2KUOCM4W.js → NIRJK52A.js} +1 -1
- package/dist/chunks/NVD5UXUT.js +22 -0
- package/dist/chunks/{QLGKS7OC.js → ODKRTA5Q.js} +2 -2
- package/dist/chunks/{ZXOT7B45.js → PIGHUXF4.js} +2 -2
- package/dist/chunks/{U2OSMAAB.js → QBYUSNOL.js} +1 -1
- package/dist/chunks/RSDDSUSD.js +2 -0
- package/dist/chunks/{SVEMN34N.js → TJRKN6TT.js} +1 -1
- package/dist/chunks/{7KAQJOKQ.js → TV4DBUC7.js} +2 -2
- package/dist/chunks/{DP7HCIWR.js → U567PXWS.js} +2 -2
- package/dist/chunks/{HJTZ5RUV.js → UCYI2SR2.js} +2 -2
- package/dist/chunks/{AAJTXVUF.js → UJ6BQKTD.js} +2 -2
- package/dist/cli.js +114 -114
- package/dist/cloud/index.js +2 -2
- package/dist/refuse/ai.js +1 -1
- package/dist/refuse/backend.js +1 -1
- package/dist/refuse/cloud.js +1 -1
- package/dist/refuse/server.js +1 -1
- package/dist/server/index.js +2 -2
- package/dist/server/testing.js +2 -2
- package/dist/web/index.js +2 -2
- package/dist/web/message.js +2 -2
- package/dist/web/palbe.js +2 -2
- package/dist/web/paywall.js +2 -2
- package/dist/web/push-sw.js +1 -1
- package/dist/web/ssr.js +2 -2
- package/dist/web/vite.js +2 -2
- package/package.json +2 -6
- package/types/internal/src/modules/ai.d.ts +4 -4
- package/types/internal/src/modules/calls.d.ts +102 -3
- package/types/internal/src/modules/machines.d.ts +13 -5
- package/types/web/src/calls.d.ts +142 -9
- package/types/web/src/index.d.ts +1 -1
- package/dist/chunks/FFLUB3R2.js +0 -2
- package/dist/chunks/I6FOJBJG.js +0 -22
- package/dist/web/calls-ui.js +0 -46
- package/types/web/src/calls-ui/index.d.ts +0 -71
|
@@ -53,6 +53,10 @@ export type Call = {
|
|
|
53
53
|
* Its people and bots
|
|
54
54
|
*/
|
|
55
55
|
participants: Participant[];
|
|
56
|
+
/**
|
|
57
|
+
* The place it is held at, as the project names it (a channel of its app, a conversation: channel:42, conversation:<id>): the place's people — whom the project's rule lets in — find it going on and join it unasked. Null for a call of no place
|
|
58
|
+
*/
|
|
59
|
+
place: string | null;
|
|
56
60
|
/**
|
|
57
61
|
* Whether it rings the people asked (false: a huddle they join)
|
|
58
62
|
*/
|
|
@@ -102,6 +106,10 @@ export type CallEvent = {
|
|
|
102
106
|
* user or bot
|
|
103
107
|
*/
|
|
104
108
|
participant_kind?: string;
|
|
109
|
+
/**
|
|
110
|
+
* The place it is held at (null for a call of no place)
|
|
111
|
+
*/
|
|
112
|
+
place: string | null;
|
|
105
113
|
/**
|
|
106
114
|
* The call's room on the media server: what an agent's ticket is for
|
|
107
115
|
*/
|
|
@@ -240,6 +248,10 @@ export type HookSettings = {
|
|
|
240
248
|
* A hook that does not answer: refuse the call, or let it
|
|
241
249
|
*/
|
|
242
250
|
on_error?: "deny" | "allow";
|
|
251
|
+
/**
|
|
252
|
+
* The hook answers places too (action place: may this person see and join the calls held at a place). Off, it is never asked of a place, and a place's call is seen only by the people asked into it (a conversation:<id> place's members aside)
|
|
253
|
+
*/
|
|
254
|
+
places?: boolean;
|
|
243
255
|
/**
|
|
244
256
|
* How long it is waited for (100 to 5,000; 2,000)
|
|
245
257
|
*/
|
|
@@ -262,6 +274,23 @@ export type InviteRequest = {
|
|
|
262
274
|
*/
|
|
263
275
|
user_ids: string[];
|
|
264
276
|
};
|
|
277
|
+
/**
|
|
278
|
+
* Comes into a group call on a device
|
|
279
|
+
*/
|
|
280
|
+
export type JoinRequest = {
|
|
281
|
+
/**
|
|
282
|
+
* The device it is joined on
|
|
283
|
+
*/
|
|
284
|
+
device_id: string;
|
|
285
|
+
/**
|
|
286
|
+
* Their picture, an https URL, likewise
|
|
287
|
+
*/
|
|
288
|
+
image_url?: string | null;
|
|
289
|
+
/**
|
|
290
|
+
* What the others see of one who comes in unasked (a place's), where nothing else names them
|
|
291
|
+
*/
|
|
292
|
+
name?: string | null;
|
|
293
|
+
};
|
|
265
294
|
/**
|
|
266
295
|
* A device's way into the call's room on the media server, where every call's media flows — one to one or in a group: its url and the ticket its client connects with
|
|
267
296
|
*/
|
|
@@ -332,6 +361,20 @@ export type Participant = {
|
|
|
332
361
|
*/
|
|
333
362
|
user_id: string;
|
|
334
363
|
};
|
|
364
|
+
/**
|
|
365
|
+
* A place and its call: going on, or — told to a watcher as it ends — its last, ended (with its version: a snapshot that comes late is known for older); no call when none goes on there. Participants carry no device_id
|
|
366
|
+
*/
|
|
367
|
+
export type PlaceView = {
|
|
368
|
+
call?: Call;
|
|
369
|
+
/**
|
|
370
|
+
* The place
|
|
371
|
+
*/
|
|
372
|
+
place: string;
|
|
373
|
+
/**
|
|
374
|
+
* How long the reader is told of the place's call (the place event on their calls channel) before the watch is asked again — a watch's answer alone
|
|
375
|
+
*/
|
|
376
|
+
watch_seconds?: number;
|
|
377
|
+
};
|
|
335
378
|
/**
|
|
336
379
|
* A call to make
|
|
337
380
|
*/
|
|
@@ -362,12 +405,16 @@ export type StartCallRequest = {
|
|
|
362
405
|
metadata?: {
|
|
363
406
|
[key: string]: string;
|
|
364
407
|
};
|
|
408
|
+
/**
|
|
409
|
+
* Holds the call at a place (a group call): letters, digits and . _ : -, 1 to 128 (channel:42; conversation:<id> for a conversation of Palbase's messaging, whose members it lets in). One call goes on at a place at a time. Who it lets in is the project's rule: a conversation's members, else the project's hook (calls.can_call, action place); with no hook, no one but those asked
|
|
410
|
+
*/
|
|
411
|
+
place?: string | null;
|
|
365
412
|
/**
|
|
366
413
|
* Ring them (true, by default); false: a group call they join (a huddle)
|
|
367
414
|
*/
|
|
368
415
|
ring?: boolean;
|
|
369
416
|
/**
|
|
370
|
-
* Who to call: one person (a direct call), or several (a group)
|
|
417
|
+
* Who to call: one person (a direct call), or several (a group); none for a call at a place, which its people join
|
|
371
418
|
*/
|
|
372
419
|
user_ids: string[];
|
|
373
420
|
/**
|
|
@@ -375,6 +422,25 @@ export type StartCallRequest = {
|
|
|
375
422
|
*/
|
|
376
423
|
video?: boolean;
|
|
377
424
|
};
|
|
425
|
+
/**
|
|
426
|
+
* A call not started: why, and — when a call goes on at its place (place_busy) — that call, to join
|
|
427
|
+
*/
|
|
428
|
+
export type StartRefused = {
|
|
429
|
+
call?: Call;
|
|
430
|
+
/**
|
|
431
|
+
* The refusal's name
|
|
432
|
+
*/
|
|
433
|
+
error: string;
|
|
434
|
+
/**
|
|
435
|
+
* What it means
|
|
436
|
+
*/
|
|
437
|
+
error_description: string;
|
|
438
|
+
/**
|
|
439
|
+
* The request's id
|
|
440
|
+
*/
|
|
441
|
+
request_id?: string;
|
|
442
|
+
[key: string]: unknown;
|
|
443
|
+
};
|
|
378
444
|
/**
|
|
379
445
|
* A way in for an agent
|
|
380
446
|
*/
|
|
@@ -517,6 +583,39 @@ export declare function client(t: Transport): {
|
|
|
517
583
|
body: TicketRequest; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
|
|
518
584
|
signal?: AbortSignal;
|
|
519
585
|
}): Promise<Reply<201, Ticket>>;
|
|
586
|
+
/**
|
|
587
|
+
* A place's call
|
|
588
|
+
*
|
|
589
|
+
* The call going on at the place, if one is, for a reader the place lets in: one of those in it or asked, or whom the project's rule lets in (a conversation's members for a conversation:<id> place, else the project's hook; with no hook, no one else).
|
|
590
|
+
*/
|
|
591
|
+
getCallPlace(input: {
|
|
592
|
+
path: {
|
|
593
|
+
place: string;
|
|
594
|
+
}; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
|
|
595
|
+
signal?: AbortSignal;
|
|
596
|
+
}): Promise<Reply<200, PlaceView>>;
|
|
597
|
+
/**
|
|
598
|
+
* Watch a place
|
|
599
|
+
*
|
|
600
|
+
* The reader is told of the place's call — started, changed, ended (no call) — as the place event on their calls channel, for watch_seconds; an app showing the place asks again before it runs out. Answered with the place's call as it is.
|
|
601
|
+
*/
|
|
602
|
+
watchCallPlace(input: {
|
|
603
|
+
path: {
|
|
604
|
+
place: string;
|
|
605
|
+
}; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
|
|
606
|
+
signal?: AbortSignal;
|
|
607
|
+
}): Promise<Reply<200, PlaceView>>;
|
|
608
|
+
/**
|
|
609
|
+
* Stop watching a place
|
|
610
|
+
*
|
|
611
|
+
* The reader is told no more of the place's call.
|
|
612
|
+
*/
|
|
613
|
+
unwatchCallPlace(input: {
|
|
614
|
+
path: {
|
|
615
|
+
place: string;
|
|
616
|
+
}; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
|
|
617
|
+
signal?: AbortSignal;
|
|
618
|
+
}): Promise<Reply<204, undefined>>;
|
|
520
619
|
/**
|
|
521
620
|
* Call settings
|
|
522
621
|
*
|
|
@@ -591,13 +690,13 @@ export declare function client(t: Transport): {
|
|
|
591
690
|
/**
|
|
592
691
|
* Join a group call
|
|
593
692
|
*
|
|
594
|
-
* Comes into a group call the reader was asked to — rung, missed, declined, or in before — on the device.
|
|
693
|
+
* Comes into a group call the reader was asked to — rung, missed, declined, or in before — on the device; or, unasked, a call held at a place whose rule lets the reader in.
|
|
595
694
|
*/
|
|
596
695
|
joinCall(input: {
|
|
597
696
|
path: {
|
|
598
697
|
call_id: string;
|
|
599
698
|
};
|
|
600
|
-
body:
|
|
699
|
+
body: JoinRequest; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
|
|
601
700
|
signal?: AbortSignal;
|
|
602
701
|
}): Promise<Reply<200, Call>>;
|
|
603
702
|
/**
|
|
@@ -210,7 +210,7 @@ export type Machine = {
|
|
|
210
210
|
*/
|
|
211
211
|
replicas: number;
|
|
212
212
|
/**
|
|
213
|
-
* Kept awake: a machine of a size that sleeps is never put to sleep when idle, and is started again at once when it is asleep — while its environment has paid rights (Pay as you go
|
|
213
|
+
* Kept awake: a machine of a size that sleeps is never put to sleep when idle, and is started again at once when it is asleep — while its environment has paid rights (Pay as you go), which pays its every hour. Without them it sleeps as any; a dedicated size never sleeps.
|
|
214
214
|
*/
|
|
215
215
|
always_on: boolean;
|
|
216
216
|
/**
|
|
@@ -303,7 +303,7 @@ export type MachineCreate = {
|
|
|
303
303
|
*/
|
|
304
304
|
replicas?: number;
|
|
305
305
|
/**
|
|
306
|
-
* Keeps it awake (Machine.always_on): open to an environment on Pay as you go
|
|
306
|
+
* Keeps it awake (Machine.always_on): open to an environment on Pay as you go, refused `always_on_not_available` otherwise.
|
|
307
307
|
*/
|
|
308
308
|
always_on?: boolean;
|
|
309
309
|
/**
|
|
@@ -396,7 +396,7 @@ export type MachineUpdate = {
|
|
|
396
396
|
*/
|
|
397
397
|
replicas?: number;
|
|
398
398
|
/**
|
|
399
|
-
* Whether it is kept awake from now on (Machine.always_on): no version changes. Turning it on is open to an environment on Pay as you go
|
|
399
|
+
* Whether it is kept awake from now on (Machine.always_on): no version changes. Turning it on is open to an environment on Pay as you go, refused `always_on_not_available` otherwise.
|
|
400
400
|
*/
|
|
401
401
|
always_on?: boolean;
|
|
402
402
|
/**
|
|
@@ -538,9 +538,13 @@ export type Database = {
|
|
|
538
538
|
*/
|
|
539
539
|
awake_hours?: number;
|
|
540
540
|
/**
|
|
541
|
-
* How long
|
|
541
|
+
* How long a Free environment's free and preview databases may run in a month between them, in hours (environment_awake_hours): past it, they sleep until the month ends, and a client is told so. Absent for a size with no such limit.
|
|
542
542
|
*/
|
|
543
543
|
awake_hours_limit?: number;
|
|
544
|
+
/**
|
|
545
|
+
* How long the environment's free and preview databases have run this month between them, deleted ones too, in hours: what awake_hours_limit holds — a database deleted and opened again gets no new hours. Present with awake_hours_limit.
|
|
546
|
+
*/
|
|
547
|
+
environment_awake_hours?: number;
|
|
544
548
|
/**
|
|
545
549
|
* How much it held when last measured — every database in it summed, the ones its owner made too — measured while it is awake. Absent before its first measure.
|
|
546
550
|
*/
|
|
@@ -973,9 +977,13 @@ export type DatabaseCreated = {
|
|
|
973
977
|
*/
|
|
974
978
|
awake_hours?: number;
|
|
975
979
|
/**
|
|
976
|
-
* How long
|
|
980
|
+
* How long a Free environment's free and preview databases may run in a month between them, in hours (environment_awake_hours): past it, they sleep until the month ends, and a client is told so. Absent for a size with no such limit.
|
|
977
981
|
*/
|
|
978
982
|
awake_hours_limit?: number;
|
|
983
|
+
/**
|
|
984
|
+
* How long the environment's free and preview databases have run this month between them, deleted ones too, in hours: what awake_hours_limit holds — a database deleted and opened again gets no new hours. Present with awake_hours_limit.
|
|
985
|
+
*/
|
|
986
|
+
environment_awake_hours?: number;
|
|
979
987
|
/**
|
|
980
988
|
* How much it held when last measured — every database in it summed, the ones its owner made too — measured while it is awake. Absent before its first measure.
|
|
981
989
|
*/
|
package/types/web/src/calls.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { calls as api } from '../../internal/src/modules/index.js';
|
|
2
|
+
import { PalbaseError } from '../../internal/src/transport.js';
|
|
2
3
|
/** A call as the module keeps it: its people, its state, how it ended. */
|
|
3
4
|
export type Call = api.Call;
|
|
4
5
|
/** A person (or the project's agent) in a call, as the call lists them. */
|
|
@@ -22,12 +23,16 @@ export interface RemoteParticipant {
|
|
|
22
23
|
name: string | null;
|
|
23
24
|
imageUrl: string | null;
|
|
24
25
|
bot: boolean;
|
|
25
|
-
/** Their
|
|
26
|
+
/** Their microphone and camera: one stream for the whole call, the same object while they are in it. */
|
|
26
27
|
stream: MediaStream;
|
|
27
28
|
/** Their microphone is heard. */
|
|
28
29
|
audio: boolean;
|
|
29
30
|
/** Their camera is seen. */
|
|
30
31
|
video: boolean;
|
|
32
|
+
/** The screen they share — its picture, and its sound if they share that — apart from their camera; null while they share none. */
|
|
33
|
+
screen: MediaStream | null;
|
|
34
|
+
/** They are heard speaking now (as the media server tells it, a moment behind). */
|
|
35
|
+
speaking: boolean;
|
|
31
36
|
}
|
|
32
37
|
export interface CallState {
|
|
33
38
|
/** The call as the module last said it (the highest version heard). */
|
|
@@ -41,6 +46,12 @@ export interface CallState {
|
|
|
41
46
|
local: MediaStream | null;
|
|
42
47
|
microphone: boolean;
|
|
43
48
|
camera: boolean;
|
|
49
|
+
/** This device shares a screen (setScreenShare). */
|
|
50
|
+
screenSharing: boolean;
|
|
51
|
+
/** The screen this device shares, for the app's own preview of it; null while it shares none. */
|
|
52
|
+
screen: MediaStream | null;
|
|
53
|
+
/** This person is heard speaking now. */
|
|
54
|
+
speaking: boolean;
|
|
44
55
|
/** The others in the call. */
|
|
45
56
|
remote: RemoteParticipant[];
|
|
46
57
|
/** Why it ended for this device: the call's end_reason, `left` (this person left a group that goes on), `declined`, `missed`, `answered_elsewhere`. */
|
|
@@ -57,6 +68,12 @@ export interface StartCallOptions {
|
|
|
57
68
|
group?: boolean;
|
|
58
69
|
/** The conversation it is made from: its members alone may be called, and it keeps the call as a message. */
|
|
59
70
|
conversationId?: string;
|
|
71
|
+
/**
|
|
72
|
+
* Holds it at a place (channel:42, conversation:<id>): a group call, whom the project's rule lets into the place
|
|
73
|
+
* joins unasked; no one need be asked. One call goes on at a place at a time: another is refused with a
|
|
74
|
+
* PlaceBusyError carrying it, to join. pb.calls.place(name).start says it too.
|
|
75
|
+
*/
|
|
76
|
+
place?: string;
|
|
60
77
|
/** The app's own words about the call, shown to those rung (32 strings, 2 KiB at most). */
|
|
61
78
|
metadata?: Record<string, string>;
|
|
62
79
|
/** The name and picture shown to those rung; else the caller's messaging profile's. */
|
|
@@ -71,6 +88,20 @@ export interface AnswerOptions {
|
|
|
71
88
|
/** A microphone (and camera) stream the app opened already; left open when the call ends. */
|
|
72
89
|
media?: MediaStream;
|
|
73
90
|
}
|
|
91
|
+
export interface CallJoinOptions extends AnswerOptions {
|
|
92
|
+
/** What the others see of this person coming into a place's call unasked, where messaging names them not. */
|
|
93
|
+
name?: string;
|
|
94
|
+
/** Their picture there, an https URL. */
|
|
95
|
+
imageUrl?: string;
|
|
96
|
+
}
|
|
97
|
+
export interface ScreenShareOptions {
|
|
98
|
+
/** Share the sound of what is shared too (a tab's, where the browser offers it). */
|
|
99
|
+
audio?: boolean;
|
|
100
|
+
}
|
|
101
|
+
/** A call started at a place: the people asked into it besides (none need be), and the rest as pb.calls.start's. */
|
|
102
|
+
export interface PlaceCallOptions extends Omit<StartCallOptions, 'place' | 'group'> {
|
|
103
|
+
userIds?: string[];
|
|
104
|
+
}
|
|
74
105
|
export interface HistoryOptions {
|
|
75
106
|
/** 1 to 100; 20 when absent. */
|
|
76
107
|
limit?: number;
|
|
@@ -84,11 +115,20 @@ export interface HistoryOptions {
|
|
|
84
115
|
export interface CallsRTC {
|
|
85
116
|
MediaStream: typeof MediaStream;
|
|
86
117
|
getUserMedia(constraints: MediaStreamConstraints): Promise<MediaStream>;
|
|
118
|
+
/** A screen, window or tab the person picks: absent where the browser shares none. */
|
|
119
|
+
getDisplayMedia?(constraints: DisplayMediaStreamOptions): Promise<MediaStream>;
|
|
87
120
|
}
|
|
88
121
|
export interface CallsOptions {
|
|
89
122
|
/** The others' voices play by themselves (true by default): false leaves each RemoteParticipant's stream to the app. */
|
|
90
123
|
playAudio?: boolean;
|
|
91
124
|
}
|
|
125
|
+
/**
|
|
126
|
+
* A call refused because one goes on at its place already (409 `place_busy`): that call, to join —
|
|
127
|
+
* pb.calls.join(e.call), or the place's join().
|
|
128
|
+
*/
|
|
129
|
+
export declare class PlaceBusyError extends PalbaseError {
|
|
130
|
+
readonly call: Call;
|
|
131
|
+
}
|
|
92
132
|
/**
|
|
93
133
|
* One call as this device has it: its state to draw (subscribe), and what the person does in it. Made by
|
|
94
134
|
* pb.calls.start/voice/video/join, or heard (pb.calls.onIncoming).
|
|
@@ -112,11 +152,16 @@ export declare class CallSession {
|
|
|
112
152
|
private readonly opened;
|
|
113
153
|
private mic;
|
|
114
154
|
private facing;
|
|
155
|
+
private shared;
|
|
156
|
+
private sharing;
|
|
115
157
|
private room;
|
|
116
158
|
private joiningRoom;
|
|
117
159
|
private roomState;
|
|
118
160
|
private readonly streams;
|
|
161
|
+
private readonly screens;
|
|
119
162
|
private readonly owners;
|
|
163
|
+
/** Who the media server hears speaking now, by identity. */
|
|
164
|
+
private speakers;
|
|
120
165
|
private readonly mutedInRoom;
|
|
121
166
|
private readonly players;
|
|
122
167
|
private sink;
|
|
@@ -129,8 +174,8 @@ export declare class CallSession {
|
|
|
129
174
|
subscribe(listener: Listener): () => void;
|
|
130
175
|
/** Answers the call on this device (the first of the person's devices to answer has it). */
|
|
131
176
|
accept(o?: AnswerOptions): Promise<void>;
|
|
132
|
-
/** Comes into a group call this person was asked to (or was in before). */
|
|
133
|
-
join(o?:
|
|
177
|
+
/** Comes into a group call this person was asked to (or was in before), or one at a place that lets them in. */
|
|
178
|
+
join(o?: CallJoinOptions): Promise<void>;
|
|
134
179
|
/** Turns the call down on every device of this person's: a direct call ends; a group goes on, and may still be joined. */
|
|
135
180
|
decline(): Promise<void>;
|
|
136
181
|
/** Hangs up (or, while it rings, cancels): a direct call ends for both; a group goes on for the others. */
|
|
@@ -145,6 +190,12 @@ export declare class CallSession {
|
|
|
145
190
|
setCamera(on: boolean): Promise<void>;
|
|
146
191
|
/** Another camera: the one named (a videoinput's deviceId), or the other facing one (front, back). */
|
|
147
192
|
switchCamera(deviceId?: string): Promise<void>;
|
|
193
|
+
/**
|
|
194
|
+
* Shares a screen, a window or a tab — the browser asks the person which — or stops sharing it. The others see it
|
|
195
|
+
* apart from the camera (their RemoteParticipant's screen); the browser's own "stop sharing" stops it here too.
|
|
196
|
+
* A person who picks none rejects it (NotAllowedError), and nothing is shared.
|
|
197
|
+
*/
|
|
198
|
+
setScreenShare(on: boolean, o?: ScreenShareOptions): Promise<void>;
|
|
148
199
|
/** Where the others' voices play: an audiooutput's deviceId (a browser that can choose one: setSinkId). */
|
|
149
200
|
setAudioOutput(deviceId: string): Promise<void>;
|
|
150
201
|
/** Reads the call as it is now. */
|
|
@@ -159,6 +210,10 @@ export declare class CallSession {
|
|
|
159
210
|
private camera;
|
|
160
211
|
/** The camera's track now (null: off): sent to the room in place of the one before. */
|
|
161
212
|
private putVideo;
|
|
213
|
+
/** The screen shared now (null: none), sent to the room in place of the one before. */
|
|
214
|
+
private putScreen;
|
|
215
|
+
/** What this device sends to the room, and what each is. */
|
|
216
|
+
private sent;
|
|
162
217
|
/** Into the call's room with a ticket of this device's: its microphone (and camera) sent there, the others' heard. */
|
|
163
218
|
private toRoom;
|
|
164
219
|
private streamOf;
|
|
@@ -196,22 +251,35 @@ export declare class Calls {
|
|
|
196
251
|
private readonly sessions;
|
|
197
252
|
private readonly incoming;
|
|
198
253
|
private readonly entered;
|
|
254
|
+
private readonly places;
|
|
199
255
|
private workerHeard;
|
|
200
256
|
/** The call this page is in (made, answered or joined here), or null. */
|
|
201
257
|
get current(): CallSession | null;
|
|
202
258
|
/**
|
|
203
|
-
* Calls one person (a direct call: their devices ring) or several (a group call),
|
|
204
|
-
* microphone (and camera) asked for first: a refusal rings no one. A call to
|
|
205
|
-
* is that call, answered. Refused with a PalbaseError: `not_allowed` (403
|
|
206
|
-
*
|
|
259
|
+
* Calls one person (a direct call: their devices ring) or several (a group call), or holds a group call at a place
|
|
260
|
+
* (o.place), from this device — its microphone (and camera) asked for first: a refusal rings no one. A call to
|
|
261
|
+
* someone calling this person this moment is that call, answered. Refused with a PalbaseError: `not_allowed` (403:
|
|
262
|
+
* the project lets this person call them, or hold a call at the place, not), `in_another_call` (409),
|
|
263
|
+
* `too_many_calls` or `quota_exceeded` (429), `invalid_user_ids`, `invalid_place` or `call_full` (400) — and a
|
|
264
|
+
* PlaceBusyError (409 `place_busy`) with the call going on at the place.
|
|
207
265
|
*/
|
|
208
266
|
start(userIds: string | string[], o?: StartCallOptions): Promise<CallSession>;
|
|
209
267
|
/** A voice call. */
|
|
210
268
|
voice(userIds: string | string[], o?: Omit<StartCallOptions, 'video'>): Promise<CallSession>;
|
|
211
269
|
/** A video call. */
|
|
212
270
|
video(userIds: string | string[], o?: Omit<StartCallOptions, 'video'>): Promise<CallSession>;
|
|
213
|
-
/**
|
|
214
|
-
|
|
271
|
+
/**
|
|
272
|
+
* Comes into a group call on this device: one this person was asked to — a huddle, one they declined or left — or,
|
|
273
|
+
* unasked, one held at a place whose rule lets them in (its id, or the call as a place or a PlaceBusyError has it).
|
|
274
|
+
* Refused with a PalbaseError: `not_allowed` (403: the place lets them not), `call_not_found` (404), `not_joinable`,
|
|
275
|
+
* `call_ended`, `call_full` or `answered_elsewhere` (409).
|
|
276
|
+
*/
|
|
277
|
+
join(call: string | Call, o?: CallJoinOptions): Promise<CallSession>;
|
|
278
|
+
/**
|
|
279
|
+
* A place calls are held at, as the project names it (channel:42, conversation:<id>): the call going on there, told
|
|
280
|
+
* as it starts, changes and ends while the place is watched; one handle for each place.
|
|
281
|
+
*/
|
|
282
|
+
place(name: string): CallPlace;
|
|
215
283
|
/**
|
|
216
284
|
* Listens for calls that ring this person (and group calls they are asked to: phase `invited`), while the page is
|
|
217
285
|
* open — and those ringing as it opens (a tap on the call's notification). Returns the unsubscribe.
|
|
@@ -231,6 +299,8 @@ export declare class Calls {
|
|
|
231
299
|
private stop;
|
|
232
300
|
private unfollow;
|
|
233
301
|
private follow;
|
|
302
|
+
/** A call to join by its id: as the module has it for this person — or, one they are not in yet, as its place told it. */
|
|
303
|
+
private toJoin;
|
|
234
304
|
/** The calls ringing this person now: a page opened by the call's notification, or a channel that was down. */
|
|
235
305
|
private ringing;
|
|
236
306
|
/** A tap on a call's notification, told by the service worker (palbase/web/push-sw.js). */
|
|
@@ -241,4 +311,67 @@ export declare class Calls {
|
|
|
241
311
|
private sessionOf;
|
|
242
312
|
private rtc;
|
|
243
313
|
}
|
|
314
|
+
export interface CallPlaceState {
|
|
315
|
+
/** The place's name. */
|
|
316
|
+
place: string;
|
|
317
|
+
/** The call going on there, as last heard (its people, not their devices); null: none, or not read yet. */
|
|
318
|
+
call: Call | null;
|
|
319
|
+
/** This page is told of the place's call as it starts, changes and ends (watch). */
|
|
320
|
+
watching: boolean;
|
|
321
|
+
/** The last refusal of reading or watching it: a PalbaseError — `not_allowed` (403) where the project's rule lets this person into the place's calls not. */
|
|
322
|
+
error: Error | null;
|
|
323
|
+
}
|
|
324
|
+
/**
|
|
325
|
+
* A place calls are held at (pb.calls.place(name)): the call going on there to draw (subscribe), watched while the
|
|
326
|
+
* page shows the place — the module tells the person's calls channel of it as it starts, changes and ends — and the
|
|
327
|
+
* call started or joined there.
|
|
328
|
+
*/
|
|
329
|
+
export declare class CallPlace {
|
|
330
|
+
readonly place: string;
|
|
331
|
+
private readonly c;
|
|
332
|
+
private snapshot;
|
|
333
|
+
private readonly listeners;
|
|
334
|
+
private call;
|
|
335
|
+
private error;
|
|
336
|
+
/** How many watch it now: the watch is the person's, one for all of this page's. */
|
|
337
|
+
private watchers;
|
|
338
|
+
private renewing;
|
|
339
|
+
private timer;
|
|
340
|
+
private poll;
|
|
341
|
+
/** Counts what the channel told: a read that answers "none" after a word heard meanwhile is older than that word. */
|
|
342
|
+
private words;
|
|
343
|
+
private readonly ended;
|
|
344
|
+
get state(): CallPlaceState;
|
|
345
|
+
/** Listens to every change of state; returns the unsubscribe. */
|
|
346
|
+
subscribe(listener: Listener): () => void;
|
|
347
|
+
/** Reads the place's call as it is now (null: none goes on). Refused with a PalbaseError `not_allowed` (403). */
|
|
348
|
+
refresh(): Promise<Call | null>;
|
|
349
|
+
/**
|
|
350
|
+
* Watches the place: told of its call as it starts, changes and ends, renewed while it is watched — until as many
|
|
351
|
+
* unwatch() as watch() were made. Answers with the call going on there (null: none). Refused with a PalbaseError
|
|
352
|
+
* `not_allowed` (403).
|
|
353
|
+
*/
|
|
354
|
+
watch(): Promise<Call | null>;
|
|
355
|
+
/** Stops watching it (the last of the page's watchers): told no more. */
|
|
356
|
+
unwatch(): Promise<void>;
|
|
357
|
+
/**
|
|
358
|
+
* Starts a group call at the place (no one need be asked), from this device. One goes on there already: a
|
|
359
|
+
* PlaceBusyError with it — the place's call is it now, to join.
|
|
360
|
+
*/
|
|
361
|
+
start(o?: PlaceCallOptions): Promise<CallSession>;
|
|
362
|
+
/** Comes into the call going on at the place, read first when none is known; none there: a PalbaseError `call_not_found` (404). */
|
|
363
|
+
join(o?: CallJoinOptions): Promise<CallSession>;
|
|
364
|
+
/** The watch asked again — the place's call read with it — and the next one set before it runs out. */
|
|
365
|
+
private renew;
|
|
366
|
+
private later;
|
|
367
|
+
/** Without the person's channel (realtime off, or not joined yet), a watched place is read. */
|
|
368
|
+
private polling;
|
|
369
|
+
private idle;
|
|
370
|
+
/** A read's answer: its call; or none — unless the channel told of the place meanwhile, which is newer. */
|
|
371
|
+
private take;
|
|
372
|
+
private set;
|
|
373
|
+
private fail;
|
|
374
|
+
private make;
|
|
375
|
+
private changed;
|
|
376
|
+
}
|
|
244
377
|
export {};
|
package/types/web/src/index.d.ts
CHANGED
|
@@ -11,7 +11,7 @@ export { Purchases, redemptionToken, type CheckoutSource, type CustomerInfo, typ
|
|
|
11
11
|
export { Notify, WebPush, type PushPermission, type PushSubscribeOptions } from './notify.js';
|
|
12
12
|
export { Flags, type FlagSource, type FlagsListener } from './flags.js';
|
|
13
13
|
export { ConversationList, ConversationView, DeletedGroupList, indexedDBKeyValue, Messaging, ScheduledList, ThreadView, type Conversation, type ConversationMatch, type ConversationViewState, type ConversationListState, type DeletedGroup, type DeletedGroupListState, type Entry, type Hit, type Member, type Message, type MessagingOptions, type MyProfile, type Observed, type OpenedFile, type OutboxItem, type OutgoingFile, type Profile, type ScheduledMessage, type SearchHit, type SearchMatch, type SearchOptions, type SearchResults, type SendOptions, type ThreadState, type ThreadViewState, } from './messaging.js';
|
|
14
|
-
export { Calls, CallSession, type AnswerOptions, type Call, type CallPage, type CallParticipant, type CallPhase, type CallsOptions, type CallState, type HistoryOptions, type RemoteParticipant, type StartCallOptions, } from './calls.js';
|
|
14
|
+
export { CallPlace, Calls, CallSession, PlaceBusyError, type AnswerOptions, type Call, type CallPage, type CallParticipant, type CallPhase, type CallPlaceState, type CallsOptions, type CallState, type CallJoinOptions, type HistoryOptions, type PlaceCallOptions, type RemoteParticipant, type ScreenShareOptions, type StartCallOptions, } from './calls.js';
|
|
15
15
|
export { Inbox, type InboxItem, type InboxListOptions, type InboxPage, type InboxView, type InboxViewOptions } from './inbox.js';
|
|
16
16
|
export { InApp, SESSION_START, type InAppOptions } from './inapp.js';
|
|
17
17
|
export type { Paywall, PaywallRenderOptions } from './paywall/placement.js';
|