@100mslive/hms-video-store 0.2.82 → 0.2.83

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.
Files changed (92) hide show
  1. package/dist/common/ui-logger.d.ts +13 -13
  2. package/dist/core/IHMSActions.d.ts +266 -264
  3. package/dist/core/IHMSNotifications.d.ts +14 -15
  4. package/dist/core/IHMSStore.d.ts +54 -56
  5. package/dist/core/hmsSDKStore/HMSNotifications.d.ts +25 -25
  6. package/dist/core/hmsSDKStore/HMSPlaylist.d.ts +21 -21
  7. package/dist/core/hmsSDKStore/HMSReactiveStore.d.ts +79 -79
  8. package/dist/core/hmsSDKStore/HMSSDKActions.d.ts +157 -157
  9. package/dist/core/hmsSDKStore/adapter.d.ts +49 -49
  10. package/dist/core/hmsSDKStore/common/mapping.d.ts +7 -7
  11. package/dist/core/hmsSDKStore/internalTypes.d.ts +4 -4
  12. package/dist/core/hmsSDKStore/sdkTypes.d.ts +3 -2
  13. package/dist/core/hmsSDKStore/sdkUtils/ActionBatcher.d.ts +19 -19
  14. package/dist/core/hmsSDKStore/sdkUtils/sdkUtils.d.ts +2 -2
  15. package/dist/core/hmsSDKStore/sdkUtils/storeMergeUtils.d.ts +14 -14
  16. package/dist/core/index.d.ts +9 -7
  17. package/dist/core/schema/device-change.d.ts +13 -13
  18. package/dist/core/schema/error.d.ts +13 -13
  19. package/dist/core/schema/index.d.ts +11 -11
  20. package/dist/core/schema/message.d.ts +31 -31
  21. package/dist/core/schema/notification.d.ts +40 -40
  22. package/dist/core/schema/peer.d.ts +67 -67
  23. package/dist/core/schema/playlist.d.ts +127 -109
  24. package/dist/core/schema/requests.d.ts +31 -31
  25. package/dist/core/schema/role.d.ts +3 -3
  26. package/dist/core/schema/room.d.ts +23 -23
  27. package/dist/core/schema/schema.d.ts +29 -29
  28. package/dist/core/schema/settings.d.ts +5 -5
  29. package/dist/core/selectors/derivedSelectors.d.ts +29 -29
  30. package/dist/core/selectors/index.d.ts +5 -5
  31. package/dist/core/selectors/playlistselectors.d.ts +3 -3
  32. package/dist/core/selectors/selectorUtils.d.ts +18 -18
  33. package/dist/core/selectors/selectors.d.ts +185 -191
  34. package/dist/core/selectors/selectorsByID.d.ts +127 -128
  35. package/dist/core/selectors/selectorsByReference.d.ts +3 -3
  36. package/dist/hms-video-store.cjs.js +1 -0
  37. package/dist/hms-video-store.esm.js +1 -5376
  38. package/dist/index.d.ts +1 -1
  39. package/package.json +21 -84
  40. package/dist/hms-video-store.cjs.development.js +0 -5468
  41. package/dist/hms-video-store.cjs.development.js.map +0 -1
  42. package/dist/hms-video-store.cjs.production.min.js +0 -2
  43. package/dist/hms-video-store.cjs.production.min.js.map +0 -1
  44. package/dist/hms-video-store.esm.js.map +0 -1
  45. package/dist/index.js +0 -8
  46. package/dist/test/fakeStore.d.ts +0 -23
  47. package/dist/test/fixtures.d.ts +0 -3
  48. package/src/common/ui-logger.ts +0 -88
  49. package/src/core/IHMSActions.ts +0 -318
  50. package/src/core/IHMSNotifications.ts +0 -16
  51. package/src/core/IHMSStore.ts +0 -60
  52. package/src/core/hmsSDKStore/HMSNotifications.ts +0 -194
  53. package/src/core/hmsSDKStore/HMSPlaylist.ts +0 -78
  54. package/src/core/hmsSDKStore/HMSReactiveStore.ts +0 -271
  55. package/src/core/hmsSDKStore/HMSSDKActions.ts +0 -1156
  56. package/src/core/hmsSDKStore/adapter.ts +0 -244
  57. package/src/core/hmsSDKStore/common/mapping.ts +0 -32
  58. package/src/core/hmsSDKStore/internalTypes.ts +0 -8
  59. package/src/core/hmsSDKStore/sdkTypes.ts +0 -55
  60. package/src/core/hmsSDKStore/sdkUtils/ActionBatcher.ts +0 -63
  61. package/src/core/hmsSDKStore/sdkUtils/sdkUtils.ts +0 -5
  62. package/src/core/hmsSDKStore/sdkUtils/storeMergeUtils.ts +0 -98
  63. package/src/core/index.ts +0 -18
  64. package/src/core/schema/device-change.ts +0 -14
  65. package/src/core/schema/error.ts +0 -13
  66. package/src/core/schema/index.ts +0 -11
  67. package/src/core/schema/message.ts +0 -35
  68. package/src/core/schema/notification.ts +0 -41
  69. package/src/core/schema/peer.ts +0 -78
  70. package/src/core/schema/playlist.ts +0 -114
  71. package/src/core/schema/requests.ts +0 -36
  72. package/src/core/schema/role.ts +0 -5
  73. package/src/core/schema/room.ts +0 -26
  74. package/src/core/schema/schema.ts +0 -94
  75. package/src/core/schema/settings.ts +0 -5
  76. package/src/core/selectors/derivedSelectors.ts +0 -81
  77. package/src/core/selectors/index.ts +0 -5
  78. package/src/core/selectors/playlistselectors.ts +0 -67
  79. package/src/core/selectors/selectorUtils.ts +0 -63
  80. package/src/core/selectors/selectors.ts +0 -400
  81. package/src/core/selectors/selectorsByID.ts +0 -401
  82. package/src/core/selectors/selectorsByReference.ts +0 -45
  83. package/src/index.ts +0 -1
  84. package/src/test/fakeStore.ts +0 -272
  85. package/src/test/fixtures.ts +0 -22
  86. package/src/test/integration/.gitkeep +0 -0
  87. package/src/test/unit/HMSNotifications.test.ts +0 -123
  88. package/src/test/unit/reactiveStore.test.ts +0 -129
  89. package/src/test/unit/roleSelectors.test.ts +0 -85
  90. package/src/test/unit/selectors.test.ts +0 -316
  91. package/src/test/unit/selectorsByReference.test.ts +0 -27
  92. package/src/test/unit/storeMergeUtils.test.ts +0 -168
@@ -1,56 +1,54 @@
1
- import { HMSStore } from './schema';
2
- import { StateSelector, StoreApi, Subscribe } from 'zustand/vanilla';
3
- import { NamedSetState } from './hmsSDKStore/internalTypes';
4
- /**
5
- * HMS Reactive store can be used to subscribe to different parts of the store using selectors
6
- * and get a callback when the value changes.
7
- */
8
- export interface IHMSStore extends StoreApi<HMSStore> {
9
- /**
10
- * Get a part of store using a selector which is true at the current point of time.
11
- *
12
- * Usage: `store.getState(selectDominantSpeaker);`
13
- */
14
- getState: GetState<HMSStore>;
15
- /**
16
- * Subscribe to a part of store using selectors, whenever the subscribed part changes, the callback
17
- * is called with both the latest and previous value of the changed part.
18
- *
19
- * Usage:
20
- * ```
21
- * const onSpeakerUpdate = (speaker, prevSpeaker) => {
22
- * console.log("speaker changed from - ", prevSpeaker, ", to - ", speaker);
23
- * }
24
- * store.subscribe(onSpeakerUpdate, selectDominantSpeaker);
25
- * ```
26
- */
27
- subscribe: Subscribe<HMSStore>;
28
- /**
29
- * @private
30
- * @internal
31
- * @privateRemarks
32
- * wraps setState to take an additional action name parameter which can show up in redux devtools.
33
- */
34
- namedSetState: NamedSetState<HMSStore>;
35
- }
36
- interface GetState<T> {
37
- (): T;
38
- <StateSlice>(selector?: StateSelector<HMSStore, StateSlice>): StateSlice;
39
- }
40
- /**
41
- * HMS store can be used to:
42
- * - Get a part of the current store or state(getState)
43
- * - Subscribe to different parts of the store using selectors and execute a callback when the value changes.
44
- *
45
- * Both getState and subscribe use selectors to query a part the store.
46
- *
47
- *
48
- * Selectors are functions with HMSStore as an argument and returns a part of the store.
49
- *
50
- * **StoreSelector** is a type alias for this type of function.
51
- *
52
- * @category Core
53
- */
54
- export interface IHMSStoreReadOnly extends Omit<IHMSStore, 'setState' | 'namedSetState' | 'destroy'> {
55
- }
56
- export {};
1
+ import { HMSStore } from './schema';
2
+ import { StateSelector, StoreApi, Subscribe } from 'zustand/vanilla';
3
+ import { NamedSetState } from './hmsSDKStore/internalTypes';
4
+ /**
5
+ * HMS Reactive store can be used to subscribe to different parts of the store using selectors
6
+ * and get a callback when the value changes.
7
+ */
8
+ export interface IHMSStore extends StoreApi<HMSStore> {
9
+ /**
10
+ * Get a part of store using a selector which is true at the current point of time.
11
+ *
12
+ * Usage: `store.getState(selectDominantSpeaker);`
13
+ */
14
+ getState: GetState<HMSStore>;
15
+ /**
16
+ * Subscribe to a part of store using selectors, whenever the subscribed part changes, the callback
17
+ * is called with both the latest and previous value of the changed part.
18
+ *
19
+ * Usage:
20
+ * ```
21
+ * const onSpeakerUpdate = (speaker, prevSpeaker) => {
22
+ * console.log("speaker changed from - ", prevSpeaker, ", to - ", speaker);
23
+ * }
24
+ * store.subscribe(onSpeakerUpdate, selectDominantSpeaker);
25
+ * ```
26
+ */
27
+ subscribe: Subscribe<HMSStore>;
28
+ /**
29
+ * @private
30
+ * @internal
31
+ * @privateRemarks
32
+ * wraps setState to take an additional action name parameter which can show up in redux devtools.
33
+ */
34
+ namedSetState: NamedSetState<HMSStore>;
35
+ }
36
+ export interface GetState<T> {
37
+ (): T;
38
+ <StateSlice>(selector?: StateSelector<HMSStore, StateSlice>): StateSlice;
39
+ }
40
+ /**
41
+ * HMS store can be used to:
42
+ * - Get a part of the current store or state(getState)
43
+ * - Subscribe to different parts of the store using selectors and execute a callback when the value changes.
44
+ *
45
+ * Both getState and subscribe use selectors to query a part the store.
46
+ *
47
+ *
48
+ * Selectors are functions with HMSStore as an argument and returns a part of the store.
49
+ *
50
+ * **StoreSelector** is a type alias for this type of function.
51
+ *
52
+ * @category Core
53
+ */
54
+ export declare type IHMSStoreReadOnly = Omit<IHMSStore, 'setState' | 'namedSetState' | 'destroy'>;
@@ -1,25 +1,25 @@
1
- import { IHMSNotifications } from '../IHMSNotifications';
2
- import { IHMSStore } from '../IHMSStore';
3
- import * as sdkTypes from './sdkTypes';
4
- import { HMSNotification, HMSPeer, HMSException, HMSMessage, HMSTrackID, HMSChangeTrackStateRequest, HMSChangeMultiTrackStateRequest, HMSLeaveRoomRequest, HMSDeviceChangeEvent, HMSPlaylistItem } from '../schema';
5
- export declare class HMSNotifications implements IHMSNotifications {
6
- private id;
7
- private eventEmitter;
8
- private store;
9
- constructor(store: IHMSStore);
10
- onNotification: (cb: (notification: HMSNotification) => void) => (() => void);
11
- sendPlaylistTrackEnded<T>(item: HMSPlaylistItem<T>): void;
12
- sendDeviceChange(request: HMSDeviceChangeEvent): void;
13
- sendLeaveRoom(request: HMSLeaveRoomRequest): void;
14
- sendPeerList(peers: HMSPeer[]): void;
15
- sendPeerUpdate(type: sdkTypes.HMSPeerUpdate, peer: HMSPeer | null): void;
16
- sendTrackUpdate(type: sdkTypes.HMSTrackUpdate, trackID: HMSTrackID): void;
17
- sendMessageReceived(message: HMSMessage): void;
18
- sendError(error: HMSException): void;
19
- sendReconnecting(error: HMSException): void;
20
- sendReconnected(): void;
21
- sendChangeTrackStateRequest(request: HMSChangeTrackStateRequest): void;
22
- sendChangeMultiTrackStateRequest(request: HMSChangeMultiTrackStateRequest): void;
23
- private emitEvent;
24
- private createNotification;
25
- }
1
+ import { IHMSNotifications } from '../IHMSNotifications';
2
+ import { IHMSStore } from '../IHMSStore';
3
+ import * as sdkTypes from './sdkTypes';
4
+ import { HMSNotification, HMSPeer, HMSException, HMSMessage, HMSTrackID, HMSChangeTrackStateRequest, HMSChangeMultiTrackStateRequest, HMSLeaveRoomRequest, HMSDeviceChangeEvent, HMSPlaylistItem } from '../schema';
5
+ export declare class HMSNotifications implements IHMSNotifications {
6
+ private id;
7
+ private eventEmitter;
8
+ private store;
9
+ constructor(store: IHMSStore);
10
+ onNotification: (cb: (notification: HMSNotification) => void) => (() => void);
11
+ sendPlaylistTrackEnded<T>(item: HMSPlaylistItem<T>): void;
12
+ sendDeviceChange(request: HMSDeviceChangeEvent): void;
13
+ sendLeaveRoom(request: HMSLeaveRoomRequest): void;
14
+ sendPeerList(peers: HMSPeer[]): void;
15
+ sendPeerUpdate(type: sdkTypes.HMSPeerUpdate, peer: HMSPeer | null): void;
16
+ sendTrackUpdate(type: sdkTypes.HMSTrackUpdate, trackID: HMSTrackID): void;
17
+ sendMessageReceived(message: HMSMessage): void;
18
+ sendError(error: HMSException): void;
19
+ sendReconnecting(error: HMSException): void;
20
+ sendReconnected(): void;
21
+ sendChangeTrackStateRequest(request: HMSChangeTrackStateRequest): void;
22
+ sendChangeMultiTrackStateRequest(request: HMSChangeMultiTrackStateRequest): void;
23
+ private emitEvent;
24
+ private createNotification;
25
+ }
@@ -1,21 +1,21 @@
1
- import { HMSPlaylistItem, HMSPlaylistType, IHMSPlaylistActions } from '../schema';
2
- import { HMSPlaylistManager } from './sdkTypes';
3
- import { IHMSStore } from '../IHMSStore';
4
- export declare class HMSPlaylist implements IHMSPlaylistActions {
5
- private playlistManager;
6
- private syncPlaylistState;
7
- private store;
8
- private type;
9
- constructor(playlistManager: HMSPlaylistManager, type: HMSPlaylistType, syncPlaylistState: (action: string) => void, store: IHMSStore);
10
- play(id: string): Promise<void>;
11
- pause(): Promise<void>;
12
- playNext(): Promise<void>;
13
- playPrevious(): Promise<void>;
14
- seek(seekValue: number): void;
15
- seekTo(seekValue: number): void;
16
- setVolume(volume: number): void;
17
- setList<T>(list: HMSPlaylistItem<T>[]): void;
18
- stop(): Promise<void>;
19
- setIsAutoplayOn(autoplay: boolean): void;
20
- setPlaybackRate(playbackRate: number): void;
21
- }
1
+ import { HMSPlaylistItem, HMSPlaylistType, IHMSPlaylistActions } from '../schema';
2
+ import { HMSPlaylistManager } from './sdkTypes';
3
+ import { IHMSStore } from '../IHMSStore';
4
+ export declare class HMSPlaylist implements IHMSPlaylistActions {
5
+ private playlistManager;
6
+ private syncPlaylistState;
7
+ private store;
8
+ private type;
9
+ constructor(playlistManager: HMSPlaylistManager, type: HMSPlaylistType, syncPlaylistState: (action: string) => void, store: IHMSStore);
10
+ play(id: string): Promise<void>;
11
+ pause(): Promise<void>;
12
+ playNext(): Promise<void>;
13
+ playPrevious(): Promise<void>;
14
+ seek(seekValue: number): void;
15
+ seekTo(seekValue: number): void;
16
+ setVolume(volume: number): void;
17
+ setList<T>(list: HMSPlaylistItem<T>[]): void;
18
+ stop(): Promise<void>;
19
+ setIsAutoplayOn(autoplay: boolean): void;
20
+ setPlaybackRate(playbackRate: number): void;
21
+ }
@@ -1,79 +1,79 @@
1
- import { IHMSActions } from '../IHMSActions';
2
- import { IHMSStore, IHMSStoreReadOnly } from '../IHMSStore';
3
- import { HMSNotifications } from './HMSNotifications';
4
- import { IHMSNotifications } from '../IHMSNotifications';
5
- export declare class HMSReactiveStore {
6
- private readonly actions;
7
- private readonly store;
8
- private readonly notifications;
9
- private initialTriggerOnSubscribe;
10
- constructor(hmsStore?: IHMSStore, hmsActions?: IHMSActions, hmsNotifications?: HMSNotifications);
11
- /**
12
- * By default store.subscribe does not call the handler with the current state at time of subscription,
13
- * this behaviour can be modified by calling this function. What it means is that instead of calling the
14
- * handler only for changes which happen post subscription we'll also call it exactly once at the time
15
- * of subscription with the current state. This behaviour is similar to that of BehaviourSubject in rxjs.
16
- * This will be an irreversible change
17
- *
18
- * Note: you don't need this if you're using our react hooks, it takes care of this requirement.
19
- */
20
- triggerOnSubscribe(): void;
21
- /**
22
- * A reactive store which has a subscribe method you can use in combination with selectors
23
- * to subscribe to a subset of the store. The store serves as a single source of truth for
24
- * all data related to the corresponding HMS Room.
25
- */
26
- getStore(): IHMSStoreReadOnly;
27
- /**
28
- * Any action which may modify the store or may need to talk to the SDK will happen
29
- * through the IHMSActions instance returned by this
30
- */
31
- getHMSActions(): IHMSActions;
32
- /**
33
- * This return notification handler function to which you can pass your callback to
34
- * receive notifications like peer joined, peer left, etc. to show in your UI or use
35
- * for analytics
36
- */
37
- getNotifications(): IHMSNotifications;
38
- /**
39
- * @internal
40
- */
41
- static createNewHMSStore(): IHMSStore;
42
- /**
43
- * @internal
44
- */
45
- static makeStoreTriggerOnSubscribe(store: IHMSStore): void;
46
- /**
47
- * use shallow equality check by default for subscribe to optimize for array/object selectors.
48
- * by default zustand does only reference matching so something like, getPeers for eg. would trigger
49
- * the corresponding component even if peers didn't actually change, as selectPeers creates a new array everytime.
50
- * Although the array reference changes, the order of peers and peer objects don't themselves change in this case,
51
- * and a shallow check avoids that triggering.
52
- * @private
53
- */
54
- private static useShallowCheckInSubscribe;
55
- /**
56
- * @private
57
- * @privateRemarks
58
- * sets up redux devtools for the store, so redux extension can be used to visualize the store.
59
- * zustand's default devtool middleware only enhances the set function, we're here creating another nameSetState in
60
- * IHMStore which behaves like setState but takes an extra parameter for action name
61
- * https://github.com/zalmoxisus/redux-devtools-extension/blob/master/docs/API/Methods.md
62
- * modified version of zustand's devtools - https://github.com/pmndrs/zustand/blob/v3.5.7/src/middleware.ts#L46
63
- */
64
- private static setUpDevtools;
65
- /**
66
- * https://github.com/zalmoxisus/redux-devtools-extension/blob/master/docs/API/Arguments.md
67
- */
68
- private static devtoolsOptions;
69
- /**
70
- * redux devtools allows for time travel debugging where it sends an action to update the store, users can
71
- * also export and import state in the devtools, listen to the corresponding functions from devtools and take
72
- * required action.
73
- * @param devtools - reference to devtools extension object
74
- * @param api
75
- * @param savedSetState - setState saved before its modified to update devtools
76
- * @private
77
- */
78
- private static devtoolsSubscribe;
79
- }
1
+ import { IHMSActions } from '../IHMSActions';
2
+ import { IHMSStore, IHMSStoreReadOnly } from '../IHMSStore';
3
+ import { HMSNotifications } from './HMSNotifications';
4
+ import { IHMSNotifications } from '../IHMSNotifications';
5
+ export declare class HMSReactiveStore {
6
+ private readonly actions;
7
+ private readonly store;
8
+ private readonly notifications;
9
+ private initialTriggerOnSubscribe;
10
+ constructor(hmsStore?: IHMSStore, hmsActions?: IHMSActions, hmsNotifications?: HMSNotifications);
11
+ /**
12
+ * By default store.subscribe does not call the handler with the current state at time of subscription,
13
+ * this behaviour can be modified by calling this function. What it means is that instead of calling the
14
+ * handler only for changes which happen post subscription we'll also call it exactly once at the time
15
+ * of subscription with the current state. This behaviour is similar to that of BehaviourSubject in rxjs.
16
+ * This will be an irreversible change
17
+ *
18
+ * Note: you don't need this if you're using our react hooks, it takes care of this requirement.
19
+ */
20
+ triggerOnSubscribe(): void;
21
+ /**
22
+ * A reactive store which has a subscribe method you can use in combination with selectors
23
+ * to subscribe to a subset of the store. The store serves as a single source of truth for
24
+ * all data related to the corresponding HMS Room.
25
+ */
26
+ getStore(): IHMSStoreReadOnly;
27
+ /**
28
+ * Any action which may modify the store or may need to talk to the SDK will happen
29
+ * through the IHMSActions instance returned by this
30
+ */
31
+ getHMSActions(): IHMSActions;
32
+ /**
33
+ * This return notification handler function to which you can pass your callback to
34
+ * receive notifications like peer joined, peer left, etc. to show in your UI or use
35
+ * for analytics
36
+ */
37
+ getNotifications(): IHMSNotifications;
38
+ /**
39
+ * @internal
40
+ */
41
+ static createNewHMSStore(): IHMSStore;
42
+ /**
43
+ * @internal
44
+ */
45
+ static makeStoreTriggerOnSubscribe(store: IHMSStore): void;
46
+ /**
47
+ * use shallow equality check by default for subscribe to optimize for array/object selectors.
48
+ * by default zustand does only reference matching so something like, getPeers for eg. would trigger
49
+ * the corresponding component even if peers didn't actually change, as selectPeers creates a new array everytime.
50
+ * Although the array reference changes, the order of peers and peer objects don't themselves change in this case,
51
+ * and a shallow check avoids that triggering.
52
+ * @private
53
+ */
54
+ private static useShallowCheckInSubscribe;
55
+ /**
56
+ * @private
57
+ * @privateRemarks
58
+ * sets up redux devtools for the store, so redux extension can be used to visualize the store.
59
+ * zustand's default devtool middleware only enhances the set function, we're here creating another nameSetState in
60
+ * IHMStore which behaves like setState but takes an extra parameter for action name
61
+ * https://github.com/zalmoxisus/redux-devtools-extension/blob/master/docs/API/Methods.md
62
+ * modified version of zustand's devtools - https://github.com/pmndrs/zustand/blob/v3.5.7/src/middleware.ts#L46
63
+ */
64
+ private static setUpDevtools;
65
+ /**
66
+ * https://github.com/zalmoxisus/redux-devtools-extension/blob/master/docs/API/Arguments.md
67
+ */
68
+ private static devtoolsOptions;
69
+ /**
70
+ * redux devtools allows for time travel debugging where it sends an action to update the store, users can
71
+ * also export and import state in the devtools, listen to the corresponding functions from devtools and take
72
+ * required action.
73
+ * @param devtools - reference to devtools extension object
74
+ * @param api
75
+ * @param savedSetState - setState saved before its modified to update devtools
76
+ * @private
77
+ */
78
+ private static devtoolsSubscribe;
79
+ }