polfan-server-js-client 0.1.992 → 0.1.993
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/build/index.js +822 -124
- package/build/index.js.map +1 -1
- package/build/types/AbstractChatClient.d.ts +5 -1
- package/build/types/state-tracker/MessagesManager.d.ts +8 -10
- package/build/types/state-tracker/RoomMessagesHistory.d.ts +17 -0
- package/build/types/state-tracker/RoomsManager.d.ts +4 -2
- package/build/types/state-tracker/TopicHistoryWindow.d.ts +58 -0
- package/build/types/types/src/index.d.ts +6 -2
- package/build/types/types/src/schemes/FollowedTopic.d.ts +0 -1
- package/build/types/types/src/schemes/Message.d.ts +8 -2
- package/{src/types/dist/schemes/commands/Ack.d.ts → build/types/types/src/schemes/commands/GetMessages.d.ts} +3 -2
- package/build/types/types/src/schemes/commands/GetTopics.d.ts +4 -0
- package/{src/types/dist/schemes/events/NewMessage.d.ts → build/types/types/src/schemes/events/Messages.d.ts} +3 -3
- package/build/types/types/src/schemes/events/Topics.d.ts +6 -0
- package/package.json +1 -1
- package/src/AbstractChatClient.ts +8 -0
- package/src/state-tracker/MessagesManager.ts +28 -60
- package/src/state-tracker/RoomMessagesHistory.ts +78 -0
- package/src/state-tracker/RoomsManager.ts +22 -2
- package/src/state-tracker/TopicHistoryWindow.ts +257 -0
- package/src/types/src/index.ts +10 -1
- package/src/types/src/schemes/FollowedTopic.ts +0 -1
- package/src/types/src/schemes/Message.ts +9 -2
- package/src/types/src/schemes/commands/GetMessages.ts +7 -0
- package/src/types/src/schemes/commands/GetTopics.ts +4 -0
- package/src/types/src/schemes/events/Messages.ts +7 -0
- package/src/types/src/schemes/events/Topics.ts +7 -0
- package/tests/history-window.test.ts +129 -0
- package/build/types/types/dist/index.d.ts +0 -1
- package/build/types/types/dist/schemes/ChatLocation.d.ts +0 -1
- package/build/types/types/dist/schemes/Envelope.d.ts +0 -1
- package/build/types/types/dist/schemes/FollowedTopic.d.ts +0 -1
- package/build/types/types/dist/schemes/Message.d.ts +0 -1
- package/build/types/types/dist/schemes/PermissionOverwritesValue.d.ts +0 -1
- package/build/types/types/dist/schemes/Role.d.ts +0 -1
- package/build/types/types/dist/schemes/Room.d.ts +0 -1
- package/build/types/types/dist/schemes/RoomMember.d.ts +0 -1
- package/build/types/types/dist/schemes/RoomSummary.d.ts +0 -1
- package/build/types/types/dist/schemes/Space.d.ts +0 -1
- package/build/types/types/dist/schemes/SpaceMember.d.ts +0 -1
- package/build/types/types/dist/schemes/Topic.d.ts +0 -1
- package/build/types/types/dist/schemes/User.d.ts +0 -1
- package/build/types/types/dist/schemes/UserState.d.ts +0 -1
- package/build/types/types/dist/schemes/commands/Ack.d.ts +0 -1
- package/build/types/types/dist/schemes/commands/AssignRole.d.ts +0 -1
- package/build/types/types/dist/schemes/commands/CreateMessage.d.ts +0 -1
- package/build/types/types/dist/schemes/commands/CreateOwner.d.ts +0 -1
- package/build/types/types/dist/schemes/commands/CreateRole.d.ts +0 -1
- package/build/types/types/dist/schemes/commands/CreateRoom.d.ts +0 -1
- package/build/types/types/dist/schemes/commands/CreateSpace.d.ts +0 -1
- package/build/types/types/dist/schemes/commands/CreateTopic.d.ts +0 -1
- package/build/types/types/dist/schemes/commands/DeassignRole.d.ts +0 -1
- package/build/types/types/dist/schemes/commands/DeleteOwner.d.ts +0 -1
- package/build/types/types/dist/schemes/commands/DeleteRole.d.ts +0 -1
- package/build/types/types/dist/schemes/commands/DeleteRoom.d.ts +0 -1
- package/build/types/types/dist/schemes/commands/DeleteSpace.d.ts +0 -1
- package/build/types/types/dist/schemes/commands/DeleteTopic.d.ts +0 -1
- package/build/types/types/dist/schemes/commands/FollowTopic.d.ts +0 -1
- package/build/types/types/dist/schemes/commands/GetComputedPermissions.d.ts +0 -1
- package/build/types/types/dist/schemes/commands/GetFollowedTopics.d.ts +0 -1
- package/build/types/types/dist/schemes/commands/GetOwners.d.ts +0 -1
- package/build/types/types/dist/schemes/commands/GetPermissionOverwriteTargets.d.ts +0 -1
- package/build/types/types/dist/schemes/commands/GetPermissionOverwrites.d.ts +0 -1
- package/build/types/types/dist/schemes/commands/GetRoomMembers.d.ts +0 -1
- package/build/types/types/dist/schemes/commands/GetSession.d.ts +0 -1
- package/build/types/types/dist/schemes/commands/GetSpaceMembers.d.ts +0 -1
- package/build/types/types/dist/schemes/commands/GetSpaceRooms.d.ts +0 -1
- package/build/types/types/dist/schemes/commands/JoinRoom.d.ts +0 -1
- package/build/types/types/dist/schemes/commands/JoinSpace.d.ts +0 -1
- package/build/types/types/dist/schemes/commands/LeaveRoom.d.ts +0 -1
- package/build/types/types/dist/schemes/commands/LeaveSpace.d.ts +0 -1
- package/build/types/types/dist/schemes/commands/SetPermissionOverwrites.d.ts +0 -1
- package/build/types/types/dist/schemes/commands/UnfollowTopic.d.ts +0 -1
- package/build/types/types/dist/schemes/commands/UpdateRole.d.ts +0 -1
- package/build/types/types/dist/schemes/commands/UpdateRoom.d.ts +0 -1
- package/build/types/types/dist/schemes/commands/UpdateSpace.d.ts +0 -1
- package/build/types/types/dist/schemes/events/Bye.d.ts +0 -1
- package/build/types/types/dist/schemes/events/ComputedPermissions.d.ts +0 -1
- package/build/types/types/dist/schemes/events/Error.d.ts +0 -1
- package/build/types/types/dist/schemes/events/FollowedTopicUpdated.d.ts +0 -1
- package/build/types/types/dist/schemes/events/FollowedTopics.d.ts +0 -1
- package/build/types/types/dist/schemes/events/NewMessage.d.ts +0 -1
- package/build/types/types/dist/schemes/events/NewRole.d.ts +0 -1
- package/build/types/types/dist/schemes/events/NewRoom.d.ts +0 -1
- package/build/types/types/dist/schemes/events/NewTopic.d.ts +0 -1
- package/build/types/types/dist/schemes/events/Ok.d.ts +0 -1
- package/build/types/types/dist/schemes/events/Owners.d.ts +0 -1
- package/build/types/types/dist/schemes/events/PermissionOverwriteTargets.d.ts +0 -1
- package/build/types/types/dist/schemes/events/PermissionOverwrites.d.ts +0 -1
- package/build/types/types/dist/schemes/events/PermissionOverwritesUpdated.d.ts +0 -1
- package/build/types/types/dist/schemes/events/RoleDeleted.d.ts +0 -1
- package/build/types/types/dist/schemes/events/RoleUpdated.d.ts +0 -1
- package/build/types/types/dist/schemes/events/RoomDeleted.d.ts +0 -1
- package/build/types/types/dist/schemes/events/RoomJoined.d.ts +0 -1
- package/build/types/types/dist/schemes/events/RoomLeft.d.ts +0 -1
- package/build/types/types/dist/schemes/events/RoomMemberJoined.d.ts +0 -1
- package/build/types/types/dist/schemes/events/RoomMemberLeft.d.ts +0 -1
- package/build/types/types/dist/schemes/events/RoomMemberUpdated.d.ts +0 -1
- package/build/types/types/dist/schemes/events/RoomMembers.d.ts +0 -1
- package/build/types/types/dist/schemes/events/RoomUpdated.d.ts +0 -1
- package/build/types/types/dist/schemes/events/Session.d.ts +0 -1
- package/build/types/types/dist/schemes/events/SpaceDeleted.d.ts +0 -1
- package/build/types/types/dist/schemes/events/SpaceJoined.d.ts +0 -1
- package/build/types/types/dist/schemes/events/SpaceLeft.d.ts +0 -1
- package/build/types/types/dist/schemes/events/SpaceMemberJoined.d.ts +0 -1
- package/build/types/types/dist/schemes/events/SpaceMemberLeft.d.ts +0 -1
- package/build/types/types/dist/schemes/events/SpaceMemberUpdated.d.ts +0 -1
- package/build/types/types/dist/schemes/events/SpaceMembers.d.ts +0 -1
- package/build/types/types/dist/schemes/events/SpaceRooms.d.ts +0 -1
- package/build/types/types/dist/schemes/events/SpaceUpdated.d.ts +0 -1
- package/build/types/types/dist/schemes/events/TopicDeleted.d.ts +0 -1
- package/build/types/types/dist/schemes/events/TopicFollowed.d.ts +0 -1
- package/build/types/types/dist/schemes/events/TopicUnfollowed.d.ts +0 -1
- package/build/types/types/dist/schemes/events/UserUpdated.d.ts +0 -1
- package/src/types/dist/index.d.ts +0 -88
- package/src/types/dist/index.js +0 -2
- package/src/types/dist/schemes/ChatLocation.d.ts +0 -5
- package/src/types/dist/schemes/ChatLocation.js +0 -2
- package/src/types/dist/schemes/Envelope.d.ts +0 -5
- package/src/types/dist/schemes/Envelope.js +0 -2
- package/src/types/dist/schemes/FollowedTopic.d.ts +0 -7
- package/src/types/dist/schemes/FollowedTopic.js +0 -2
- package/src/types/dist/schemes/Message.d.ts +0 -8
- package/src/types/dist/schemes/Message.js +0 -2
- package/src/types/dist/schemes/PermissionOverwritesValue.d.ts +0 -4
- package/src/types/dist/schemes/PermissionOverwritesValue.js +0 -2
- package/src/types/dist/schemes/Role.d.ts +0 -6
- package/src/types/dist/schemes/Role.js +0 -2
- package/src/types/dist/schemes/Room.d.ts +0 -10
- package/src/types/dist/schemes/Room.js +0 -2
- package/src/types/dist/schemes/RoomMember.d.ts +0 -7
- package/src/types/dist/schemes/RoomMember.js +0 -2
- package/src/types/dist/schemes/RoomSummary.d.ts +0 -5
- package/src/types/dist/schemes/RoomSummary.js +0 -2
- package/src/types/dist/schemes/Space.d.ts +0 -6
- package/src/types/dist/schemes/Space.js +0 -2
- package/src/types/dist/schemes/SpaceMember.d.ts +0 -5
- package/src/types/dist/schemes/SpaceMember.js +0 -2
- package/src/types/dist/schemes/Topic.d.ts +0 -9
- package/src/types/dist/schemes/Topic.js +0 -2
- package/src/types/dist/schemes/User.d.ts +0 -8
- package/src/types/dist/schemes/User.js +0 -2
- package/src/types/dist/schemes/UserState.d.ts +0 -6
- package/src/types/dist/schemes/UserState.js +0 -2
- package/src/types/dist/schemes/commands/Ack.js +0 -2
- package/src/types/dist/schemes/commands/AssignRole.d.ts +0 -6
- package/src/types/dist/schemes/commands/AssignRole.js +0 -2
- package/src/types/dist/schemes/commands/CreateMessage.d.ts +0 -5
- package/src/types/dist/schemes/commands/CreateMessage.js +0 -2
- package/src/types/dist/schemes/commands/CreateOwner.d.ts +0 -5
- package/src/types/dist/schemes/commands/CreateOwner.js +0 -2
- package/src/types/dist/schemes/commands/CreateRole.d.ts +0 -5
- package/src/types/dist/schemes/commands/CreateRole.js +0 -2
- package/src/types/dist/schemes/commands/CreateRoom.d.ts +0 -7
- package/src/types/dist/schemes/commands/CreateRoom.js +0 -2
- package/src/types/dist/schemes/commands/CreateSpace.d.ts +0 -3
- package/src/types/dist/schemes/commands/CreateSpace.js +0 -2
- package/src/types/dist/schemes/commands/CreateTopic.d.ts +0 -12
- package/src/types/dist/schemes/commands/CreateTopic.js +0 -2
- package/src/types/dist/schemes/commands/DeassignRole.d.ts +0 -6
- package/src/types/dist/schemes/commands/DeassignRole.js +0 -2
- package/src/types/dist/schemes/commands/DeleteOwner.d.ts +0 -5
- package/src/types/dist/schemes/commands/DeleteOwner.js +0 -2
- package/src/types/dist/schemes/commands/DeleteRole.d.ts +0 -4
- package/src/types/dist/schemes/commands/DeleteRole.js +0 -2
- package/src/types/dist/schemes/commands/DeleteRoom.d.ts +0 -3
- package/src/types/dist/schemes/commands/DeleteRoom.js +0 -2
- package/src/types/dist/schemes/commands/DeleteSpace.d.ts +0 -3
- package/src/types/dist/schemes/commands/DeleteSpace.js +0 -2
- package/src/types/dist/schemes/commands/DeleteTopic.d.ts +0 -4
- package/src/types/dist/schemes/commands/DeleteTopic.js +0 -2
- package/src/types/dist/schemes/commands/FollowTopic.d.ts +0 -4
- package/src/types/dist/schemes/commands/FollowTopic.js +0 -2
- package/src/types/dist/schemes/commands/GetComputedPermissions.d.ts +0 -4
- package/src/types/dist/schemes/commands/GetComputedPermissions.js +0 -2
- package/src/types/dist/schemes/commands/GetFollowedTopics.d.ts +0 -4
- package/src/types/dist/schemes/commands/GetFollowedTopics.js +0 -2
- package/src/types/dist/schemes/commands/GetOwners.d.ts +0 -4
- package/src/types/dist/schemes/commands/GetOwners.js +0 -2
- package/src/types/dist/schemes/commands/GetPermissionOverwriteTargets.d.ts +0 -4
- package/src/types/dist/schemes/commands/GetPermissionOverwriteTargets.js +0 -2
- package/src/types/dist/schemes/commands/GetPermissionOverwrites.d.ts +0 -6
- package/src/types/dist/schemes/commands/GetPermissionOverwrites.js +0 -2
- package/src/types/dist/schemes/commands/GetRoomMembers.d.ts +0 -3
- package/src/types/dist/schemes/commands/GetRoomMembers.js +0 -2
- package/src/types/dist/schemes/commands/GetSession.d.ts +0 -2
- package/src/types/dist/schemes/commands/GetSession.js +0 -2
- package/src/types/dist/schemes/commands/GetSpaceMembers.d.ts +0 -3
- package/src/types/dist/schemes/commands/GetSpaceMembers.js +0 -2
- package/src/types/dist/schemes/commands/GetSpaceRooms.d.ts +0 -3
- package/src/types/dist/schemes/commands/GetSpaceRooms.js +0 -2
- package/src/types/dist/schemes/commands/JoinRoom.d.ts +0 -3
- package/src/types/dist/schemes/commands/JoinRoom.js +0 -2
- package/src/types/dist/schemes/commands/JoinSpace.d.ts +0 -3
- package/src/types/dist/schemes/commands/JoinSpace.js +0 -2
- package/src/types/dist/schemes/commands/LeaveRoom.d.ts +0 -3
- package/src/types/dist/schemes/commands/LeaveRoom.js +0 -2
- package/src/types/dist/schemes/commands/LeaveSpace.d.ts +0 -3
- package/src/types/dist/schemes/commands/LeaveSpace.js +0 -2
- package/src/types/dist/schemes/commands/SetPermissionOverwrites.d.ts +0 -8
- package/src/types/dist/schemes/commands/SetPermissionOverwrites.js +0 -2
- package/src/types/dist/schemes/commands/UnfollowTopic.d.ts +0 -4
- package/src/types/dist/schemes/commands/UnfollowTopic.js +0 -2
- package/src/types/dist/schemes/commands/UpdateRole.d.ts +0 -7
- package/src/types/dist/schemes/commands/UpdateRole.js +0 -2
- package/src/types/dist/schemes/commands/UpdateRoom.d.ts +0 -5
- package/src/types/dist/schemes/commands/UpdateRoom.js +0 -2
- package/src/types/dist/schemes/commands/UpdateSpace.d.ts +0 -4
- package/src/types/dist/schemes/commands/UpdateSpace.js +0 -2
- package/src/types/dist/schemes/events/Bye.d.ts +0 -3
- package/src/types/dist/schemes/events/Bye.js +0 -2
- package/src/types/dist/schemes/events/ComputedPermissions.d.ts +0 -5
- package/src/types/dist/schemes/events/ComputedPermissions.js +0 -2
- package/src/types/dist/schemes/events/Error.d.ts +0 -4
- package/src/types/dist/schemes/events/Error.js +0 -2
- package/src/types/dist/schemes/events/FollowedTopicUpdated.d.ts +0 -4
- package/src/types/dist/schemes/events/FollowedTopicUpdated.js +0 -2
- package/src/types/dist/schemes/events/FollowedTopics.d.ts +0 -6
- package/src/types/dist/schemes/events/FollowedTopics.js +0 -2
- package/src/types/dist/schemes/events/NewMessage.js +0 -2
- package/src/types/dist/schemes/events/NewRole.d.ts +0 -5
- package/src/types/dist/schemes/events/NewRole.js +0 -2
- package/src/types/dist/schemes/events/NewRoom.d.ts +0 -5
- package/src/types/dist/schemes/events/NewRoom.js +0 -2
- package/src/types/dist/schemes/events/NewTopic.d.ts +0 -5
- package/src/types/dist/schemes/events/NewTopic.js +0 -2
- package/src/types/dist/schemes/events/Ok.d.ts +0 -2
- package/src/types/dist/schemes/events/Ok.js +0 -2
- package/src/types/dist/schemes/events/Owners.d.ts +0 -8
- package/src/types/dist/schemes/events/Owners.js +0 -2
- package/src/types/dist/schemes/events/PermissionOverwriteTargets.d.ts +0 -10
- package/src/types/dist/schemes/events/PermissionOverwriteTargets.js +0 -2
- package/src/types/dist/schemes/events/PermissionOverwrites.d.ts +0 -8
- package/src/types/dist/schemes/events/PermissionOverwrites.js +0 -2
- package/src/types/dist/schemes/events/PermissionOverwritesUpdated.d.ts +0 -8
- package/src/types/dist/schemes/events/PermissionOverwritesUpdated.js +0 -2
- package/src/types/dist/schemes/events/RoleDeleted.d.ts +0 -4
- package/src/types/dist/schemes/events/RoleDeleted.js +0 -2
- package/src/types/dist/schemes/events/RoleUpdated.d.ts +0 -5
- package/src/types/dist/schemes/events/RoleUpdated.js +0 -2
- package/src/types/dist/schemes/events/RoomDeleted.d.ts +0 -3
- package/src/types/dist/schemes/events/RoomDeleted.js +0 -2
- package/src/types/dist/schemes/events/RoomJoined.d.ts +0 -4
- package/src/types/dist/schemes/events/RoomJoined.js +0 -2
- package/src/types/dist/schemes/events/RoomLeft.d.ts +0 -3
- package/src/types/dist/schemes/events/RoomLeft.js +0 -2
- package/src/types/dist/schemes/events/RoomMemberJoined.d.ts +0 -5
- package/src/types/dist/schemes/events/RoomMemberJoined.js +0 -2
- package/src/types/dist/schemes/events/RoomMemberLeft.d.ts +0 -4
- package/src/types/dist/schemes/events/RoomMemberLeft.js +0 -2
- package/src/types/dist/schemes/events/RoomMemberUpdated.d.ts +0 -6
- package/src/types/dist/schemes/events/RoomMemberUpdated.js +0 -2
- package/src/types/dist/schemes/events/RoomMembers.d.ts +0 -5
- package/src/types/dist/schemes/events/RoomMembers.js +0 -2
- package/src/types/dist/schemes/events/RoomUpdated.d.ts +0 -4
- package/src/types/dist/schemes/events/RoomUpdated.js +0 -2
- package/src/types/dist/schemes/events/Session.d.ts +0 -7
- package/src/types/dist/schemes/events/Session.js +0 -2
- package/src/types/dist/schemes/events/SpaceDeleted.d.ts +0 -3
- package/src/types/dist/schemes/events/SpaceDeleted.js +0 -2
- package/src/types/dist/schemes/events/SpaceJoined.d.ts +0 -4
- package/src/types/dist/schemes/events/SpaceJoined.js +0 -2
- package/src/types/dist/schemes/events/SpaceLeft.d.ts +0 -3
- package/src/types/dist/schemes/events/SpaceLeft.js +0 -2
- package/src/types/dist/schemes/events/SpaceMemberJoined.d.ts +0 -5
- package/src/types/dist/schemes/events/SpaceMemberJoined.js +0 -2
- package/src/types/dist/schemes/events/SpaceMemberLeft.d.ts +0 -4
- package/src/types/dist/schemes/events/SpaceMemberLeft.js +0 -2
- package/src/types/dist/schemes/events/SpaceMemberUpdated.d.ts +0 -6
- package/src/types/dist/schemes/events/SpaceMemberUpdated.js +0 -2
- package/src/types/dist/schemes/events/SpaceMembers.d.ts +0 -5
- package/src/types/dist/schemes/events/SpaceMembers.js +0 -2
- package/src/types/dist/schemes/events/SpaceRooms.d.ts +0 -5
- package/src/types/dist/schemes/events/SpaceRooms.js +0 -2
- package/src/types/dist/schemes/events/SpaceUpdated.d.ts +0 -4
- package/src/types/dist/schemes/events/SpaceUpdated.js +0 -2
- package/src/types/dist/schemes/events/TopicDeleted.d.ts +0 -4
- package/src/types/dist/schemes/events/TopicDeleted.js +0 -2
- package/src/types/dist/schemes/events/TopicFollowed.d.ts +0 -4
- package/src/types/dist/schemes/events/TopicFollowed.js +0 -2
- package/src/types/dist/schemes/events/TopicUnfollowed.d.ts +0 -4
- package/src/types/dist/schemes/events/TopicUnfollowed.js +0 -2
- package/src/types/dist/schemes/events/UserUpdated.d.ts +0 -4
- package/src/types/dist/schemes/events/UserUpdated.js +0 -2
package/build/index.js
CHANGED
|
@@ -621,20 +621,721 @@ var PromiseRegistry = /*#__PURE__*/function () {
|
|
|
621
621
|
}]);
|
|
622
622
|
return PromiseRegistry;
|
|
623
623
|
}();
|
|
624
|
+
;// CONCATENATED MODULE: ./src/state-tracker/TopicHistoryWindow.ts
|
|
625
|
+
function TopicHistoryWindow_typeof(obj) { "@babel/helpers - typeof"; return TopicHistoryWindow_typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, TopicHistoryWindow_typeof(obj); }
|
|
626
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
627
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { TopicHistoryWindow_defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
628
|
+
function TopicHistoryWindow_toConsumableArray(arr) { return TopicHistoryWindow_arrayWithoutHoles(arr) || TopicHistoryWindow_iterableToArray(arr) || TopicHistoryWindow_unsupportedIterableToArray(arr) || TopicHistoryWindow_nonIterableSpread(); }
|
|
629
|
+
function TopicHistoryWindow_nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
630
|
+
function TopicHistoryWindow_unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return TopicHistoryWindow_arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return TopicHistoryWindow_arrayLikeToArray(o, minLen); }
|
|
631
|
+
function TopicHistoryWindow_iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
632
|
+
function TopicHistoryWindow_arrayWithoutHoles(arr) { if (Array.isArray(arr)) return TopicHistoryWindow_arrayLikeToArray(arr); }
|
|
633
|
+
function TopicHistoryWindow_arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
634
|
+
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, "_invoke", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == TopicHistoryWindow_typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, "_invoke", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var methodName = context.method, method = delegate.iterator[methodName]; if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator["return"] && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel; var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) { if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; } return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) { keys.push(key); } return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) { "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); } }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, "catch": function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
|
|
635
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
636
|
+
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
637
|
+
function TopicHistoryWindow_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
638
|
+
function TopicHistoryWindow_defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, TopicHistoryWindow_toPropertyKey(descriptor.key), descriptor); } }
|
|
639
|
+
function TopicHistoryWindow_createClass(Constructor, protoProps, staticProps) { if (protoProps) TopicHistoryWindow_defineProperties(Constructor.prototype, protoProps); if (staticProps) TopicHistoryWindow_defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
640
|
+
function TopicHistoryWindow_inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) TopicHistoryWindow_setPrototypeOf(subClass, superClass); }
|
|
641
|
+
function TopicHistoryWindow_setPrototypeOf(o, p) { TopicHistoryWindow_setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return TopicHistoryWindow_setPrototypeOf(o, p); }
|
|
642
|
+
function TopicHistoryWindow_createSuper(Derived) { var hasNativeReflectConstruct = TopicHistoryWindow_isNativeReflectConstruct(); return function _createSuperInternal() { var Super = TopicHistoryWindow_getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = TopicHistoryWindow_getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return TopicHistoryWindow_possibleConstructorReturn(this, result); }; }
|
|
643
|
+
function TopicHistoryWindow_possibleConstructorReturn(self, call) { if (call && (TopicHistoryWindow_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return TopicHistoryWindow_assertThisInitialized(self); }
|
|
644
|
+
function TopicHistoryWindow_assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
645
|
+
function TopicHistoryWindow_isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
646
|
+
function TopicHistoryWindow_getPrototypeOf(o) { TopicHistoryWindow_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return TopicHistoryWindow_getPrototypeOf(o); }
|
|
647
|
+
function TopicHistoryWindow_defineProperty(obj, key, value) { key = TopicHistoryWindow_toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
648
|
+
function TopicHistoryWindow_toPropertyKey(arg) { var key = TopicHistoryWindow_toPrimitive(arg, "string"); return TopicHistoryWindow_typeof(key) === "symbol" ? key : String(key); }
|
|
649
|
+
function TopicHistoryWindow_toPrimitive(input, hint) { if (TopicHistoryWindow_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (TopicHistoryWindow_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
650
|
+
|
|
651
|
+
var WindowState;
|
|
652
|
+
(function (WindowState) {
|
|
653
|
+
WindowState[WindowState["UNINITIALIZED"] = 0] = "UNINITIALIZED";
|
|
654
|
+
WindowState[WindowState["LATEST"] = 1] = "LATEST";
|
|
655
|
+
WindowState[WindowState["PAST"] = 2] = "PAST";
|
|
656
|
+
})(WindowState || (WindowState = {}));
|
|
657
|
+
var TraversableRemoteCollection = /*#__PURE__*/function (_ObservableIndexedObj) {
|
|
658
|
+
TopicHistoryWindow_inherits(TraversableRemoteCollection, _ObservableIndexedObj);
|
|
659
|
+
var _super = TopicHistoryWindow_createSuper(TraversableRemoteCollection);
|
|
660
|
+
function TraversableRemoteCollection() {
|
|
661
|
+
var _this;
|
|
662
|
+
TopicHistoryWindow_classCallCheck(this, TraversableRemoteCollection);
|
|
663
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
664
|
+
args[_key] = arguments[_key];
|
|
665
|
+
}
|
|
666
|
+
_this = _super.call.apply(_super, [this].concat(args));
|
|
667
|
+
TopicHistoryWindow_defineProperty(TopicHistoryWindow_assertThisInitialized(_this), "limit", 50);
|
|
668
|
+
TopicHistoryWindow_defineProperty(TopicHistoryWindow_assertThisInitialized(_this), "currentState", WindowState.UNINITIALIZED);
|
|
669
|
+
TopicHistoryWindow_defineProperty(TopicHistoryWindow_assertThisInitialized(_this), "fetchingState", undefined);
|
|
670
|
+
return _this;
|
|
671
|
+
}
|
|
672
|
+
TopicHistoryWindow_createClass(TraversableRemoteCollection, [{
|
|
673
|
+
key: "state",
|
|
674
|
+
get:
|
|
675
|
+
/**
|
|
676
|
+
* Current mode od collection window. To change mode, call one of available fetch methods.
|
|
677
|
+
*/
|
|
678
|
+
function get() {
|
|
679
|
+
return this.currentState;
|
|
680
|
+
}
|
|
681
|
+
|
|
682
|
+
/**
|
|
683
|
+
* Maximum numer of items stored in window.
|
|
684
|
+
* Null for unlimited.
|
|
685
|
+
*/
|
|
686
|
+
}, {
|
|
687
|
+
key: "resetToLatest",
|
|
688
|
+
value: function () {
|
|
689
|
+
var _resetToLatest = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
690
|
+
var result;
|
|
691
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
692
|
+
while (1) {
|
|
693
|
+
switch (_context.prev = _context.next) {
|
|
694
|
+
case 0:
|
|
695
|
+
this.throwIfFetchingInProgress();
|
|
696
|
+
if (!(this.currentState === WindowState.LATEST)) {
|
|
697
|
+
_context.next = 3;
|
|
698
|
+
break;
|
|
699
|
+
}
|
|
700
|
+
return _context.abrupt("return");
|
|
701
|
+
case 3:
|
|
702
|
+
this.fetchingState = WindowState.LATEST;
|
|
703
|
+
_context.prev = 4;
|
|
704
|
+
_context.next = 7;
|
|
705
|
+
return this.fetchLatestItems();
|
|
706
|
+
case 7:
|
|
707
|
+
result = _context.sent;
|
|
708
|
+
case 8:
|
|
709
|
+
_context.prev = 8;
|
|
710
|
+
this.fetchingState = undefined;
|
|
711
|
+
return _context.finish(8);
|
|
712
|
+
case 11:
|
|
713
|
+
this.deleteAll();
|
|
714
|
+
this.addItems(result, 'tail');
|
|
715
|
+
this.currentState = WindowState.LATEST;
|
|
716
|
+
case 14:
|
|
717
|
+
case "end":
|
|
718
|
+
return _context.stop();
|
|
719
|
+
}
|
|
720
|
+
}
|
|
721
|
+
}, _callee, this, [[4,, 8, 11]]);
|
|
722
|
+
}));
|
|
723
|
+
function resetToLatest() {
|
|
724
|
+
return _resetToLatest.apply(this, arguments);
|
|
725
|
+
}
|
|
726
|
+
return resetToLatest;
|
|
727
|
+
}()
|
|
728
|
+
}, {
|
|
729
|
+
key: "fetchPrevious",
|
|
730
|
+
value: function () {
|
|
731
|
+
var _fetchPrevious = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
732
|
+
var result;
|
|
733
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
734
|
+
while (1) {
|
|
735
|
+
switch (_context2.prev = _context2.next) {
|
|
736
|
+
case 0:
|
|
737
|
+
this.throwIfFetchingInProgress();
|
|
738
|
+
this.fetchingState = WindowState.PAST;
|
|
739
|
+
_context2.prev = 2;
|
|
740
|
+
_context2.next = 5;
|
|
741
|
+
return this.fetchItemsBefore();
|
|
742
|
+
case 5:
|
|
743
|
+
result = _context2.sent;
|
|
744
|
+
case 6:
|
|
745
|
+
_context2.prev = 6;
|
|
746
|
+
this.fetchingState = undefined;
|
|
747
|
+
return _context2.finish(6);
|
|
748
|
+
case 9:
|
|
749
|
+
if (result) {
|
|
750
|
+
_context2.next = 11;
|
|
751
|
+
break;
|
|
752
|
+
}
|
|
753
|
+
return _context2.abrupt("return", this.resetToLatest());
|
|
754
|
+
case 11:
|
|
755
|
+
if (!result.length) {
|
|
756
|
+
_context2.next = 21;
|
|
757
|
+
break;
|
|
758
|
+
}
|
|
759
|
+
this.addItems(result, 'head');
|
|
760
|
+
_context2.next = 15;
|
|
761
|
+
return this.isLatestItemLoaded();
|
|
762
|
+
case 15:
|
|
763
|
+
if (!_context2.sent) {
|
|
764
|
+
_context2.next = 19;
|
|
765
|
+
break;
|
|
766
|
+
}
|
|
767
|
+
_context2.t0 = WindowState.LATEST;
|
|
768
|
+
_context2.next = 20;
|
|
769
|
+
break;
|
|
770
|
+
case 19:
|
|
771
|
+
_context2.t0 = WindowState.PAST;
|
|
772
|
+
case 20:
|
|
773
|
+
this.currentState = _context2.t0;
|
|
774
|
+
case 21:
|
|
775
|
+
case "end":
|
|
776
|
+
return _context2.stop();
|
|
777
|
+
}
|
|
778
|
+
}
|
|
779
|
+
}, _callee2, this, [[2,, 6, 9]]);
|
|
780
|
+
}));
|
|
781
|
+
function fetchPrevious() {
|
|
782
|
+
return _fetchPrevious.apply(this, arguments);
|
|
783
|
+
}
|
|
784
|
+
return fetchPrevious;
|
|
785
|
+
}()
|
|
786
|
+
}, {
|
|
787
|
+
key: "fetchNext",
|
|
788
|
+
value: function () {
|
|
789
|
+
var _fetchNext = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
|
|
790
|
+
var result;
|
|
791
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
792
|
+
while (1) {
|
|
793
|
+
switch (_context3.prev = _context3.next) {
|
|
794
|
+
case 0:
|
|
795
|
+
this.throwIfFetchingInProgress();
|
|
796
|
+
_context3.prev = 1;
|
|
797
|
+
_context3.next = 4;
|
|
798
|
+
return this.fetchItemsAfter();
|
|
799
|
+
case 4:
|
|
800
|
+
result = _context3.sent;
|
|
801
|
+
case 5:
|
|
802
|
+
_context3.prev = 5;
|
|
803
|
+
this.fetchingState = undefined;
|
|
804
|
+
return _context3.finish(5);
|
|
805
|
+
case 8:
|
|
806
|
+
if (result) {
|
|
807
|
+
_context3.next = 12;
|
|
808
|
+
break;
|
|
809
|
+
}
|
|
810
|
+
_context3.next = 11;
|
|
811
|
+
return this.resetToLatest();
|
|
812
|
+
case 11:
|
|
813
|
+
return _context3.abrupt("return");
|
|
814
|
+
case 12:
|
|
815
|
+
if (!result.length) {
|
|
816
|
+
_context3.next = 16;
|
|
817
|
+
break;
|
|
818
|
+
}
|
|
819
|
+
this.addItems(result, 'tail');
|
|
820
|
+
_context3.next = 16;
|
|
821
|
+
return this.refreshMode();
|
|
822
|
+
case 16:
|
|
823
|
+
case "end":
|
|
824
|
+
return _context3.stop();
|
|
825
|
+
}
|
|
826
|
+
}
|
|
827
|
+
}, _callee3, this, [[1,, 5, 8]]);
|
|
828
|
+
}));
|
|
829
|
+
function fetchNext() {
|
|
830
|
+
return _fetchNext.apply(this, arguments);
|
|
831
|
+
}
|
|
832
|
+
return fetchNext;
|
|
833
|
+
}()
|
|
834
|
+
}, {
|
|
835
|
+
key: "refreshMode",
|
|
836
|
+
value: function () {
|
|
837
|
+
var _refreshMode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
|
|
838
|
+
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
839
|
+
while (1) {
|
|
840
|
+
switch (_context4.prev = _context4.next) {
|
|
841
|
+
case 0:
|
|
842
|
+
_context4.next = 2;
|
|
843
|
+
return this.isLatestItemLoaded();
|
|
844
|
+
case 2:
|
|
845
|
+
if (!_context4.sent) {
|
|
846
|
+
_context4.next = 6;
|
|
847
|
+
break;
|
|
848
|
+
}
|
|
849
|
+
_context4.t0 = WindowState.LATEST;
|
|
850
|
+
_context4.next = 7;
|
|
851
|
+
break;
|
|
852
|
+
case 6:
|
|
853
|
+
_context4.t0 = WindowState.PAST;
|
|
854
|
+
case 7:
|
|
855
|
+
this.currentState = _context4.t0;
|
|
856
|
+
case 8:
|
|
857
|
+
case "end":
|
|
858
|
+
return _context4.stop();
|
|
859
|
+
}
|
|
860
|
+
}
|
|
861
|
+
}, _callee4, this);
|
|
862
|
+
}));
|
|
863
|
+
function refreshMode() {
|
|
864
|
+
return _refreshMode.apply(this, arguments);
|
|
865
|
+
}
|
|
866
|
+
return refreshMode;
|
|
867
|
+
}()
|
|
868
|
+
}, {
|
|
869
|
+
key: "throwIfFetchingInProgress",
|
|
870
|
+
value: function throwIfFetchingInProgress() {
|
|
871
|
+
if (this.fetchingState) {
|
|
872
|
+
throw new Error("Items fetching in progress: ".concat(WindowState[this.fetchingState]));
|
|
873
|
+
}
|
|
874
|
+
}
|
|
875
|
+
}, {
|
|
876
|
+
key: "addItems",
|
|
877
|
+
value: function addItems(newItems, to) {
|
|
878
|
+
var result;
|
|
879
|
+
if (to === 'head') {
|
|
880
|
+
result = this.trimItemsArrayToLimit([].concat(TopicHistoryWindow_toConsumableArray(newItems), TopicHistoryWindow_toConsumableArray(this.items)), 'tail');
|
|
881
|
+
}
|
|
882
|
+
if (to === 'tail') {
|
|
883
|
+
result = this.trimItemsArrayToLimit([].concat(TopicHistoryWindow_toConsumableArray(this.items), TopicHistoryWindow_toConsumableArray(newItems)), 'head');
|
|
884
|
+
}
|
|
885
|
+
this.deleteAll();
|
|
886
|
+
this.set.apply(this, TopicHistoryWindow_toConsumableArray(result));
|
|
887
|
+
}
|
|
888
|
+
|
|
889
|
+
/**
|
|
890
|
+
* Return array with messages of count that matching limit.
|
|
891
|
+
*/
|
|
892
|
+
}, {
|
|
893
|
+
key: "trimItemsArrayToLimit",
|
|
894
|
+
value: function trimItemsArrayToLimit(items, from) {
|
|
895
|
+
if (this.limit === null) {
|
|
896
|
+
return items;
|
|
897
|
+
}
|
|
898
|
+
if (from === 'head') {
|
|
899
|
+
return items.slice(-this.limit);
|
|
900
|
+
}
|
|
901
|
+
if (from === 'tail') {
|
|
902
|
+
return items.slice(0, this.limit);
|
|
903
|
+
}
|
|
904
|
+
}
|
|
905
|
+
}]);
|
|
906
|
+
return TraversableRemoteCollection;
|
|
907
|
+
}(ObservableIndexedObjectCollection);
|
|
908
|
+
var TopicHistoryWindow = /*#__PURE__*/function (_TraversableRemoteCol) {
|
|
909
|
+
TopicHistoryWindow_inherits(TopicHistoryWindow, _TraversableRemoteCol);
|
|
910
|
+
var _super2 = TopicHistoryWindow_createSuper(TopicHistoryWindow);
|
|
911
|
+
/**
|
|
912
|
+
* Reexported available window modes enum.
|
|
913
|
+
*/
|
|
914
|
+
|
|
915
|
+
function TopicHistoryWindow(roomId, topicId, tracker) {
|
|
916
|
+
var _this2;
|
|
917
|
+
TopicHistoryWindow_classCallCheck(this, TopicHistoryWindow);
|
|
918
|
+
_this2 = _super2.call(this, 'id');
|
|
919
|
+
_this2.roomId = roomId;
|
|
920
|
+
_this2.topicId = topicId;
|
|
921
|
+
_this2.tracker = tracker;
|
|
922
|
+
TopicHistoryWindow_defineProperty(TopicHistoryWindow_assertThisInitialized(_this2), "WindowState", WindowState);
|
|
923
|
+
_this2.tracker.client.on('Session', function (ev) {
|
|
924
|
+
return _this2.handleSession(ev);
|
|
925
|
+
});
|
|
926
|
+
_this2.tracker.client.on('NewMessage', function (ev) {
|
|
927
|
+
return _this2.handleNewMessage(ev);
|
|
928
|
+
});
|
|
929
|
+
return _this2;
|
|
930
|
+
}
|
|
931
|
+
|
|
932
|
+
/**
|
|
933
|
+
* For internal use.
|
|
934
|
+
* @internal
|
|
935
|
+
*/
|
|
936
|
+
TopicHistoryWindow_createClass(TopicHistoryWindow, [{
|
|
937
|
+
key: "_setTopicReference",
|
|
938
|
+
value: function _setTopicReference(ref) {
|
|
939
|
+
var refMessage = this.get(ref.messageId);
|
|
940
|
+
if (refMessage) {
|
|
941
|
+
// Update referenced topic ID in message
|
|
942
|
+
this.set(_objectSpread(_objectSpread({}, refMessage), {}, {
|
|
943
|
+
topicRef: ref.topicId
|
|
944
|
+
}));
|
|
945
|
+
}
|
|
946
|
+
}
|
|
947
|
+
}, {
|
|
948
|
+
key: "handleNewMessage",
|
|
949
|
+
value: function () {
|
|
950
|
+
var _handleNewMessage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(ev) {
|
|
951
|
+
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
952
|
+
while (1) {
|
|
953
|
+
switch (_context5.prev = _context5.next) {
|
|
954
|
+
case 0:
|
|
955
|
+
if (!([WindowState.LATEST, WindowState.UNINITIALIZED].includes(this.state) && ev.location.roomId === this.roomId && ev.location.topicId === this.topicId)) {
|
|
956
|
+
_context5.next = 5;
|
|
957
|
+
break;
|
|
958
|
+
}
|
|
959
|
+
this.set(ev.message);
|
|
960
|
+
if (!(this.state === WindowState.UNINITIALIZED)) {
|
|
961
|
+
_context5.next = 5;
|
|
962
|
+
break;
|
|
963
|
+
}
|
|
964
|
+
_context5.next = 5;
|
|
965
|
+
return this.refreshMode();
|
|
966
|
+
case 5:
|
|
967
|
+
case "end":
|
|
968
|
+
return _context5.stop();
|
|
969
|
+
}
|
|
970
|
+
}
|
|
971
|
+
}, _callee5, this);
|
|
972
|
+
}));
|
|
973
|
+
function handleNewMessage(_x) {
|
|
974
|
+
return _handleNewMessage.apply(this, arguments);
|
|
975
|
+
}
|
|
976
|
+
return handleNewMessage;
|
|
977
|
+
}()
|
|
978
|
+
}, {
|
|
979
|
+
key: "handleSession",
|
|
980
|
+
value: function handleSession(ev) {
|
|
981
|
+
this.resetToLatest();
|
|
982
|
+
}
|
|
983
|
+
}, {
|
|
984
|
+
key: "fetchItemsAfter",
|
|
985
|
+
value: function () {
|
|
986
|
+
var _fetchItemsAfter = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {
|
|
987
|
+
var _this$getAt;
|
|
988
|
+
var afterId, result;
|
|
989
|
+
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
990
|
+
while (1) {
|
|
991
|
+
switch (_context6.prev = _context6.next) {
|
|
992
|
+
case 0:
|
|
993
|
+
afterId = (_this$getAt = this.getAt(this.length - 1)) === null || _this$getAt === void 0 ? void 0 : _this$getAt.id;
|
|
994
|
+
if (afterId) {
|
|
995
|
+
_context6.next = 3;
|
|
996
|
+
break;
|
|
997
|
+
}
|
|
998
|
+
return _context6.abrupt("return", null);
|
|
999
|
+
case 3:
|
|
1000
|
+
_context6.next = 5;
|
|
1001
|
+
return this.tracker.client.send('GetMessages', {
|
|
1002
|
+
location: {
|
|
1003
|
+
roomId: this.roomId,
|
|
1004
|
+
topicId: this.topicId
|
|
1005
|
+
},
|
|
1006
|
+
after: afterId
|
|
1007
|
+
});
|
|
1008
|
+
case 5:
|
|
1009
|
+
result = _context6.sent;
|
|
1010
|
+
if (!result.error) {
|
|
1011
|
+
_context6.next = 8;
|
|
1012
|
+
break;
|
|
1013
|
+
}
|
|
1014
|
+
throw new Error("Cannot fetch messages: ".concat(result.error.message));
|
|
1015
|
+
case 8:
|
|
1016
|
+
return _context6.abrupt("return", result.data.messages);
|
|
1017
|
+
case 9:
|
|
1018
|
+
case "end":
|
|
1019
|
+
return _context6.stop();
|
|
1020
|
+
}
|
|
1021
|
+
}
|
|
1022
|
+
}, _callee6, this);
|
|
1023
|
+
}));
|
|
1024
|
+
function fetchItemsAfter() {
|
|
1025
|
+
return _fetchItemsAfter.apply(this, arguments);
|
|
1026
|
+
}
|
|
1027
|
+
return fetchItemsAfter;
|
|
1028
|
+
}()
|
|
1029
|
+
}, {
|
|
1030
|
+
key: "fetchItemsBefore",
|
|
1031
|
+
value: function () {
|
|
1032
|
+
var _fetchItemsBefore = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7() {
|
|
1033
|
+
var _this$getAt2;
|
|
1034
|
+
var beforeId, result;
|
|
1035
|
+
return _regeneratorRuntime().wrap(function _callee7$(_context7) {
|
|
1036
|
+
while (1) {
|
|
1037
|
+
switch (_context7.prev = _context7.next) {
|
|
1038
|
+
case 0:
|
|
1039
|
+
beforeId = (_this$getAt2 = this.getAt(0)) === null || _this$getAt2 === void 0 ? void 0 : _this$getAt2.id;
|
|
1040
|
+
if (beforeId) {
|
|
1041
|
+
_context7.next = 3;
|
|
1042
|
+
break;
|
|
1043
|
+
}
|
|
1044
|
+
return _context7.abrupt("return", null);
|
|
1045
|
+
case 3:
|
|
1046
|
+
_context7.next = 5;
|
|
1047
|
+
return this.tracker.client.send('GetMessages', {
|
|
1048
|
+
location: {
|
|
1049
|
+
roomId: this.roomId,
|
|
1050
|
+
topicId: this.topicId
|
|
1051
|
+
},
|
|
1052
|
+
before: beforeId
|
|
1053
|
+
});
|
|
1054
|
+
case 5:
|
|
1055
|
+
result = _context7.sent;
|
|
1056
|
+
if (!result.error) {
|
|
1057
|
+
_context7.next = 8;
|
|
1058
|
+
break;
|
|
1059
|
+
}
|
|
1060
|
+
throw new Error("Cannot fetch messages: ".concat(result.error.message));
|
|
1061
|
+
case 8:
|
|
1062
|
+
return _context7.abrupt("return", result.data.messages);
|
|
1063
|
+
case 9:
|
|
1064
|
+
case "end":
|
|
1065
|
+
return _context7.stop();
|
|
1066
|
+
}
|
|
1067
|
+
}
|
|
1068
|
+
}, _callee7, this);
|
|
1069
|
+
}));
|
|
1070
|
+
function fetchItemsBefore() {
|
|
1071
|
+
return _fetchItemsBefore.apply(this, arguments);
|
|
1072
|
+
}
|
|
1073
|
+
return fetchItemsBefore;
|
|
1074
|
+
}()
|
|
1075
|
+
}, {
|
|
1076
|
+
key: "fetchLatestItems",
|
|
1077
|
+
value: function () {
|
|
1078
|
+
var _fetchLatestItems = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8() {
|
|
1079
|
+
var result;
|
|
1080
|
+
return _regeneratorRuntime().wrap(function _callee8$(_context8) {
|
|
1081
|
+
while (1) {
|
|
1082
|
+
switch (_context8.prev = _context8.next) {
|
|
1083
|
+
case 0:
|
|
1084
|
+
_context8.next = 2;
|
|
1085
|
+
return this.tracker.client.send('GetMessages', {
|
|
1086
|
+
location: {
|
|
1087
|
+
roomId: this.roomId,
|
|
1088
|
+
topicId: this.topicId
|
|
1089
|
+
}
|
|
1090
|
+
});
|
|
1091
|
+
case 2:
|
|
1092
|
+
result = _context8.sent;
|
|
1093
|
+
if (!result.error) {
|
|
1094
|
+
_context8.next = 5;
|
|
1095
|
+
break;
|
|
1096
|
+
}
|
|
1097
|
+
throw new Error("Cannot fetch messages: ".concat(result.error.message));
|
|
1098
|
+
case 5:
|
|
1099
|
+
return _context8.abrupt("return", result.data.messages);
|
|
1100
|
+
case 6:
|
|
1101
|
+
case "end":
|
|
1102
|
+
return _context8.stop();
|
|
1103
|
+
}
|
|
1104
|
+
}
|
|
1105
|
+
}, _callee8, this);
|
|
1106
|
+
}));
|
|
1107
|
+
function fetchLatestItems() {
|
|
1108
|
+
return _fetchLatestItems.apply(this, arguments);
|
|
1109
|
+
}
|
|
1110
|
+
return fetchLatestItems;
|
|
1111
|
+
}()
|
|
1112
|
+
}, {
|
|
1113
|
+
key: "getTopic",
|
|
1114
|
+
value: function () {
|
|
1115
|
+
var _getTopic = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9() {
|
|
1116
|
+
return _regeneratorRuntime().wrap(function _callee9$(_context9) {
|
|
1117
|
+
while (1) {
|
|
1118
|
+
switch (_context9.prev = _context9.next) {
|
|
1119
|
+
case 0:
|
|
1120
|
+
_context9.next = 2;
|
|
1121
|
+
return this.tracker.rooms.getTopics(this.roomId, [this.topicId]);
|
|
1122
|
+
case 2:
|
|
1123
|
+
return _context9.abrupt("return", _context9.sent.get(this.topicId));
|
|
1124
|
+
case 3:
|
|
1125
|
+
case "end":
|
|
1126
|
+
return _context9.stop();
|
|
1127
|
+
}
|
|
1128
|
+
}
|
|
1129
|
+
}, _callee9, this);
|
|
1130
|
+
}));
|
|
1131
|
+
function getTopic() {
|
|
1132
|
+
return _getTopic.apply(this, arguments);
|
|
1133
|
+
}
|
|
1134
|
+
return getTopic;
|
|
1135
|
+
}()
|
|
1136
|
+
}, {
|
|
1137
|
+
key: "getLatestMessageId",
|
|
1138
|
+
value: function () {
|
|
1139
|
+
var _getLatestMessageId = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10() {
|
|
1140
|
+
var _yield$this$getTopic, _yield$this$getTopic$;
|
|
1141
|
+
return _regeneratorRuntime().wrap(function _callee10$(_context10) {
|
|
1142
|
+
while (1) {
|
|
1143
|
+
switch (_context10.prev = _context10.next) {
|
|
1144
|
+
case 0:
|
|
1145
|
+
_context10.next = 2;
|
|
1146
|
+
return this.getTopic();
|
|
1147
|
+
case 2:
|
|
1148
|
+
_context10.t1 = _yield$this$getTopic = _context10.sent;
|
|
1149
|
+
_context10.t0 = _context10.t1 === null;
|
|
1150
|
+
if (_context10.t0) {
|
|
1151
|
+
_context10.next = 6;
|
|
1152
|
+
break;
|
|
1153
|
+
}
|
|
1154
|
+
_context10.t0 = _yield$this$getTopic === void 0;
|
|
1155
|
+
case 6:
|
|
1156
|
+
if (!_context10.t0) {
|
|
1157
|
+
_context10.next = 10;
|
|
1158
|
+
break;
|
|
1159
|
+
}
|
|
1160
|
+
_context10.t2 = void 0;
|
|
1161
|
+
_context10.next = 11;
|
|
1162
|
+
break;
|
|
1163
|
+
case 10:
|
|
1164
|
+
_context10.t2 = (_yield$this$getTopic$ = _yield$this$getTopic.lastMessage) === null || _yield$this$getTopic$ === void 0 ? void 0 : _yield$this$getTopic$.id;
|
|
1165
|
+
case 11:
|
|
1166
|
+
return _context10.abrupt("return", _context10.t2);
|
|
1167
|
+
case 12:
|
|
1168
|
+
case "end":
|
|
1169
|
+
return _context10.stop();
|
|
1170
|
+
}
|
|
1171
|
+
}
|
|
1172
|
+
}, _callee10, this);
|
|
1173
|
+
}));
|
|
1174
|
+
function getLatestMessageId() {
|
|
1175
|
+
return _getLatestMessageId.apply(this, arguments);
|
|
1176
|
+
}
|
|
1177
|
+
return getLatestMessageId;
|
|
1178
|
+
}()
|
|
1179
|
+
}, {
|
|
1180
|
+
key: "isLatestItemLoaded",
|
|
1181
|
+
value: function () {
|
|
1182
|
+
var _isLatestItemLoaded = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11() {
|
|
1183
|
+
var lastMessageId;
|
|
1184
|
+
return _regeneratorRuntime().wrap(function _callee11$(_context11) {
|
|
1185
|
+
while (1) {
|
|
1186
|
+
switch (_context11.prev = _context11.next) {
|
|
1187
|
+
case 0:
|
|
1188
|
+
_context11.next = 2;
|
|
1189
|
+
return this.getLatestMessageId();
|
|
1190
|
+
case 2:
|
|
1191
|
+
lastMessageId = _context11.sent;
|
|
1192
|
+
return _context11.abrupt("return", lastMessageId ? this.has(lastMessageId) : false);
|
|
1193
|
+
case 4:
|
|
1194
|
+
case "end":
|
|
1195
|
+
return _context11.stop();
|
|
1196
|
+
}
|
|
1197
|
+
}
|
|
1198
|
+
}, _callee11, this);
|
|
1199
|
+
}));
|
|
1200
|
+
function isLatestItemLoaded() {
|
|
1201
|
+
return _isLatestItemLoaded.apply(this, arguments);
|
|
1202
|
+
}
|
|
1203
|
+
return isLatestItemLoaded;
|
|
1204
|
+
}()
|
|
1205
|
+
}]);
|
|
1206
|
+
return TopicHistoryWindow;
|
|
1207
|
+
}(TraversableRemoteCollection);
|
|
1208
|
+
;// CONCATENATED MODULE: ./src/state-tracker/RoomMessagesHistory.ts
|
|
1209
|
+
function RoomMessagesHistory_typeof(obj) { "@babel/helpers - typeof"; return RoomMessagesHistory_typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, RoomMessagesHistory_typeof(obj); }
|
|
1210
|
+
function RoomMessagesHistory_regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ RoomMessagesHistory_regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, "_invoke", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == RoomMessagesHistory_typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, "_invoke", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var methodName = context.method, method = delegate.iterator[methodName]; if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator["return"] && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel; var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) { if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; } return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) { keys.push(key); } return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) { "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); } }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, "catch": function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
|
|
1211
|
+
function RoomMessagesHistory_asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
1212
|
+
function RoomMessagesHistory_asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { RoomMessagesHistory_asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { RoomMessagesHistory_asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
1213
|
+
function RoomMessagesHistory_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
1214
|
+
function RoomMessagesHistory_defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, RoomMessagesHistory_toPropertyKey(descriptor.key), descriptor); } }
|
|
1215
|
+
function RoomMessagesHistory_createClass(Constructor, protoProps, staticProps) { if (protoProps) RoomMessagesHistory_defineProperties(Constructor.prototype, protoProps); if (staticProps) RoomMessagesHistory_defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
1216
|
+
function RoomMessagesHistory_defineProperty(obj, key, value) { key = RoomMessagesHistory_toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
1217
|
+
function RoomMessagesHistory_toPropertyKey(arg) { var key = RoomMessagesHistory_toPrimitive(arg, "string"); return RoomMessagesHistory_typeof(key) === "symbol" ? key : String(key); }
|
|
1218
|
+
function RoomMessagesHistory_toPrimitive(input, hint) { if (RoomMessagesHistory_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (RoomMessagesHistory_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
1219
|
+
|
|
1220
|
+
|
|
1221
|
+
var RoomMessagesHistory = /*#__PURE__*/function () {
|
|
1222
|
+
function RoomMessagesHistory(room, tracker) {
|
|
1223
|
+
var _this = this;
|
|
1224
|
+
RoomMessagesHistory_classCallCheck(this, RoomMessagesHistory);
|
|
1225
|
+
this.room = room;
|
|
1226
|
+
this.tracker = tracker;
|
|
1227
|
+
RoomMessagesHistory_defineProperty(this, "historyWindows", new IndexedCollection());
|
|
1228
|
+
this.tracker.client.on('RoomUpdated', function (ev) {
|
|
1229
|
+
return _this.handleRoomUpdated(ev);
|
|
1230
|
+
});
|
|
1231
|
+
this.tracker.client.on('NewTopic', function (ev) {
|
|
1232
|
+
return _this.handleNewTopic(ev);
|
|
1233
|
+
});
|
|
1234
|
+
this.tracker.client.on('TopicDeleted', function (ev) {
|
|
1235
|
+
return _this.handleTopicDeleted(ev);
|
|
1236
|
+
});
|
|
1237
|
+
if (this.room.defaultTopic) {
|
|
1238
|
+
this.createHistoryWindowForTopic(this.room.defaultTopic);
|
|
1239
|
+
}
|
|
1240
|
+
}
|
|
1241
|
+
|
|
1242
|
+
/**
|
|
1243
|
+
* Returns a history window object for the given topic ID, allowing you to view message history.
|
|
1244
|
+
*/
|
|
1245
|
+
RoomMessagesHistory_createClass(RoomMessagesHistory, [{
|
|
1246
|
+
key: "getMessagesWindow",
|
|
1247
|
+
value: function () {
|
|
1248
|
+
var _getMessagesWindow = RoomMessagesHistory_asyncToGenerator( /*#__PURE__*/RoomMessagesHistory_regeneratorRuntime().mark(function _callee(topicId) {
|
|
1249
|
+
var historyWindow, topic;
|
|
1250
|
+
return RoomMessagesHistory_regeneratorRuntime().wrap(function _callee$(_context) {
|
|
1251
|
+
while (1) {
|
|
1252
|
+
switch (_context.prev = _context.next) {
|
|
1253
|
+
case 0:
|
|
1254
|
+
historyWindow = this.historyWindows.get(topicId);
|
|
1255
|
+
if (historyWindow) {
|
|
1256
|
+
_context.next = 6;
|
|
1257
|
+
break;
|
|
1258
|
+
}
|
|
1259
|
+
_context.next = 4;
|
|
1260
|
+
return this.tracker.rooms.getTopics(this.room.id, [topicId]);
|
|
1261
|
+
case 4:
|
|
1262
|
+
topic = _context.sent.get(topicId);
|
|
1263
|
+
if (topic) {
|
|
1264
|
+
this.createHistoryWindowForTopic(topic);
|
|
1265
|
+
}
|
|
1266
|
+
case 6:
|
|
1267
|
+
return _context.abrupt("return", this.historyWindows.get(topicId));
|
|
1268
|
+
case 7:
|
|
1269
|
+
case "end":
|
|
1270
|
+
return _context.stop();
|
|
1271
|
+
}
|
|
1272
|
+
}
|
|
1273
|
+
}, _callee, this);
|
|
1274
|
+
}));
|
|
1275
|
+
function getMessagesWindow(_x) {
|
|
1276
|
+
return _getMessagesWindow.apply(this, arguments);
|
|
1277
|
+
}
|
|
1278
|
+
return getMessagesWindow;
|
|
1279
|
+
}()
|
|
1280
|
+
}, {
|
|
1281
|
+
key: "handleRoomUpdated",
|
|
1282
|
+
value: function handleRoomUpdated(ev) {
|
|
1283
|
+
if (this.room.id === ev.room.id) {
|
|
1284
|
+
this.room = ev.room;
|
|
1285
|
+
if (ev.room.defaultTopic) {
|
|
1286
|
+
this.createHistoryWindowForTopic(ev.room.defaultTopic);
|
|
1287
|
+
}
|
|
1288
|
+
}
|
|
1289
|
+
}
|
|
1290
|
+
}, {
|
|
1291
|
+
key: "handleNewTopic",
|
|
1292
|
+
value: function handleNewTopic(ev) {
|
|
1293
|
+
if (this.room.id === ev.roomId) {
|
|
1294
|
+
this.createHistoryWindowForTopic(ev.topic);
|
|
1295
|
+
}
|
|
1296
|
+
}
|
|
1297
|
+
}, {
|
|
1298
|
+
key: "handleTopicDeleted",
|
|
1299
|
+
value: function handleTopicDeleted(ev) {
|
|
1300
|
+
if (this.room.id === ev.location.roomId) {
|
|
1301
|
+
this.historyWindows["delete"](ev.location.topicId);
|
|
1302
|
+
}
|
|
1303
|
+
}
|
|
1304
|
+
}, {
|
|
1305
|
+
key: "createHistoryWindowForTopic",
|
|
1306
|
+
value: function createHistoryWindowForTopic(topic) {
|
|
1307
|
+
if (this.historyWindows.has(topic.id)) {
|
|
1308
|
+
return;
|
|
1309
|
+
}
|
|
1310
|
+
this.historyWindows.set([topic.id, new TopicHistoryWindow(this.room.id, topic.id, this.tracker)]);
|
|
1311
|
+
|
|
1312
|
+
// If new topic refers to some message from this room, update other structures
|
|
1313
|
+
if (topic.messageRef) {
|
|
1314
|
+
var refHistoryWindow = this.historyWindows.get(topic.messageRef.topicId);
|
|
1315
|
+
refHistoryWindow._setTopicReference({
|
|
1316
|
+
topicId: topic.id,
|
|
1317
|
+
// Reverse the reference
|
|
1318
|
+
messageId: topic.messageRef.messageId
|
|
1319
|
+
});
|
|
1320
|
+
}
|
|
1321
|
+
}
|
|
1322
|
+
}]);
|
|
1323
|
+
return RoomMessagesHistory;
|
|
1324
|
+
}();
|
|
624
1325
|
;// CONCATENATED MODULE: ./src/state-tracker/MessagesManager.ts
|
|
625
1326
|
function MessagesManager_typeof(obj) { "@babel/helpers - typeof"; return MessagesManager_typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, MessagesManager_typeof(obj); }
|
|
626
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
627
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { MessagesManager_defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
628
1327
|
function MessagesManager_toConsumableArray(arr) { return MessagesManager_arrayWithoutHoles(arr) || MessagesManager_iterableToArray(arr) || MessagesManager_unsupportedIterableToArray(arr) || MessagesManager_nonIterableSpread(); }
|
|
629
1328
|
function MessagesManager_nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
630
1329
|
function MessagesManager_iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
631
1330
|
function MessagesManager_arrayWithoutHoles(arr) { if (Array.isArray(arr)) return MessagesManager_arrayLikeToArray(arr); }
|
|
1331
|
+
function MessagesManager_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
1332
|
+
function MessagesManager_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? MessagesManager_ownKeys(Object(source), !0).forEach(function (key) { MessagesManager_defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : MessagesManager_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
632
1333
|
function MessagesManager_createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = MessagesManager_unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
|
|
633
1334
|
function MessagesManager_unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return MessagesManager_arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return MessagesManager_arrayLikeToArray(o, minLen); }
|
|
634
1335
|
function MessagesManager_arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
635
|
-
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, "_invoke", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == MessagesManager_typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, "_invoke", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var methodName = context.method, method = delegate.iterator[methodName]; if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator["return"] && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel; var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) { if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; } return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) { keys.push(key); } return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) { "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); } }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, "catch": function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
|
|
636
|
-
function
|
|
637
|
-
function
|
|
1336
|
+
function MessagesManager_regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ MessagesManager_regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, "_invoke", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == MessagesManager_typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, "_invoke", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var methodName = context.method, method = delegate.iterator[methodName]; if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator["return"] && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel; var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) { if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; } return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) { keys.push(key); } return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) { "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); } }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, "catch": function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
|
|
1337
|
+
function MessagesManager_asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
1338
|
+
function MessagesManager_asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { MessagesManager_asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { MessagesManager_asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
638
1339
|
function MessagesManager_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
639
1340
|
function MessagesManager_defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, MessagesManager_toPropertyKey(descriptor.key), descriptor); } }
|
|
640
1341
|
function MessagesManager_createClass(Constructor, protoProps, staticProps) { if (protoProps) MessagesManager_defineProperties(Constructor.prototype, protoProps); if (staticProps) MessagesManager_defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
@@ -643,20 +1344,16 @@ function MessagesManager_toPropertyKey(arg) { var key = MessagesManager_toPrimit
|
|
|
643
1344
|
function MessagesManager_toPrimitive(input, hint) { if (MessagesManager_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (MessagesManager_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
644
1345
|
|
|
645
1346
|
|
|
646
|
-
var getCombinedId = function getCombinedId(location) {
|
|
647
|
-
var _location$roomId, _location$topicId;
|
|
648
|
-
return ((_location$roomId = location.roomId) !== null && _location$roomId !== void 0 ? _location$roomId : '') + ((_location$topicId = location.topicId) !== null && _location$topicId !== void 0 ? _location$topicId : '');
|
|
649
|
-
};
|
|
650
|
-
var MessagesManager = /*#__PURE__*/function () {
|
|
651
|
-
// Temporary not lazy loaded; server must implement GetTopicMessages command.
|
|
652
1347
|
|
|
1348
|
+
var MessagesManager = /*#__PURE__*/function () {
|
|
653
1349
|
function MessagesManager(tracker) {
|
|
654
1350
|
var _this = this;
|
|
655
1351
|
MessagesManager_classCallCheck(this, MessagesManager);
|
|
656
1352
|
this.tracker = tracker;
|
|
657
|
-
MessagesManager_defineProperty(this, "
|
|
1353
|
+
MessagesManager_defineProperty(this, "roomHistories", new IndexedCollection());
|
|
658
1354
|
MessagesManager_defineProperty(this, "followedTopics", new IndexedCollection());
|
|
659
1355
|
MessagesManager_defineProperty(this, "followedTopicsPromises", new PromiseRegistry());
|
|
1356
|
+
MessagesManager_defineProperty(this, "deferredSession", new DeferredTask());
|
|
660
1357
|
this.tracker.client.on('Session', function (ev) {
|
|
661
1358
|
return _this.handleSession(ev);
|
|
662
1359
|
});
|
|
@@ -690,28 +1387,31 @@ var MessagesManager = /*#__PURE__*/function () {
|
|
|
690
1387
|
}
|
|
691
1388
|
|
|
692
1389
|
/**
|
|
693
|
-
* Get
|
|
1390
|
+
* Get history manager for given room ID.
|
|
694
1391
|
*/
|
|
695
1392
|
MessagesManager_createClass(MessagesManager, [{
|
|
696
|
-
key: "
|
|
1393
|
+
key: "getRoomHistory",
|
|
697
1394
|
value: function () {
|
|
698
|
-
var
|
|
699
|
-
return
|
|
1395
|
+
var _getRoomHistory = MessagesManager_asyncToGenerator( /*#__PURE__*/MessagesManager_regeneratorRuntime().mark(function _callee(roomId) {
|
|
1396
|
+
return MessagesManager_regeneratorRuntime().wrap(function _callee$(_context) {
|
|
700
1397
|
while (1) {
|
|
701
1398
|
switch (_context.prev = _context.next) {
|
|
702
1399
|
case 0:
|
|
703
|
-
|
|
704
|
-
|
|
1400
|
+
_context.next = 2;
|
|
1401
|
+
return this.deferredSession.promise;
|
|
1402
|
+
case 2:
|
|
1403
|
+
return _context.abrupt("return", this.roomHistories.get(roomId));
|
|
1404
|
+
case 3:
|
|
705
1405
|
case "end":
|
|
706
1406
|
return _context.stop();
|
|
707
1407
|
}
|
|
708
1408
|
}
|
|
709
1409
|
}, _callee, this);
|
|
710
1410
|
}));
|
|
711
|
-
function
|
|
712
|
-
return
|
|
1411
|
+
function getRoomHistory(_x) {
|
|
1412
|
+
return _getRoomHistory.apply(this, arguments);
|
|
713
1413
|
}
|
|
714
|
-
return
|
|
1414
|
+
return getRoomHistory;
|
|
715
1415
|
}()
|
|
716
1416
|
/**
|
|
717
1417
|
* Cache followed topics for all joined rooms in a space and fetch them in bulk if necessary.
|
|
@@ -721,9 +1421,9 @@ var MessagesManager = /*#__PURE__*/function () {
|
|
|
721
1421
|
}, {
|
|
722
1422
|
key: "cacheSpaceFollowedTopic",
|
|
723
1423
|
value: function () {
|
|
724
|
-
var _cacheSpaceFollowedTopic =
|
|
1424
|
+
var _cacheSpaceFollowedTopic = MessagesManager_asyncToGenerator( /*#__PURE__*/MessagesManager_regeneratorRuntime().mark(function _callee2(spaceId) {
|
|
725
1425
|
var roomIds, result;
|
|
726
|
-
return
|
|
1426
|
+
return MessagesManager_regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
727
1427
|
while (1) {
|
|
728
1428
|
switch (_context2.prev = _context2.next) {
|
|
729
1429
|
case 0:
|
|
@@ -782,9 +1482,9 @@ var MessagesManager = /*#__PURE__*/function () {
|
|
|
782
1482
|
}, {
|
|
783
1483
|
key: "getRoomFollowedTopics",
|
|
784
1484
|
value: function () {
|
|
785
|
-
var _getRoomFollowedTopics =
|
|
1485
|
+
var _getRoomFollowedTopics = MessagesManager_asyncToGenerator( /*#__PURE__*/MessagesManager_regeneratorRuntime().mark(function _callee4(roomId) {
|
|
786
1486
|
var _this2 = this;
|
|
787
|
-
return
|
|
1487
|
+
return MessagesManager_regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
788
1488
|
while (1) {
|
|
789
1489
|
switch (_context4.prev = _context4.next) {
|
|
790
1490
|
case 0:
|
|
@@ -802,9 +1502,9 @@ var MessagesManager = /*#__PURE__*/function () {
|
|
|
802
1502
|
break;
|
|
803
1503
|
}
|
|
804
1504
|
if (this.followedTopicsPromises.notExist(roomId)) {
|
|
805
|
-
this.followedTopicsPromises.registerByFunction( /*#__PURE__*/
|
|
1505
|
+
this.followedTopicsPromises.registerByFunction( /*#__PURE__*/MessagesManager_asyncToGenerator( /*#__PURE__*/MessagesManager_regeneratorRuntime().mark(function _callee3() {
|
|
806
1506
|
var result;
|
|
807
|
-
return
|
|
1507
|
+
return MessagesManager_regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
808
1508
|
while (1) {
|
|
809
1509
|
switch (_context3.prev = _context3.next) {
|
|
810
1510
|
case 0:
|
|
@@ -853,9 +1553,9 @@ var MessagesManager = /*#__PURE__*/function () {
|
|
|
853
1553
|
}, {
|
|
854
1554
|
key: "ackRoomFollowedTopics",
|
|
855
1555
|
value: function () {
|
|
856
|
-
var _ackRoomFollowedTopics =
|
|
1556
|
+
var _ackRoomFollowedTopics = MessagesManager_asyncToGenerator( /*#__PURE__*/MessagesManager_regeneratorRuntime().mark(function _callee5(roomId) {
|
|
857
1557
|
var collection, _iterator, _step, followedTopic;
|
|
858
|
-
return
|
|
1558
|
+
return MessagesManager_regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
859
1559
|
while (1) {
|
|
860
1560
|
switch (_context5.prev = _context5.next) {
|
|
861
1561
|
case 0:
|
|
@@ -919,9 +1619,9 @@ var MessagesManager = /*#__PURE__*/function () {
|
|
|
919
1619
|
}, {
|
|
920
1620
|
key: "calculateRoomMissedMessages",
|
|
921
1621
|
value: function () {
|
|
922
|
-
var _calculateRoomMissedMessages =
|
|
923
|
-
var collection
|
|
924
|
-
return
|
|
1622
|
+
var _calculateRoomMissedMessages = MessagesManager_asyncToGenerator( /*#__PURE__*/MessagesManager_regeneratorRuntime().mark(function _callee6(roomId) {
|
|
1623
|
+
var collection;
|
|
1624
|
+
return MessagesManager_regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
925
1625
|
while (1) {
|
|
926
1626
|
switch (_context6.prev = _context6.next) {
|
|
927
1627
|
case 0:
|
|
@@ -929,32 +1629,17 @@ var MessagesManager = /*#__PURE__*/function () {
|
|
|
929
1629
|
return this.getRoomFollowedTopics(roomId);
|
|
930
1630
|
case 2:
|
|
931
1631
|
collection = _context6.sent;
|
|
932
|
-
if (collection) {
|
|
1632
|
+
if (!collection) {
|
|
933
1633
|
_context6.next = 5;
|
|
934
1634
|
break;
|
|
935
1635
|
}
|
|
936
|
-
return _context6.abrupt("return",
|
|
1636
|
+
return _context6.abrupt("return", collection.items.reduce(function (previousValue, currentValue) {
|
|
1637
|
+
var _currentValue$missed;
|
|
1638
|
+
return previousValue + ((_currentValue$missed = currentValue.missed) !== null && _currentValue$missed !== void 0 ? _currentValue$missed : 0);
|
|
1639
|
+
}, 0));
|
|
937
1640
|
case 5:
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
try {
|
|
941
|
-
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
942
|
-
followedTopic = _step2.value;
|
|
943
|
-
missed += (_ref2 = (_followedTopic$missed = followedTopic.missed) !== null && _followedTopic$missed !== void 0 ? _followedTopic$missed : followedTopic.missedMoreThan) !== null && _ref2 !== void 0 ? _ref2 : 0;
|
|
944
|
-
if (followedTopic.missedMoreThan) {
|
|
945
|
-
missedMore = true;
|
|
946
|
-
}
|
|
947
|
-
}
|
|
948
|
-
} catch (err) {
|
|
949
|
-
_iterator2.e(err);
|
|
950
|
-
} finally {
|
|
951
|
-
_iterator2.f();
|
|
952
|
-
}
|
|
953
|
-
return _context6.abrupt("return", {
|
|
954
|
-
missed: missed,
|
|
955
|
-
missedMore: missedMore
|
|
956
|
-
});
|
|
957
|
-
case 9:
|
|
1641
|
+
return _context6.abrupt("return", undefined);
|
|
1642
|
+
case 6:
|
|
958
1643
|
case "end":
|
|
959
1644
|
return _context6.stop();
|
|
960
1645
|
}
|
|
@@ -973,54 +1658,20 @@ var MessagesManager = /*#__PURE__*/function () {
|
|
|
973
1658
|
}, {
|
|
974
1659
|
key: "_deleteByTopicIds",
|
|
975
1660
|
value: function _deleteByTopicIds(roomId) {
|
|
976
|
-
var _this$
|
|
1661
|
+
var _this$followedTopics$;
|
|
977
1662
|
for (var _len = arguments.length, topicIds = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
978
1663
|
topicIds[_key - 1] = arguments[_key];
|
|
979
1664
|
}
|
|
980
|
-
(_this$list = this.list)["delete"].apply(_this$list, MessagesManager_toConsumableArray(topicIds.map(function (topicId) {
|
|
981
|
-
return getCombinedId({
|
|
982
|
-
roomId: roomId,
|
|
983
|
-
topicId: topicId
|
|
984
|
-
});
|
|
985
|
-
})));
|
|
986
1665
|
(_this$followedTopics$ = this.followedTopics.get(roomId)) === null || _this$followedTopics$ === void 0 ? void 0 : _this$followedTopics$["delete"].apply(_this$followedTopics$, topicIds);
|
|
987
1666
|
}
|
|
988
1667
|
}, {
|
|
989
|
-
key: "
|
|
990
|
-
value: function
|
|
991
|
-
|
|
992
|
-
newTopics[_key2 - 1] = arguments[_key2];
|
|
993
|
-
}
|
|
994
|
-
for (var _i = 0, _newTopics = newTopics; _i < _newTopics.length; _i++) {
|
|
995
|
-
var newTopic = _newTopics[_i];
|
|
996
|
-
var newTopicCombinedId = getCombinedId({
|
|
997
|
-
roomId: roomId,
|
|
998
|
-
topicId: newTopic.id
|
|
999
|
-
});
|
|
1000
|
-
this.list.set([newTopicCombinedId, new ObservableIndexedObjectCollection('id')]);
|
|
1001
|
-
|
|
1002
|
-
// If new topic refers to some message from this room, update other structures
|
|
1003
|
-
if (newTopic.messageRef) {
|
|
1004
|
-
var refTopicCombinedId = getCombinedId({
|
|
1005
|
-
roomId: roomId,
|
|
1006
|
-
topicId: newTopic.messageRef.topicId
|
|
1007
|
-
});
|
|
1008
|
-
var refTopicMessages = this.list.get(refTopicCombinedId);
|
|
1009
|
-
var refMessage = refTopicMessages === null || refTopicMessages === void 0 ? void 0 : refTopicMessages.get(newTopic.messageRef.messageId);
|
|
1010
|
-
if (refMessage) {
|
|
1011
|
-
// Update referenced topic ID in message
|
|
1012
|
-
refTopicMessages.set(_objectSpread(_objectSpread({}, refMessage), {}, {
|
|
1013
|
-
topicRef: newTopic.id
|
|
1014
|
-
}));
|
|
1015
|
-
}
|
|
1016
|
-
}
|
|
1017
|
-
}
|
|
1668
|
+
key: "createHistoryForNewRoom",
|
|
1669
|
+
value: function createHistoryForNewRoom(room) {
|
|
1670
|
+
this.roomHistories.set([room.id, new RoomMessagesHistory(room, this.tracker)]);
|
|
1018
1671
|
}
|
|
1019
1672
|
}, {
|
|
1020
1673
|
key: "handleNewMessage",
|
|
1021
1674
|
value: function handleNewMessage(ev) {
|
|
1022
|
-
var _this$list$get;
|
|
1023
|
-
(_this$list$get = this.list.get(getCombinedId(ev.location))) === null || _this$list$get === void 0 ? void 0 : _this$list$get.set(ev.message);
|
|
1024
1675
|
this.updateLocallyFollowedTopicOnNewMessage(ev);
|
|
1025
1676
|
}
|
|
1026
1677
|
}, {
|
|
@@ -1043,49 +1694,48 @@ var MessagesManager = /*#__PURE__*/function () {
|
|
|
1043
1694
|
}, {
|
|
1044
1695
|
key: "handleRoomDeleted",
|
|
1045
1696
|
value: function handleRoomDeleted(ev) {
|
|
1697
|
+
this.roomHistories["delete"](ev.id);
|
|
1046
1698
|
this.clearRoomFollowedTopicsStructures(ev.id);
|
|
1047
1699
|
}
|
|
1048
1700
|
}, {
|
|
1049
1701
|
key: "handleRoomJoin",
|
|
1050
1702
|
value: function handleRoomJoin(ev) {
|
|
1051
|
-
|
|
1052
|
-
this.createHistoryForNewTopic(ev.room.id, ev.room.defaultTopic);
|
|
1053
|
-
}
|
|
1703
|
+
this.createHistoryForNewRoom(ev.room);
|
|
1054
1704
|
this.clearRoomFollowedTopicsStructures(ev.room.id);
|
|
1055
1705
|
}
|
|
1056
1706
|
}, {
|
|
1057
1707
|
key: "handleRoomLeft",
|
|
1058
1708
|
value: function handleRoomLeft(ev) {
|
|
1709
|
+
this.roomHistories["delete"](ev.id);
|
|
1059
1710
|
this.clearRoomFollowedTopicsStructures(ev.id);
|
|
1060
1711
|
}
|
|
1061
1712
|
}, {
|
|
1062
1713
|
key: "handleNewTopic",
|
|
1063
1714
|
value: function () {
|
|
1064
|
-
var _handleNewTopic =
|
|
1715
|
+
var _handleNewTopic = MessagesManager_asyncToGenerator( /*#__PURE__*/MessagesManager_regeneratorRuntime().mark(function _callee7(ev) {
|
|
1065
1716
|
var result, followedTopic;
|
|
1066
|
-
return
|
|
1717
|
+
return MessagesManager_regeneratorRuntime().wrap(function _callee7$(_context7) {
|
|
1067
1718
|
while (1) {
|
|
1068
1719
|
switch (_context7.prev = _context7.next) {
|
|
1069
1720
|
case 0:
|
|
1070
|
-
this.createHistoryForNewTopic(ev.roomId, ev.topic);
|
|
1071
1721
|
if (!this.followedTopics.has(ev.roomId)) {
|
|
1072
|
-
_context7.next =
|
|
1722
|
+
_context7.next = 6;
|
|
1073
1723
|
break;
|
|
1074
1724
|
}
|
|
1075
|
-
_context7.next =
|
|
1725
|
+
_context7.next = 3;
|
|
1076
1726
|
return this.tracker.client.send('GetFollowedTopics', {
|
|
1077
1727
|
location: {
|
|
1078
1728
|
roomId: ev.roomId,
|
|
1079
1729
|
topicId: ev.topic.id
|
|
1080
1730
|
}
|
|
1081
1731
|
});
|
|
1082
|
-
case
|
|
1732
|
+
case 3:
|
|
1083
1733
|
result = _context7.sent;
|
|
1084
1734
|
followedTopic = result.data.followedTopics[0];
|
|
1085
1735
|
if (followedTopic) {
|
|
1086
1736
|
this.followedTopics.get(ev.roomId).set(followedTopic);
|
|
1087
1737
|
}
|
|
1088
|
-
case
|
|
1738
|
+
case 6:
|
|
1089
1739
|
case "end":
|
|
1090
1740
|
return _context7.stop();
|
|
1091
1741
|
}
|
|
@@ -1107,11 +1757,12 @@ var MessagesManager = /*#__PURE__*/function () {
|
|
|
1107
1757
|
key: "handleSession",
|
|
1108
1758
|
value: function handleSession(ev) {
|
|
1109
1759
|
var _this3 = this;
|
|
1760
|
+
this.followedTopics.deleteAll();
|
|
1761
|
+
this.roomHistories.deleteAll();
|
|
1110
1762
|
ev.state.rooms.forEach(function (room) {
|
|
1111
|
-
|
|
1112
|
-
_this3.createHistoryForNewTopic(room.id, room.defaultTopic);
|
|
1113
|
-
}
|
|
1763
|
+
return _this3.createHistoryForNewRoom(room);
|
|
1114
1764
|
});
|
|
1765
|
+
this.deferredSession.resolve();
|
|
1115
1766
|
}
|
|
1116
1767
|
}, {
|
|
1117
1768
|
key: "updateLocallyFollowedTopicOnNewMessage",
|
|
@@ -1123,23 +1774,21 @@ var MessagesManager = /*#__PURE__*/function () {
|
|
|
1123
1774
|
// Skip if we don't follow this room or targeted topic
|
|
1124
1775
|
return;
|
|
1125
1776
|
}
|
|
1126
|
-
var isMe = ev.message.
|
|
1777
|
+
var isMe = ev.message.user.id === ((_this$tracker$me = this.tracker.me) === null || _this$tracker$me === void 0 ? void 0 : _this$tracker$me.id);
|
|
1127
1778
|
var update;
|
|
1128
1779
|
if (isMe) {
|
|
1129
1780
|
// Reset missed messages count if new message is authored by me
|
|
1130
1781
|
update = {
|
|
1131
1782
|
missed: 0,
|
|
1132
|
-
missedMoreThan: null,
|
|
1133
1783
|
lastAckMessageId: ev.message.id
|
|
1134
1784
|
};
|
|
1135
1785
|
} else {
|
|
1136
1786
|
// ...add 1 otherwise
|
|
1137
1787
|
update = {
|
|
1138
|
-
missed: followedTopic.missed === null ? null : followedTopic.missed + 1
|
|
1139
|
-
missedMoreThan: followedTopic.missedMoreThan === null ? null : followedTopic.missedMoreThan
|
|
1788
|
+
missed: followedTopic.missed === null ? null : followedTopic.missed + 1
|
|
1140
1789
|
};
|
|
1141
1790
|
}
|
|
1142
|
-
roomFollowedTopics.set(
|
|
1791
|
+
roomFollowedTopics.set(MessagesManager_objectSpread(MessagesManager_objectSpread({}, followedTopic), update));
|
|
1143
1792
|
}
|
|
1144
1793
|
}, {
|
|
1145
1794
|
key: "setFollowedTopicsArray",
|
|
@@ -1208,6 +1857,7 @@ var RoomsManager = /*#__PURE__*/function () {
|
|
|
1208
1857
|
RoomsManager_defineProperty(this, "members", new IndexedCollection());
|
|
1209
1858
|
RoomsManager_defineProperty(this, "deferredSession", new DeferredTask());
|
|
1210
1859
|
RoomsManager_defineProperty(this, "membersPromises", new PromiseRegistry());
|
|
1860
|
+
RoomsManager_defineProperty(this, "topicsPromises", new PromiseRegistry());
|
|
1211
1861
|
this.messages = new MessagesManager(tracker);
|
|
1212
1862
|
this.tracker.client.on('NewMessage', function (ev) {
|
|
1213
1863
|
return _this.handleNewMessage(ev);
|
|
@@ -1388,12 +2038,15 @@ var RoomsManager = /*#__PURE__*/function () {
|
|
|
1388
2038
|
return get;
|
|
1389
2039
|
}()
|
|
1390
2040
|
/**
|
|
1391
|
-
* Get collection of room
|
|
2041
|
+
* Get a collection of locally cached Topic objects for given room.
|
|
2042
|
+
* You can pass topic ids as second argument, to try to fetch them from the server.
|
|
1392
2043
|
*/
|
|
1393
2044
|
}, {
|
|
1394
2045
|
key: "getTopics",
|
|
1395
2046
|
value: function () {
|
|
1396
|
-
var _getTopics = RoomsManager_asyncToGenerator( /*#__PURE__*/RoomsManager_regeneratorRuntime().mark(function _callee5(roomId) {
|
|
2047
|
+
var _getTopics = RoomsManager_asyncToGenerator( /*#__PURE__*/RoomsManager_regeneratorRuntime().mark(function _callee5(roomId, tryToFetchTopicIds) {
|
|
2048
|
+
var _this3 = this;
|
|
2049
|
+
var missingIds, promise, _iterator, _step, topicId;
|
|
1397
2050
|
return RoomsManager_regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
1398
2051
|
while (1) {
|
|
1399
2052
|
switch (_context5.prev = _context5.next) {
|
|
@@ -1401,15 +2054,60 @@ var RoomsManager = /*#__PURE__*/function () {
|
|
|
1401
2054
|
_context5.next = 2;
|
|
1402
2055
|
return this.deferredSession.promise;
|
|
1403
2056
|
case 2:
|
|
2057
|
+
if (!(tryToFetchTopicIds !== null && tryToFetchTopicIds !== void 0 && tryToFetchTopicIds.length)) {
|
|
2058
|
+
_context5.next = 22;
|
|
2059
|
+
break;
|
|
2060
|
+
}
|
|
2061
|
+
missingIds = tryToFetchTopicIds.filter(function (topicId) {
|
|
2062
|
+
return !_this3.topicsPromises.has(roomId + topicId);
|
|
2063
|
+
});
|
|
2064
|
+
if (missingIds.length) {
|
|
2065
|
+
promise = this.tracker.client.send('GetTopics', {
|
|
2066
|
+
roomId: roomId,
|
|
2067
|
+
ids: missingIds
|
|
2068
|
+
}).then(function (result) {
|
|
2069
|
+
var _this3$topics$get;
|
|
2070
|
+
return (_this3$topics$get = _this3.topics.get(result.data.location.roomId)) === null || _this3$topics$get === void 0 ? void 0 : _this3$topics$get.set.apply(_this3$topics$get, RoomsManager_toConsumableArray(result.data.topics));
|
|
2071
|
+
});
|
|
2072
|
+
missingIds.forEach(function (topicId) {
|
|
2073
|
+
return _this3.topicsPromises.register(promise, roomId + topicId);
|
|
2074
|
+
});
|
|
2075
|
+
}
|
|
2076
|
+
_iterator = RoomsManager_createForOfIteratorHelper(tryToFetchTopicIds);
|
|
2077
|
+
_context5.prev = 6;
|
|
2078
|
+
_iterator.s();
|
|
2079
|
+
case 8:
|
|
2080
|
+
if ((_step = _iterator.n()).done) {
|
|
2081
|
+
_context5.next = 14;
|
|
2082
|
+
break;
|
|
2083
|
+
}
|
|
2084
|
+
topicId = _step.value;
|
|
2085
|
+
_context5.next = 12;
|
|
2086
|
+
return this.topicsPromises.get(roomId + topicId);
|
|
2087
|
+
case 12:
|
|
2088
|
+
_context5.next = 8;
|
|
2089
|
+
break;
|
|
2090
|
+
case 14:
|
|
2091
|
+
_context5.next = 19;
|
|
2092
|
+
break;
|
|
2093
|
+
case 16:
|
|
2094
|
+
_context5.prev = 16;
|
|
2095
|
+
_context5.t0 = _context5["catch"](6);
|
|
2096
|
+
_iterator.e(_context5.t0);
|
|
2097
|
+
case 19:
|
|
2098
|
+
_context5.prev = 19;
|
|
2099
|
+
_iterator.f();
|
|
2100
|
+
return _context5.finish(19);
|
|
2101
|
+
case 22:
|
|
1404
2102
|
return _context5.abrupt("return", this.topics.get(roomId));
|
|
1405
|
-
case
|
|
2103
|
+
case 23:
|
|
1406
2104
|
case "end":
|
|
1407
2105
|
return _context5.stop();
|
|
1408
2106
|
}
|
|
1409
2107
|
}
|
|
1410
|
-
}, _callee5, this);
|
|
2108
|
+
}, _callee5, this, [[6, 16, 19, 22]]);
|
|
1411
2109
|
}));
|
|
1412
|
-
function getTopics(_x3) {
|
|
2110
|
+
function getTopics(_x3, _x4) {
|
|
1413
2111
|
return _getTopics.apply(this, arguments);
|
|
1414
2112
|
}
|
|
1415
2113
|
return getTopics;
|
|
@@ -1445,11 +2143,11 @@ var RoomsManager = /*#__PURE__*/function () {
|
|
|
1445
2143
|
key: "handleSpaceMemberUpdated",
|
|
1446
2144
|
value: function handleSpaceMemberUpdated(ev) {
|
|
1447
2145
|
// Update members of rooms related to this space
|
|
1448
|
-
var
|
|
1449
|
-
|
|
2146
|
+
var _iterator2 = RoomsManager_createForOfIteratorHelper(this.list.findBy('spaceId', ev.spaceId).items),
|
|
2147
|
+
_step2;
|
|
1450
2148
|
try {
|
|
1451
|
-
for (
|
|
1452
|
-
var room =
|
|
2149
|
+
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
2150
|
+
var room = _step2.value;
|
|
1453
2151
|
var roomMembers = this.members.get(room.id);
|
|
1454
2152
|
if (!roomMembers || !roomMembers.has(ev.userId)) {
|
|
1455
2153
|
// Skip update if member list for this room is not loaded
|
|
@@ -1466,18 +2164,18 @@ var RoomsManager = /*#__PURE__*/function () {
|
|
|
1466
2164
|
roomMembers.set(roomMember);
|
|
1467
2165
|
}
|
|
1468
2166
|
} catch (err) {
|
|
1469
|
-
|
|
2167
|
+
_iterator2.e(err);
|
|
1470
2168
|
} finally {
|
|
1471
|
-
|
|
2169
|
+
_iterator2.f();
|
|
1472
2170
|
}
|
|
1473
2171
|
}
|
|
1474
2172
|
}, {
|
|
1475
2173
|
key: "handleSpaceMemberLeft",
|
|
1476
2174
|
value: function handleSpaceMemberLeft(ev) {
|
|
1477
|
-
var
|
|
2175
|
+
var _this4 = this;
|
|
1478
2176
|
this.list.findBy('spaceId', ev.spaceId).items.forEach(function (room) {
|
|
1479
|
-
var
|
|
1480
|
-
return (
|
|
2177
|
+
var _this4$members$get;
|
|
2178
|
+
return (_this4$members$get = _this4.members.get(room.id)) === null || _this4$members$get === void 0 ? void 0 : _this4$members$get["delete"](ev.userId);
|
|
1481
2179
|
});
|
|
1482
2180
|
}
|
|
1483
2181
|
}, {
|