@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.
@@ -1496,70 +1496,6 @@ interface DeleteChatMessageResponse {
1496
1496
  * @generated MessageType for protobuf message socket.chat.DeleteChatMessageResponse
1497
1497
  */
1498
1498
  declare const DeleteChatMessageResponse: DeleteChatMessageResponse$Type;
1499
- declare class EnablePluginResponse$Type extends MessageType$1<EnablePluginResponse> {
1500
- constructor();
1501
- }
1502
- /**
1503
- * Response sent whenever a plugin is enabled.
1504
- * Applicable for all requests that enable a plugin.
1505
- *
1506
- * @generated from protobuf message socket.plugin.EnablePluginResponse
1507
- */
1508
- interface EnablePluginResponse {
1509
- /**
1510
- * @generated from protobuf field: string plugin_id = 1;
1511
- */
1512
- pluginId: string;
1513
- /**
1514
- * @generated from protobuf field: string enabled_by = 2;
1515
- */
1516
- enabledBy: string;
1517
- }
1518
- /**
1519
- * @generated MessageType for protobuf message socket.plugin.EnablePluginResponse
1520
- */
1521
- declare const EnablePluginResponse: EnablePluginResponse$Type;
1522
- declare class EnablePluginsResponse$Type extends MessageType$1<EnablePluginsResponse> {
1523
- constructor();
1524
- }
1525
- /**
1526
- * Response sent when all enabled plugins are requested.
1527
- *
1528
- * @generated from protobuf message socket.plugin.EnablePluginsResponse
1529
- */
1530
- interface EnablePluginsResponse {
1531
- /**
1532
- * @generated from protobuf field: repeated socket.plugin.EnablePluginResponse plugins = 1;
1533
- */
1534
- plugins: EnablePluginResponse[];
1535
- }
1536
- /**
1537
- * @generated MessageType for protobuf message socket.plugin.EnablePluginsResponse
1538
- */
1539
- declare const EnablePluginsResponse: EnablePluginsResponse$Type;
1540
- declare class DisablePluginResponse$Type extends MessageType$1<DisablePluginResponse> {
1541
- constructor();
1542
- }
1543
- /**
1544
- * Response sent whenever a plugin is disabled.
1545
- * Applicable for all requests that disable a plugin.
1546
- *
1547
- * @generated from protobuf message socket.plugin.DisablePluginResponse
1548
- */
1549
- interface DisablePluginResponse {
1550
- /**
1551
- * @generated from protobuf field: string plugin_id = 1;
1552
- */
1553
- pluginId: string;
1554
- /**
1555
- * @generated from protobuf field: string disabled_by = 2;
1556
- */
1557
- disabledBy: string;
1558
- }
1559
- /**
1560
- * @generated MessageType for protobuf message socket.plugin.DisablePluginResponse
1561
- */
1562
- declare const DisablePluginResponse: DisablePluginResponse$Type;
1563
1499
  declare class PluginStoreItem$Type extends MessageType$1<PluginStoreItem> {
1564
1500
  constructor();
1565
1501
  }
@@ -1615,28 +1551,6 @@ interface PluginStoreResponse {
1615
1551
  * @generated MessageType for protobuf message socket.plugin.PluginStoreResponse
1616
1552
  */
1617
1553
  declare const PluginStoreResponse: PluginStoreResponse$Type;
1618
- declare class PluginEventResponse$Type extends MessageType$1<PluginEventResponse> {
1619
- constructor();
1620
- }
1621
- /**
1622
- * Response sent for custom plugin event.
1623
- *
1624
- * @generated from protobuf message socket.plugin.PluginEventResponse
1625
- */
1626
- interface PluginEventResponse {
1627
- /**
1628
- * @generated from protobuf field: string plugin_id = 1;
1629
- */
1630
- pluginId: string;
1631
- /**
1632
- * @generated from protobuf field: bytes plugin_data = 2;
1633
- */
1634
- pluginData: Uint8Array;
1635
- }
1636
- /**
1637
- * @generated MessageType for protobuf message socket.plugin.PluginEventResponse
1638
- */
1639
- declare const PluginEventResponse: PluginEventResponse$Type;
1640
1554
  declare class GetStagePeersResponse$Type extends MessageType$1<GetStagePeersResponse> {
1641
1555
  constructor();
1642
1556
  }
@@ -3191,152 +3105,6 @@ declare class Livestream extends TypedEventEmitter$1<LivestreamEvents> {
3191
3105
  start(livestreamConfig?: StartLivestreamConfig): Promise<void>;
3192
3106
  stop(): Promise<void>;
3193
3107
  }
3194
- type PluginSocketMessage = DisablePluginResponse | EnablePluginResponse | PluginEventResponse | PluginStoreResponse | SendChatMessageToPeersResponse | SendChatMessageToRoomResponse;
3195
- declare class PluginSocketHandler {
3196
- constructor(context: Context<ContextState>, socketService: SocketService);
3197
- readonly logger: Logger;
3198
- addPlugin(pluginId: string, staggered: boolean): void;
3199
- removePlugin(pluginId: string): void;
3200
- getActivePlugins(): Promise<EnablePluginsResponse>;
3201
- customPluginEventToRoom(pluginId: string, data: any, messageId?: string): void;
3202
- customPluginEventToPeers(pluginId: string, peerIds: string[], data: any, messageId?: string): void;
3203
- enablePluginForRoom(pluginId: string, messageId?: string): void;
3204
- enablePluginForPeers(pluginId: string, peerIds: string[], messageId?: string): void;
3205
- disablePluginForRoom(pluginId: string, messageId?: string): void;
3206
- disablePluginForPeers(pluginId: string, peerIds: string[], messageId?: string): void;
3207
- storeInsertKeys(pluginId: string, store: string, insertKeys: {
3208
- key: string;
3209
- payload?: any;
3210
- }[], messageId?: string): void;
3211
- storeGetKeys(pluginId: string, store: string, getKeys: {
3212
- key: string;
3213
- }[], messageId?: string): void;
3214
- storeDeleteKeys(pluginId: string, store: string, deleteKeys: {
3215
- key: string;
3216
- }[], messageId?: string): void;
3217
- storeDelete(pluginId: string, store: string, messageId?: string): void;
3218
- getPluginDataOld(pluginId: string, store: string): void;
3219
- storePluginDataOld(pluginId: string, store: string, data: any): void;
3220
- on(event: number, handler: (socketMessage: PluginSocketMessage, messageId?: string) => void): void;
3221
- }
3222
- interface PluginResponse {
3223
- baseURL: string;
3224
- createdAt: string;
3225
- description: string;
3226
- id: string;
3227
- name: string;
3228
- organizationId: string;
3229
- picture: string;
3230
- private: boolean;
3231
- published: boolean;
3232
- staggered: boolean;
3233
- tags: string[];
3234
- type: string;
3235
- updatedAt: string;
3236
- }
3237
- interface PluginViews {
3238
- [viewId: string]: {
3239
- url: string;
3240
- suggestedPosition: string;
3241
- };
3242
- }
3243
- interface PluginConfig {
3244
- name: string;
3245
- pluginId: string;
3246
- version: string;
3247
- description: string;
3248
- author?: string;
3249
- repository?: string;
3250
- tags?: string[];
3251
- picture?: string;
3252
- url?: string;
3253
- files: {
3254
- include: string[];
3255
- exclude?: string[];
3256
- };
3257
- views?: PluginViews;
3258
- contentScript?: string;
3259
- permissions?: {
3260
- [key: string]: {
3261
- default: boolean;
3262
- description: string;
3263
- };
3264
- };
3265
- config?: {
3266
- [key: string]: string;
3267
- };
3268
- }
3269
- interface PluginIframeMessage {
3270
- type: number;
3271
- uuid: string;
3272
- payload?: any;
3273
- }
3274
- interface SendDataOptions {
3275
- eventName: string;
3276
- data: any;
3277
- }
3278
- interface ReactNativeWebViewEvent {
3279
- nativeEvent: {
3280
- data: string;
3281
- };
3282
- }
3283
- interface ReactNativeWebView {
3284
- src: string;
3285
- allow: string;
3286
- title: string;
3287
- props: {
3288
- onMessage: (event: ReactNativeWebViewEvent) => void;
3289
- };
3290
- postMessage: (message: string) => void;
3291
- }
3292
- declare const PluginEventKeys: {
3293
- stateUpdate: string;
3294
- ready: string;
3295
- closed: string;
3296
- toggleViewMode: string;
3297
- enabled: string;
3298
- '* ': string;
3299
- };
3300
- type _string = string & {
3301
- _?: any;
3302
- };
3303
- type PluginEvents$1 = keyof typeof PluginEventKeys | _string;
3304
- declare class Plugin extends CustomEventEmitter<PluginEvents$1> {
3305
- readonly baseURL: string;
3306
- readonly createdAt: Date;
3307
- readonly description: string;
3308
- readonly id: string;
3309
- readonly name: string;
3310
- readonly organizationId: string;
3311
- readonly picture: string;
3312
- readonly private: boolean;
3313
- readonly published: boolean;
3314
- readonly staggered: boolean;
3315
- readonly tags: string[];
3316
- readonly type: string;
3317
- readonly updatedAt: Date;
3318
- config?: PluginConfig;
3319
- active: boolean;
3320
- iframes: Map<string, {
3321
- iframe: HTMLIFrameElement | ReactNativeWebView;
3322
- listener?: (message: MessageEvent) => void;
3323
- }>;
3324
- enabledBy: string;
3325
- readonly telemetry: Telemetry;
3326
- 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);
3327
- sendIframeEvent(message: PluginIframeMessage): void;
3328
- private handleIframeMessage;
3329
- sendData(payload: SendDataOptions): void;
3330
- removePluginView(viewId?: string): void;
3331
- addPluginView(iframe: HTMLIFrameElement | ReactNativeWebView, viewId?: string): void;
3332
- private setActive;
3333
- activateForSelf(): Promise<void>;
3334
- deactivateForSelf(): void;
3335
- enable(): Promise<void>;
3336
- disable(): void;
3337
- activate(): Promise<void>;
3338
- deactivate(): Promise<void>;
3339
- }
3340
3108
  interface RecordingConfig {
3341
3109
  fileNamePrefix?: string;
3342
3110
  videoConfig?: {
@@ -3354,10 +3122,6 @@ declare class APIClient extends API {
3354
3122
  telemetry: Telemetry;
3355
3123
  constructor(context: Context<ContextState>, options?: APIOptions);
3356
3124
  getICEServers(): Promise<any>;
3357
- getPlugins(): Promise<any[]>;
3358
- getPluginDetails(pluginId: string): Promise<PluginResponse>;
3359
- getPluginConfig(pluginBaseUrl: string): Promise<PluginConfig>;
3360
- authorizePlugin(pluginId: string): Promise<string>;
3361
3125
  getPresignedUrls(filename: string): Promise<{
3362
3126
  getLocation: any;
3363
3127
  putLocation: any;
@@ -3556,6 +3320,110 @@ declare class Polls extends TypedEventEmitter$1<PollsEvents> {
3556
3320
  create(question: string, options: string[], anonymous?: boolean, hideVotes?: boolean): Promise<void>;
3557
3321
  vote(id: string, index: number): Promise<void>;
3558
3322
  }
3323
+ declare class StoresSocketHandler {
3324
+ constructor(context: Context<ContextState>, socketService: SocketService);
3325
+ readonly logger: Logger;
3326
+ readonly peerId: string;
3327
+ storeInsertKeys(pluginId: string, store: string, insertKeys: {
3328
+ key: string;
3329
+ payload?: unknown;
3330
+ }[], messageId?: string): void;
3331
+ storeGetKeys(pluginId: string, store: string, getKeys: {
3332
+ key: string;
3333
+ }[], messageId?: string): void;
3334
+ storeDeleteKeys(pluginId: string, store: string, deleteKeys: {
3335
+ key: string;
3336
+ }[], messageId?: string): void;
3337
+ on(event: number, handler: (socketMessage: PluginStoreResponse, messageId?: string) => void): void;
3338
+ }
3339
+ type StoreData = {
3340
+ [type: string]: any;
3341
+ };
3342
+ type RateLimitConfig = {
3343
+ maxInvocations: number;
3344
+ period: number;
3345
+ };
3346
+ declare class Store {
3347
+ name: string;
3348
+ rateLimitConfig: {
3349
+ maxInvocations: number;
3350
+ period: number;
3351
+ };
3352
+ bulkRateLimitConfig: {
3353
+ maxInvocations: number;
3354
+ period: number;
3355
+ };
3356
+ private listeners;
3357
+ constructor({ name, socketHandler, meetingId }: {
3358
+ name: string;
3359
+ socketHandler: StoresSocketHandler;
3360
+ meetingId: string;
3361
+ });
3362
+ set(key: string, value: any, sync?: boolean, emit?: boolean): Promise<void>;
3363
+ private remoteSet;
3364
+ bulkSet(data: Array<{
3365
+ key: string;
3366
+ payload: any;
3367
+ }>): Promise<void>;
3368
+ update(key: string, value: any, sync?: boolean): Promise<void>;
3369
+ delete(key: string, sync?: boolean, emit?: boolean): Promise<void>;
3370
+ bulkDelete(data: Array<{
3371
+ key: string;
3372
+ }>): Promise<void>;
3373
+ get(key: string): any;
3374
+ getAll(): StoreData;
3375
+ clear(): void;
3376
+ readonly rateLimits: {
3377
+ maxInvocations: number;
3378
+ period: number;
3379
+ };
3380
+ updateRateLimits(num: number, period: number): void;
3381
+ readonly bulkRateLimits: {
3382
+ maxInvocations: number;
3383
+ period: number;
3384
+ };
3385
+ updateBulkRateLimits(num: number, period: number): void;
3386
+ subscribe(key: string | '*', cb: (value: any) => any): void;
3387
+ unsubscribe(key: string | '*', cb?: (value: any) => any): void;
3388
+ populate(data: StoreData): void;
3389
+ }
3390
+ interface ClientPluginPermissions {
3391
+ canActivate: boolean;
3392
+ canDeactivate: boolean;
3393
+ }
3394
+ interface ClientPluginConfig {
3395
+ name: string;
3396
+ icon: string;
3397
+ id: string;
3398
+ permissions: ClientPluginPermissions;
3399
+ component: unknown;
3400
+ }
3401
+ declare const PluginEventKeys: {
3402
+ stateUpdate: string;
3403
+ ready: string;
3404
+ closed: string;
3405
+ enabled: string;
3406
+ '* ': string;
3407
+ };
3408
+ type _string = string & {
3409
+ _?: any;
3410
+ };
3411
+ type PluginEvents$1 = keyof typeof PluginEventKeys | _string;
3412
+ declare class Plugin extends CustomEventEmitter<PluginEvents$1> {
3413
+ readonly name: string;
3414
+ readonly icon: string;
3415
+ readonly id: string;
3416
+ readonly permissions: ClientPluginPermissions;
3417
+ active: boolean;
3418
+ enabledBy: string;
3419
+ readonly component: unknown;
3420
+ readonly telemetry: Telemetry;
3421
+ constructor(context: Context<ContextState>, config: ClientPluginConfig, activePluginsStore: Store, self: Self);
3422
+ activateForSelf(): void;
3423
+ deactivateForSelf(): void;
3424
+ activate(): Promise<void>;
3425
+ deactivate(): Promise<void>;
3426
+ }
3559
3427
  type PluginMapEvents = {
3560
3428
  ['pluginAdded']: (plugin: Plugin) => void;
3561
3429
  ['pluginDeleted']: (plugin: Plugin) => void;
@@ -3583,6 +3451,12 @@ declare class Plugins {
3583
3451
  readonly active: PluginMap;
3584
3452
  constructor(logger: Logger);
3585
3453
  }
3454
+ declare class StoreManager {
3455
+ stores: Map<String, Store>;
3456
+ constructor(context: Context<ContextState>, handler: StoresSocketHandler);
3457
+ create(name: string, _internal?: boolean): Promise<Store>;
3458
+ refresh(name: string): Promise<Store>;
3459
+ }
3586
3460
  declare class SelfMedia extends TypedEventEmitter$1<SelfEvents> {
3587
3461
  protected localMediaHandler: LocalMediaHandler;
3588
3462
  constructor(context: Context<ContextState>, logger: Logger);
@@ -3759,61 +3633,6 @@ declare class Internals {
3759
3633
  constructor(authToken: string, logger: Logger, features: Features, callStats: InhouseCallStats);
3760
3634
  static init(context: Context<ContextState>): Internals;
3761
3635
  }
3762
- type StoreData = {
3763
- [type: string]: any;
3764
- };
3765
- type RateLimitConfig = {
3766
- maxInvocations: number;
3767
- period: number;
3768
- };
3769
- declare class Store {
3770
- name: string;
3771
- rateLimitConfig: {
3772
- maxInvocations: number;
3773
- period: number;
3774
- };
3775
- bulkRateLimitConfig: {
3776
- maxInvocations: number;
3777
- period: number;
3778
- };
3779
- private listeners;
3780
- constructor({ name, socketHandler, meetingId }: {
3781
- name: string;
3782
- socketHandler: PluginSocketHandler;
3783
- meetingId: string;
3784
- });
3785
- set(key: string, value: any, sync?: boolean, emit?: boolean): Promise<void>;
3786
- private remoteSet;
3787
- bulkSet(data: Array<{
3788
- key: string;
3789
- payload: any;
3790
- }>): Promise<void>;
3791
- update(key: string, value: any, sync?: boolean): Promise<void>;
3792
- delete(key: string, sync?: boolean, emit?: boolean): Promise<void>;
3793
- bulkDelete(data: Array<{
3794
- key: string;
3795
- }>): Promise<void>;
3796
- get(key: string): any;
3797
- getAll(): StoreData;
3798
- readonly rateLimits: {
3799
- maxInvocations: number;
3800
- period: number;
3801
- };
3802
- updateRateLimits(num: number, period: number): void;
3803
- readonly bulkRateLimits: {
3804
- maxInvocations: number;
3805
- period: number;
3806
- };
3807
- updateBulkRateLimits(num: number, period: number): void;
3808
- subscribe(key: string | '*', cb: (value: any) => any): void;
3809
- unsubscribe(key: string | '*', cb?: (value: any) => any): void;
3810
- populate(data: StoreData): void;
3811
- }
3812
- declare class StoreManager {
3813
- stores: Map<String, Store>;
3814
- constructor(context: Context<ContextState>, handler: PluginSocketHandler);
3815
- create(name: string): Promise<Store>;
3816
- }
3817
3636
  declare const enum PRODUCERS_TYPE {
3818
3637
  WEBCAM = "webcam",
3819
3638
  WEBCAM_BACKUP = "webcam_backup",
@@ -4019,14 +3838,6 @@ interface Modules {
4019
3838
  devTools?: {
4020
3839
  logs: boolean;
4021
3840
  logLevel?: LogLevel[number];
4022
- plugins?: {
4023
- id: string;
4024
- name: string;
4025
- port: number;
4026
- picture?: string;
4027
- description?: string;
4028
- staggered?: boolean;
4029
- }[];
4030
3841
  };
4031
3842
  experimentalAudioPlayback?: boolean;
4032
3843
  }
@@ -4042,6 +3853,7 @@ interface DefaultOptions {
4042
3853
  screenshare?: ScreenshareQualityConstraints;
4043
3854
  };
4044
3855
  isNonPreferredDevice?: (device: MediaDeviceInfo) => boolean;
3856
+ plugins?: ClientPluginConfig[];
4045
3857
  }
4046
3858
  interface RoomDetails {
4047
3859
  meetingTitle: string;
@@ -4855,7 +4667,6 @@ interface IceServerInformation {
4855
4667
  }
4856
4668
  interface CachedUserDetails {
4857
4669
  peerId?: string;
4858
- pluginInformation: PluginResponse[];
4859
4670
  userDetails: UserDetailsResponseV2;
4860
4671
  roomDetails: RoomDetails;
4861
4672
  iceServers: IceServerInformation[];
@@ -4876,7 +4687,6 @@ declare class API {
4876
4687
  protected authToken: string;
4877
4688
  protected organizationId: string;
4878
4689
  protected iceServers: IceServerInformation[];
4879
- protected pluginInformation: PluginResponse[];
4880
4690
  protected userDetails: UserDetailsResponseV2;
4881
4691
  protected roomDetails: RoomDetails;
4882
4692
  readonly peerId: string;
@@ -4980,4 +4790,4 @@ declare global {
4980
4790
  TransformStream?: any;
4981
4791
  }
4982
4792
  }
4983
- 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 };
4793
+ 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 };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cloudflare/realtimekit",
3
- "version": "1.5.1",
3
+ "version": "1.5.2-staging.2",
4
4
  "description": "A real-time video and audio SDK for building custom, collaborative communication experiences.",
5
5
  "main": "./dist/index.cjs.js",
6
6
  "module": "./dist/index.es.js",
@@ -86,8 +86,7 @@
86
86
  "worker-timers": "7.0.60"
87
87
  },
88
88
  "publishConfig": {
89
- "access": "public",
90
- "tag": "latest"
89
+ "tag": "staging"
91
90
  },
92
91
  "devDependencies": {
93
92
  "@types/events": "^3.0.0",