@flashphoner/sfusdk 2.0.291 → 2.0.294
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/dist/client.version +1 -1
- package/dist/sdk/attachments-transfer-client.d.ts +9 -0
- package/dist/sdk/attachments-transfer-client.js +130 -0
- package/dist/sdk/attachments-transfer-client.js.map +1 -0
- package/dist/sdk/attachments-transfer-manager.d.ts +8 -0
- package/dist/sdk/attachments-transfer-manager.js +29 -0
- package/dist/sdk/attachments-transfer-manager.js.map +1 -0
- package/dist/sdk/connection.d.ts +1 -0
- package/dist/sdk/connection.js +7 -3
- package/dist/sdk/connection.js.map +1 -1
- package/dist/sdk/constants.d.ts +23 -3
- package/dist/sdk/constants.js +8 -0
- package/dist/sdk/constants.js.map +1 -1
- package/dist/sdk/sfu-extended.d.ts +33 -4
- package/dist/sdk/sfu-extended.js +73 -57
- package/dist/sdk/sfu-extended.js.map +1 -1
- package/docs/assets/navigation.js +1 -1
- package/docs/assets/search.js +1 -1
- package/docs/classes/attachments_transfer_client.AttachmentsTransferClient.html +10 -0
- package/docs/classes/attachments_transfer_manager.AttachmentsTransferManager.html +4 -0
- package/docs/classes/connection.Connection.html +2 -1
- package/docs/classes/sfu_extended.SfuExtended.html +90 -80
- package/docs/enums/constants.AttachmentState.html +2 -2
- package/docs/enums/constants.AuthenticationStatus.html +2 -2
- package/docs/enums/constants.ChannelSendPolicy.html +2 -2
- package/docs/enums/constants.ChatError.html +3 -2
- package/docs/enums/constants.ChatReceivePolicy.html +2 -2
- package/docs/enums/constants.ChatSectionsError.html +2 -2
- package/docs/enums/constants.ChatType.html +2 -2
- package/docs/enums/constants.ConferenceType.html +2 -2
- package/docs/enums/constants.ConnectionType.html +2 -2
- package/docs/enums/constants.ContactError.html +2 -2
- package/docs/enums/constants.DeliveryStatus.html +2 -2
- package/docs/enums/constants.ExamplesError.html +2 -2
- package/docs/enums/constants.ExamplesEvent.html +2 -2
- package/docs/enums/constants.InternalApi.html +5 -2
- package/docs/enums/constants.MeetingSyncEvent.html +10 -10
- package/docs/enums/constants.MessageAttachmentMediaType.html +2 -2
- package/docs/enums/constants.MessageAttachmentType.html +2 -2
- package/docs/enums/constants.MessageState.html +2 -2
- package/docs/enums/constants.MessageTargetEntityType.html +2 -2
- package/docs/enums/constants.Operations.html +2 -2
- package/docs/enums/constants.ParticipantRole.html +2 -2
- package/docs/enums/constants.PresenceStatus.html +2 -2
- package/docs/enums/constants.RemoteSdpType.html +2 -2
- package/docs/enums/constants.RoomError.html +2 -2
- package/docs/enums/constants.RoomState.html +2 -2
- package/docs/enums/constants.SortOrder.html +2 -2
- package/docs/enums/constants.SpaceError.html +2 -2
- package/docs/enums/constants.SpaceEvent.html +18 -14
- package/docs/enums/constants.State.html +2 -2
- package/docs/enums/constants.StatsType.html +2 -2
- package/docs/enums/constants.TrackType.html +2 -2
- package/docs/enums/constants.UserInfoError.html +2 -2
- package/docs/enums/constants.UserManagementError.html +2 -2
- package/docs/modules/attachments_transfer_client.html +2 -0
- package/docs/modules/attachments_transfer_manager.html +2 -0
- package/docs/modules/constants.html +2 -0
- package/docs/modules/sfu_extended.html +2 -0
- package/docs/types/constants.AddRemoveTracks.html +1 -1
- package/docs/types/constants.AddRemoveTracksSync.html +1 -1
- package/docs/types/constants.AddedMembersToThread.html +1 -0
- package/docs/types/constants.AddedRemovedReactionOnMessage.html +1 -1
- package/docs/types/constants.AddedRoleToMember.html +1 -1
- package/docs/types/constants.Attachment.html +1 -1
- package/docs/types/constants.AttachmentInfo.html +1 -1
- package/docs/types/constants.AttachmentRequest.html +1 -1
- package/docs/types/constants.AttachmentRequestAck.html +1 -1
- package/docs/types/constants.AttachmentStatus.html +1 -1
- package/docs/types/constants.AttachmentStatusEvent.html +1 -1
- package/docs/types/constants.AuthenticationStatusEvent.html +1 -1
- package/docs/types/constants.BannedContact.html +1 -1
- package/docs/types/constants.BitrateTestStatus.html +1 -1
- package/docs/types/constants.BooleanEvent.html +1 -1
- package/docs/types/constants.Calendar.html +1 -1
- package/docs/types/constants.CalendarEvent.html +1 -1
- package/docs/types/constants.CalendarEventEvent.html +1 -1
- package/docs/types/constants.Chat.html +1 -1
- package/docs/types/constants.ChatLoadedEvent.html +1 -1
- package/docs/types/constants.ChatMap.html +1 -1
- package/docs/types/constants.ChatMessagesCount.html +1 -1
- package/docs/types/constants.ChatMessagesEvent.html +1 -1
- package/docs/types/constants.ChatSearchResultEvent.html +1 -1
- package/docs/types/constants.ChatsEvent.html +1 -1
- package/docs/types/constants.ConnectionDetails.html +1 -1
- package/docs/types/constants.ConnectionFailedEvent.html +1 -1
- package/docs/types/constants.Contact.html +1 -1
- package/docs/types/constants.ContactDeleted.html +1 -1
- package/docs/types/constants.ContactUpdated.html +1 -1
- package/docs/types/constants.ControlMessage.html +1 -1
- package/docs/types/constants.ControlMessageEvent.html +1 -1
- package/docs/types/constants.CreatedRoom.html +1 -1
- package/docs/types/constants.EvictedFromRoom.html +1 -1
- package/docs/types/constants.EvictedSync.html +1 -1
- package/docs/types/constants.ExamplesUser.html +1 -1
- package/docs/types/constants.ExamplesUserEvent.html +1 -1
- package/docs/types/constants.FirstAndLastChatMessage.html +1 -1
- package/docs/types/constants.FragmentedMessage.html +1 -1
- package/docs/types/constants.FriendInvite.html +1 -1
- package/docs/types/constants.FriendInviteDeleted.html +1 -1
- package/docs/types/constants.InternalMessage.html +1 -1
- package/docs/types/constants.JoinedRoom.html +1 -1
- package/docs/types/constants.JoinedRoomSync.html +1 -1
- package/docs/types/constants.LastReadMessageUpdate.html +1 -1
- package/docs/types/constants.LastReadMessageUpdated.html +1 -1
- package/docs/types/constants.LeftMeetingSync.html +1 -1
- package/docs/types/constants.LeftRoom.html +1 -1
- package/docs/types/constants.LoadMessagesWithMentionsResult.html +1 -1
- package/docs/types/constants.MeetingEndedSync.html +1 -1
- package/docs/types/constants.MeetingNameUpdatedSync.html +1 -1
- package/docs/types/constants.MeetingsPreviewEvent.html +1 -1
- package/docs/types/constants.Message.html +1 -1
- package/docs/types/constants.MessageAttachment.html +1 -1
- package/docs/types/constants.MessageAttachmentData.html +1 -1
- package/docs/types/constants.MessageAttachmentsSearchResult.html +1 -1
- package/docs/types/constants.MessageDeleted.html +1 -1
- package/docs/types/constants.MessageDeliveryStatus.html +1 -1
- package/docs/types/constants.MessageEdited.html +1 -1
- package/docs/types/constants.MessageInfo.html +1 -1
- package/docs/types/constants.MessageReaction.html +1 -1
- package/docs/types/constants.MessageStatus.html +1 -1
- package/docs/types/constants.MessageStatusEvent.html +1 -1
- package/docs/types/constants.MessageStatusUpdate.html +1 -1
- package/docs/types/constants.MessageTargetEntityId.html +1 -1
- package/docs/types/constants.MessageWithUploadingAttachments.html +1 -1
- package/docs/types/constants.NewChatEvent.html +1 -1
- package/docs/types/constants.NewContact.html +1 -1
- package/docs/types/constants.NewFriendInvite.html +1 -1
- package/docs/types/constants.NewMeeting.html +1 -1
- package/docs/types/constants.NewSpaceCategoryEvent.html +1 -1
- package/docs/types/constants.NewSpaceChannelEvent.html +1 -1
- package/docs/types/constants.NewSpaceEvent.html +1 -1
- package/docs/types/constants.NewSpaceRoleAdded.html +1 -1
- package/docs/types/constants.NewSpaceThreadEvent.html +1 -1
- package/docs/types/constants.OperationFailed.html +1 -1
- package/docs/types/constants.OperationFailedEvent.html +1 -1
- package/docs/types/constants.Participant.html +1 -1
- package/docs/types/constants.ParticipantAVSMutedEvent.html +1 -1
- package/docs/types/constants.ParticipantConfigEvent.html +1 -1
- package/docs/types/constants.ParticipantRenamed.html +1 -1
- package/docs/types/constants.ParticipantsListEvent.html +1 -1
- package/docs/types/constants.ParticipantsListSyncEvent.html +1 -1
- package/docs/types/constants.PlacedInLobbyEvent.html +1 -1
- package/docs/types/constants.PlacedInWaitingRoomEvent.html +1 -1
- package/docs/types/constants.PublicChannelsEvent.html +1 -1
- package/docs/types/constants.Quality.html +1 -1
- package/docs/types/constants.RemoteSdp.html +1 -1
- package/docs/types/constants.RemoteSdpInfo.html +1 -1
- package/docs/types/constants.RemovedChatEvent.html +1 -1
- package/docs/types/constants.RemovedMemberFromThread.html +1 -0
- package/docs/types/constants.RemovedRoleFromMember.html +1 -1
- package/docs/types/constants.ResetPasswordRequestStatus.html +1 -1
- package/docs/types/constants.RoleAssigned.html +1 -1
- package/docs/types/constants.RolePermissionSectionsEvent.html +1 -1
- package/docs/types/constants.RolesListEvent.html +1 -1
- package/docs/types/constants.RoomAvailable.html +1 -1
- package/docs/types/constants.RoomConfigEvent.html +1 -1
- package/docs/types/constants.RoomExtendedConfig.html +1 -1
- package/docs/types/constants.RoomExtendedParticipantConfig.html +1 -1
- package/docs/types/constants.RoomExtendedParticipantsConfig.html +1 -1
- package/docs/types/constants.RoomExtendedScreenSharingConfig.html +1 -1
- package/docs/types/constants.RoomInfo.html +1 -1
- package/docs/types/constants.RoomMessage.html +1 -1
- package/docs/types/constants.RoomNameUpdated.html +1 -1
- package/docs/types/constants.RoomScreenSharingConfigEvent.html +1 -1
- package/docs/types/constants.SFUMeetingParticipantPreview.html +1 -1
- package/docs/types/constants.SFUMeetingPreview.html +1 -1
- package/docs/types/constants.SfuMessageEvent.html +1 -1
- package/docs/types/constants.SfuSpace.html +1 -1
- package/docs/types/constants.SfuSpaceCategory.html +1 -1
- package/docs/types/constants.SfuSpaceChannel.html +1 -1
- package/docs/types/constants.SfuSpaceChannelAccessRights.html +1 -1
- package/docs/types/constants.SfuSpaceInvite.html +1 -1
- package/docs/types/constants.SfuSpaceMember.html +1 -1
- package/docs/types/constants.SfuSpaceRole.html +1 -1
- package/docs/types/constants.SfuSpaceRolePermission.html +1 -1
- package/docs/types/constants.SfuSpaceRolePermissionSection.html +1 -1
- package/docs/types/constants.SfuSpaceThread.html +1 -1
- package/docs/types/constants.SfuSpaceUserBan.html +1 -1
- package/docs/types/constants.SignUpStatus.html +1 -1
- package/docs/types/constants.SpaceCategoryDeleted.html +1 -1
- package/docs/types/constants.SpaceCategoryUpdated.html +1 -1
- package/docs/types/constants.SpaceChannelDeleted.html +1 -1
- package/docs/types/constants.SpaceChannelMoved.html +1 -1
- package/docs/types/constants.SpaceChannelUpdated.html +1 -1
- package/docs/types/constants.SpaceCreatedEvent.html +1 -1
- package/docs/types/constants.SpaceDeletedEvent.html +1 -1
- package/docs/types/constants.SpaceInviteCreated.html +1 -1
- package/docs/types/constants.SpaceInviteRevoked.html +1 -1
- package/docs/types/constants.SpaceOverviewUpdated.html +1 -1
- package/docs/types/constants.SpaceRoleDeleted.html +1 -1
- package/docs/types/constants.SpaceRoleUpdated.html +1 -1
- package/docs/types/constants.SpaceThreadDeleted.html +1 -1
- package/docs/types/constants.SpaceThreadUpdated.html +1 -1
- package/docs/types/constants.StopScreenSharingEvent.html +1 -1
- package/docs/types/constants.StopTrackEvent.html +1 -1
- package/docs/types/constants.TracksQualityState.html +1 -1
- package/docs/types/constants.UnreadMessagesCountEvent.html +1 -1
- package/docs/types/constants.UnreadMessagesCountUpdate.html +1 -1
- package/docs/types/constants.UpdateChatEvent.html +1 -1
- package/docs/types/constants.UpdateMessagesDeliveryStatusEvent.html +1 -1
- package/docs/types/constants.UploadingAttachmentInfo.html +1 -1
- package/docs/types/constants.UserCalendarEvent.html +1 -1
- package/docs/types/constants.UserChatEncryptedPassword.html +1 -1
- package/docs/types/constants.UserContacts.html +1 -1
- package/docs/types/constants.UserContactsEvent.html +1 -1
- package/docs/types/constants.UserEmail.html +1 -1
- package/docs/types/constants.UserEncryptionInfo.html +1 -1
- package/docs/types/constants.UserEncryptionInfoEvent.html +1 -1
- package/docs/types/constants.UserHostKey.html +1 -1
- package/docs/types/constants.UserHostKeyChangedEvent.html +1 -1
- package/docs/types/constants.UserId.html +1 -1
- package/docs/types/constants.UserInfo.html +1 -1
- package/docs/types/constants.UserInfoChangedEvent.html +1 -1
- package/docs/types/constants.UserInfoEvent.html +1 -1
- package/docs/types/constants.UserJoinedToSpaceEvent.html +1 -1
- package/docs/types/constants.UserLeftSpace.html +1 -1
- package/docs/types/constants.UserNickname.html +1 -1
- package/docs/types/constants.UserNicknameChangedEvent.html +1 -1
- package/docs/types/constants.UserPassword.html +1 -1
- package/docs/types/constants.UserPhoneNumber.html +1 -1
- package/docs/types/constants.UserPhoneNumberChangedEvent.html +1 -1
- package/docs/types/constants.UserPmiSettings.html +1 -1
- package/docs/types/constants.UserPresenceStatusUpdated.html +1 -1
- package/docs/types/constants.UserRoomsEvent.html +1 -1
- package/docs/types/constants.UserSpacesEvent.html +1 -1
- package/docs/types/constants.UserSpecificChatInfo.html +1 -1
- package/docs/types/constants.UserTimezone.html +1 -1
- package/docs/types/constants.UserTimezoneChangedEvent.html +1 -1
- package/docs/types/constants.WaitingListEvent.html +1 -1
- package/docs/types/constants.WaitingParticipant.html +1 -1
- package/docs/types/constants.WaitingRoomUpdate.html +1 -1
- package/docs/types/sfu_extended.EventUnion.html +1 -0
- package/docs/types/sfu_extended.NotifyUnion.html +1 -0
- package/docs/variables/constants.ATTACHMENT_CHUNK_SIZE.html +1 -1
- package/docs/variables/constants.ATTACHMENT_ID_LENGTH.html +1 -1
- package/docs/variables/constants.WS_CONNECTION_TIMEOUT.html +1 -1
- package/docs/variables/constants.WS_PINGS_MISSING_THRESHOLD.html +1 -1
- package/docs/variables/constants.WS_PING_INTERVAL_MS.html +1 -1
- package/package.json +1 -1
package/dist/sdk/sfu-extended.js
CHANGED
|
@@ -45,7 +45,7 @@ var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (
|
|
|
45
45
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
46
46
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
47
47
|
};
|
|
48
|
-
var _SfuExtended_instances, _SfuExtended_connection, _SfuExtended__user, _SfuExtended__server, _SfuExtended__state, _SfuExtended_rooms, _SfuExtended_notifier, _SfuExtended_uploadingAttachmentState,
|
|
48
|
+
var _SfuExtended_instances, _SfuExtended_connection, _SfuExtended__user, _SfuExtended__server, _SfuExtended__url, _SfuExtended__state, _SfuExtended_rooms, _SfuExtended_notifier, _SfuExtended_uploadingAttachmentState, _SfuExtended_attachmentsTransferManager, _SfuExtended_binaryChunkSize, _SfuExtended_logger, _SfuExtended_loggerPrefix, _SfuExtended_signUpId, _SfuExtended_resetPasswordId, _SfuExtended_emmitAction, _SfuExtended_emmitBinaryAction, _SfuExtended_checkAuthenticated, _SfuExtended_createConnection, _SfuExtended_getConnectionConfigForAnonymousUser, _SfuExtended_getConnectionConfigForExamples;
|
|
49
49
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
50
50
|
exports.SfuExtended = void 0;
|
|
51
51
|
const uuid_1 = require("uuid");
|
|
@@ -57,18 +57,20 @@ const room_extended_1 = require("./room-extended");
|
|
|
57
57
|
const sending_attachments_handler_1 = require("./sending-attachments-handler");
|
|
58
58
|
const logger_1 = __importStar(require("./logger"));
|
|
59
59
|
const reset_password_handler_1 = require("./reset-password-handler");
|
|
60
|
+
const attachments_transfer_manager_1 = require("./attachments-transfer-manager");
|
|
60
61
|
class SfuExtended {
|
|
61
62
|
constructor(logLevel, prefix, log) {
|
|
62
63
|
_SfuExtended_instances.add(this);
|
|
63
64
|
_SfuExtended_connection.set(this, void 0);
|
|
64
65
|
_SfuExtended__user.set(this, void 0);
|
|
65
66
|
_SfuExtended__server.set(this, void 0);
|
|
67
|
+
_SfuExtended__url.set(this, void 0);
|
|
66
68
|
_SfuExtended__state.set(this, constants_1.State.NEW);
|
|
67
69
|
_SfuExtended_rooms.set(this, {});
|
|
68
70
|
//TODO(naz): Provide union instead of InternalMessage
|
|
69
71
|
_SfuExtended_notifier.set(this, new notifier_1.Notifier());
|
|
70
72
|
_SfuExtended_uploadingAttachmentState.set(this, {});
|
|
71
|
-
|
|
73
|
+
_SfuExtended_attachmentsTransferManager.set(this, new attachments_transfer_manager_1.AttachmentsTransferManager(__classPrivateFieldGet(this, _SfuExtended_notifier, "f")));
|
|
72
74
|
_SfuExtended_binaryChunkSize.set(this, void 0);
|
|
73
75
|
_SfuExtended_logger.set(this, new logger_1.default());
|
|
74
76
|
_SfuExtended_loggerPrefix.set(this, void 0);
|
|
@@ -120,6 +122,7 @@ class SfuExtended {
|
|
|
120
122
|
const self = this;
|
|
121
123
|
__classPrivateFieldGet(this, _SfuExtended_instances, "m", _SfuExtended_createConnection).call(this);
|
|
122
124
|
__classPrivateFieldSet(this, _SfuExtended__server, new URL(options.url).hostname, "f");
|
|
125
|
+
__classPrivateFieldSet(this, _SfuExtended__url, options.url, "f");
|
|
123
126
|
__classPrivateFieldSet(this, _SfuExtended_binaryChunkSize, options.binaryChunkSize ? options.binaryChunkSize : constants_1.ATTACHMENT_CHUNK_SIZE, "f");
|
|
124
127
|
return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
|
|
125
128
|
try {
|
|
@@ -816,6 +819,18 @@ class SfuExtended {
|
|
|
816
819
|
* On client side should receive {@link SfuEvent.MESSAGE_ATTACHMENT_STATE} with {@link AttachmentStatus} to show progress
|
|
817
820
|
*/
|
|
818
821
|
getMessageAttachment(attachment) {
|
|
822
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
823
|
+
let result;
|
|
824
|
+
try {
|
|
825
|
+
result = yield this.downloadAttachment(attachment);
|
|
826
|
+
}
|
|
827
|
+
catch (e) {
|
|
828
|
+
throw e;
|
|
829
|
+
}
|
|
830
|
+
return yield __classPrivateFieldGet(this, _SfuExtended_attachmentsTransferManager, "f").download(result, __classPrivateFieldGet(this, _SfuExtended__url, "f"));
|
|
831
|
+
});
|
|
832
|
+
}
|
|
833
|
+
downloadAttachment(attachment) {
|
|
819
834
|
__classPrivateFieldGet(this, _SfuExtended_instances, "m", _SfuExtended_checkAuthenticated).call(this);
|
|
820
835
|
const self = this;
|
|
821
836
|
const { targetEntityType, targetEntityId, messageId, attachmentId, name } = attachment;
|
|
@@ -1843,6 +1858,47 @@ class SfuExtended {
|
|
|
1843
1858
|
}, resolve, reject);
|
|
1844
1859
|
});
|
|
1845
1860
|
}
|
|
1861
|
+
/**
|
|
1862
|
+
* Add members to thread
|
|
1863
|
+
*
|
|
1864
|
+
* Thread members will receive {@link SpaceEvent.ADDED_MEMBERS_TO_THREAD} with {@link AddedMembersToThread}
|
|
1865
|
+
*
|
|
1866
|
+
* New members will receive {@link NEW_SPACE_THREAD} with {@link NewSpaceThreadEvent}
|
|
1867
|
+
*
|
|
1868
|
+
*/
|
|
1869
|
+
addMembersToThread(options) {
|
|
1870
|
+
__classPrivateFieldGet(this, _SfuExtended_instances, "m", _SfuExtended_checkAuthenticated).call(this);
|
|
1871
|
+
const self = this;
|
|
1872
|
+
return new Promise(function (resolve, reject) {
|
|
1873
|
+
__classPrivateFieldGet(self, _SfuExtended_instances, "m", _SfuExtended_emmitAction).call(self, constants_1.InternalApi.ADD_MEMBERS_TO_THREAD, {
|
|
1874
|
+
spaceId: options.spaceId,
|
|
1875
|
+
channelId: options.channelId,
|
|
1876
|
+
threadId: options.threadId,
|
|
1877
|
+
members: options.members
|
|
1878
|
+
}, resolve, reject);
|
|
1879
|
+
});
|
|
1880
|
+
}
|
|
1881
|
+
/**
|
|
1882
|
+
* Remove member from thread
|
|
1883
|
+
*
|
|
1884
|
+
* For space owner/thread creator only
|
|
1885
|
+
*
|
|
1886
|
+
* Thread members will receive {@link SpaceEvent.REMOVED_MEMBER_FROM_THREAD} with {@link RemovedMemberFromThread}
|
|
1887
|
+
*
|
|
1888
|
+
* The removed member will receive {@link SpaceEvent.SPACE_THREAD_DELETED} with {@link SpaceThreadDeleted}
|
|
1889
|
+
*/
|
|
1890
|
+
removeMemberFromThread(options) {
|
|
1891
|
+
__classPrivateFieldGet(this, _SfuExtended_instances, "m", _SfuExtended_checkAuthenticated).call(this);
|
|
1892
|
+
const self = this;
|
|
1893
|
+
return new Promise(function (resolve, reject) {
|
|
1894
|
+
__classPrivateFieldGet(self, _SfuExtended_instances, "m", _SfuExtended_emmitAction).call(self, constants_1.InternalApi.REMOVE_MEMBER_FROM_THREAD, {
|
|
1895
|
+
spaceId: options.spaceId,
|
|
1896
|
+
channelId: options.channelId,
|
|
1897
|
+
threadId: options.threadId,
|
|
1898
|
+
member: options.member
|
|
1899
|
+
}, resolve, reject);
|
|
1900
|
+
});
|
|
1901
|
+
}
|
|
1846
1902
|
/**
|
|
1847
1903
|
* Delete space thread
|
|
1848
1904
|
*
|
|
@@ -2099,7 +2155,7 @@ class SfuExtended {
|
|
|
2099
2155
|
}
|
|
2100
2156
|
}
|
|
2101
2157
|
exports.SfuExtended = SfuExtended;
|
|
2102
|
-
_SfuExtended_connection = new WeakMap(), _SfuExtended__user = new WeakMap(), _SfuExtended__server = new WeakMap(), _SfuExtended__state = new WeakMap(), _SfuExtended_rooms = new WeakMap(), _SfuExtended_notifier = new WeakMap(), _SfuExtended_uploadingAttachmentState = new WeakMap(),
|
|
2158
|
+
_SfuExtended_connection = new WeakMap(), _SfuExtended__user = new WeakMap(), _SfuExtended__server = new WeakMap(), _SfuExtended__url = new WeakMap(), _SfuExtended__state = new WeakMap(), _SfuExtended_rooms = new WeakMap(), _SfuExtended_notifier = new WeakMap(), _SfuExtended_uploadingAttachmentState = new WeakMap(), _SfuExtended_attachmentsTransferManager = new WeakMap(), _SfuExtended_binaryChunkSize = new WeakMap(), _SfuExtended_logger = new WeakMap(), _SfuExtended_loggerPrefix = new WeakMap(), _SfuExtended_signUpId = new WeakMap(), _SfuExtended_resetPasswordId = new WeakMap(), _SfuExtended_instances = new WeakSet(), _SfuExtended_emmitAction = function _SfuExtended_emmitAction(action, data, resolve, reject) {
|
|
2103
2159
|
const id = (0, uuid_1.v4)();
|
|
2104
2160
|
promises_1.default.add(id, resolve, reject);
|
|
2105
2161
|
__classPrivateFieldGet(this, _SfuExtended_connection, "f").send(action, Object.assign(Object.assign({}, data), { internalMessageId: id }));
|
|
@@ -2150,10 +2206,7 @@ _SfuExtended_connection = new WeakMap(), _SfuExtended__user = new WeakMap(), _Sf
|
|
|
2150
2206
|
else if (data[0].type === constants_1.InternalApi.SFU_ATTACHMENT_REQUEST_ACK) {
|
|
2151
2207
|
const ack = data[0];
|
|
2152
2208
|
const request = ack.attachmentRequest;
|
|
2153
|
-
|
|
2154
|
-
if (!state) {
|
|
2155
|
-
__classPrivateFieldGet(this, _SfuExtended_downloadingAttachmentState, "f").push(Object.assign(Object.assign({}, request), { payload: null, internalMessageId: ack.internalMessageId }));
|
|
2156
|
-
}
|
|
2209
|
+
promises_1.default.resolve(data[0].internalMessageId, Object.assign(Object.assign({}, request), { payload: null, sessionId: ack.sessionId, internalMessageId: ack.internalMessageId }));
|
|
2157
2210
|
}
|
|
2158
2211
|
else if (data[0].type === constants_1.InternalApi.USER_CALENDAR) {
|
|
2159
2212
|
const calendar = data[0];
|
|
@@ -2500,6 +2553,18 @@ _SfuExtended_connection = new WeakMap(), _SfuExtended__user = new WeakMap(), _Sf
|
|
|
2500
2553
|
__classPrivateFieldGet(this, _SfuExtended_notifier, "f").notify(constants_1.SpaceEvent.SPACE_THREAD_UPDATED, event);
|
|
2501
2554
|
}
|
|
2502
2555
|
}
|
|
2556
|
+
else if (data[0].type === constants_1.SpaceEvent.ADDED_MEMBERS_TO_THREAD) {
|
|
2557
|
+
const event = data[0];
|
|
2558
|
+
if (!promises_1.default.resolve(data[0].internalMessageId, event)) {
|
|
2559
|
+
__classPrivateFieldGet(this, _SfuExtended_notifier, "f").notify(constants_1.SpaceEvent.ADDED_MEMBERS_TO_THREAD, event);
|
|
2560
|
+
}
|
|
2561
|
+
}
|
|
2562
|
+
else if (data[0].type === constants_1.SpaceEvent.REMOVED_MEMBER_FROM_THREAD) {
|
|
2563
|
+
const event = data[0];
|
|
2564
|
+
if (!promises_1.default.resolve(data[0].internalMessageId, event)) {
|
|
2565
|
+
__classPrivateFieldGet(this, _SfuExtended_notifier, "f").notify(constants_1.SpaceEvent.REMOVED_MEMBER_FROM_THREAD, event);
|
|
2566
|
+
}
|
|
2567
|
+
}
|
|
2503
2568
|
else if (data[0].type === constants_1.SpaceEvent.SPACE_THREAD_DELETED) {
|
|
2504
2569
|
const event = data[0];
|
|
2505
2570
|
if (!promises_1.default.resolve(data[0].internalMessageId, event)) {
|
|
@@ -2687,51 +2752,13 @@ _SfuExtended_connection = new WeakMap(), _SfuExtended__user = new WeakMap(), _Sf
|
|
|
2687
2752
|
__classPrivateFieldGet(this, _SfuExtended_notifier, "f").notify(constants_1.SfuEvent.FAILED, data[0]);
|
|
2688
2753
|
break;
|
|
2689
2754
|
}
|
|
2690
|
-
}, (
|
|
2691
|
-
switch (name) {
|
|
2692
|
-
case constants_1.InternalApi.BINARY_DATA:
|
|
2693
|
-
const headerSize = 4;
|
|
2694
|
-
const buffer = new Uint8Array(data);
|
|
2695
|
-
const messageTransferId = buffer[1];
|
|
2696
|
-
const attachmentTransferId = buffer[2];
|
|
2697
|
-
const eof = buffer[headerSize - 1];
|
|
2698
|
-
const attachment = __classPrivateFieldGet(this, _SfuExtended_downloadingAttachmentState, "f").find((attachment) => attachment.attachmentTransferId === attachmentTransferId && attachment.messageTransferId === messageTransferId);
|
|
2699
|
-
if (attachment) {
|
|
2700
|
-
if (!attachment.payload) {
|
|
2701
|
-
attachment.payload = data.slice(headerSize, data.byteLength);
|
|
2702
|
-
}
|
|
2703
|
-
else {
|
|
2704
|
-
//ToDo (igor): optimize ArrayBuffer merging
|
|
2705
|
-
const newData = new Uint8Array(attachment.payload.byteLength + (data.byteLength - headerSize));
|
|
2706
|
-
newData.set(new Uint8Array(attachment.payload), 0);
|
|
2707
|
-
newData.set(new Uint8Array(data.slice(headerSize, data.byteLength)), attachment.payload.byteLength);
|
|
2708
|
-
attachment.payload = newData.buffer;
|
|
2709
|
-
}
|
|
2710
|
-
if (eof === 1) {
|
|
2711
|
-
__classPrivateFieldGet(this, _SfuExtended_instances, "m", _SfuExtended_notifyMessageAttachmentState).call(this, attachment, constants_1.AttachmentState.DOWNLOADED);
|
|
2712
|
-
const index = __classPrivateFieldGet(this, _SfuExtended_downloadingAttachmentState, "f").indexOf(attachment);
|
|
2713
|
-
__classPrivateFieldGet(this, _SfuExtended_downloadingAttachmentState, "f").splice(index, 1);
|
|
2714
|
-
// ToDo (igor): need to resolve or reject in any case
|
|
2715
|
-
promises_1.default.resolve(attachment.internalMessageId, attachment);
|
|
2716
|
-
}
|
|
2717
|
-
else {
|
|
2718
|
-
__classPrivateFieldGet(this, _SfuExtended_instances, "m", _SfuExtended_notifyMessageAttachmentState).call(this, attachment, constants_1.AttachmentState.PENDING);
|
|
2719
|
-
}
|
|
2720
|
-
}
|
|
2721
|
-
else {
|
|
2722
|
-
__classPrivateFieldGet(this, _SfuExtended_logger, "f").info("Unable to find attachment with messageTransferId " + messageTransferId + " attachmentTransferId " + attachmentTransferId);
|
|
2723
|
-
}
|
|
2724
|
-
break;
|
|
2725
|
-
default:
|
|
2726
|
-
console.error("Unknown binary data type " + name);
|
|
2727
|
-
}
|
|
2755
|
+
}, () => {
|
|
2728
2756
|
}, (e) => {
|
|
2729
2757
|
__classPrivateFieldSet(self, _SfuExtended__state, constants_1.State.FAILED, "f");
|
|
2730
2758
|
__classPrivateFieldGet(self, _SfuExtended_notifier, "f").notify(constants_1.SfuEvent.CONNECTION_FAILED, e);
|
|
2731
2759
|
}, (e) => {
|
|
2732
2760
|
__classPrivateFieldSet(self, _SfuExtended__state, constants_1.State.DISCONNECTED, "f");
|
|
2733
2761
|
self.disconnect();
|
|
2734
|
-
__classPrivateFieldGet(self, _SfuExtended_downloadingAttachmentState, "f").length = 0;
|
|
2735
2762
|
__classPrivateFieldSet(self, _SfuExtended_uploadingAttachmentState, {}, "f");
|
|
2736
2763
|
const event = {
|
|
2737
2764
|
reason: e.reason,
|
|
@@ -2759,17 +2786,6 @@ _SfuExtended_connection = new WeakMap(), _SfuExtended__user = new WeakMap(), _Sf
|
|
|
2759
2786
|
nickname: ""
|
|
2760
2787
|
}
|
|
2761
2788
|
};
|
|
2762
|
-
}, _SfuExtended_notifyMessageAttachmentState = function _SfuExtended_notifyMessageAttachmentState(attachment, state) {
|
|
2763
|
-
const status = {
|
|
2764
|
-
targetEntityType: attachment.targetEntityType,
|
|
2765
|
-
targetEntityId: attachment.targetEntityId,
|
|
2766
|
-
messageId: attachment.messageId,
|
|
2767
|
-
id: attachment.attachmentId,
|
|
2768
|
-
name: attachment.name,
|
|
2769
|
-
state: state,
|
|
2770
|
-
downloadedSize: attachment.payload.byteLength
|
|
2771
|
-
};
|
|
2772
|
-
__classPrivateFieldGet(this, _SfuExtended_notifier, "f").notify(constants_1.SfuEvent.MESSAGE_ATTACHMENT_STATE, status);
|
|
2773
2789
|
}, _SfuExtended_getConnectionConfigForExamples = function _SfuExtended_getConnectionConfigForExamples(url, timeout) {
|
|
2774
2790
|
return {
|
|
2775
2791
|
url: url,
|