polfan-server-js-client 0.1.26 → 0.1.27
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 +319 -59
- package/build/index.js.map +1 -1
- package/build/types/AbstractChatClient.d.ts +4 -1
- package/build/types/state-tracker/ChatStateTracker.d.ts +2 -1
- package/build/types/state-tracker/MessagesManager.d.ts +38 -0
- package/build/types/state-tracker/RoomsManager.d.ts +3 -7
- package/package.json +2 -2
- package/src/AbstractChatClient.ts +6 -0
- package/src/state-tracker/ChatStateTracker.ts +7 -3
- package/src/state-tracker/MessagesManager.ts +158 -0
- package/src/state-tracker/RoomsManager.ts +9 -22
package/build/index.js
CHANGED
|
@@ -579,6 +579,296 @@ var DeferredTask = /*#__PURE__*/DeferredTask_createClass(function DeferredTask()
|
|
|
579
579
|
return _this.resolve = resolve;
|
|
580
580
|
});
|
|
581
581
|
});
|
|
582
|
+
;// CONCATENATED MODULE: ./src/state-tracker/MessagesManager.ts
|
|
583
|
+
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); }
|
|
584
|
+
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; }
|
|
585
|
+
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; }
|
|
586
|
+
function MessagesManager_toConsumableArray(arr) { return MessagesManager_arrayWithoutHoles(arr) || MessagesManager_iterableToArray(arr) || MessagesManager_unsupportedIterableToArray(arr) || MessagesManager_nonIterableSpread(); }
|
|
587
|
+
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."); }
|
|
588
|
+
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); }
|
|
589
|
+
function MessagesManager_iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
590
|
+
function MessagesManager_arrayWithoutHoles(arr) { if (Array.isArray(arr)) return MessagesManager_arrayLikeToArray(arr); }
|
|
591
|
+
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; }
|
|
592
|
+
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; }
|
|
593
|
+
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); } }
|
|
594
|
+
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); }); }; }
|
|
595
|
+
function MessagesManager_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
596
|
+
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); } }
|
|
597
|
+
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; }
|
|
598
|
+
function MessagesManager_defineProperty(obj, key, value) { key = MessagesManager_toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
599
|
+
function MessagesManager_toPropertyKey(arg) { var key = MessagesManager_toPrimitive(arg, "string"); return MessagesManager_typeof(key) === "symbol" ? key : String(key); }
|
|
600
|
+
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); }
|
|
601
|
+
|
|
602
|
+
var getCombinedId = function getCombinedId() {
|
|
603
|
+
for (var _len = arguments.length, ids = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
604
|
+
ids[_key] = arguments[_key];
|
|
605
|
+
}
|
|
606
|
+
return ids.join('_');
|
|
607
|
+
};
|
|
608
|
+
var MessagesManager = /*#__PURE__*/function () {
|
|
609
|
+
// Temporary not lazy loaded; server must implement GetTopicMessages command.
|
|
610
|
+
|
|
611
|
+
function MessagesManager(tracker) {
|
|
612
|
+
var _this = this;
|
|
613
|
+
MessagesManager_classCallCheck(this, MessagesManager);
|
|
614
|
+
this.tracker = tracker;
|
|
615
|
+
MessagesManager_defineProperty(this, "list", new IndexedCollection());
|
|
616
|
+
MessagesManager_defineProperty(this, "acks", new IndexedCollection());
|
|
617
|
+
this.tracker.client.on('NewMessage', function (ev) {
|
|
618
|
+
return _this.handleNewMessage(ev);
|
|
619
|
+
});
|
|
620
|
+
this.tracker.client.on('AckReports', function (ev) {
|
|
621
|
+
return _this.handleAckReports(ev);
|
|
622
|
+
});
|
|
623
|
+
}
|
|
624
|
+
|
|
625
|
+
/**
|
|
626
|
+
* Get collection of the messages written in topic.
|
|
627
|
+
*/
|
|
628
|
+
MessagesManager_createClass(MessagesManager, [{
|
|
629
|
+
key: "get",
|
|
630
|
+
value: function () {
|
|
631
|
+
var _get = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(roomId, topicId) {
|
|
632
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
633
|
+
while (1) {
|
|
634
|
+
switch (_context.prev = _context.next) {
|
|
635
|
+
case 0:
|
|
636
|
+
return _context.abrupt("return", this.list.get(getCombinedId(roomId, topicId)));
|
|
637
|
+
case 1:
|
|
638
|
+
case "end":
|
|
639
|
+
return _context.stop();
|
|
640
|
+
}
|
|
641
|
+
}
|
|
642
|
+
}, _callee, this);
|
|
643
|
+
}));
|
|
644
|
+
function get(_x, _x2) {
|
|
645
|
+
return _get.apply(this, arguments);
|
|
646
|
+
}
|
|
647
|
+
return get;
|
|
648
|
+
}()
|
|
649
|
+
/**
|
|
650
|
+
* Get ack reports for rooms you are in the given space.
|
|
651
|
+
* @param spaceId
|
|
652
|
+
*/
|
|
653
|
+
}, {
|
|
654
|
+
key: "getSpaceAckReports",
|
|
655
|
+
value: function () {
|
|
656
|
+
var _getSpaceAckReports = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(spaceId) {
|
|
657
|
+
var _this2 = this;
|
|
658
|
+
var roomIds, missingRoomIds, result;
|
|
659
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
660
|
+
while (1) {
|
|
661
|
+
switch (_context2.prev = _context2.next) {
|
|
662
|
+
case 0:
|
|
663
|
+
_context2.next = 2;
|
|
664
|
+
return this.tracker.spaces.get();
|
|
665
|
+
case 2:
|
|
666
|
+
if (_context2.sent.has(spaceId)) {
|
|
667
|
+
_context2.next = 4;
|
|
668
|
+
break;
|
|
669
|
+
}
|
|
670
|
+
return _context2.abrupt("return", undefined);
|
|
671
|
+
case 4:
|
|
672
|
+
_context2.next = 6;
|
|
673
|
+
return this.tracker.rooms.get();
|
|
674
|
+
case 6:
|
|
675
|
+
roomIds = _context2.sent.findBy('spaceId', spaceId).map(function (room) {
|
|
676
|
+
return room.id;
|
|
677
|
+
});
|
|
678
|
+
missingRoomIds = roomIds.filter(function (roomId) {
|
|
679
|
+
return !_this2.acks.has(roomId);
|
|
680
|
+
});
|
|
681
|
+
if (!missingRoomIds.length) {
|
|
682
|
+
_context2.next = 15;
|
|
683
|
+
break;
|
|
684
|
+
}
|
|
685
|
+
_context2.next = 11;
|
|
686
|
+
return this.tracker.client.send('GetAckReports', {
|
|
687
|
+
spaceId: spaceId
|
|
688
|
+
});
|
|
689
|
+
case 11:
|
|
690
|
+
result = _context2.sent;
|
|
691
|
+
if (!result.error) {
|
|
692
|
+
_context2.next = 14;
|
|
693
|
+
break;
|
|
694
|
+
}
|
|
695
|
+
throw result.error;
|
|
696
|
+
case 14:
|
|
697
|
+
missingRoomIds.forEach(function (roomId) {
|
|
698
|
+
var reports = result.data.reports.filter(function (report) {
|
|
699
|
+
return report.roomId === roomId;
|
|
700
|
+
});
|
|
701
|
+
_this2.acks.set([roomId, new ObservableIndexedObjectCollection('topicId', reports)]);
|
|
702
|
+
});
|
|
703
|
+
case 15:
|
|
704
|
+
return _context2.abrupt("return", new IndexedCollection(Array.from(this.acks.items).filter(function (collection) {
|
|
705
|
+
return roomIds.includes(collection[0]);
|
|
706
|
+
})));
|
|
707
|
+
case 16:
|
|
708
|
+
case "end":
|
|
709
|
+
return _context2.stop();
|
|
710
|
+
}
|
|
711
|
+
}
|
|
712
|
+
}, _callee2, this);
|
|
713
|
+
}));
|
|
714
|
+
function getSpaceAckReports(_x3) {
|
|
715
|
+
return _getSpaceAckReports.apply(this, arguments);
|
|
716
|
+
}
|
|
717
|
+
return getSpaceAckReports;
|
|
718
|
+
}()
|
|
719
|
+
/**
|
|
720
|
+
* Get ack reports for the given room. Undefined if you are not in the room.
|
|
721
|
+
* @param roomId
|
|
722
|
+
*/
|
|
723
|
+
}, {
|
|
724
|
+
key: "getRoomAckReports",
|
|
725
|
+
value: function () {
|
|
726
|
+
var _getRoomAckReports = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(roomId) {
|
|
727
|
+
var room, result;
|
|
728
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
729
|
+
while (1) {
|
|
730
|
+
switch (_context3.prev = _context3.next) {
|
|
731
|
+
case 0:
|
|
732
|
+
_context3.next = 2;
|
|
733
|
+
return this.tracker.rooms.get();
|
|
734
|
+
case 2:
|
|
735
|
+
room = _context3.sent.get(roomId);
|
|
736
|
+
if (room) {
|
|
737
|
+
_context3.next = 5;
|
|
738
|
+
break;
|
|
739
|
+
}
|
|
740
|
+
return _context3.abrupt("return", undefined);
|
|
741
|
+
case 5:
|
|
742
|
+
if (this.acks.has(roomId)) {
|
|
743
|
+
_context3.next = 12;
|
|
744
|
+
break;
|
|
745
|
+
}
|
|
746
|
+
_context3.next = 8;
|
|
747
|
+
return this.tracker.client.send('GetAckReports', {
|
|
748
|
+
roomId: roomId
|
|
749
|
+
});
|
|
750
|
+
case 8:
|
|
751
|
+
result = _context3.sent;
|
|
752
|
+
if (!result.error) {
|
|
753
|
+
_context3.next = 11;
|
|
754
|
+
break;
|
|
755
|
+
}
|
|
756
|
+
throw result.error;
|
|
757
|
+
case 11:
|
|
758
|
+
this.acks.set([roomId, new ObservableIndexedObjectCollection('topicId', result.data.reports)]);
|
|
759
|
+
case 12:
|
|
760
|
+
return _context3.abrupt("return", this.acks.get(roomId));
|
|
761
|
+
case 13:
|
|
762
|
+
case "end":
|
|
763
|
+
return _context3.stop();
|
|
764
|
+
}
|
|
765
|
+
}
|
|
766
|
+
}, _callee3, this);
|
|
767
|
+
}));
|
|
768
|
+
function getRoomAckReports(_x4) {
|
|
769
|
+
return _getRoomAckReports.apply(this, arguments);
|
|
770
|
+
}
|
|
771
|
+
return getRoomAckReports;
|
|
772
|
+
}()
|
|
773
|
+
/**
|
|
774
|
+
* For internal use. If you want to delete the message, execute a proper command on client object.
|
|
775
|
+
* @internal
|
|
776
|
+
*/
|
|
777
|
+
}, {
|
|
778
|
+
key: "_deleteByTopicIds",
|
|
779
|
+
value: function _deleteByTopicIds(roomId) {
|
|
780
|
+
var _this$list, _this$acks$get;
|
|
781
|
+
for (var _len2 = arguments.length, topicIds = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
|
|
782
|
+
topicIds[_key2 - 1] = arguments[_key2];
|
|
783
|
+
}
|
|
784
|
+
(_this$list = this.list)["delete"].apply(_this$list, MessagesManager_toConsumableArray(topicIds.map(function (topicId) {
|
|
785
|
+
return getCombinedId(roomId, topicId);
|
|
786
|
+
})));
|
|
787
|
+
(_this$acks$get = this.acks.get(roomId)) === null || _this$acks$get === void 0 ? void 0 : _this$acks$get["delete"].apply(_this$acks$get, topicIds);
|
|
788
|
+
}
|
|
789
|
+
|
|
790
|
+
/**
|
|
791
|
+
* For internal use. If you want to add new topic, execute a proper command on client object.
|
|
792
|
+
* @internal
|
|
793
|
+
*/
|
|
794
|
+
}, {
|
|
795
|
+
key: "_handleNewTopics",
|
|
796
|
+
value: function _handleNewTopics(roomId) {
|
|
797
|
+
var _this$list2;
|
|
798
|
+
for (var _len3 = arguments.length, topics = new Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) {
|
|
799
|
+
topics[_key3 - 1] = arguments[_key3];
|
|
800
|
+
}
|
|
801
|
+
(_this$list2 = this.list).set.apply(_this$list2, MessagesManager_toConsumableArray(topics.map(function (topic) {
|
|
802
|
+
return [getCombinedId(roomId, topic.id), new ObservableIndexedObjectCollection('id')];
|
|
803
|
+
})));
|
|
804
|
+
this.createAckReportsForNewTopics(roomId, topics);
|
|
805
|
+
}
|
|
806
|
+
}, {
|
|
807
|
+
key: "handleNewMessage",
|
|
808
|
+
value: function handleNewMessage(ev) {
|
|
809
|
+
this.list.get(getCombinedId(ev.roomId, ev.topicId)).set(ev.message);
|
|
810
|
+
this.updateLocallyAckReportOnNewMessage(ev.roomId, ev.topicId, ev.message.author.id);
|
|
811
|
+
}
|
|
812
|
+
}, {
|
|
813
|
+
key: "handleAckReports",
|
|
814
|
+
value: function handleAckReports(ev) {
|
|
815
|
+
var _this3 = this;
|
|
816
|
+
ev.reports.forEach(function (report) {
|
|
817
|
+
var ackReports = _this3.acks.get(report.roomId);
|
|
818
|
+
if (ackReports) {
|
|
819
|
+
ackReports.set(report);
|
|
820
|
+
}
|
|
821
|
+
});
|
|
822
|
+
}
|
|
823
|
+
}, {
|
|
824
|
+
key: "createAckReportsForNewTopics",
|
|
825
|
+
value: function createAckReportsForNewTopics(roomId, topics) {
|
|
826
|
+
var ackReports = this.acks.get(roomId);
|
|
827
|
+
if (!ackReports) {
|
|
828
|
+
// If we don't follow ack reports for this room, skip
|
|
829
|
+
return;
|
|
830
|
+
}
|
|
831
|
+
var newReports = topics.map(function (topic) {
|
|
832
|
+
return {
|
|
833
|
+
roomId: roomId,
|
|
834
|
+
topicId: topic.id,
|
|
835
|
+
lastAckMessageId: null,
|
|
836
|
+
missed: null,
|
|
837
|
+
missedMoreThan: null
|
|
838
|
+
};
|
|
839
|
+
});
|
|
840
|
+
ackReports.set.apply(ackReports, MessagesManager_toConsumableArray(newReports));
|
|
841
|
+
}
|
|
842
|
+
}, {
|
|
843
|
+
key: "updateLocallyAckReportOnNewMessage",
|
|
844
|
+
value: function updateLocallyAckReportOnNewMessage(roomId, topicId, authorId) {
|
|
845
|
+
var _this$tracker$me;
|
|
846
|
+
var ackReports = this.acks.get(roomId);
|
|
847
|
+
if (!ackReports) {
|
|
848
|
+
// If we don't follow ack reports for this room, skip
|
|
849
|
+
return;
|
|
850
|
+
}
|
|
851
|
+
var isMe = authorId === ((_this$tracker$me = this.tracker.me) === null || _this$tracker$me === void 0 ? void 0 : _this$tracker$me.id);
|
|
852
|
+
var currentAckReport = ackReports.get(topicId);
|
|
853
|
+
var update;
|
|
854
|
+
if (isMe) {
|
|
855
|
+
// Reset missed messages count if new message is authored by me
|
|
856
|
+
update = {
|
|
857
|
+
missed: 0,
|
|
858
|
+
missedMoreThan: null
|
|
859
|
+
};
|
|
860
|
+
} else {
|
|
861
|
+
// ...add 1 otherwise
|
|
862
|
+
update = {
|
|
863
|
+
missed: currentAckReport.missed ? currentAckReport.missed + 1 : null,
|
|
864
|
+
missedMoreThan: currentAckReport.missedMoreThan ? currentAckReport.missedMoreThan : null
|
|
865
|
+
};
|
|
866
|
+
}
|
|
867
|
+
ackReports.set(_objectSpread(_objectSpread({}, currentAckReport), update));
|
|
868
|
+
}
|
|
869
|
+
}]);
|
|
870
|
+
return MessagesManager;
|
|
871
|
+
}();
|
|
582
872
|
;// CONCATENATED MODULE: ./src/state-tracker/RoomsManager.ts
|
|
583
873
|
function RoomsManager_typeof(obj) { "@babel/helpers - typeof"; return RoomsManager_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; }, RoomsManager_typeof(obj); }
|
|
584
874
|
function RoomsManager_createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = RoomsManager_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; } } }; }
|
|
@@ -588,9 +878,9 @@ function RoomsManager_unsupportedIterableToArray(o, minLen) { if (!o) return; if
|
|
|
588
878
|
function RoomsManager_iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
589
879
|
function RoomsManager_arrayWithoutHoles(arr) { if (Array.isArray(arr)) return RoomsManager_arrayLikeToArray(arr); }
|
|
590
880
|
function RoomsManager_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; }
|
|
591
|
-
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" == RoomsManager_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; }
|
|
592
|
-
function
|
|
593
|
-
function
|
|
881
|
+
function RoomsManager_regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ RoomsManager_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" == RoomsManager_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; }
|
|
882
|
+
function RoomsManager_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); } }
|
|
883
|
+
function RoomsManager_asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { RoomsManager_asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { RoomsManager_asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
594
884
|
function RoomsManager_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
595
885
|
function RoomsManager_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, RoomsManager_toPropertyKey(descriptor.key), descriptor); } }
|
|
596
886
|
function RoomsManager_createClass(Constructor, protoProps, staticProps) { if (protoProps) RoomsManager_defineProperties(Constructor.prototype, protoProps); if (staticProps) RoomsManager_defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
@@ -599,21 +889,18 @@ function RoomsManager_toPropertyKey(arg) { var key = RoomsManager_toPrimitive(ar
|
|
|
599
889
|
function RoomsManager_toPrimitive(input, hint) { if (RoomsManager_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (RoomsManager_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
600
890
|
|
|
601
891
|
|
|
602
|
-
var RoomsManager = /*#__PURE__*/function () {
|
|
603
|
-
// Temporary not lazy loaded; server must implement GetTopicMessages command.
|
|
604
892
|
|
|
893
|
+
var RoomsManager = /*#__PURE__*/function () {
|
|
605
894
|
function RoomsManager(tracker) {
|
|
606
895
|
var _this = this;
|
|
607
896
|
RoomsManager_classCallCheck(this, RoomsManager);
|
|
608
897
|
this.tracker = tracker;
|
|
898
|
+
RoomsManager_defineProperty(this, "messages", void 0);
|
|
609
899
|
RoomsManager_defineProperty(this, "list", new ObservableIndexedObjectCollection('id'));
|
|
610
900
|
RoomsManager_defineProperty(this, "topics", new IndexedCollection());
|
|
611
|
-
RoomsManager_defineProperty(this, "topicsMessages", new IndexedCollection());
|
|
612
901
|
RoomsManager_defineProperty(this, "members", new IndexedCollection());
|
|
613
902
|
RoomsManager_defineProperty(this, "deferredSession", new DeferredTask());
|
|
614
|
-
this.
|
|
615
|
-
return _this.handleNewMessage(ev);
|
|
616
|
-
});
|
|
903
|
+
this.messages = new MessagesManager(tracker);
|
|
617
904
|
this.tracker.client.on('NewTopic', function (ev) {
|
|
618
905
|
return _this.handleNewTopic(ev);
|
|
619
906
|
});
|
|
@@ -649,9 +936,9 @@ var RoomsManager = /*#__PURE__*/function () {
|
|
|
649
936
|
RoomsManager_createClass(RoomsManager, [{
|
|
650
937
|
key: "getMembers",
|
|
651
938
|
value: function () {
|
|
652
|
-
var _getMembers =
|
|
939
|
+
var _getMembers = RoomsManager_asyncToGenerator( /*#__PURE__*/RoomsManager_regeneratorRuntime().mark(function _callee(roomId) {
|
|
653
940
|
var result;
|
|
654
|
-
return
|
|
941
|
+
return RoomsManager_regeneratorRuntime().wrap(function _callee$(_context) {
|
|
655
942
|
while (1) {
|
|
656
943
|
switch (_context.prev = _context.next) {
|
|
657
944
|
case 0:
|
|
@@ -692,9 +979,9 @@ var RoomsManager = /*#__PURE__*/function () {
|
|
|
692
979
|
}, {
|
|
693
980
|
key: "getMe",
|
|
694
981
|
value: function () {
|
|
695
|
-
var _getMe =
|
|
982
|
+
var _getMe = RoomsManager_asyncToGenerator( /*#__PURE__*/RoomsManager_regeneratorRuntime().mark(function _callee2(roomId) {
|
|
696
983
|
var userId, members;
|
|
697
|
-
return
|
|
984
|
+
return RoomsManager_regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
698
985
|
while (1) {
|
|
699
986
|
switch (_context2.prev = _context2.next) {
|
|
700
987
|
case 0:
|
|
@@ -734,8 +1021,8 @@ var RoomsManager = /*#__PURE__*/function () {
|
|
|
734
1021
|
}, {
|
|
735
1022
|
key: "get",
|
|
736
1023
|
value: function () {
|
|
737
|
-
var _get =
|
|
738
|
-
return
|
|
1024
|
+
var _get = RoomsManager_asyncToGenerator( /*#__PURE__*/RoomsManager_regeneratorRuntime().mark(function _callee3() {
|
|
1025
|
+
return RoomsManager_regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
739
1026
|
while (1) {
|
|
740
1027
|
switch (_context3.prev = _context3.next) {
|
|
741
1028
|
case 0:
|
|
@@ -761,8 +1048,8 @@ var RoomsManager = /*#__PURE__*/function () {
|
|
|
761
1048
|
}, {
|
|
762
1049
|
key: "getTopics",
|
|
763
1050
|
value: function () {
|
|
764
|
-
var _getTopics =
|
|
765
|
-
return
|
|
1051
|
+
var _getTopics = RoomsManager_asyncToGenerator( /*#__PURE__*/RoomsManager_regeneratorRuntime().mark(function _callee4(roomId) {
|
|
1052
|
+
return RoomsManager_regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
766
1053
|
while (1) {
|
|
767
1054
|
switch (_context4.prev = _context4.next) {
|
|
768
1055
|
case 0:
|
|
@@ -782,30 +1069,6 @@ var RoomsManager = /*#__PURE__*/function () {
|
|
|
782
1069
|
}
|
|
783
1070
|
return getTopics;
|
|
784
1071
|
}()
|
|
785
|
-
/**
|
|
786
|
-
* Get collection of the messages written in topic.
|
|
787
|
-
*/
|
|
788
|
-
}, {
|
|
789
|
-
key: "getMessages",
|
|
790
|
-
value: function () {
|
|
791
|
-
var _getMessages = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(topicId) {
|
|
792
|
-
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
793
|
-
while (1) {
|
|
794
|
-
switch (_context5.prev = _context5.next) {
|
|
795
|
-
case 0:
|
|
796
|
-
return _context5.abrupt("return", this.topicsMessages.get(topicId));
|
|
797
|
-
case 1:
|
|
798
|
-
case "end":
|
|
799
|
-
return _context5.stop();
|
|
800
|
-
}
|
|
801
|
-
}
|
|
802
|
-
}, _callee5, this);
|
|
803
|
-
}));
|
|
804
|
-
function getMessages(_x4) {
|
|
805
|
-
return _getMessages.apply(this, arguments);
|
|
806
|
-
}
|
|
807
|
-
return getMessages;
|
|
808
|
-
}()
|
|
809
1072
|
/**
|
|
810
1073
|
* For internal use. If you want to leave the room, execute a proper command on client object.
|
|
811
1074
|
* @internal
|
|
@@ -813,21 +1076,20 @@ var RoomsManager = /*#__PURE__*/function () {
|
|
|
813
1076
|
}, {
|
|
814
1077
|
key: "_delete",
|
|
815
1078
|
value: function _delete() {
|
|
816
|
-
var _this$list, _this$members, _this$
|
|
1079
|
+
var _this$list, _this$members, _this$topics;
|
|
817
1080
|
for (var _len = arguments.length, roomIds = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
818
1081
|
roomIds[_key] = arguments[_key];
|
|
819
1082
|
}
|
|
820
1083
|
(_this$list = this.list)["delete"].apply(_this$list, roomIds);
|
|
821
1084
|
(_this$members = this.members)["delete"].apply(_this$members, roomIds);
|
|
822
|
-
var topicIds = [];
|
|
823
1085
|
for (var _i = 0, _roomIds = roomIds; _i < _roomIds.length; _i++) {
|
|
824
|
-
var _this$topics$get$map, _this$topics$get;
|
|
1086
|
+
var _this$topics$get$map, _this$topics$get, _this$messages;
|
|
825
1087
|
var roomId = _roomIds[_i];
|
|
826
|
-
topicIds
|
|
1088
|
+
var topicIds = (_this$topics$get$map = (_this$topics$get = this.topics.get(roomId)) === null || _this$topics$get === void 0 ? void 0 : _this$topics$get.map(function (topic) {
|
|
827
1089
|
return topic.id;
|
|
828
|
-
})) !== null && _this$topics$get$map !== void 0 ? _this$topics$get$map : []
|
|
1090
|
+
})) !== null && _this$topics$get$map !== void 0 ? _this$topics$get$map : [];
|
|
1091
|
+
(_this$messages = this.messages)._deleteByTopicIds.apply(_this$messages, [roomId].concat(RoomsManager_toConsumableArray(topicIds)));
|
|
829
1092
|
}
|
|
830
|
-
(_this$topicsMessages = this.topicsMessages)["delete"].apply(_this$topicsMessages, topicIds);
|
|
831
1093
|
(_this$topics = this.topics)["delete"].apply(_this$topics, roomIds);
|
|
832
1094
|
}
|
|
833
1095
|
|
|
@@ -886,11 +1148,6 @@ var RoomsManager = /*#__PURE__*/function () {
|
|
|
886
1148
|
collection["delete"](ev.id);
|
|
887
1149
|
this.list.get(ev.roomId).topics = collection.items;
|
|
888
1150
|
}
|
|
889
|
-
}, {
|
|
890
|
-
key: "handleNewMessage",
|
|
891
|
-
value: function handleNewMessage(ev) {
|
|
892
|
-
this.topicsMessages.get(ev.topicId).set(ev.message);
|
|
893
|
-
}
|
|
894
1151
|
}, {
|
|
895
1152
|
key: "handleNewTopic",
|
|
896
1153
|
value: function handleNewTopic(ev) {
|
|
@@ -900,7 +1157,7 @@ var RoomsManager = /*#__PURE__*/function () {
|
|
|
900
1157
|
}, {
|
|
901
1158
|
key: "addJoinedRoomTopics",
|
|
902
1159
|
value: function addJoinedRoomTopics(roomId) {
|
|
903
|
-
var _this$
|
|
1160
|
+
var _this$messages2;
|
|
904
1161
|
for (var _len2 = arguments.length, topics = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
|
|
905
1162
|
topics[_key2 - 1] = arguments[_key2];
|
|
906
1163
|
}
|
|
@@ -910,9 +1167,7 @@ var RoomsManager = /*#__PURE__*/function () {
|
|
|
910
1167
|
} else {
|
|
911
1168
|
this.topics.set([roomId, new ObservableIndexedObjectCollection('id', topics)]);
|
|
912
1169
|
}
|
|
913
|
-
(_this$
|
|
914
|
-
return [topic.id, new ObservableIndexedObjectCollection('id')];
|
|
915
|
-
})));
|
|
1170
|
+
(_this$messages2 = this.messages)._handleNewTopics.apply(_this$messages2, [roomId].concat(topics));
|
|
916
1171
|
}
|
|
917
1172
|
}, {
|
|
918
1173
|
key: "handleRoomJoined",
|
|
@@ -1747,13 +2002,18 @@ var ChatStateTracker = /*#__PURE__*/function () {
|
|
|
1747
2002
|
ChatStateTracker_defineProperty(this, "rooms", new RoomsManager(this));
|
|
1748
2003
|
ChatStateTracker_defineProperty(this, "spaces", new SpacesManager(this));
|
|
1749
2004
|
ChatStateTracker_defineProperty(this, "permissions", new PermissionsManager(this));
|
|
1750
|
-
ChatStateTracker_defineProperty(this, "
|
|
2005
|
+
ChatStateTracker_defineProperty(this, "_me", null);
|
|
1751
2006
|
ChatStateTracker_defineProperty(this, "deferredSession", new DeferredTask());
|
|
1752
2007
|
this.client.on('Session', function (ev) {
|
|
1753
2008
|
return _this.handleSession(ev);
|
|
1754
2009
|
});
|
|
1755
2010
|
}
|
|
1756
2011
|
ChatStateTracker_createClass(ChatStateTracker, [{
|
|
2012
|
+
key: "me",
|
|
2013
|
+
get: function get() {
|
|
2014
|
+
return this._me;
|
|
2015
|
+
}
|
|
2016
|
+
}, {
|
|
1757
2017
|
key: "getMe",
|
|
1758
2018
|
value: function () {
|
|
1759
2019
|
var _getMe = ChatStateTracker_asyncToGenerator( /*#__PURE__*/ChatStateTracker_regeneratorRuntime().mark(function _callee() {
|
|
@@ -1764,7 +2024,7 @@ var ChatStateTracker = /*#__PURE__*/function () {
|
|
|
1764
2024
|
_context.next = 2;
|
|
1765
2025
|
return this.deferredSession.promise;
|
|
1766
2026
|
case 2:
|
|
1767
|
-
return _context.abrupt("return", this.
|
|
2027
|
+
return _context.abrupt("return", this._me);
|
|
1768
2028
|
case 3:
|
|
1769
2029
|
case "end":
|
|
1770
2030
|
return _context.stop();
|
|
@@ -1780,7 +2040,7 @@ var ChatStateTracker = /*#__PURE__*/function () {
|
|
|
1780
2040
|
}, {
|
|
1781
2041
|
key: "handleSession",
|
|
1782
2042
|
value: function handleSession(ev) {
|
|
1783
|
-
this.
|
|
2043
|
+
this._me = ev.user;
|
|
1784
2044
|
this.deferredSession.resolve();
|
|
1785
2045
|
}
|
|
1786
2046
|
}]);
|