@cloudflare/realtimekit 1.5.2-staging.1 → 1.5.2-staging.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -1503,70 +1503,6 @@ interface DeleteChatMessageResponse {
1503
1503
  */
1504
1504
  declare const DeleteChatMessageResponse: DeleteChatMessageResponse$Type;
1505
1505
 
1506
- declare class EnablePluginResponse$Type extends MessageType$1<EnablePluginResponse> {
1507
- constructor();
1508
- }
1509
- /**
1510
- * Response sent whenever a plugin is enabled.
1511
- * Applicable for all requests that enable a plugin.
1512
- *
1513
- * @generated from protobuf message socket.plugin.EnablePluginResponse
1514
- */
1515
- interface EnablePluginResponse {
1516
- /**
1517
- * @generated from protobuf field: string plugin_id = 1;
1518
- */
1519
- pluginId: string;
1520
- /**
1521
- * @generated from protobuf field: string enabled_by = 2;
1522
- */
1523
- enabledBy: string;
1524
- }
1525
- /**
1526
- * @generated MessageType for protobuf message socket.plugin.EnablePluginResponse
1527
- */
1528
- declare const EnablePluginResponse: EnablePluginResponse$Type;
1529
- declare class EnablePluginsResponse$Type extends MessageType$1<EnablePluginsResponse> {
1530
- constructor();
1531
- }
1532
- /**
1533
- * Response sent when all enabled plugins are requested.
1534
- *
1535
- * @generated from protobuf message socket.plugin.EnablePluginsResponse
1536
- */
1537
- interface EnablePluginsResponse {
1538
- /**
1539
- * @generated from protobuf field: repeated socket.plugin.EnablePluginResponse plugins = 1;
1540
- */
1541
- plugins: EnablePluginResponse[];
1542
- }
1543
- /**
1544
- * @generated MessageType for protobuf message socket.plugin.EnablePluginsResponse
1545
- */
1546
- declare const EnablePluginsResponse: EnablePluginsResponse$Type;
1547
- declare class DisablePluginResponse$Type extends MessageType$1<DisablePluginResponse> {
1548
- constructor();
1549
- }
1550
- /**
1551
- * Response sent whenever a plugin is disabled.
1552
- * Applicable for all requests that disable a plugin.
1553
- *
1554
- * @generated from protobuf message socket.plugin.DisablePluginResponse
1555
- */
1556
- interface DisablePluginResponse {
1557
- /**
1558
- * @generated from protobuf field: string plugin_id = 1;
1559
- */
1560
- pluginId: string;
1561
- /**
1562
- * @generated from protobuf field: string disabled_by = 2;
1563
- */
1564
- disabledBy: string;
1565
- }
1566
- /**
1567
- * @generated MessageType for protobuf message socket.plugin.DisablePluginResponse
1568
- */
1569
- declare const DisablePluginResponse: DisablePluginResponse$Type;
1570
1506
  declare class PluginStoreItem$Type extends MessageType$1<PluginStoreItem> {
1571
1507
  constructor();
1572
1508
  }
@@ -1622,28 +1558,6 @@ interface PluginStoreResponse {
1622
1558
  * @generated MessageType for protobuf message socket.plugin.PluginStoreResponse
1623
1559
  */
1624
1560
  declare const PluginStoreResponse: PluginStoreResponse$Type;
1625
- declare class PluginEventResponse$Type extends MessageType$1<PluginEventResponse> {
1626
- constructor();
1627
- }
1628
- /**
1629
- * Response sent for custom plugin event.
1630
- *
1631
- * @generated from protobuf message socket.plugin.PluginEventResponse
1632
- */
1633
- interface PluginEventResponse {
1634
- /**
1635
- * @generated from protobuf field: string plugin_id = 1;
1636
- */
1637
- pluginId: string;
1638
- /**
1639
- * @generated from protobuf field: bytes plugin_data = 2;
1640
- */
1641
- pluginData: Uint8Array;
1642
- }
1643
- /**
1644
- * @generated MessageType for protobuf message socket.plugin.PluginEventResponse
1645
- */
1646
- declare const PluginEventResponse: PluginEventResponse$Type;
1647
1561
 
1648
1562
  declare class GetStagePeersResponse$Type extends MessageType$1<GetStagePeersResponse> {
1649
1563
  constructor();
@@ -3205,154 +3119,6 @@ declare class Livestream extends TypedEventEmitter$1<LivestreamEvents> {
3205
3119
  stop(): Promise<void>;
3206
3120
  }
3207
3121
 
3208
- type PluginSocketMessage = DisablePluginResponse | EnablePluginResponse | PluginEventResponse | PluginStoreResponse | SendChatMessageToPeersResponse | SendChatMessageToRoomResponse;
3209
- declare class PluginSocketHandler {
3210
- constructor(context: Context<ContextState>, socketService: SocketService);
3211
- get logger(): Logger;
3212
- addPlugin(pluginId: string, staggered: boolean): void;
3213
- removePlugin(pluginId: string): void;
3214
- getActivePlugins(): Promise<EnablePluginsResponse>;
3215
- customPluginEventToRoom(pluginId: string, data: any, messageId?: string): void;
3216
- customPluginEventToPeers(pluginId: string, peerIds: string[], data: any, messageId?: string): void;
3217
- enablePluginForRoom(pluginId: string, messageId?: string): void;
3218
- enablePluginForPeers(pluginId: string, peerIds: string[], messageId?: string): void;
3219
- disablePluginForRoom(pluginId: string, messageId?: string): void;
3220
- disablePluginForPeers(pluginId: string, peerIds: string[], messageId?: string): void;
3221
- storeInsertKeys(pluginId: string, store: string, insertKeys: {
3222
- key: string;
3223
- payload?: any;
3224
- }[], messageId?: string): void;
3225
- storeGetKeys(pluginId: string, store: string, getKeys: {
3226
- key: string;
3227
- }[], messageId?: string): void;
3228
- storeDeleteKeys(pluginId: string, store: string, deleteKeys: {
3229
- key: string;
3230
- }[], messageId?: string): void;
3231
- storeDelete(pluginId: string, store: string, messageId?: string): void;
3232
- getPluginDataOld(pluginId: string, store: string): void;
3233
- storePluginDataOld(pluginId: string, store: string, data: any): void;
3234
- on(event: number, handler: (socketMessage: PluginSocketMessage, messageId?: string) => void): void;
3235
- }
3236
-
3237
- interface PluginResponse {
3238
- baseURL: string;
3239
- createdAt: string;
3240
- description: string;
3241
- id: string;
3242
- name: string;
3243
- organizationId: string;
3244
- picture: string;
3245
- private: boolean;
3246
- published: boolean;
3247
- staggered: boolean;
3248
- tags: string[];
3249
- type: string;
3250
- updatedAt: string;
3251
- }
3252
- interface PluginViews {
3253
- [viewId: string]: {
3254
- url: string;
3255
- suggestedPosition: string;
3256
- };
3257
- }
3258
- interface PluginConfig {
3259
- name: string;
3260
- pluginId: string;
3261
- version: string;
3262
- description: string;
3263
- author?: string;
3264
- repository?: string;
3265
- tags?: string[];
3266
- picture?: string;
3267
- url?: string;
3268
- files: {
3269
- include: string[];
3270
- exclude?: string[];
3271
- };
3272
- views?: PluginViews;
3273
- contentScript?: string;
3274
- permissions?: {
3275
- [key: string]: {
3276
- default: boolean;
3277
- description: string;
3278
- };
3279
- };
3280
- config?: {
3281
- [key: string]: string;
3282
- };
3283
- }
3284
- interface PluginIframeMessage {
3285
- type: number;
3286
- uuid: string;
3287
- payload?: any;
3288
- }
3289
- interface SendDataOptions {
3290
- eventName: string;
3291
- data: any;
3292
- }
3293
- interface ReactNativeWebViewEvent {
3294
- nativeEvent: {
3295
- data: string;
3296
- };
3297
- }
3298
- interface ReactNativeWebView {
3299
- src: string;
3300
- allow: string;
3301
- title: string;
3302
- props: {
3303
- onMessage: (event: ReactNativeWebViewEvent) => void;
3304
- };
3305
- postMessage: (message: string) => void;
3306
- }
3307
- declare const PluginEventKeys: {
3308
- stateUpdate: string;
3309
- ready: string;
3310
- closed: string;
3311
- toggleViewMode: string;
3312
- enabled: string;
3313
- '* ': string;
3314
- };
3315
- type _string = string & {
3316
- _?: any;
3317
- };
3318
- type PluginEvents$1 = keyof typeof PluginEventKeys | _string;
3319
- declare class Plugin extends CustomEventEmitter<PluginEvents$1> {
3320
- readonly baseURL: string;
3321
- readonly createdAt: Date;
3322
- readonly description: string;
3323
- readonly id: string;
3324
- readonly name: string;
3325
- readonly organizationId: string;
3326
- readonly picture: string;
3327
- readonly private: boolean;
3328
- readonly published: boolean;
3329
- readonly staggered: boolean;
3330
- readonly tags: string[];
3331
- readonly type: string;
3332
- readonly updatedAt: Date;
3333
- config?: PluginConfig;
3334
- active: boolean;
3335
- iframes: Map<string, {
3336
- iframe: HTMLIFrameElement | ReactNativeWebView;
3337
- listener?: (message: MessageEvent) => void;
3338
- }>;
3339
- enabledBy: string;
3340
- get telemetry(): Telemetry;
3341
- constructor(context: Context<ContextState>, { baseURL, createdAt, description, id, name, organizationId, picture, private: isPrivate, published, staggered, tags, type, updatedAt, }: PluginResponse, pluginSocketHandler: PluginSocketHandler, self: Self, participants: Participants, chat: Readonly<Chat>, meetingTitle: string);
3342
- sendIframeEvent(message: PluginIframeMessage): void;
3343
- private handleIframeMessage;
3344
- sendData(payload: SendDataOptions): void;
3345
- removePluginView(viewId?: string): void;
3346
- addPluginView(iframe: HTMLIFrameElement | ReactNativeWebView, viewId?: string): void;
3347
- private setActive;
3348
- activateForSelf(): Promise<void>;
3349
- deactivateForSelf(): void;
3350
- enable(): Promise<void>;
3351
- disable(): void;
3352
- activate(): Promise<void>;
3353
- deactivate(): Promise<void>;
3354
- }
3355
-
3356
3122
  interface RecordingConfig {
3357
3123
  fileNamePrefix?: string;
3358
3124
  videoConfig?: {
@@ -3370,10 +3136,6 @@ declare class APIClient extends API {
3370
3136
  telemetry: Telemetry;
3371
3137
  constructor(context: Context<ContextState>, options?: APIOptions);
3372
3138
  getICEServers(): Promise<any>;
3373
- getPlugins(): Promise<any[]>;
3374
- getPluginDetails(pluginId: string): Promise<PluginResponse>;
3375
- getPluginConfig(pluginBaseUrl: string): Promise<PluginConfig>;
3376
- authorizePlugin(pluginId: string): Promise<string>;
3377
3139
  getPresignedUrls(filename: string): Promise<{
3378
3140
  getLocation: any;
3379
3141
  putLocation: any;
@@ -3576,6 +3338,113 @@ declare class Polls extends TypedEventEmitter$1<PollsEvents> {
3576
3338
  vote(id: string, index: number): Promise<void>;
3577
3339
  }
3578
3340
 
3341
+ declare class StoresSocketHandler {
3342
+ constructor(context: Context<ContextState>, socketService: SocketService);
3343
+ get logger(): Logger;
3344
+ get peerId(): string;
3345
+ storeInsertKeys(pluginId: string, store: string, insertKeys: {
3346
+ key: string;
3347
+ payload?: unknown;
3348
+ }[], messageId?: string): void;
3349
+ storeGetKeys(pluginId: string, store: string, getKeys: {
3350
+ key: string;
3351
+ }[], messageId?: string): void;
3352
+ storeDeleteKeys(pluginId: string, store: string, deleteKeys: {
3353
+ key: string;
3354
+ }[], messageId?: string): void;
3355
+ on(event: number, handler: (socketMessage: PluginStoreResponse, messageId?: string) => void): void;
3356
+ }
3357
+
3358
+ type StoreData = {
3359
+ [type: string]: any;
3360
+ };
3361
+ type RateLimitConfig = {
3362
+ maxInvocations: number;
3363
+ period: number;
3364
+ };
3365
+ declare class Store {
3366
+ name: string;
3367
+ rateLimitConfig: {
3368
+ maxInvocations: number;
3369
+ period: number;
3370
+ };
3371
+ bulkRateLimitConfig: {
3372
+ maxInvocations: number;
3373
+ period: number;
3374
+ };
3375
+ private listeners;
3376
+ constructor({ name, socketHandler, meetingId }: {
3377
+ name: string;
3378
+ socketHandler: StoresSocketHandler;
3379
+ meetingId: string;
3380
+ });
3381
+ set(key: string, value: any, sync?: boolean, emit?: boolean): Promise<void>;
3382
+ private remoteSet;
3383
+ bulkSet(data: Array<{
3384
+ key: string;
3385
+ payload: any;
3386
+ }>): Promise<void>;
3387
+ update(key: string, value: any, sync?: boolean): Promise<void>;
3388
+ delete(key: string, sync?: boolean, emit?: boolean): Promise<void>;
3389
+ bulkDelete(data: Array<{
3390
+ key: string;
3391
+ }>): Promise<void>;
3392
+ get(key: string): any;
3393
+ getAll(): StoreData;
3394
+ clear(): void;
3395
+ get rateLimits(): {
3396
+ maxInvocations: number;
3397
+ period: number;
3398
+ };
3399
+ updateRateLimits(num: number, period: number): void;
3400
+ get bulkRateLimits(): {
3401
+ maxInvocations: number;
3402
+ period: number;
3403
+ };
3404
+ updateBulkRateLimits(num: number, period: number): void;
3405
+ subscribe(key: string | '*', cb: (value: any) => any): void;
3406
+ unsubscribe(key: string | '*', cb?: (value: any) => any): void;
3407
+ populate(data: StoreData): void;
3408
+ }
3409
+
3410
+ interface ClientPluginPermissions {
3411
+ canActivate: boolean;
3412
+ canDeactivate: boolean;
3413
+ }
3414
+ interface ClientPluginConfig {
3415
+ name: string;
3416
+ icon: string;
3417
+ id: string;
3418
+ permissions: ClientPluginPermissions;
3419
+ component: unknown;
3420
+ }
3421
+ declare const PluginEventKeys: {
3422
+ stateUpdate: string;
3423
+ ready: string;
3424
+ closed: string;
3425
+ enabled: string;
3426
+ '* ': string;
3427
+ };
3428
+ type _string = string & {
3429
+ _?: any;
3430
+ };
3431
+ type PluginEvents$1 = keyof typeof PluginEventKeys | _string;
3432
+ declare class Plugin extends CustomEventEmitter<PluginEvents$1> {
3433
+ readonly name: string;
3434
+ readonly icon: string;
3435
+ readonly id: string;
3436
+ readonly permissions: ClientPluginPermissions;
3437
+ active: boolean;
3438
+ enabledBy: string;
3439
+ get component(): unknown;
3440
+ get telemetry(): Telemetry;
3441
+ constructor(context: Context<ContextState>, config: ClientPluginConfig, activePluginsStore: Store, self: Self);
3442
+ activateForSelf(): void;
3443
+ deactivateForSelf(): void;
3444
+ activate(): Promise<void>;
3445
+ deactivate(): Promise<void>;
3446
+ }
3447
+
3579
3448
  type PluginMapEvents = {
3580
3449
  ['pluginAdded']: (plugin: Plugin) => void;
3581
3450
  ['pluginDeleted']: (plugin: Plugin) => void;
@@ -3605,6 +3474,13 @@ declare class Plugins {
3605
3474
  constructor(logger: Logger);
3606
3475
  }
3607
3476
 
3477
+ declare class StoreManager {
3478
+ stores: Map<String, Store>;
3479
+ constructor(context: Context<ContextState>, handler: StoresSocketHandler);
3480
+ create(name: string, _internal?: boolean): Promise<Store>;
3481
+ refresh(name: string): Promise<Store>;
3482
+ }
3483
+
3608
3484
  declare class SelfMedia extends TypedEventEmitter$1<SelfEvents> {
3609
3485
  protected localMediaHandler: LocalMediaHandler;
3610
3486
  constructor(context: Context<ContextState>, logger: Logger);
@@ -3787,63 +3663,6 @@ declare class Internals {
3787
3663
  static init(context: Context<ContextState>): Internals;
3788
3664
  }
3789
3665
 
3790
- type StoreData = {
3791
- [type: string]: any;
3792
- };
3793
- type RateLimitConfig = {
3794
- maxInvocations: number;
3795
- period: number;
3796
- };
3797
- declare class Store {
3798
- name: string;
3799
- rateLimitConfig: {
3800
- maxInvocations: number;
3801
- period: number;
3802
- };
3803
- bulkRateLimitConfig: {
3804
- maxInvocations: number;
3805
- period: number;
3806
- };
3807
- private listeners;
3808
- constructor({ name, socketHandler, meetingId }: {
3809
- name: string;
3810
- socketHandler: PluginSocketHandler;
3811
- meetingId: string;
3812
- });
3813
- set(key: string, value: any, sync?: boolean, emit?: boolean): Promise<void>;
3814
- private remoteSet;
3815
- bulkSet(data: Array<{
3816
- key: string;
3817
- payload: any;
3818
- }>): Promise<void>;
3819
- update(key: string, value: any, sync?: boolean): Promise<void>;
3820
- delete(key: string, sync?: boolean, emit?: boolean): Promise<void>;
3821
- bulkDelete(data: Array<{
3822
- key: string;
3823
- }>): Promise<void>;
3824
- get(key: string): any;
3825
- getAll(): StoreData;
3826
- get rateLimits(): {
3827
- maxInvocations: number;
3828
- period: number;
3829
- };
3830
- updateRateLimits(num: number, period: number): void;
3831
- get bulkRateLimits(): {
3832
- maxInvocations: number;
3833
- period: number;
3834
- };
3835
- updateBulkRateLimits(num: number, period: number): void;
3836
- subscribe(key: string | '*', cb: (value: any) => any): void;
3837
- unsubscribe(key: string | '*', cb?: (value: any) => any): void;
3838
- populate(data: StoreData): void;
3839
- }
3840
-
3841
- declare class StoreManager {
3842
- stores: Map<String, Store>;
3843
- constructor(context: Context<ContextState>, handler: PluginSocketHandler);
3844
- create(name: string): Promise<Store>;
3845
- }
3846
-
3847
3666
  declare const enum PRODUCERS_TYPE {
3848
3667
  WEBCAM = "webcam",
3849
3668
  WEBCAM_BACKUP = "webcam_backup",
@@ -4054,14 +3873,6 @@ interface Modules {
4054
3873
  devTools?: {
4055
3874
  logs: boolean;
4056
3875
  logLevel?: LogLevel[number];
4057
- plugins?: {
4058
- id: string;
4059
- name: string;
4060
- port: number;
4061
- picture?: string;
4062
- description?: string;
4063
- staggered?: boolean;
4064
- }[];
4065
3876
  };
4066
3877
  experimentalAudioPlayback?: boolean;
4067
3878
  }
@@ -4077,6 +3888,7 @@ interface DefaultOptions {
4077
3888
  screenshare?: ScreenshareQualityConstraints;
4078
3889
  };
4079
3890
  isNonPreferredDevice?: (device: MediaDeviceInfo) => boolean;
3891
+ plugins?: ClientPluginConfig[];
4080
3892
  }
4081
3893
  interface RoomDetails {
4082
3894
  meetingTitle: string;
@@ -4894,7 +4706,6 @@ interface IceServerInformation {
4894
4706
  }
4895
4707
  interface CachedUserDetails {
4896
4708
  peerId?: string;
4897
- pluginInformation: PluginResponse[];
4898
4709
  userDetails: UserDetailsResponseV2;
4899
4710
  roomDetails: RoomDetails;
4900
4711
  iceServers: IceServerInformation[];
@@ -4915,7 +4726,6 @@ declare class API {
4915
4726
  protected authToken: string;
4916
4727
  protected organizationId: string;
4917
4728
  protected iceServers: IceServerInformation[];
4918
- protected pluginInformation: PluginResponse[];
4919
4729
  protected userDetails: UserDetailsResponseV2;
4920
4730
  protected roomDetails: RoomDetails;
4921
4731
  get peerId(): string;
@@ -4993,6 +4803,7 @@ type RTKParticipantMap = Readonly<ParticipantMap>;
4993
4803
  type RTKPlugin = Readonly<Plugin>;
4994
4804
  type RTKPlugins = Readonly<Plugins>;
4995
4805
  type RTKPluginMap = Readonly<PluginMap>;
4806
+
4996
4807
  type RTKMeta = Readonly<Meta>;
4997
4808
  type RTKSelf = Readonly<Self>;
4998
4809
  type RTKSelfMedia = Readonly<SelfMedia>;
@@ -5032,4 +4843,4 @@ declare global {
5032
4843
  }
5033
4844
  }
5034
4845
 
5035
- export { ActiveTab, ActiveTabType, AudioMiddleware, BroadcastMessagePayload, CachedUserDetails, ChatUpdateParams, ClientError, CustomMessage, DeviceConfig, FileMessage, ImageMessage, JoinedPeer, LeaveRoomState, LivestreamIngestionCredentials, LivestreamState, LogData, MediaConnectionState, MediaConnectionUpdate, MediaConstraints, MediaKind, MediaPermission, Message, BasicParticipant as RTKBasicParticipant, BasicParticipantsMap as RTKBasicParticipantsMap, RTKChat, ClientOptions as RTKClientOptions, RTKConfigOptions, RTKConnectedMeetings, RTKLivestream, RTKLogger, RTKMeta, RTKParticipant, RTKParticipantMap, RTKParticipants, RTKPermissionsPreset, RTKPlugin, RTKPluginMap, RTKPlugins, RTKPolls, RTKRecording, RTKSelf, RTKSelfMedia, RTKStore, StoreData as RTKStoreData, RateLimitConfig as RTKStoreRateLimitConfig, RTKThemePreset, RecordingState, RequestToJoinType, SocketConnectionState, StageStatus, StartLivestreamConfig, TextMessage, UserDetailsResponseV2, VideoMiddleware, VideoQualityConstraints, Client as default, LeaveRoomState as leaveRoomState };
4846
+ export { ActiveTab, ActiveTabType, AudioMiddleware, BroadcastMessagePayload, CachedUserDetails, ChatUpdateParams, ClientError, ClientPluginConfig, ClientPluginPermissions, CustomMessage, DeviceConfig, FileMessage, ImageMessage, JoinedPeer, LeaveRoomState, LivestreamIngestionCredentials, LivestreamState, LogData, MediaConnectionState, MediaConnectionUpdate, MediaConstraints, MediaKind, MediaPermission, Message, BasicParticipant as RTKBasicParticipant, BasicParticipantsMap as RTKBasicParticipantsMap, RTKChat, ClientOptions as RTKClientOptions, RTKConfigOptions, RTKConnectedMeetings, RTKLivestream, RTKLogger, RTKMeta, RTKParticipant, RTKParticipantMap, RTKParticipants, RTKPermissionsPreset, RTKPlugin, RTKPluginMap, RTKPlugins, RTKPolls, RTKRecording, RTKSelf, RTKSelfMedia, RTKStore, StoreData as RTKStoreData, RateLimitConfig as RTKStoreRateLimitConfig, RTKThemePreset, RecordingState, RequestToJoinType, SocketConnectionState, StageStatus, StartLivestreamConfig, TextMessage, UserDetailsResponseV2, VideoMiddleware, VideoQualityConstraints, Client as default, LeaveRoomState as leaveRoomState };