@cloudflare/realtimekit 1.5.1 → 1.5.2-staging.2

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.
@@ -1,7 +1,7 @@
1
1
  import { EventEmitter } from 'events';
2
- import { InhouseCallStats } from '@cloudflare/realtimekit-callstats';
3
2
  import * as _cloudflare_realtimekit_utils from '@cloudflare/realtimekit-utils';
4
3
  import { PresetTypeV2, MediaVideoQualityType, ViewType, LivestreamViewerMediaQualityType, MediaScreenShareQualityType, PluginAccessControls, WaitingRoomTypes, MediaProductionPermissionType, RecorderType as RecorderType$1, BorderRadius, BorderWidth, Theme } from '@cloudflare/realtimekit-utils';
4
+ import { InhouseCallStats } from '@cloudflare/realtimekit-callstats';
5
5
  import { MessageType as MessageType$1 } from '@protobuf-ts/runtime';
6
6
  import { ProducerScoreStats, ConsumerScoreStats } from '@cloudflare/realtimekit-callstats/dist/measurements/types';
7
7
  import * as WorkerTimers from 'worker-timers';
@@ -1534,70 +1534,6 @@ interface DeleteChatMessageResponse {
1534
1534
  */
1535
1535
  declare const DeleteChatMessageResponse: DeleteChatMessageResponse$Type;
1536
1536
 
1537
- declare class EnablePluginResponse$Type extends MessageType$1<EnablePluginResponse> {
1538
- constructor();
1539
- }
1540
- /**
1541
- * Response sent whenever a plugin is enabled.
1542
- * Applicable for all requests that enable a plugin.
1543
- *
1544
- * @generated from protobuf message socket.plugin.EnablePluginResponse
1545
- */
1546
- interface EnablePluginResponse {
1547
- /**
1548
- * @generated from protobuf field: string plugin_id = 1;
1549
- */
1550
- pluginId: string;
1551
- /**
1552
- * @generated from protobuf field: string enabled_by = 2;
1553
- */
1554
- enabledBy: string;
1555
- }
1556
- /**
1557
- * @generated MessageType for protobuf message socket.plugin.EnablePluginResponse
1558
- */
1559
- declare const EnablePluginResponse: EnablePluginResponse$Type;
1560
- declare class EnablePluginsResponse$Type extends MessageType$1<EnablePluginsResponse> {
1561
- constructor();
1562
- }
1563
- /**
1564
- * Response sent when all enabled plugins are requested.
1565
- *
1566
- * @generated from protobuf message socket.plugin.EnablePluginsResponse
1567
- */
1568
- interface EnablePluginsResponse {
1569
- /**
1570
- * @generated from protobuf field: repeated socket.plugin.EnablePluginResponse plugins = 1;
1571
- */
1572
- plugins: EnablePluginResponse[];
1573
- }
1574
- /**
1575
- * @generated MessageType for protobuf message socket.plugin.EnablePluginsResponse
1576
- */
1577
- declare const EnablePluginsResponse: EnablePluginsResponse$Type;
1578
- declare class DisablePluginResponse$Type extends MessageType$1<DisablePluginResponse> {
1579
- constructor();
1580
- }
1581
- /**
1582
- * Response sent whenever a plugin is disabled.
1583
- * Applicable for all requests that disable a plugin.
1584
- *
1585
- * @generated from protobuf message socket.plugin.DisablePluginResponse
1586
- */
1587
- interface DisablePluginResponse {
1588
- /**
1589
- * @generated from protobuf field: string plugin_id = 1;
1590
- */
1591
- pluginId: string;
1592
- /**
1593
- * @generated from protobuf field: string disabled_by = 2;
1594
- */
1595
- disabledBy: string;
1596
- }
1597
- /**
1598
- * @generated MessageType for protobuf message socket.plugin.DisablePluginResponse
1599
- */
1600
- declare const DisablePluginResponse: DisablePluginResponse$Type;
1601
1537
  declare class PluginStoreItem$Type extends MessageType$1<PluginStoreItem> {
1602
1538
  constructor();
1603
1539
  }
@@ -1653,28 +1589,6 @@ interface PluginStoreResponse {
1653
1589
  * @generated MessageType for protobuf message socket.plugin.PluginStoreResponse
1654
1590
  */
1655
1591
  declare const PluginStoreResponse: PluginStoreResponse$Type;
1656
- declare class PluginEventResponse$Type extends MessageType$1<PluginEventResponse> {
1657
- constructor();
1658
- }
1659
- /**
1660
- * Response sent for custom plugin event.
1661
- *
1662
- * @generated from protobuf message socket.plugin.PluginEventResponse
1663
- */
1664
- interface PluginEventResponse {
1665
- /**
1666
- * @generated from protobuf field: string plugin_id = 1;
1667
- */
1668
- pluginId: string;
1669
- /**
1670
- * @generated from protobuf field: bytes plugin_data = 2;
1671
- */
1672
- pluginData: Uint8Array;
1673
- }
1674
- /**
1675
- * @generated MessageType for protobuf message socket.plugin.PluginEventResponse
1676
- */
1677
- declare const PluginEventResponse: PluginEventResponse$Type;
1678
1592
 
1679
1593
  declare class GetStagePeersResponse$Type extends MessageType$1<GetStagePeersResponse> {
1680
1594
  constructor();
@@ -2243,154 +2157,6 @@ declare class ClientMap<T extends (EventMap & WildCardEvent<T>), U extends {
2243
2157
  toArray(): U[];
2244
2158
  }
2245
2159
 
2246
- type PluginSocketMessage = DisablePluginResponse | EnablePluginResponse | PluginEventResponse | PluginStoreResponse | SendChatMessageToPeersResponse | SendChatMessageToRoomResponse;
2247
- declare class PluginSocketHandler {
2248
- constructor(context: Context<ContextState>, socketService: SocketService);
2249
- get logger(): Logger;
2250
- addPlugin(pluginId: string, staggered: boolean): void;
2251
- removePlugin(pluginId: string): void;
2252
- getActivePlugins(): Promise<EnablePluginsResponse>;
2253
- customPluginEventToRoom(pluginId: string, data: any, messageId?: string): void;
2254
- customPluginEventToPeers(pluginId: string, peerIds: string[], data: any, messageId?: string): void;
2255
- enablePluginForRoom(pluginId: string, messageId?: string): void;
2256
- enablePluginForPeers(pluginId: string, peerIds: string[], messageId?: string): void;
2257
- disablePluginForRoom(pluginId: string, messageId?: string): void;
2258
- disablePluginForPeers(pluginId: string, peerIds: string[], messageId?: string): void;
2259
- storeInsertKeys(pluginId: string, store: string, insertKeys: {
2260
- key: string;
2261
- payload?: any;
2262
- }[], messageId?: string): void;
2263
- storeGetKeys(pluginId: string, store: string, getKeys: {
2264
- key: string;
2265
- }[], messageId?: string): void;
2266
- storeDeleteKeys(pluginId: string, store: string, deleteKeys: {
2267
- key: string;
2268
- }[], messageId?: string): void;
2269
- storeDelete(pluginId: string, store: string, messageId?: string): void;
2270
- getPluginDataOld(pluginId: string, store: string): void;
2271
- storePluginDataOld(pluginId: string, store: string, data: any): void;
2272
- on(event: number, handler: (socketMessage: PluginSocketMessage, messageId?: string) => void): void;
2273
- }
2274
-
2275
- interface PluginResponse {
2276
- baseURL: string;
2277
- createdAt: string;
2278
- description: string;
2279
- id: string;
2280
- name: string;
2281
- organizationId: string;
2282
- picture: string;
2283
- private: boolean;
2284
- published: boolean;
2285
- staggered: boolean;
2286
- tags: string[];
2287
- type: string;
2288
- updatedAt: string;
2289
- }
2290
- interface PluginViews {
2291
- [viewId: string]: {
2292
- url: string;
2293
- suggestedPosition: string;
2294
- };
2295
- }
2296
- interface PluginConfig {
2297
- name: string;
2298
- pluginId: string;
2299
- version: string;
2300
- description: string;
2301
- author?: string;
2302
- repository?: string;
2303
- tags?: string[];
2304
- picture?: string;
2305
- url?: string;
2306
- files: {
2307
- include: string[];
2308
- exclude?: string[];
2309
- };
2310
- views?: PluginViews;
2311
- contentScript?: string;
2312
- permissions?: {
2313
- [key: string]: {
2314
- default: boolean;
2315
- description: string;
2316
- };
2317
- };
2318
- config?: {
2319
- [key: string]: string;
2320
- };
2321
- }
2322
- interface PluginIframeMessage {
2323
- type: number;
2324
- uuid: string;
2325
- payload?: any;
2326
- }
2327
- interface SendDataOptions {
2328
- eventName: string;
2329
- data: any;
2330
- }
2331
- interface ReactNativeWebViewEvent {
2332
- nativeEvent: {
2333
- data: string;
2334
- };
2335
- }
2336
- interface ReactNativeWebView {
2337
- src: string;
2338
- allow: string;
2339
- title: string;
2340
- props: {
2341
- onMessage: (event: ReactNativeWebViewEvent) => void;
2342
- };
2343
- postMessage: (message: string) => void;
2344
- }
2345
- declare const PluginEventKeys: {
2346
- stateUpdate: string;
2347
- ready: string;
2348
- closed: string;
2349
- toggleViewMode: string;
2350
- enabled: string;
2351
- '* ': string;
2352
- };
2353
- type _string = string & {
2354
- _?: any;
2355
- };
2356
- type PluginEvents$1 = keyof typeof PluginEventKeys | _string;
2357
- declare class Plugin extends CustomEventEmitter<PluginEvents$1> {
2358
- readonly baseURL: string;
2359
- readonly createdAt: Date;
2360
- readonly description: string;
2361
- readonly id: string;
2362
- readonly name: string;
2363
- readonly organizationId: string;
2364
- readonly picture: string;
2365
- readonly private: boolean;
2366
- readonly published: boolean;
2367
- readonly staggered: boolean;
2368
- readonly tags: string[];
2369
- readonly type: string;
2370
- readonly updatedAt: Date;
2371
- config?: PluginConfig;
2372
- active: boolean;
2373
- iframes: Map<string, {
2374
- iframe: HTMLIFrameElement | ReactNativeWebView;
2375
- listener?: (message: MessageEvent) => void;
2376
- }>;
2377
- enabledBy: string;
2378
- get telemetry(): Telemetry;
2379
- 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);
2380
- sendIframeEvent(message: PluginIframeMessage): void;
2381
- private handleIframeMessage;
2382
- sendData(payload: SendDataOptions): void;
2383
- removePluginView(viewId?: string): void;
2384
- addPluginView(iframe: HTMLIFrameElement | ReactNativeWebView, viewId?: string): void;
2385
- private setActive;
2386
- activateForSelf(): Promise<void>;
2387
- deactivateForSelf(): void;
2388
- enable(): Promise<void>;
2389
- disable(): void;
2390
- activate(): Promise<void>;
2391
- deactivate(): Promise<void>;
2392
- }
2393
-
2394
2160
  interface ResponseStatus {
2395
2161
  success: boolean;
2396
2162
  message: string;
@@ -2870,7 +2636,6 @@ interface IceServerInformation {
2870
2636
  }
2871
2637
  interface CachedUserDetails {
2872
2638
  peerId?: string;
2873
- pluginInformation: PluginResponse[];
2874
2639
  userDetails: UserDetailsResponseV2;
2875
2640
  roomDetails: RoomDetails;
2876
2641
  iceServers: IceServerInformation[];
@@ -2891,7 +2656,6 @@ declare class API {
2891
2656
  protected authToken: string;
2892
2657
  protected organizationId: string;
2893
2658
  protected iceServers: IceServerInformation[];
2894
- protected pluginInformation: PluginResponse[];
2895
2659
  protected userDetails: UserDetailsResponseV2;
2896
2660
  protected roomDetails: RoomDetails;
2897
2661
  get peerId(): string;
@@ -3014,6 +2778,109 @@ declare class Polls extends TypedEventEmitter<PollsEvents> {
3014
2778
  vote(id: string, index: number): Promise<void>;
3015
2779
  }
3016
2780
 
2781
+ declare class StoresSocketHandler {
2782
+ constructor(context: Context<ContextState>, socketService: SocketService);
2783
+ get logger(): Logger;
2784
+ get peerId(): string;
2785
+ storeInsertKeys(pluginId: string, store: string, insertKeys: {
2786
+ key: string;
2787
+ payload?: unknown;
2788
+ }[], messageId?: string): void;
2789
+ storeGetKeys(pluginId: string, store: string, getKeys: {
2790
+ key: string;
2791
+ }[], messageId?: string): void;
2792
+ storeDeleteKeys(pluginId: string, store: string, deleteKeys: {
2793
+ key: string;
2794
+ }[], messageId?: string): void;
2795
+ on(event: number, handler: (socketMessage: PluginStoreResponse, messageId?: string) => void): void;
2796
+ }
2797
+
2798
+ type StoreData = {
2799
+ [type: string]: any;
2800
+ };
2801
+ declare class Store {
2802
+ name: string;
2803
+ rateLimitConfig: {
2804
+ maxInvocations: number;
2805
+ period: number;
2806
+ };
2807
+ bulkRateLimitConfig: {
2808
+ maxInvocations: number;
2809
+ period: number;
2810
+ };
2811
+ private listeners;
2812
+ constructor({ name, socketHandler, meetingId }: {
2813
+ name: string;
2814
+ socketHandler: StoresSocketHandler;
2815
+ meetingId: string;
2816
+ });
2817
+ set(key: string, value: any, sync?: boolean, emit?: boolean): Promise<void>;
2818
+ private remoteSet;
2819
+ bulkSet(data: Array<{
2820
+ key: string;
2821
+ payload: any;
2822
+ }>): Promise<void>;
2823
+ update(key: string, value: any, sync?: boolean): Promise<void>;
2824
+ delete(key: string, sync?: boolean, emit?: boolean): Promise<void>;
2825
+ bulkDelete(data: Array<{
2826
+ key: string;
2827
+ }>): Promise<void>;
2828
+ get(key: string): any;
2829
+ getAll(): StoreData;
2830
+ clear(): void;
2831
+ get rateLimits(): {
2832
+ maxInvocations: number;
2833
+ period: number;
2834
+ };
2835
+ updateRateLimits(num: number, period: number): void;
2836
+ get bulkRateLimits(): {
2837
+ maxInvocations: number;
2838
+ period: number;
2839
+ };
2840
+ updateBulkRateLimits(num: number, period: number): void;
2841
+ subscribe(key: string | '*', cb: (value: any) => any): void;
2842
+ unsubscribe(key: string | '*', cb?: (value: any) => any): void;
2843
+ populate(data: StoreData): void;
2844
+ }
2845
+
2846
+ interface ClientPluginPermissions {
2847
+ canActivate: boolean;
2848
+ canDeactivate: boolean;
2849
+ }
2850
+ interface ClientPluginConfig {
2851
+ name: string;
2852
+ icon: string;
2853
+ id: string;
2854
+ permissions: ClientPluginPermissions;
2855
+ component: unknown;
2856
+ }
2857
+ declare const PluginEventKeys: {
2858
+ stateUpdate: string;
2859
+ ready: string;
2860
+ closed: string;
2861
+ enabled: string;
2862
+ '* ': string;
2863
+ };
2864
+ type _string = string & {
2865
+ _?: any;
2866
+ };
2867
+ type PluginEvents$1 = keyof typeof PluginEventKeys | _string;
2868
+ declare class Plugin extends CustomEventEmitter<PluginEvents$1> {
2869
+ readonly name: string;
2870
+ readonly icon: string;
2871
+ readonly id: string;
2872
+ readonly permissions: ClientPluginPermissions;
2873
+ active: boolean;
2874
+ enabledBy: string;
2875
+ get component(): unknown;
2876
+ get telemetry(): Telemetry;
2877
+ constructor(context: Context<ContextState>, config: ClientPluginConfig, activePluginsStore: Store, self: Self);
2878
+ activateForSelf(): void;
2879
+ deactivateForSelf(): void;
2880
+ activate(): Promise<void>;
2881
+ deactivate(): Promise<void>;
2882
+ }
2883
+
3017
2884
  type PluginMapEvents = {
3018
2885
  ['pluginAdded']: (plugin: Plugin) => void;
3019
2886
  ['pluginDeleted']: (plugin: Plugin) => void;
@@ -3277,57 +3144,11 @@ declare class ClientError extends Error {
3277
3144
  constructor(message: string, code?: keyof typeof ERROR_CODES, logger?: Logger | undefined, log?: boolean);
3278
3145
  }
3279
3146
 
3280
- type StoreData = {
3281
- [type: string]: any;
3282
- };
3283
- declare class Store {
3284
- name: string;
3285
- rateLimitConfig: {
3286
- maxInvocations: number;
3287
- period: number;
3288
- };
3289
- bulkRateLimitConfig: {
3290
- maxInvocations: number;
3291
- period: number;
3292
- };
3293
- private listeners;
3294
- constructor({ name, socketHandler, meetingId }: {
3295
- name: string;
3296
- socketHandler: PluginSocketHandler;
3297
- meetingId: string;
3298
- });
3299
- set(key: string, value: any, sync?: boolean, emit?: boolean): Promise<void>;
3300
- private remoteSet;
3301
- bulkSet(data: Array<{
3302
- key: string;
3303
- payload: any;
3304
- }>): Promise<void>;
3305
- update(key: string, value: any, sync?: boolean): Promise<void>;
3306
- delete(key: string, sync?: boolean, emit?: boolean): Promise<void>;
3307
- bulkDelete(data: Array<{
3308
- key: string;
3309
- }>): Promise<void>;
3310
- get(key: string): any;
3311
- getAll(): StoreData;
3312
- get rateLimits(): {
3313
- maxInvocations: number;
3314
- period: number;
3315
- };
3316
- updateRateLimits(num: number, period: number): void;
3317
- get bulkRateLimits(): {
3318
- maxInvocations: number;
3319
- period: number;
3320
- };
3321
- updateBulkRateLimits(num: number, period: number): void;
3322
- subscribe(key: string | '*', cb: (value: any) => any): void;
3323
- unsubscribe(key: string | '*', cb?: (value: any) => any): void;
3324
- populate(data: StoreData): void;
3325
- }
3326
-
3327
3147
  declare class StoreManager {
3328
3148
  stores: Map<String, Store>;
3329
- constructor(context: Context<ContextState>, handler: PluginSocketHandler);
3330
- create(name: string): Promise<Store>;
3149
+ constructor(context: Context<ContextState>, handler: StoresSocketHandler);
3150
+ create(name: string, _internal?: boolean): Promise<Store>;
3151
+ refresh(name: string): Promise<Store>;
3331
3152
  }
3332
3153
 
3333
3154
  interface SocketServicePayload {
@@ -3962,10 +3783,6 @@ declare class APIClient extends API {
3962
3783
  telemetry: Telemetry;
3963
3784
  constructor(context: Context<ContextState>, options?: APIOptions);
3964
3785
  getICEServers(): Promise<any>;
3965
- getPlugins(): Promise<any[]>;
3966
- getPluginDetails(pluginId: string): Promise<PluginResponse>;
3967
- getPluginConfig(pluginBaseUrl: string): Promise<PluginConfig>;
3968
- authorizePlugin(pluginId: string): Promise<string>;
3969
3786
  getPresignedUrls(filename: string): Promise<{
3970
3787
  getLocation: any;
3971
3788
  putLocation: any;
@@ -4221,14 +4038,6 @@ interface Modules {
4221
4038
  devTools?: {
4222
4039
  logs: boolean;
4223
4040
  logLevel?: LogLevel[number];
4224
- plugins?: {
4225
- id: string;
4226
- name: string;
4227
- port: number;
4228
- picture?: string;
4229
- description?: string;
4230
- staggered?: boolean;
4231
- }[];
4232
4041
  };
4233
4042
  experimentalAudioPlayback?: boolean;
4234
4043
  }
@@ -4244,6 +4053,7 @@ interface DefaultOptions {
4244
4053
  screenshare?: ScreenshareQualityConstraints;
4245
4054
  };
4246
4055
  isNonPreferredDevice?: (device: MediaDeviceInfo) => boolean;
4056
+ plugins?: ClientPluginConfig[];
4247
4057
  }
4248
4058
  interface RoomDetails {
4249
4059
  meetingTitle: string;