@stream-io/video-client 0.1.0 → 0.1.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.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,20 @@
2
2
 
3
3
  This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
4
4
 
5
+ ### [0.1.2](https://github.com/GetStream/stream-video-js/compare/client0.1.1...client0.1.2) (2023-07-19)
6
+
7
+
8
+ ### Features
9
+
10
+ * server-side client ([#815](https://github.com/GetStream/stream-video-js/issues/815)) ([c3bc445](https://github.com/GetStream/stream-video-js/commit/c3bc445c7db68965934c3e72f005ff7e949e9328))
11
+
12
+ ### [0.1.1](https://github.com/GetStream/stream-video-js/compare/client0.1.0...client0.1.1) (2023-07-18)
13
+
14
+
15
+ ### Features
16
+
17
+ * **sessions:** update to the new call.session event models ([#806](https://github.com/GetStream/stream-video-js/issues/806)) ([2966837](https://github.com/GetStream/stream-video-js/commit/296683789823a8dd12e99193f6baaf971824ae83))
18
+
5
19
  ## [0.1.0](https://github.com/GetStream/stream-video-js/compare/client0.0.51...client0.1.0) (2023-07-17)
6
20
 
7
21
 
@@ -8378,7 +8378,7 @@ const watchCallSessionParticipantJoined = (state) => {
8378
8378
  return function onCallParticipantJoined(event) {
8379
8379
  if (event.type !== 'call.session_participant_joined')
8380
8380
  return;
8381
- const { user, user_session_id } = event;
8381
+ const { participant } = event;
8382
8382
  state.setMetadata((metadata) => {
8383
8383
  if (!metadata || !metadata.session) {
8384
8384
  state.logger('warn', `Received call.session_participant_joined event but the metadata structure is invalid.`, event);
@@ -8386,16 +8386,8 @@ const watchCallSessionParticipantJoined = (state) => {
8386
8386
  }
8387
8387
  const { session } = metadata;
8388
8388
  const { participants, participants_count_by_role } = session;
8389
- return Object.assign(Object.assign({}, metadata), { session: Object.assign(Object.assign({}, session), { participants: [
8390
- ...participants,
8391
- {
8392
- // FIXME OL: ideally, this comes from the backend
8393
- joined_at: new Date().toISOString(),
8394
- user,
8395
- role: user.role,
8396
- user_session_id,
8397
- },
8398
- ], participants_count_by_role: Object.assign(Object.assign({}, participants_count_by_role), { [user.role]: (participants_count_by_role[user.role] || 0) + 1 }) }) });
8389
+ const { user } = participant;
8390
+ return Object.assign(Object.assign({}, metadata), { session: Object.assign(Object.assign({}, session), { participants: [...participants, participant], participants_count_by_role: Object.assign(Object.assign({}, participants_count_by_role), { [user.role]: (participants_count_by_role[user.role] || 0) + 1 }) }) });
8399
8391
  });
8400
8392
  };
8401
8393
  };
@@ -8408,7 +8400,7 @@ const watchCallSessionParticipantLeft = (state) => {
8408
8400
  return function onCallParticipantLeft(event) {
8409
8401
  if (event.type !== 'call.session_participant_left')
8410
8402
  return;
8411
- const { user, user_session_id } = event;
8403
+ const { user, user_session_id } = event.participant;
8412
8404
  state.setMetadata((metadata) => {
8413
8405
  if (!metadata || !metadata.session) {
8414
8406
  state.logger('warn', `Received call.session_participant_left event but the metadata structure is invalid.`, event);
@@ -11325,7 +11317,7 @@ class WSConnectionFallback {
11325
11317
  }
11326
11318
  }
11327
11319
 
11328
- const version = '0.1.0';
11320
+ const version = '0.1.2';
11329
11321
 
11330
11322
  const logger = getLogger(['location']);
11331
11323
  const HINT_URL = `https://hint.stream-io-video.com/`;
@@ -11916,10 +11908,12 @@ class StreamClient {
11916
11908
  keepAliveMsecs: 3000,
11917
11909
  });
11918
11910
  }
11919
- this.connectionIdPromise = new Promise((resolve, reject) => {
11920
- this.resolveConnectionId = resolve;
11921
- this.rejectConnectionId = reject;
11922
- });
11911
+ this.connectionIdPromise = this.secret
11912
+ ? undefined
11913
+ : new Promise((resolve, reject) => {
11914
+ this.resolveConnectionId = resolve;
11915
+ this.rejectConnectionId = reject;
11916
+ });
11923
11917
  this.setBaseURL(this.options.baseURL || 'https://video.stream-io-api.com/video');
11924
11918
  if (typeof process !== 'undefined' && process.env.STREAM_LOCAL_TEST_RUN) {
11925
11919
  this.setBaseURL('http://localhost:3030/video');
@@ -12052,22 +12046,6 @@ class StreamVideoClient {
12052
12046
  this.edges = () => __awaiter(this, void 0, void 0, function* () {
12053
12047
  return this.streamClient.get(`/edges`);
12054
12048
  });
12055
- // server-side only endpoints
12056
- this.createCallType = (data) => __awaiter(this, void 0, void 0, function* () {
12057
- return this.streamClient.post(`/calltypes`, data);
12058
- });
12059
- this.getCallType = (name) => __awaiter(this, void 0, void 0, function* () {
12060
- return this.streamClient.get(`/calltypes/${name}`);
12061
- });
12062
- this.updateCallType = (name, data) => __awaiter(this, void 0, void 0, function* () {
12063
- return this.streamClient.put(`/calltypes/${name}`, data);
12064
- });
12065
- this.deleteCallType = (name) => __awaiter(this, void 0, void 0, function* () {
12066
- return this.streamClient.delete(`/calltypes/${name}`);
12067
- });
12068
- this.listCallTypes = () => __awaiter(this, void 0, void 0, function* () {
12069
- return this.streamClient.get(`/calltypes`);
12070
- });
12071
12049
  /**
12072
12050
  * addDevice - Adds a push device for a user.
12073
12051
  *
@@ -12287,6 +12265,27 @@ class StreamVideoClient {
12287
12265
  return yield this.addDevice(id, push_provider, push_provider_name, userID, true);
12288
12266
  });
12289
12267
  }
12268
+ }
12269
+
12270
+ class StreamVideoServerClient extends StreamVideoClient {
12271
+ constructor(apiKey, options) {
12272
+ super({ apiKey, options });
12273
+ this.getCallTypes = () => {
12274
+ return this.streamClient.get('/calltypes');
12275
+ };
12276
+ this.getCallType = (name) => {
12277
+ return this.streamClient.get(`/calltypes/${name}`);
12278
+ };
12279
+ this.createCallType = (data) => {
12280
+ return this.streamClient.post('/calltypes', data);
12281
+ };
12282
+ this.deleteCallType = (name) => {
12283
+ return this.streamClient.delete(`/calltypes/${name}`);
12284
+ };
12285
+ this.updateCallType = (name, data) => {
12286
+ return this.streamClient.put(`/calltypes/${name}`, data);
12287
+ };
12288
+ }
12290
12289
  /**
12291
12290
  * createToken - Creates a token to authenticate this user. This function is used server side.
12292
12291
  * The resulting token should be passed to the client side when the users register or logs in.
@@ -12636,5 +12635,5 @@ var browsers = /*#__PURE__*/Object.freeze({
12636
12635
  isSafari: isSafari
12637
12636
  });
12638
12637
 
12639
- export { AudioSettingsDefaultDeviceEnum, AudioSettingsRequestDefaultDeviceEnum, browsers as Browsers, Call, CallState, CallType, CallTypes, CallingState, CreateDeviceRequestPushProviderEnum, DebounceType, ErrorFromResponse, OwnCapability, RecordSettingsModeEnum, RecordSettingsQualityEnum, RecordSettingsRequestModeEnum, RecordSettingsRequestQualityEnum, rxUtils as RxUtils, events as SfuEvents, models as SfuModels, StreamSfuClient, StreamVideoClient, StreamVideoReadOnlyStateStore, StreamVideoWriteableStateStore, TranscriptionSettingsModeEnum, TranscriptionSettingsRequestModeEnum, VideoSettingsCameraFacingEnum, VideoSettingsRequestCameraFacingEnum, ViewportTracker, VisibilityState, checkIfAudioOutputChangeSupported, combineComparators, conditional, createSoundDetector, defaultSortPreset, descending, disposeOfMediaStream, dominantSpeaker, getAudioDevices, getAudioOutputDevices, getAudioStream, getClientDetails, getDeviceInfo, getLogger, getOSInfo, getScreenShareStream, getSdkInfo, getVideoDevices, getVideoStream, isStreamVideoLocalParticipant, livestreamOrAudioRoomSortPreset, logLevels, logToConsole, name, noopComparator, pinned, publishingAudio, publishingVideo, reactionType, role, screenSharing, setDeviceInfo, setLogLevel, setLogger, setOSInfo, setSdkInfo, speakerLayoutSortPreset, speaking, watchForAddedDefaultAudioDevice, watchForAddedDefaultAudioOutputDevice, watchForAddedDefaultVideoDevice, watchForDisconnectedAudioDevice, watchForDisconnectedAudioOutputDevice, watchForDisconnectedVideoDevice };
12638
+ export { AudioSettingsDefaultDeviceEnum, AudioSettingsRequestDefaultDeviceEnum, browsers as Browsers, Call, CallState, CallType, CallTypes, CallingState, CreateDeviceRequestPushProviderEnum, DebounceType, ErrorFromResponse, OwnCapability, RecordSettingsModeEnum, RecordSettingsQualityEnum, RecordSettingsRequestModeEnum, RecordSettingsRequestQualityEnum, rxUtils as RxUtils, events as SfuEvents, models as SfuModels, StreamSfuClient, StreamVideoClient, StreamVideoReadOnlyStateStore, StreamVideoServerClient, StreamVideoWriteableStateStore, TranscriptionSettingsModeEnum, TranscriptionSettingsRequestModeEnum, VideoSettingsCameraFacingEnum, VideoSettingsRequestCameraFacingEnum, ViewportTracker, VisibilityState, checkIfAudioOutputChangeSupported, combineComparators, conditional, createSoundDetector, defaultSortPreset, descending, disposeOfMediaStream, dominantSpeaker, getAudioDevices, getAudioOutputDevices, getAudioStream, getClientDetails, getDeviceInfo, getLogger, getOSInfo, getScreenShareStream, getSdkInfo, getVideoDevices, getVideoStream, isStreamVideoLocalParticipant, livestreamOrAudioRoomSortPreset, logLevels, logToConsole, name, noopComparator, pinned, publishingAudio, publishingVideo, reactionType, role, screenSharing, setDeviceInfo, setLogLevel, setLogger, setOSInfo, setSdkInfo, speakerLayoutSortPreset, speaking, watchForAddedDefaultAudioDevice, watchForAddedDefaultAudioOutputDevice, watchForAddedDefaultVideoDevice, watchForDisconnectedAudioDevice, watchForDisconnectedAudioOutputDevice, watchForDisconnectedVideoDevice };
12640
12639
  //# sourceMappingURL=index.browser.es.js.map