@stream-io/video-client 0.6.9 → 0.7.0

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 (32) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/dist/index.browser.es.js +13 -170
  3. package/dist/index.browser.es.js.map +1 -1
  4. package/dist/index.cjs.js +12 -177
  5. package/dist/index.cjs.js.map +1 -1
  6. package/dist/index.d.ts +0 -1
  7. package/dist/index.es.js +13 -175
  8. package/dist/index.es.js.map +1 -1
  9. package/dist/src/Call.d.ts +1 -7
  10. package/dist/src/coordinator/connection/client.d.ts +0 -11
  11. package/dist/src/coordinator/connection/signing.d.ts +1 -24
  12. package/dist/src/coordinator/connection/token_manager.d.ts +2 -3
  13. package/dist/src/coordinator/connection/types.d.ts +4 -4
  14. package/dist/src/gen/coordinator/index.d.ts +323 -1184
  15. package/dist/src/store/CallState.d.ts +2 -2
  16. package/index.ts +0 -1
  17. package/package.json +2 -3
  18. package/src/Call.ts +0 -19
  19. package/src/__tests__/StreamVideoClient.test.ts +8 -3
  20. package/src/coordinator/connection/client.ts +1 -40
  21. package/src/coordinator/connection/signing.ts +10 -89
  22. package/src/coordinator/connection/token_manager.ts +3 -17
  23. package/src/coordinator/connection/types.ts +4 -4
  24. package/src/gen/coordinator/index.ts +299 -1155
  25. package/src/store/CallState.ts +5 -4
  26. package/dist/src/StreamVideoServerClient.d.ts +0 -33
  27. package/src/StreamVideoServerClient.ts +0 -106
  28. package/src/__tests__/server-side/call-members.test.ts +0 -93
  29. package/src/__tests__/server-side/call-types.test.ts +0 -127
  30. package/src/__tests__/server-side/call.test.ts +0 -158
  31. package/src/__tests__/server-side/create-token.test.ts +0 -44
  32. package/src/__tests__/server-side/server-side-user.test.ts +0 -28
package/CHANGELOG.md CHANGED
@@ -2,6 +2,24 @@
2
2
 
3
3
  This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
4
4
 
5
+ ## [0.7.0](https://github.com/GetStream/stream-video-js/compare/@stream-io/video-client-0.6.10...@stream-io/video-client-0.7.0) (2024-04-09)
6
+
7
+
8
+ ### ⚠ BREAKING CHANGES
9
+
10
+ * remove server-side capabilities from JS client (#1282)
11
+
12
+ ### Features
13
+
14
+ * remove server-side capabilities from JS client ([#1282](https://github.com/GetStream/stream-video-js/issues/1282)) ([362b6b5](https://github.com/GetStream/stream-video-js/commit/362b6b501e6aa1864eb8486e3129a1705a4d41fb))
15
+
16
+ ### [0.6.10](https://github.com/GetStream/stream-video-js/compare/@stream-io/video-client-0.6.9...@stream-io/video-client-0.6.10) (2024-04-05)
17
+
18
+
19
+ ### Features
20
+
21
+ * revert add submit feedback method to Call ([#1307](https://github.com/GetStream/stream-video-js/issues/1307)) ([#1308](https://github.com/GetStream/stream-video-js/issues/1308)) ([df9a74d](https://github.com/GetStream/stream-video-js/commit/df9a74dddf0287812b723d134d92941ac939bb9f))
22
+
5
23
  ### [0.6.9](https://github.com/GetStream/stream-video-js/compare/@stream-io/video-client-0.6.8...@stream-io/video-client-0.6.9) (2024-04-05)
6
24
 
7
25
 
@@ -33,26 +33,6 @@ const CreateDeviceRequestPushProviderEnum = {
33
33
  HUAWEI: 'huawei',
34
34
  XIAOMI: 'xiaomi',
35
35
  };
36
- /**
37
- * @export
38
- */
39
- const LayoutSettingsNameEnum = {
40
- SPOTLIGHT: 'spotlight',
41
- GRID: 'grid',
42
- SINGLE_PARTICIPANT: 'single-participant',
43
- MOBILE: 'mobile',
44
- CUSTOM: 'custom',
45
- };
46
- /**
47
- * @export
48
- */
49
- const LayoutSettingsRequestNameEnum = {
50
- SPOTLIGHT: 'spotlight',
51
- GRID: 'grid',
52
- SINGLE_PARTICIPANT: 'single-participant',
53
- MOBILE: 'mobile',
54
- CUSTOM: 'custom',
55
- };
56
36
  /**
57
37
  * All possibility of string to use
58
38
  * @export
@@ -7106,6 +7086,7 @@ class CallState {
7106
7086
  'call.session_started': (e) => this.updateFromCallResponse(e.call),
7107
7087
  'call.unblocked_user': this.unblockUser,
7108
7088
  'call.updated': (e) => this.updateFromCallResponse(e.call),
7089
+ 'call.deleted': undefined,
7109
7090
  };
7110
7091
  }
7111
7092
  /**
@@ -12609,19 +12590,6 @@ class Call {
12609
12590
  const endpoint = `${this.streamClientBasePath}/stats/${callSessionID}`;
12610
12591
  return this.streamClient.get(endpoint);
12611
12592
  };
12612
- /**
12613
- * Submit feedback on call experience
12614
- *
12615
- * @returns
12616
- */
12617
- this.submitFeedback = async (feedback) => {
12618
- const callSessionId = this.state.session?.id;
12619
- if (!callSessionId) {
12620
- return;
12621
- }
12622
- const endpoint = `${this.streamClientBasePath}/feedback/${callSessionId}`;
12623
- return this.streamClient.post(endpoint, feedback);
12624
- };
12625
12593
  /**
12626
12594
  * Sends a custom event to all call participants.
12627
12595
  *
@@ -13577,8 +13545,6 @@ class StableWSConnection {
13577
13545
  }
13578
13546
  }
13579
13547
 
13580
- var jwt = null;
13581
-
13582
13548
  function isString(arrayOrString) {
13583
13549
  return typeof arrayOrString === 'string';
13584
13550
  }
@@ -13630,47 +13596,6 @@ const decodeBase64 = (s) => {
13630
13596
  return r;
13631
13597
  };
13632
13598
 
13633
- /**
13634
- * Creates the JWT token that can be used for a UserSession
13635
- * @method JWTUserToken
13636
- * @memberof signing
13637
- * @private
13638
- * @param {Secret} apiSecret - API Secret key
13639
- * @param {string} userId - The user_id key in the JWT payload
13640
- * @param {UR} [extraData] - Extra that should be part of the JWT token
13641
- * @param {SignOptions} [jwtOptions] - Options that can be past to jwt.sign
13642
- * @return {string} JWT Token
13643
- */
13644
- function JWTUserToken(apiSecret, userId, extraData = {}, jwtOptions = {}) {
13645
- if (typeof userId !== 'string') {
13646
- throw new TypeError('userId should be a string');
13647
- }
13648
- ({
13649
- user_id: userId,
13650
- ...extraData,
13651
- });
13652
- // make sure we return a clear error when jwt is shimmed (ie. browser build)
13653
- {
13654
- throw Error(`Unable to find jwt crypto, if you are getting this error is probably because you are trying to generate tokens on browser or React Native (or other environment where crypto functions are not available). Please Note: token should only be generated server-side.`);
13655
- }
13656
- }
13657
- function JWTServerToken(apiSecret, jwtOptions = {}) {
13658
- const payload = {
13659
- server: true,
13660
- };
13661
- const opts = Object.assign({ algorithm: 'HS256', noTimestamp: true }, jwtOptions);
13662
- return jwt.sign(payload, apiSecret, opts);
13663
- }
13664
- function UserFromToken(token) {
13665
- const fragments = token.split('.');
13666
- if (fragments.length !== 3) {
13667
- return '';
13668
- }
13669
- const b64Payload = fragments[1];
13670
- const payload = decodeBase64(b64Payload);
13671
- const data = JSON.parse(payload);
13672
- return data.user_id;
13673
- }
13674
13599
  /**
13675
13600
  *
13676
13601
  * @param {string} userId the id of the user
@@ -13683,6 +13608,16 @@ function DevToken(userId) {
13683
13608
  'devtoken', // hardcoded signature
13684
13609
  ].join('.');
13685
13610
  }
13611
+ function UserFromToken(token) {
13612
+ const fragments = token.split('.');
13613
+ if (fragments.length !== 3) {
13614
+ return '';
13615
+ }
13616
+ const b64Payload = fragments[1];
13617
+ const payload = decodeBase64(b64Payload);
13618
+ const data = JSON.parse(payload);
13619
+ return data.user_id;
13620
+ }
13686
13621
 
13687
13622
  /**
13688
13623
  * TokenManager
@@ -13715,10 +13650,6 @@ class TokenManager {
13715
13650
  this.token = tokenOrProvider;
13716
13651
  this.type = 'static';
13717
13652
  }
13718
- if (!tokenOrProvider && this.user && this.secret) {
13719
- this.token = JWTUserToken(this.secret, user.id, {}, {});
13720
- this.type = 'static';
13721
- }
13722
13653
  await this.loadToken();
13723
13654
  };
13724
13655
  /**
@@ -13788,9 +13719,6 @@ class TokenManager {
13788
13719
  if (this.user && !this.token) {
13789
13720
  return this.token;
13790
13721
  }
13791
- if (this.secret) {
13792
- return JWTServerToken(this.secret);
13793
- }
13794
13722
  throw new Error(`Both secret and user tokens are not set. Either client.connectUser wasn't called or client.disconnect was called`);
13795
13723
  };
13796
13724
  this.isStatic = () => this.type === 'static';
@@ -13799,9 +13727,6 @@ class TokenManager {
13799
13727
  this.secret = secret;
13800
13728
  }
13801
13729
  this.type = 'static';
13802
- if (this.secret) {
13803
- this.token = JWTServerToken(this.secret);
13804
- }
13805
13730
  }
13806
13731
  }
13807
13732
 
@@ -14228,7 +14153,6 @@ class StreamClient {
14228
14153
  this.guestUserCreatePromise = this.doAxiosRequest('post', '/guest', {
14229
14154
  user: {
14230
14155
  ...user,
14231
- role: 'guest',
14232
14156
  },
14233
14157
  }, { publicEndpoint: true });
14234
14158
  const response = await this.guestUserCreatePromise;
@@ -14490,7 +14414,7 @@ class StreamClient {
14490
14414
  });
14491
14415
  };
14492
14416
  this.getUserAgent = () => {
14493
- const version = "0.6.9" ;
14417
+ const version = "0.7.0" ;
14494
14418
  return (this.userAgent ||
14495
14419
  `stream-video-javascript-client-${this.node ? 'node' : 'browser'}-${version}`);
14496
14420
  };
@@ -14562,32 +14486,6 @@ class StreamClient {
14562
14486
  this.createAbortControllerForNextRequest = () => {
14563
14487
  return (this.nextRequestAbortController = new AbortController());
14564
14488
  };
14565
- /**
14566
- * createToken - Creates a token to authenticate this user. This function is used server side.
14567
- * The resulting token should be passed to the client side when the users registers or logs in.
14568
- *
14569
- * @param {string} userID The UserWithId ID
14570
- * @param {number} [exp] The expiration time for the token expressed in the number of seconds since the epoch
14571
- * @param call_cids for anonymous tokens you have to provide the call cids the use can join
14572
- *
14573
- * @return {string} Returns a token
14574
- */
14575
- this.createToken = (userID, exp, iat, call_cids) => {
14576
- if (this.secret == null) {
14577
- throw Error(`tokens can only be created server-side using the API Secret`);
14578
- }
14579
- const extra = {};
14580
- if (exp) {
14581
- extra.exp = exp;
14582
- }
14583
- if (iat) {
14584
- extra.iat = iat;
14585
- }
14586
- if (call_cids) {
14587
- extra.call_cids = call_cids;
14588
- }
14589
- return JWTUserToken(this.secret, userID, extra, {});
14590
- };
14591
14489
  // set the key
14592
14490
  this.key = key;
14593
14491
  // set the secret
@@ -14992,60 +14890,5 @@ class StreamVideoClient {
14992
14890
  }
14993
14891
  }
14994
14892
 
14995
- /**
14996
- * @deprecated Please use the `@stream-io/node-sdk` package instead.
14997
- *
14998
- * @see https://getstream.io/video/docs/api/
14999
- */
15000
- class StreamVideoServerClient extends StreamVideoClient {
15001
- constructor(apiKey, options) {
15002
- super({ apiKey, options });
15003
- this.getCallTypes = () => {
15004
- return this.streamClient.get('/calltypes');
15005
- };
15006
- this.getCallType = (name) => {
15007
- return this.streamClient.get(`/calltypes/${name}`);
15008
- };
15009
- this.createCallType = (data) => {
15010
- return this.streamClient.post('/calltypes', data);
15011
- };
15012
- this.deleteCallType = (name) => {
15013
- return this.streamClient.delete(`/calltypes/${name}`);
15014
- };
15015
- this.updateCallType = (name, data) => {
15016
- return this.streamClient.put(`/calltypes/${name}`, data);
15017
- };
15018
- this.listExternalStorage = () => {
15019
- return this.streamClient.get('/external_storage');
15020
- };
15021
- this.createExternalStorage = (request) => {
15022
- return this.streamClient.post('/external_storage', request);
15023
- };
15024
- this.deleteExternalStorage = (name) => {
15025
- return this.streamClient.delete(`/external_storage/${name}`);
15026
- };
15027
- this.updateExternalStorage = (name, request) => {
15028
- return this.streamClient.put(`/external_storage/${name}`, request);
15029
- };
15030
- this.checkExternalStorage = (name) => {
15031
- return this.streamClient.get(`/external_storage/${name}/check`);
15032
- };
15033
- }
15034
- /**
15035
- * createToken - Creates a token to authenticate this user. This function is used server side.
15036
- * The resulting token should be passed to the client side when the users register or logs in.
15037
- *
15038
- * @param {string} userID The User ID
15039
- * @param {number} [exp] The expiration time for the token expressed in the number of seconds since the epoch
15040
- * @param {number} [iat] The timestamp when a token has been issued
15041
- * @param call_cids for anonymous tokens you have to provide the call cids the use can join
15042
- *
15043
- * @return {string} Returns a token
15044
- */
15045
- createToken(userID, exp, iat, call_cids) {
15046
- return this.streamClient.createToken(userID, exp, iat, call_cids);
15047
- }
15048
- }
15049
-
15050
- export { AudioSettingsDefaultDeviceEnum, AudioSettingsRequestDefaultDeviceEnum, browsers as Browsers, Call, CallState, CallType, CallTypes, CallingState, CameraManager, CameraManagerState, CreateDeviceRequestPushProviderEnum, DebounceType, DynascaleManager, ErrorFromResponse, InputMediaDeviceManager, InputMediaDeviceManagerState, LayoutSettingsNameEnum, LayoutSettingsRequestNameEnum, MicrophoneManager, MicrophoneManagerState, OwnCapability, RecordSettingsRequestModeEnum, RecordSettingsRequestQualityEnum, rxUtils as RxUtils, ScreenShareManager, ScreenShareState, events as SfuEvents, models as SfuModels, SpeakerManager, SpeakerState, StreamSfuClient, StreamVideoClient, StreamVideoReadOnlyStateStore, StreamVideoServerClient, StreamVideoWriteableStateStore, TranscriptionSettingsModeEnum, TranscriptionSettingsRequestModeEnum, VideoSettingsCameraFacingEnum, VideoSettingsRequestCameraFacingEnum, ViewportTracker, VisibilityState, checkIfAudioOutputChangeSupported, combineComparators, conditional, createSoundDetector, defaultSortPreset, descending, deviceIds$, disposeOfMediaStream, dominantSpeaker, getAudioDevices, getAudioOutputDevices, getAudioStream, getClientDetails, getDeviceInfo, getLogger, getOSInfo, getScreenShareStream, getSdkInfo, getVideoDevices, getVideoStream, getWebRTCInfo, livestreamOrAudioRoomSortPreset, logLevels, logToConsole, name, noopComparator, paginatedLayoutSortPreset, pinned, publishingAudio, publishingVideo, reactionType, role, screenSharing, setDeviceInfo, setLogLevel, setLogger, setOSInfo, setSdkInfo, setWebRTCInfo, speakerLayoutSortPreset, speaking };
14893
+ export { AudioSettingsDefaultDeviceEnum, AudioSettingsRequestDefaultDeviceEnum, browsers as Browsers, Call, CallState, CallType, CallTypes, CallingState, CameraManager, CameraManagerState, CreateDeviceRequestPushProviderEnum, DebounceType, DynascaleManager, ErrorFromResponse, InputMediaDeviceManager, InputMediaDeviceManagerState, MicrophoneManager, MicrophoneManagerState, OwnCapability, RecordSettingsRequestModeEnum, RecordSettingsRequestQualityEnum, rxUtils as RxUtils, ScreenShareManager, ScreenShareState, events as SfuEvents, models as SfuModels, SpeakerManager, SpeakerState, StreamSfuClient, StreamVideoClient, StreamVideoReadOnlyStateStore, StreamVideoWriteableStateStore, TranscriptionSettingsModeEnum, TranscriptionSettingsRequestModeEnum, VideoSettingsCameraFacingEnum, VideoSettingsRequestCameraFacingEnum, ViewportTracker, VisibilityState, checkIfAudioOutputChangeSupported, combineComparators, conditional, createSoundDetector, defaultSortPreset, descending, deviceIds$, disposeOfMediaStream, dominantSpeaker, getAudioDevices, getAudioOutputDevices, getAudioStream, getClientDetails, getDeviceInfo, getLogger, getOSInfo, getScreenShareStream, getSdkInfo, getVideoDevices, getVideoStream, getWebRTCInfo, livestreamOrAudioRoomSortPreset, logLevels, logToConsole, name, noopComparator, paginatedLayoutSortPreset, pinned, publishingAudio, publishingVideo, reactionType, role, screenSharing, setDeviceInfo, setLogLevel, setLogger, setOSInfo, setSdkInfo, setWebRTCInfo, speakerLayoutSortPreset, speaking };
15051
14894
  //# sourceMappingURL=index.browser.es.js.map