@cloudflare/realtimekit 1.5.2-staging.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';
@@ -1525,70 +1525,6 @@ interface DeleteChatMessageResponse {
1525
1525
  * @generated MessageType for protobuf message socket.chat.DeleteChatMessageResponse
1526
1526
  */
1527
1527
  declare const DeleteChatMessageResponse: DeleteChatMessageResponse$Type;
1528
- declare class EnablePluginResponse$Type extends MessageType$1<EnablePluginResponse> {
1529
- constructor();
1530
- }
1531
- /**
1532
- * Response sent whenever a plugin is enabled.
1533
- * Applicable for all requests that enable a plugin.
1534
- *
1535
- * @generated from protobuf message socket.plugin.EnablePluginResponse
1536
- */
1537
- interface EnablePluginResponse {
1538
- /**
1539
- * @generated from protobuf field: string plugin_id = 1;
1540
- */
1541
- pluginId: string;
1542
- /**
1543
- * @generated from protobuf field: string enabled_by = 2;
1544
- */
1545
- enabledBy: string;
1546
- }
1547
- /**
1548
- * @generated MessageType for protobuf message socket.plugin.EnablePluginResponse
1549
- */
1550
- declare const EnablePluginResponse: EnablePluginResponse$Type;
1551
- declare class EnablePluginsResponse$Type extends MessageType$1<EnablePluginsResponse> {
1552
- constructor();
1553
- }
1554
- /**
1555
- * Response sent when all enabled plugins are requested.
1556
- *
1557
- * @generated from protobuf message socket.plugin.EnablePluginsResponse
1558
- */
1559
- interface EnablePluginsResponse {
1560
- /**
1561
- * @generated from protobuf field: repeated socket.plugin.EnablePluginResponse plugins = 1;
1562
- */
1563
- plugins: EnablePluginResponse[];
1564
- }
1565
- /**
1566
- * @generated MessageType for protobuf message socket.plugin.EnablePluginsResponse
1567
- */
1568
- declare const EnablePluginsResponse: EnablePluginsResponse$Type;
1569
- declare class DisablePluginResponse$Type extends MessageType$1<DisablePluginResponse> {
1570
- constructor();
1571
- }
1572
- /**
1573
- * Response sent whenever a plugin is disabled.
1574
- * Applicable for all requests that disable a plugin.
1575
- *
1576
- * @generated from protobuf message socket.plugin.DisablePluginResponse
1577
- */
1578
- interface DisablePluginResponse {
1579
- /**
1580
- * @generated from protobuf field: string plugin_id = 1;
1581
- */
1582
- pluginId: string;
1583
- /**
1584
- * @generated from protobuf field: string disabled_by = 2;
1585
- */
1586
- disabledBy: string;
1587
- }
1588
- /**
1589
- * @generated MessageType for protobuf message socket.plugin.DisablePluginResponse
1590
- */
1591
- declare const DisablePluginResponse: DisablePluginResponse$Type;
1592
1528
  declare class PluginStoreItem$Type extends MessageType$1<PluginStoreItem> {
1593
1529
  constructor();
1594
1530
  }
@@ -1644,28 +1580,6 @@ interface PluginStoreResponse {
1644
1580
  * @generated MessageType for protobuf message socket.plugin.PluginStoreResponse
1645
1581
  */
1646
1582
  declare const PluginStoreResponse: PluginStoreResponse$Type;
1647
- declare class PluginEventResponse$Type extends MessageType$1<PluginEventResponse> {
1648
- constructor();
1649
- }
1650
- /**
1651
- * Response sent for custom plugin event.
1652
- *
1653
- * @generated from protobuf message socket.plugin.PluginEventResponse
1654
- */
1655
- interface PluginEventResponse {
1656
- /**
1657
- * @generated from protobuf field: string plugin_id = 1;
1658
- */
1659
- pluginId: string;
1660
- /**
1661
- * @generated from protobuf field: bytes plugin_data = 2;
1662
- */
1663
- pluginData: Uint8Array;
1664
- }
1665
- /**
1666
- * @generated MessageType for protobuf message socket.plugin.PluginEventResponse
1667
- */
1668
- declare const PluginEventResponse: PluginEventResponse$Type;
1669
1583
  declare class GetStagePeersResponse$Type extends MessageType$1<GetStagePeersResponse> {
1670
1584
  constructor();
1671
1585
  }
@@ -2237,152 +2151,6 @@ declare class ClientMap<T extends (EventMap & WildCardEvent<T>), U extends {
2237
2151
  clear(emitEvent?: boolean, removeListeners?: boolean): void;
2238
2152
  toArray(): U[];
2239
2153
  }
2240
- type PluginSocketMessage = DisablePluginResponse | EnablePluginResponse | PluginEventResponse | PluginStoreResponse | SendChatMessageToPeersResponse | SendChatMessageToRoomResponse;
2241
- declare class PluginSocketHandler {
2242
- constructor(context: Context<ContextState>, socketService: SocketService);
2243
- readonly logger: Logger;
2244
- addPlugin(pluginId: string, staggered: boolean): void;
2245
- removePlugin(pluginId: string): void;
2246
- getActivePlugins(): Promise<EnablePluginsResponse>;
2247
- customPluginEventToRoom(pluginId: string, data: any, messageId?: string): void;
2248
- customPluginEventToPeers(pluginId: string, peerIds: string[], data: any, messageId?: string): void;
2249
- enablePluginForRoom(pluginId: string, messageId?: string): void;
2250
- enablePluginForPeers(pluginId: string, peerIds: string[], messageId?: string): void;
2251
- disablePluginForRoom(pluginId: string, messageId?: string): void;
2252
- disablePluginForPeers(pluginId: string, peerIds: string[], messageId?: string): void;
2253
- storeInsertKeys(pluginId: string, store: string, insertKeys: {
2254
- key: string;
2255
- payload?: any;
2256
- }[], messageId?: string): void;
2257
- storeGetKeys(pluginId: string, store: string, getKeys: {
2258
- key: string;
2259
- }[], messageId?: string): void;
2260
- storeDeleteKeys(pluginId: string, store: string, deleteKeys: {
2261
- key: string;
2262
- }[], messageId?: string): void;
2263
- storeDelete(pluginId: string, store: string, messageId?: string): void;
2264
- getPluginDataOld(pluginId: string, store: string): void;
2265
- storePluginDataOld(pluginId: string, store: string, data: any): void;
2266
- on(event: number, handler: (socketMessage: PluginSocketMessage, messageId?: string) => void): void;
2267
- }
2268
- interface PluginResponse {
2269
- baseURL: string;
2270
- createdAt: string;
2271
- description: string;
2272
- id: string;
2273
- name: string;
2274
- organizationId: string;
2275
- picture: string;
2276
- private: boolean;
2277
- published: boolean;
2278
- staggered: boolean;
2279
- tags: string[];
2280
- type: string;
2281
- updatedAt: string;
2282
- }
2283
- interface PluginViews {
2284
- [viewId: string]: {
2285
- url: string;
2286
- suggestedPosition: string;
2287
- };
2288
- }
2289
- interface PluginConfig {
2290
- name: string;
2291
- pluginId: string;
2292
- version: string;
2293
- description: string;
2294
- author?: string;
2295
- repository?: string;
2296
- tags?: string[];
2297
- picture?: string;
2298
- url?: string;
2299
- files: {
2300
- include: string[];
2301
- exclude?: string[];
2302
- };
2303
- views?: PluginViews;
2304
- contentScript?: string;
2305
- permissions?: {
2306
- [key: string]: {
2307
- default: boolean;
2308
- description: string;
2309
- };
2310
- };
2311
- config?: {
2312
- [key: string]: string;
2313
- };
2314
- }
2315
- interface PluginIframeMessage {
2316
- type: number;
2317
- uuid: string;
2318
- payload?: any;
2319
- }
2320
- interface SendDataOptions {
2321
- eventName: string;
2322
- data: any;
2323
- }
2324
- interface ReactNativeWebViewEvent {
2325
- nativeEvent: {
2326
- data: string;
2327
- };
2328
- }
2329
- interface ReactNativeWebView {
2330
- src: string;
2331
- allow: string;
2332
- title: string;
2333
- props: {
2334
- onMessage: (event: ReactNativeWebViewEvent) => void;
2335
- };
2336
- postMessage: (message: string) => void;
2337
- }
2338
- declare const PluginEventKeys: {
2339
- stateUpdate: string;
2340
- ready: string;
2341
- closed: string;
2342
- toggleViewMode: string;
2343
- enabled: string;
2344
- '* ': string;
2345
- };
2346
- type _string = string & {
2347
- _?: any;
2348
- };
2349
- type PluginEvents$1 = keyof typeof PluginEventKeys | _string;
2350
- declare class Plugin extends CustomEventEmitter<PluginEvents$1> {
2351
- readonly baseURL: string;
2352
- readonly createdAt: Date;
2353
- readonly description: string;
2354
- readonly id: string;
2355
- readonly name: string;
2356
- readonly organizationId: string;
2357
- readonly picture: string;
2358
- readonly private: boolean;
2359
- readonly published: boolean;
2360
- readonly staggered: boolean;
2361
- readonly tags: string[];
2362
- readonly type: string;
2363
- readonly updatedAt: Date;
2364
- config?: PluginConfig;
2365
- active: boolean;
2366
- iframes: Map<string, {
2367
- iframe: HTMLIFrameElement | ReactNativeWebView;
2368
- listener?: (message: MessageEvent) => void;
2369
- }>;
2370
- enabledBy: string;
2371
- readonly telemetry: Telemetry;
2372
- 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);
2373
- sendIframeEvent(message: PluginIframeMessage): void;
2374
- private handleIframeMessage;
2375
- sendData(payload: SendDataOptions): void;
2376
- removePluginView(viewId?: string): void;
2377
- addPluginView(iframe: HTMLIFrameElement | ReactNativeWebView, viewId?: string): void;
2378
- private setActive;
2379
- activateForSelf(): Promise<void>;
2380
- deactivateForSelf(): void;
2381
- enable(): Promise<void>;
2382
- disable(): void;
2383
- activate(): Promise<void>;
2384
- deactivate(): Promise<void>;
2385
- }
2386
2154
  interface ResponseStatus {
2387
2155
  success: boolean;
2388
2156
  message: string;
@@ -2851,7 +2619,6 @@ interface IceServerInformation {
2851
2619
  }
2852
2620
  interface CachedUserDetails {
2853
2621
  peerId?: string;
2854
- pluginInformation: PluginResponse[];
2855
2622
  userDetails: UserDetailsResponseV2;
2856
2623
  roomDetails: RoomDetails;
2857
2624
  iceServers: IceServerInformation[];
@@ -2872,7 +2639,6 @@ declare class API {
2872
2639
  protected authToken: string;
2873
2640
  protected organizationId: string;
2874
2641
  protected iceServers: IceServerInformation[];
2875
- protected pluginInformation: PluginResponse[];
2876
2642
  protected userDetails: UserDetailsResponseV2;
2877
2643
  protected roomDetails: RoomDetails;
2878
2644
  readonly peerId: string;
@@ -2990,6 +2756,106 @@ declare class Polls extends TypedEventEmitter<PollsEvents> {
2990
2756
  create(question: string, options: string[], anonymous?: boolean, hideVotes?: boolean): Promise<void>;
2991
2757
  vote(id: string, index: number): Promise<void>;
2992
2758
  }
2759
+ declare class StoresSocketHandler {
2760
+ constructor(context: Context<ContextState>, socketService: SocketService);
2761
+ readonly logger: Logger;
2762
+ readonly peerId: string;
2763
+ storeInsertKeys(pluginId: string, store: string, insertKeys: {
2764
+ key: string;
2765
+ payload?: unknown;
2766
+ }[], messageId?: string): void;
2767
+ storeGetKeys(pluginId: string, store: string, getKeys: {
2768
+ key: string;
2769
+ }[], messageId?: string): void;
2770
+ storeDeleteKeys(pluginId: string, store: string, deleteKeys: {
2771
+ key: string;
2772
+ }[], messageId?: string): void;
2773
+ on(event: number, handler: (socketMessage: PluginStoreResponse, messageId?: string) => void): void;
2774
+ }
2775
+ type StoreData = {
2776
+ [type: string]: any;
2777
+ };
2778
+ declare class Store {
2779
+ name: string;
2780
+ rateLimitConfig: {
2781
+ maxInvocations: number;
2782
+ period: number;
2783
+ };
2784
+ bulkRateLimitConfig: {
2785
+ maxInvocations: number;
2786
+ period: number;
2787
+ };
2788
+ private listeners;
2789
+ constructor({ name, socketHandler, meetingId }: {
2790
+ name: string;
2791
+ socketHandler: StoresSocketHandler;
2792
+ meetingId: string;
2793
+ });
2794
+ set(key: string, value: any, sync?: boolean, emit?: boolean): Promise<void>;
2795
+ private remoteSet;
2796
+ bulkSet(data: Array<{
2797
+ key: string;
2798
+ payload: any;
2799
+ }>): Promise<void>;
2800
+ update(key: string, value: any, sync?: boolean): Promise<void>;
2801
+ delete(key: string, sync?: boolean, emit?: boolean): Promise<void>;
2802
+ bulkDelete(data: Array<{
2803
+ key: string;
2804
+ }>): Promise<void>;
2805
+ get(key: string): any;
2806
+ getAll(): StoreData;
2807
+ clear(): void;
2808
+ readonly rateLimits: {
2809
+ maxInvocations: number;
2810
+ period: number;
2811
+ };
2812
+ updateRateLimits(num: number, period: number): void;
2813
+ readonly bulkRateLimits: {
2814
+ maxInvocations: number;
2815
+ period: number;
2816
+ };
2817
+ updateBulkRateLimits(num: number, period: number): void;
2818
+ subscribe(key: string | '*', cb: (value: any) => any): void;
2819
+ unsubscribe(key: string | '*', cb?: (value: any) => any): void;
2820
+ populate(data: StoreData): void;
2821
+ }
2822
+ interface ClientPluginPermissions {
2823
+ canActivate: boolean;
2824
+ canDeactivate: boolean;
2825
+ }
2826
+ interface ClientPluginConfig {
2827
+ name: string;
2828
+ icon: string;
2829
+ id: string;
2830
+ permissions: ClientPluginPermissions;
2831
+ component: unknown;
2832
+ }
2833
+ declare const PluginEventKeys: {
2834
+ stateUpdate: string;
2835
+ ready: string;
2836
+ closed: string;
2837
+ enabled: string;
2838
+ '* ': string;
2839
+ };
2840
+ type _string = string & {
2841
+ _?: any;
2842
+ };
2843
+ type PluginEvents$1 = keyof typeof PluginEventKeys | _string;
2844
+ declare class Plugin extends CustomEventEmitter<PluginEvents$1> {
2845
+ readonly name: string;
2846
+ readonly icon: string;
2847
+ readonly id: string;
2848
+ readonly permissions: ClientPluginPermissions;
2849
+ active: boolean;
2850
+ enabledBy: string;
2851
+ readonly component: unknown;
2852
+ readonly telemetry: Telemetry;
2853
+ constructor(context: Context<ContextState>, config: ClientPluginConfig, activePluginsStore: Store, self: Self);
2854
+ activateForSelf(): void;
2855
+ deactivateForSelf(): void;
2856
+ activate(): Promise<void>;
2857
+ deactivate(): Promise<void>;
2858
+ }
2993
2859
  type PluginMapEvents = {
2994
2860
  ['pluginAdded']: (plugin: Plugin) => void;
2995
2861
  ['pluginDeleted']: (plugin: Plugin) => void;
@@ -3244,56 +3110,11 @@ declare class ClientError extends Error {
3244
3110
  code: keyof typeof ERROR_CODES;
3245
3111
  constructor(message: string, code?: keyof typeof ERROR_CODES, logger?: Logger | undefined, log?: boolean);
3246
3112
  }
3247
- type StoreData = {
3248
- [type: string]: any;
3249
- };
3250
- declare class Store {
3251
- name: string;
3252
- rateLimitConfig: {
3253
- maxInvocations: number;
3254
- period: number;
3255
- };
3256
- bulkRateLimitConfig: {
3257
- maxInvocations: number;
3258
- period: number;
3259
- };
3260
- private listeners;
3261
- constructor({ name, socketHandler, meetingId }: {
3262
- name: string;
3263
- socketHandler: PluginSocketHandler;
3264
- meetingId: string;
3265
- });
3266
- set(key: string, value: any, sync?: boolean, emit?: boolean): Promise<void>;
3267
- private remoteSet;
3268
- bulkSet(data: Array<{
3269
- key: string;
3270
- payload: any;
3271
- }>): Promise<void>;
3272
- update(key: string, value: any, sync?: boolean): Promise<void>;
3273
- delete(key: string, sync?: boolean, emit?: boolean): Promise<void>;
3274
- bulkDelete(data: Array<{
3275
- key: string;
3276
- }>): Promise<void>;
3277
- get(key: string): any;
3278
- getAll(): StoreData;
3279
- readonly rateLimits: {
3280
- maxInvocations: number;
3281
- period: number;
3282
- };
3283
- updateRateLimits(num: number, period: number): void;
3284
- readonly bulkRateLimits: {
3285
- maxInvocations: number;
3286
- period: number;
3287
- };
3288
- updateBulkRateLimits(num: number, period: number): void;
3289
- subscribe(key: string | '*', cb: (value: any) => any): void;
3290
- unsubscribe(key: string | '*', cb?: (value: any) => any): void;
3291
- populate(data: StoreData): void;
3292
- }
3293
3113
  declare class StoreManager {
3294
3114
  stores: Map<String, Store>;
3295
- constructor(context: Context<ContextState>, handler: PluginSocketHandler);
3296
- create(name: string): Promise<Store>;
3115
+ constructor(context: Context<ContextState>, handler: StoresSocketHandler);
3116
+ create(name: string, _internal?: boolean): Promise<Store>;
3117
+ refresh(name: string): Promise<Store>;
3297
3118
  }
3298
3119
  interface SocketServicePayload {
3299
3120
  payload: any;
@@ -3934,10 +3755,6 @@ declare class APIClient extends API {
3934
3755
  telemetry: Telemetry;
3935
3756
  constructor(context: Context<ContextState>, options?: APIOptions);
3936
3757
  getICEServers(): Promise<any>;
3937
- getPlugins(): Promise<any[]>;
3938
- getPluginDetails(pluginId: string): Promise<PluginResponse>;
3939
- getPluginConfig(pluginBaseUrl: string): Promise<PluginConfig>;
3940
- authorizePlugin(pluginId: string): Promise<string>;
3941
3758
  getPresignedUrls(filename: string): Promise<{
3942
3759
  getLocation: any;
3943
3760
  putLocation: any;
@@ -4188,14 +4005,6 @@ interface Modules {
4188
4005
  devTools?: {
4189
4006
  logs: boolean;
4190
4007
  logLevel?: LogLevel[number];
4191
- plugins?: {
4192
- id: string;
4193
- name: string;
4194
- port: number;
4195
- picture?: string;
4196
- description?: string;
4197
- staggered?: boolean;
4198
- }[];
4199
4008
  };
4200
4009
  experimentalAudioPlayback?: boolean;
4201
4010
  }
@@ -4211,6 +4020,7 @@ interface DefaultOptions {
4211
4020
  screenshare?: ScreenshareQualityConstraints;
4212
4021
  };
4213
4022
  isNonPreferredDevice?: (device: MediaDeviceInfo) => boolean;
4023
+ plugins?: ClientPluginConfig[];
4214
4024
  }
4215
4025
  interface RoomDetails {
4216
4026
  meetingTitle: string;