@stream-io/video-client 0.6.10 → 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.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,17 @@
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
+
5
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)
6
17
 
7
18
 
@@ -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
  /**
@@ -13564,8 +13545,6 @@ class StableWSConnection {
13564
13545
  }
13565
13546
  }
13566
13547
 
13567
- var jwt = null;
13568
-
13569
13548
  function isString(arrayOrString) {
13570
13549
  return typeof arrayOrString === 'string';
13571
13550
  }
@@ -13617,47 +13596,6 @@ const decodeBase64 = (s) => {
13617
13596
  return r;
13618
13597
  };
13619
13598
 
13620
- /**
13621
- * Creates the JWT token that can be used for a UserSession
13622
- * @method JWTUserToken
13623
- * @memberof signing
13624
- * @private
13625
- * @param {Secret} apiSecret - API Secret key
13626
- * @param {string} userId - The user_id key in the JWT payload
13627
- * @param {UR} [extraData] - Extra that should be part of the JWT token
13628
- * @param {SignOptions} [jwtOptions] - Options that can be past to jwt.sign
13629
- * @return {string} JWT Token
13630
- */
13631
- function JWTUserToken(apiSecret, userId, extraData = {}, jwtOptions = {}) {
13632
- if (typeof userId !== 'string') {
13633
- throw new TypeError('userId should be a string');
13634
- }
13635
- ({
13636
- user_id: userId,
13637
- ...extraData,
13638
- });
13639
- // make sure we return a clear error when jwt is shimmed (ie. browser build)
13640
- {
13641
- 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.`);
13642
- }
13643
- }
13644
- function JWTServerToken(apiSecret, jwtOptions = {}) {
13645
- const payload = {
13646
- server: true,
13647
- };
13648
- const opts = Object.assign({ algorithm: 'HS256', noTimestamp: true }, jwtOptions);
13649
- return jwt.sign(payload, apiSecret, opts);
13650
- }
13651
- function UserFromToken(token) {
13652
- const fragments = token.split('.');
13653
- if (fragments.length !== 3) {
13654
- return '';
13655
- }
13656
- const b64Payload = fragments[1];
13657
- const payload = decodeBase64(b64Payload);
13658
- const data = JSON.parse(payload);
13659
- return data.user_id;
13660
- }
13661
13599
  /**
13662
13600
  *
13663
13601
  * @param {string} userId the id of the user
@@ -13670,6 +13608,16 @@ function DevToken(userId) {
13670
13608
  'devtoken', // hardcoded signature
13671
13609
  ].join('.');
13672
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
+ }
13673
13621
 
13674
13622
  /**
13675
13623
  * TokenManager
@@ -13702,10 +13650,6 @@ class TokenManager {
13702
13650
  this.token = tokenOrProvider;
13703
13651
  this.type = 'static';
13704
13652
  }
13705
- if (!tokenOrProvider && this.user && this.secret) {
13706
- this.token = JWTUserToken(this.secret, user.id, {}, {});
13707
- this.type = 'static';
13708
- }
13709
13653
  await this.loadToken();
13710
13654
  };
13711
13655
  /**
@@ -13775,9 +13719,6 @@ class TokenManager {
13775
13719
  if (this.user && !this.token) {
13776
13720
  return this.token;
13777
13721
  }
13778
- if (this.secret) {
13779
- return JWTServerToken(this.secret);
13780
- }
13781
13722
  throw new Error(`Both secret and user tokens are not set. Either client.connectUser wasn't called or client.disconnect was called`);
13782
13723
  };
13783
13724
  this.isStatic = () => this.type === 'static';
@@ -13786,9 +13727,6 @@ class TokenManager {
13786
13727
  this.secret = secret;
13787
13728
  }
13788
13729
  this.type = 'static';
13789
- if (this.secret) {
13790
- this.token = JWTServerToken(this.secret);
13791
- }
13792
13730
  }
13793
13731
  }
13794
13732
 
@@ -14215,7 +14153,6 @@ class StreamClient {
14215
14153
  this.guestUserCreatePromise = this.doAxiosRequest('post', '/guest', {
14216
14154
  user: {
14217
14155
  ...user,
14218
- role: 'guest',
14219
14156
  },
14220
14157
  }, { publicEndpoint: true });
14221
14158
  const response = await this.guestUserCreatePromise;
@@ -14477,7 +14414,7 @@ class StreamClient {
14477
14414
  });
14478
14415
  };
14479
14416
  this.getUserAgent = () => {
14480
- const version = "0.6.10" ;
14417
+ const version = "0.7.0" ;
14481
14418
  return (this.userAgent ||
14482
14419
  `stream-video-javascript-client-${this.node ? 'node' : 'browser'}-${version}`);
14483
14420
  };
@@ -14549,32 +14486,6 @@ class StreamClient {
14549
14486
  this.createAbortControllerForNextRequest = () => {
14550
14487
  return (this.nextRequestAbortController = new AbortController());
14551
14488
  };
14552
- /**
14553
- * createToken - Creates a token to authenticate this user. This function is used server side.
14554
- * The resulting token should be passed to the client side when the users registers or logs in.
14555
- *
14556
- * @param {string} userID The UserWithId ID
14557
- * @param {number} [exp] The expiration time for the token expressed in the number of seconds since the epoch
14558
- * @param call_cids for anonymous tokens you have to provide the call cids the use can join
14559
- *
14560
- * @return {string} Returns a token
14561
- */
14562
- this.createToken = (userID, exp, iat, call_cids) => {
14563
- if (this.secret == null) {
14564
- throw Error(`tokens can only be created server-side using the API Secret`);
14565
- }
14566
- const extra = {};
14567
- if (exp) {
14568
- extra.exp = exp;
14569
- }
14570
- if (iat) {
14571
- extra.iat = iat;
14572
- }
14573
- if (call_cids) {
14574
- extra.call_cids = call_cids;
14575
- }
14576
- return JWTUserToken(this.secret, userID, extra, {});
14577
- };
14578
14489
  // set the key
14579
14490
  this.key = key;
14580
14491
  // set the secret
@@ -14979,60 +14890,5 @@ class StreamVideoClient {
14979
14890
  }
14980
14891
  }
14981
14892
 
14982
- /**
14983
- * @deprecated Please use the `@stream-io/node-sdk` package instead.
14984
- *
14985
- * @see https://getstream.io/video/docs/api/
14986
- */
14987
- class StreamVideoServerClient extends StreamVideoClient {
14988
- constructor(apiKey, options) {
14989
- super({ apiKey, options });
14990
- this.getCallTypes = () => {
14991
- return this.streamClient.get('/calltypes');
14992
- };
14993
- this.getCallType = (name) => {
14994
- return this.streamClient.get(`/calltypes/${name}`);
14995
- };
14996
- this.createCallType = (data) => {
14997
- return this.streamClient.post('/calltypes', data);
14998
- };
14999
- this.deleteCallType = (name) => {
15000
- return this.streamClient.delete(`/calltypes/${name}`);
15001
- };
15002
- this.updateCallType = (name, data) => {
15003
- return this.streamClient.put(`/calltypes/${name}`, data);
15004
- };
15005
- this.listExternalStorage = () => {
15006
- return this.streamClient.get('/external_storage');
15007
- };
15008
- this.createExternalStorage = (request) => {
15009
- return this.streamClient.post('/external_storage', request);
15010
- };
15011
- this.deleteExternalStorage = (name) => {
15012
- return this.streamClient.delete(`/external_storage/${name}`);
15013
- };
15014
- this.updateExternalStorage = (name, request) => {
15015
- return this.streamClient.put(`/external_storage/${name}`, request);
15016
- };
15017
- this.checkExternalStorage = (name) => {
15018
- return this.streamClient.get(`/external_storage/${name}/check`);
15019
- };
15020
- }
15021
- /**
15022
- * createToken - Creates a token to authenticate this user. This function is used server side.
15023
- * The resulting token should be passed to the client side when the users register or logs in.
15024
- *
15025
- * @param {string} userID The User ID
15026
- * @param {number} [exp] The expiration time for the token expressed in the number of seconds since the epoch
15027
- * @param {number} [iat] The timestamp when a token has been issued
15028
- * @param call_cids for anonymous tokens you have to provide the call cids the use can join
15029
- *
15030
- * @return {string} Returns a token
15031
- */
15032
- createToken(userID, exp, iat, call_cids) {
15033
- return this.streamClient.createToken(userID, exp, iat, call_cids);
15034
- }
15035
- }
15036
-
15037
- 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 };
15038
14894
  //# sourceMappingURL=index.browser.es.js.map