@stream-io/video-client 0.3.32 → 0.3.34

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 (47) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/dist/index.browser.es.js +1388 -1351
  3. package/dist/index.browser.es.js.map +1 -1
  4. package/dist/index.cjs.js +1382 -1345
  5. package/dist/index.cjs.js.map +1 -1
  6. package/dist/index.es.js +1388 -1351
  7. package/dist/index.es.js.map +1 -1
  8. package/dist/src/coordinator/connection/insights.d.ts +1 -0
  9. package/dist/src/devices/devices.d.ts +0 -9
  10. package/dist/src/store/rxUtils.d.ts +3 -1
  11. package/package.json +12 -14
  12. package/src/__tests__/server-side/call-types.test.ts +1 -1
  13. package/src/coordinator/connection/client.ts +1 -1
  14. package/src/devices/ScreenShareState.ts +1 -2
  15. package/src/devices/devices.ts +51 -42
  16. package/src/rtc/Publisher.ts +0 -1
  17. package/src/sorting/presets.ts +35 -19
  18. package/src/store/CallState.ts +25 -20
  19. package/src/store/rxUtils.ts +15 -7
  20. package/dist/src/__tests__/StreamVideoClient.test.d.ts +0 -1
  21. package/dist/src/__tests__/server-side/call-members.test.d.ts +0 -1
  22. package/dist/src/__tests__/server-side/call-types.test.d.ts +0 -1
  23. package/dist/src/__tests__/server-side/call.test.d.ts +0 -1
  24. package/dist/src/__tests__/server-side/create-token.test.d.ts +0 -1
  25. package/dist/src/__tests__/server-side/server-side-user.test.d.ts +0 -1
  26. package/dist/src/devices/__tests__/CameraManager.test.d.ts +0 -1
  27. package/dist/src/devices/__tests__/InputMediaDeviceManager.test.d.ts +0 -1
  28. package/dist/src/devices/__tests__/MicrophoneManager.test.d.ts +0 -1
  29. package/dist/src/devices/__tests__/ScreenShareManager.test.d.ts +0 -1
  30. package/dist/src/devices/__tests__/SpeakerManager.test.d.ts +0 -1
  31. package/dist/src/devices/__tests__/mocks.d.ts +0 -7
  32. package/dist/src/events/__tests__/call-permissions.test.d.ts +0 -1
  33. package/dist/src/events/__tests__/call.test.d.ts +0 -1
  34. package/dist/src/events/__tests__/mutes.test.d.ts +0 -1
  35. package/dist/src/events/__tests__/participant.test.d.ts +0 -1
  36. package/dist/src/helpers/__tests__/DynascaleManager.test.d.ts +0 -4
  37. package/dist/src/helpers/__tests__/hq-audio-sdp.d.ts +0 -1
  38. package/dist/src/helpers/__tests__/sdp-munging.test.d.ts +0 -1
  39. package/dist/src/rtc/__tests__/Publisher.test.d.ts +0 -1
  40. package/dist/src/rtc/__tests__/Subscriber.test.d.ts +0 -1
  41. package/dist/src/rtc/__tests__/mocks/webrtc.mocks.d.ts +0 -1
  42. package/dist/src/rtc/__tests__/videoLayers.test.d.ts +0 -1
  43. package/dist/src/sorting/__tests__/participant-data.d.ts +0 -2
  44. package/dist/src/sorting/__tests__/presets.test.d.ts +0 -1
  45. package/dist/src/sorting/__tests__/sorting.test.d.ts +0 -1
  46. package/dist/src/store/__tests__/CallState.test.d.ts +0 -1
  47. package/dist/version.d.ts +0 -1
@@ -1,3 +1,4 @@
1
+ /// <reference types="ws" />
1
2
  import { StableWSConnection } from './connection';
2
3
  export type InsightTypes = 'ws_fatal' | 'ws_success_after_failure' | 'http_hi_failed';
3
4
  export declare class InsightMetrics {
@@ -7,23 +7,14 @@ import { Observable } from 'rxjs';
7
7
  export declare const checkIfAudioOutputChangeSupported: () => boolean;
8
8
  /**
9
9
  * Prompts the user for a permission to use audio devices (if not already granted) and lists the available 'audioinput' devices, if devices are added/removed the list is updated.
10
- *
11
- * @angular It's recommended to use the [`DeviceManagerService`](./DeviceManagerService.md) for a higher level API, use this low-level method only if the `DeviceManagerService` doesn't suit your requirements.
12
- * @returns
13
10
  */
14
11
  export declare const getAudioDevices: () => Observable<MediaDeviceInfo[]>;
15
12
  /**
16
13
  * Prompts the user for a permission to use video devices (if not already granted) and lists the available 'videoinput' devices, if devices are added/removed the list is updated.
17
- *
18
- * @angular It's recommended to use the [`DeviceManagerService`](./DeviceManagerService.md) for a higher level API, use this low-level method only if the `DeviceManagerService` doesn't suit your requirements.
19
- * @returns
20
14
  */
21
15
  export declare const getVideoDevices: () => Observable<MediaDeviceInfo[]>;
22
16
  /**
23
17
  * Prompts the user for a permission to use audio devices (if not already granted) and lists the available 'audiooutput' devices, if devices are added/removed the list is updated. Selecting 'audiooutput' device only makes sense if [the browser has support for changing audio output on 'audio' elements](#checkifaudiooutputchangesupported)
24
- *
25
- * @angular It's recommended to use the [`DeviceManagerService`](./DeviceManagerService.md) for a higher level API, use this low-level method only if the `DeviceManagerService` doesn't suit your requirements.
26
- * @returns
27
18
  */
28
19
  export declare const getAudioOutputDevices: () => Observable<MediaDeviceInfo[]>;
29
20
  /**
@@ -1,8 +1,9 @@
1
1
  import { Observable, Subject } from 'rxjs';
2
+ type FunctionPatch<T> = (currentValue: T) => T;
2
3
  /**
3
4
  * A value or a function which takes the current value and returns a new value.
4
5
  */
5
- export type Patch<T> = T | ((currentValue: T) => T);
6
+ export type Patch<T> = T | FunctionPatch<T>;
6
7
  /**
7
8
  * Gets the current value of an observable, or undefined if the observable has
8
9
  * not emitted a value yet.
@@ -27,3 +28,4 @@ export declare const setCurrentValue: <T>(subject: Subject<T>, update: Patch<T>)
27
28
  * @param handler the handler to call when the observable emits a value.
28
29
  */
29
30
  export declare const createSubscription: <T>(observable: Observable<T>, handler: (value: T) => void) => () => void;
31
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stream-io/video-client",
3
- "version": "0.3.32",
3
+ "version": "0.3.34",
4
4
  "packageManager": "yarn@3.2.4",
5
5
  "main": "dist/index.cjs.js",
6
6
  "module": "dist/index.es.js",
@@ -9,16 +9,14 @@
9
9
  "types": "dist/index.d.ts",
10
10
  "license": "See license in LICENSE",
11
11
  "scripts": {
12
- "postinstall": "yarn copy-version",
13
12
  "clean": "rimraf dist",
14
- "start": "yarn copy-version && rollup -w -c",
15
- "build": "yarn clean && yarn copy-version && rollup -c",
13
+ "start": "rollup -w -c",
14
+ "build": "yarn clean && rollup -c",
16
15
  "test": "vitest",
17
16
  "clean:docs": "rimraf generated-docs",
18
17
  "test-ci": "vitest --coverage",
19
18
  "generate:open-api": "./generate-openapi.sh protocol",
20
- "generate:open-api:dev": "./generate-openapi.sh chat",
21
- "copy-version": "echo \"export const version = '$npm_package_version';\" > ./version.ts"
19
+ "generate:open-api:dev": "./generate-openapi.sh chat"
22
20
  },
23
21
  "files": [
24
22
  "dist",
@@ -33,7 +31,7 @@
33
31
  "@protobuf-ts/runtime": "^2.9.1",
34
32
  "@protobuf-ts/runtime-rpc": "^2.9.1",
35
33
  "@protobuf-ts/twirp-transport": "^2.9.1",
36
- "@types/ws": "^8.5.6",
34
+ "@types/ws": "^8.5.7",
37
35
  "axios": "^1.5.1",
38
36
  "base64-js": "^1.5.1",
39
37
  "isomorphic-ws": "^5.0.0",
@@ -46,19 +44,19 @@
46
44
  },
47
45
  "devDependencies": {
48
46
  "@openapitools/openapi-generator-cli": "^2.7.0",
49
- "@rollup/plugin-replace": "^5.0.2",
50
- "@rollup/plugin-typescript": "^11.1.2",
47
+ "@rollup/plugin-replace": "^5.0.4",
48
+ "@rollup/plugin-typescript": "^11.1.5",
51
49
  "@types/jsonwebtoken": "^9.0.3",
52
50
  "@types/sdp-transform": "^2.4.7",
53
51
  "@types/ua-parser-js": "^0.7.37",
54
52
  "@vitest/coverage-v8": "^0.34.4",
55
53
  "dotenv": "^16.3.1",
56
54
  "happy-dom": "^11.0.2",
57
- "prettier": "^2.8.4",
58
- "rimraf": "^5.0.1",
59
- "rollup": "^3.28.1",
60
- "typescript": "^4.9.5",
61
- "vite": "^4.4.9",
55
+ "prettier": "^2.8.8",
56
+ "rimraf": "^5.0.5",
57
+ "rollup": "^3.29.4",
58
+ "typescript": "^5.2.2",
59
+ "vite": "^4.4.11",
62
60
  "vitest": "^0.34.4",
63
61
  "vitest-mock-extended": "^1.2.1"
64
62
  }
@@ -92,7 +92,7 @@ describe('call types CRUD API', () => {
92
92
  });
93
93
  });
94
94
 
95
- it.skip('update', async () => {
95
+ it('update', async () => {
96
96
  const updateResponse = await client.updateCallType(callTypeName, {
97
97
  settings: {
98
98
  audio: { mic_default_on: false, default_device: 'earpiece' },
@@ -34,7 +34,6 @@ import {
34
34
  UserWithId,
35
35
  } from './types';
36
36
  import { InsightMetrics, postInsights } from './insights';
37
- import { version } from '../../../version';
38
37
  import { getLocationHint } from './location';
39
38
  import { CreateGuestRequest, CreateGuestResponse } from '../../gen/coordinator';
40
39
 
@@ -796,6 +795,7 @@ export class StreamClient {
796
795
  };
797
796
 
798
797
  getUserAgent = () => {
798
+ const version = process.env.PKG_VERSION || '0.0.0-development';
799
799
  return (
800
800
  this.userAgent ||
801
801
  `stream-video-javascript-client-${
@@ -1,6 +1,5 @@
1
- import { BehaviorSubject } from 'rxjs';
1
+ import { BehaviorSubject, distinctUntilChanged } from 'rxjs';
2
2
  import { InputMediaDeviceManagerState } from './InputMediaDeviceManagerState';
3
- import { distinctUntilChanged } from 'rxjs/operators';
4
3
  import { ScreenShareSettings } from '../types';
5
4
 
6
5
  export class ScreenShareState extends InputMediaDeviceManagerState<DisplayMediaStreamOptions> {
@@ -65,68 +65,77 @@ const videoDeviceConstraints = {
65
65
  },
66
66
  } satisfies MediaStreamConstraints;
67
67
 
68
- // Audio and video devices are requested in two separate requests: that way users will be presented with two separate prompts -> they can give access to just camera, or just microphone
69
- const deviceChange$ = new Observable((subscriber) => {
70
- const deviceChangeHandler = () => subscriber.next();
68
+ /**
69
+ * Creates a memoized observable instance
70
+ * that will be created only once and shared between all callers.
71
+ *
72
+ * @param create a function that creates an Observable.
73
+ */
74
+ const memoizedObservable = <T>(create: () => Observable<T>) => {
75
+ let memoized: Observable<T>;
76
+ return () => {
77
+ if (!memoized) memoized = create();
78
+ return memoized;
79
+ };
80
+ };
71
81
 
72
- navigator.mediaDevices.addEventListener?.(
73
- 'devicechange',
74
- deviceChangeHandler,
75
- );
82
+ const getDeviceChangeObserver = memoizedObservable(() => {
83
+ // Audio and video devices are requested in two separate requests.
84
+ // That way, users will be presented with two separate prompts
85
+ // -> they can give access to just camera, or just microphone
86
+ return new Observable((subscriber) => {
87
+ // 'addEventListener' is not available in React Native
88
+ if (!navigator.mediaDevices.addEventListener) return;
76
89
 
77
- return () =>
78
- navigator.mediaDevices.removeEventListener?.(
79
- 'devicechange',
80
- deviceChangeHandler,
81
- );
82
- }).pipe(
83
- debounceTime(500),
84
- concatMap(() => from(navigator.mediaDevices.enumerateDevices())),
85
- shareReplay(1),
86
- );
90
+ const notify = () => subscriber.next();
91
+ navigator.mediaDevices.addEventListener('devicechange', notify);
92
+ return () => {
93
+ navigator.mediaDevices.removeEventListener('devicechange', notify);
94
+ };
95
+ }).pipe(
96
+ debounceTime(500),
97
+ concatMap(() => from(navigator.mediaDevices.enumerateDevices())),
98
+ shareReplay(1),
99
+ );
100
+ });
87
101
 
88
- const audioDevices$ = merge(
89
- getDevices(audioDeviceConstraints),
90
- deviceChange$,
91
- ).pipe(shareReplay(1));
102
+ const getAudioDevicesObserver = memoizedObservable(() => {
103
+ return merge(
104
+ getDevices(audioDeviceConstraints),
105
+ getDeviceChangeObserver(),
106
+ ).pipe(shareReplay(1));
107
+ });
92
108
 
93
- const videoDevices$ = merge(
94
- getDevices(videoDeviceConstraints),
95
- deviceChange$,
96
- ).pipe(shareReplay(1));
109
+ const getVideoDevicesObserver = memoizedObservable(() => {
110
+ return merge(
111
+ getDevices(videoDeviceConstraints),
112
+ getDeviceChangeObserver(),
113
+ ).pipe(shareReplay(1));
114
+ });
97
115
 
98
116
  /**
99
117
  * Prompts the user for a permission to use audio devices (if not already granted) and lists the available 'audioinput' devices, if devices are added/removed the list is updated.
100
- *
101
- * @angular It's recommended to use the [`DeviceManagerService`](./DeviceManagerService.md) for a higher level API, use this low-level method only if the `DeviceManagerService` doesn't suit your requirements.
102
- * @returns
103
118
  */
104
- export const getAudioDevices = () =>
105
- audioDevices$.pipe(
119
+ export const getAudioDevices = () => {
120
+ return getAudioDevicesObserver().pipe(
106
121
  map((values) => values.filter((d) => d.kind === 'audioinput')),
107
122
  );
123
+ };
108
124
 
109
125
  /**
110
126
  * Prompts the user for a permission to use video devices (if not already granted) and lists the available 'videoinput' devices, if devices are added/removed the list is updated.
111
- *
112
- * @angular It's recommended to use the [`DeviceManagerService`](./DeviceManagerService.md) for a higher level API, use this low-level method only if the `DeviceManagerService` doesn't suit your requirements.
113
- * @returns
114
127
  */
115
- export const getVideoDevices = () =>
116
- videoDevices$.pipe(
117
- map((values) =>
118
- values.filter((d) => d.kind === 'videoinput' && d.deviceId.length),
119
- ),
128
+ export const getVideoDevices = () => {
129
+ return getVideoDevicesObserver().pipe(
130
+ map((values) => values.filter((d) => d.kind === 'videoinput')),
120
131
  );
132
+ };
121
133
 
122
134
  /**
123
135
  * Prompts the user for a permission to use audio devices (if not already granted) and lists the available 'audiooutput' devices, if devices are added/removed the list is updated. Selecting 'audiooutput' device only makes sense if [the browser has support for changing audio output on 'audio' elements](#checkifaudiooutputchangesupported)
124
- *
125
- * @angular It's recommended to use the [`DeviceManagerService`](./DeviceManagerService.md) for a higher level API, use this low-level method only if the `DeviceManagerService` doesn't suit your requirements.
126
- * @returns
127
136
  */
128
137
  export const getAudioOutputDevices = () => {
129
- return audioDevices$.pipe(
138
+ return getAudioDevicesObserver().pipe(
130
139
  map((values) => values.filter((d) => d.kind === 'audiooutput')),
131
140
  );
132
141
  };
@@ -707,7 +707,6 @@ export class Publisher {
707
707
  ].includes(trackType);
708
708
 
709
709
  const trackSettings = track.getSettings();
710
- // @ts-expect-error - `channelCount` is not defined on `MediaTrackSettings`
711
710
  const isStereo = isAudioTrack && trackSettings.channelCount === 2;
712
711
 
713
712
  return {
@@ -39,11 +39,15 @@ const ifInvisibleOrUnknownBy = conditional(
39
39
  export const defaultSortPreset = combineComparators(
40
40
  pinned,
41
41
  screenSharing,
42
- ifInvisibleBy(dominantSpeaker),
43
- ifInvisibleBy(speaking),
44
- ifInvisibleBy(reactionType('raised-hand')),
45
- ifInvisibleBy(publishingVideo),
46
- ifInvisibleBy(publishingAudio),
42
+ ifInvisibleBy(
43
+ combineComparators(
44
+ dominantSpeaker,
45
+ speaking,
46
+ reactionType('raised-hand'),
47
+ publishingVideo,
48
+ publishingAudio,
49
+ ),
50
+ ),
47
51
  // ifInvisibleBy(name),
48
52
  );
49
53
 
@@ -54,10 +58,14 @@ export const speakerLayoutSortPreset = combineComparators(
54
58
  pinned,
55
59
  screenSharing,
56
60
  dominantSpeaker,
57
- ifInvisibleBy(speaking),
58
- ifInvisibleBy(reactionType('raised-hand')),
59
- ifInvisibleBy(publishingVideo),
60
- ifInvisibleBy(publishingAudio),
61
+ ifInvisibleBy(
62
+ combineComparators(
63
+ speaking,
64
+ reactionType('raised-hand'),
65
+ publishingVideo,
66
+ publishingAudio,
67
+ ),
68
+ ),
61
69
  // ifInvisibleBy(name),
62
70
  );
63
71
 
@@ -67,11 +75,15 @@ export const speakerLayoutSortPreset = combineComparators(
67
75
  */
68
76
  export const paginatedLayoutSortPreset = combineComparators(
69
77
  pinned,
70
- ifInvisibleOrUnknownBy(dominantSpeaker),
71
- ifInvisibleOrUnknownBy(speaking),
72
- ifInvisibleOrUnknownBy(reactionType('raised-hand')),
73
- ifInvisibleOrUnknownBy(publishingVideo),
74
- ifInvisibleOrUnknownBy(publishingAudio),
78
+ ifInvisibleOrUnknownBy(
79
+ combineComparators(
80
+ dominantSpeaker,
81
+ speaking,
82
+ reactionType('raised-hand'),
83
+ publishingVideo,
84
+ publishingAudio,
85
+ ),
86
+ ),
75
87
  // ifInvisibleOrUnknownBy(name),
76
88
  );
77
89
 
@@ -79,11 +91,15 @@ export const paginatedLayoutSortPreset = combineComparators(
79
91
  * The sorting preset for livestreams and audio rooms.
80
92
  */
81
93
  export const livestreamOrAudioRoomSortPreset = combineComparators(
82
- ifInvisibleBy(dominantSpeaker),
83
- ifInvisibleBy(speaking),
84
- ifInvisibleBy(reactionType('raised-hand')),
85
- ifInvisibleBy(publishingVideo),
86
- ifInvisibleBy(publishingAudio),
94
+ ifInvisibleBy(
95
+ combineComparators(
96
+ dominantSpeaker,
97
+ speaking,
98
+ reactionType('raised-hand'),
99
+ publishingVideo,
100
+ publishingAudio,
101
+ ),
102
+ ),
87
103
  role('admin', 'host', 'speaker'),
88
104
  // name,
89
105
  );
@@ -1,5 +1,10 @@
1
- import { BehaviorSubject, Observable } from 'rxjs';
2
- import { distinctUntilChanged, map, shareReplay } from 'rxjs/operators';
1
+ import {
2
+ BehaviorSubject,
3
+ distinctUntilChanged,
4
+ map,
5
+ Observable,
6
+ shareReplay,
7
+ } from 'rxjs';
3
8
  import type { Patch } from './rxUtils';
4
9
  import * as RxUtils from './rxUtils';
5
10
  import {
@@ -406,38 +411,38 @@ export class CallState {
406
411
 
407
412
  // events that update call state:
408
413
  'call.accepted': (e) => this.updateFromCallResponse(e.call),
414
+ 'call.blocked_user': this.blockUser,
409
415
  'call.created': (e) => this.updateFromCallResponse(e.call),
410
- 'call.notification': (e) => {
416
+ 'call.ended': (e) => {
411
417
  this.updateFromCallResponse(e.call);
412
- this.setMembers(e.members);
418
+ this.setCurrentValue(this.endedBySubject, e.user);
413
419
  },
414
- 'call.rejected': (e) => this.updateFromCallResponse(e.call),
415
- 'call.ring': (e) => this.updateFromCallResponse(e.call),
420
+ 'call.hls_broadcasting_started': this.updateFromHLSBroadcastStarted,
421
+ 'call.hls_broadcasting_stopped': this.updateFromHLSBroadcastStopped,
416
422
  'call.live_started': (e) => this.updateFromCallResponse(e.call),
417
- 'call.updated': (e) => this.updateFromCallResponse(e.call),
418
- 'call.session_started': (e) => this.updateFromCallResponse(e.call),
419
- 'call.session_ended': (e) => this.updateFromCallResponse(e.call),
420
- 'call.ended': (e) => {
423
+ 'call.member_added': this.updateFromMemberAdded,
424
+ 'call.member_removed': this.updateFromMemberRemoved,
425
+ 'call.member_updated_permission': this.updateMembers,
426
+ 'call.member_updated': this.updateMembers,
427
+ 'call.notification': (e) => {
421
428
  this.updateFromCallResponse(e.call);
422
- this.setCurrentValue(this.endedBySubject, e.user);
429
+ this.setMembers(e.members);
423
430
  },
431
+ 'call.permissions_updated': this.updateOwnCapabilities,
432
+ 'call.reaction_new': this.updateParticipantReaction,
424
433
  'call.recording_started': () =>
425
434
  this.setCurrentValue(this.recordingSubject, true),
426
435
  'call.recording_stopped': () =>
427
436
  this.setCurrentValue(this.recordingSubject, false),
428
- 'call.hls_broadcasting_started': this.updateFromHLSBroadcastStarted,
429
- 'call.hls_broadcasting_stopped': this.updateFromHLSBroadcastStopped,
437
+ 'call.rejected': (e) => this.updateFromCallResponse(e.call),
438
+ 'call.ring': (e) => this.updateFromCallResponse(e.call),
439
+ 'call.session_ended': (e) => this.updateFromCallResponse(e.call),
430
440
  'call.session_participant_joined':
431
441
  this.updateFromSessionParticipantJoined,
432
442
  'call.session_participant_left': this.updateFromSessionParticipantLeft,
433
- 'call.blocked_user': this.blockUser,
443
+ 'call.session_started': (e) => this.updateFromCallResponse(e.call),
434
444
  'call.unblocked_user': this.unblockUser,
435
- 'call.permissions_updated': this.updateOwnCapabilities,
436
- 'call.member_added': this.updateFromMemberAdded,
437
- 'call.member_removed': this.updateFromMemberRemoved,
438
- 'call.member_updated': this.updateMembers,
439
- 'call.member_updated_permission': this.updateMembers,
440
- 'call.reaction_new': this.updateParticipantReaction,
445
+ 'call.updated': (e) => this.updateFromCallResponse(e.call),
441
446
  };
442
447
  }
443
448
 
@@ -1,9 +1,19 @@
1
- import { Observable, Subject, combineLatest } from 'rxjs';
1
+ import { combineLatest, Observable, Subject } from 'rxjs';
2
+
3
+ type FunctionPatch<T> = (currentValue: T) => T;
2
4
 
3
5
  /**
4
6
  * A value or a function which takes the current value and returns a new value.
5
7
  */
6
- export type Patch<T> = T | ((currentValue: T) => T);
8
+ export type Patch<T> = T | FunctionPatch<T>;
9
+
10
+ /**
11
+ * Checks if the provided update is a function patch.
12
+ *
13
+ * @param update the value to check.
14
+ */
15
+ const isFunctionPatch = <T>(update: Patch<T>): update is FunctionPatch<T> =>
16
+ typeof update === 'function';
7
17
 
8
18
  /**
9
19
  * Gets the current value of an observable, or undefined if the observable has
@@ -39,11 +49,9 @@ export const getCurrentValue = <T>(observable$: Observable<T>) => {
39
49
  * @return the updated value.
40
50
  */
41
51
  export const setCurrentValue = <T>(subject: Subject<T>, update: Patch<T>) => {
42
- const next =
43
- // TypeScript needs more context to infer the type of update
44
- typeof update === 'function' && update instanceof Function
45
- ? update(getCurrentValue(subject))
46
- : update;
52
+ const next = isFunctionPatch(update)
53
+ ? update(getCurrentValue(subject))
54
+ : update;
47
55
 
48
56
  subject.next(next);
49
57
  return next;
@@ -1 +0,0 @@
1
- import 'dotenv/config';
@@ -1 +0,0 @@
1
- import 'dotenv/config';
@@ -1 +0,0 @@
1
- import 'dotenv/config';
@@ -1 +0,0 @@
1
- import 'dotenv/config';
@@ -1 +0,0 @@
1
- import 'dotenv/config';
@@ -1 +0,0 @@
1
- import 'dotenv/config';
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1,7 +0,0 @@
1
- import { Call } from '../../Call';
2
- export declare const mockVideoDevices: MediaDeviceInfo[];
3
- export declare const mockAudioDevices: MediaDeviceInfo[];
4
- export declare const mockCall: () => Partial<Call>;
5
- export declare const mockAudioStream: () => MediaStream;
6
- export declare const mockVideoStream: () => MediaStream;
7
- export declare const mockScreenShareStream: (includeAudio?: boolean) => MediaStream;
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1,4 +0,0 @@
1
- /**
2
- * @vitest-environment happy-dom
3
- */
4
- import '../../rtc/__tests__/mocks/webrtc.mocks';
@@ -1 +0,0 @@
1
- export declare const initialSdp: string;
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- import './mocks/webrtc.mocks';
@@ -1 +0,0 @@
1
- import './mocks/webrtc.mocks';
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- import './mocks/webrtc.mocks';
@@ -1,2 +0,0 @@
1
- import { StreamVideoParticipant } from '../../types';
2
- export declare const participants: () => StreamVideoParticipant[];
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
package/dist/version.d.ts DELETED
@@ -1 +0,0 @@
1
- export declare const version = "0.3.32";