stream-chat 8.54.1 → 8.55.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser.es.js +1065 -248
- package/dist/browser.es.js.map +1 -1
- package/dist/browser.full-bundle.min.js +1 -1
- package/dist/browser.full-bundle.min.js.map +1 -1
- package/dist/browser.js +1069 -247
- package/dist/browser.js.map +1 -1
- package/dist/index.es.js +1065 -248
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +1069 -247
- package/dist/index.js.map +1 -1
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/search_controller.d.ts +174 -0
- package/dist/types/search_controller.d.ts.map +1 -0
- package/dist/types/utils.d.ts +28 -0
- package/dist/types/utils.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/index.ts +1 -0
- package/src/search_controller.ts +489 -0
- package/src/utils.ts +76 -0
package/dist/index.js
CHANGED
|
@@ -328,9 +328,9 @@ var Campaign = /*#__PURE__*/function () {
|
|
|
328
328
|
return Campaign;
|
|
329
329
|
}();
|
|
330
330
|
|
|
331
|
-
function ownKeys$
|
|
331
|
+
function ownKeys$d(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
332
332
|
|
|
333
|
-
function _objectSpread$
|
|
333
|
+
function _objectSpread$d(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$d(Object(source), true).forEach(function (key) { _defineProperty__default['default'](target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$d(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
334
334
|
|
|
335
335
|
function _createForOfIteratorHelper$5(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray$5(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) { function e(_x) { return _e.apply(this, arguments); } e.toString = function () { return _e.toString(); }; return e; }(function (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 (_e2) { function e(_x2) { return _e2.apply(this, arguments); } e.toString = function () { return _e2.toString(); }; return e; }(function (e) { didErr = true; err = e; }), f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
336
336
|
|
|
@@ -592,7 +592,7 @@ var axiosParamsSerializer = function axiosParamsSerializer(params) {
|
|
|
592
592
|
*/
|
|
593
593
|
|
|
594
594
|
function formatMessage(message) {
|
|
595
|
-
return _objectSpread$
|
|
595
|
+
return _objectSpread$d(_objectSpread$d({}, message), {}, {
|
|
596
596
|
/**
|
|
597
597
|
* @deprecated please use `html`
|
|
598
598
|
*/
|
|
@@ -735,25 +735,86 @@ function maybeGetReactionGroupsFallback(groups, counts, scores) {
|
|
|
735
735
|
}
|
|
736
736
|
|
|
737
737
|
return null;
|
|
738
|
-
} //
|
|
738
|
+
} // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
739
739
|
|
|
740
740
|
|
|
741
|
-
|
|
742
|
-
|
|
741
|
+
// works exactly the same as lodash.debounce
|
|
742
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
743
|
+
var debounce = function debounce(fn) {
|
|
744
|
+
var timeout = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
743
745
|
|
|
744
746
|
var _ref2 = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {},
|
|
745
747
|
_ref2$leading = _ref2.leading,
|
|
746
|
-
leading = _ref2$leading === void 0 ?
|
|
748
|
+
leading = _ref2$leading === void 0 ? false : _ref2$leading,
|
|
747
749
|
_ref2$trailing = _ref2.trailing,
|
|
748
|
-
trailing = _ref2$trailing === void 0 ?
|
|
750
|
+
trailing = _ref2$trailing === void 0 ? true : _ref2$trailing;
|
|
749
751
|
|
|
750
752
|
var runningTimeout = null;
|
|
751
|
-
var
|
|
752
|
-
|
|
753
|
+
var argsForTrailingExecution = null;
|
|
754
|
+
var lastResult;
|
|
755
|
+
|
|
756
|
+
var debouncedFn = function debouncedFn() {
|
|
753
757
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
754
758
|
args[_key] = arguments[_key];
|
|
755
759
|
}
|
|
756
760
|
|
|
761
|
+
if (runningTimeout) {
|
|
762
|
+
clearTimeout(runningTimeout);
|
|
763
|
+
} else if (leading) {
|
|
764
|
+
lastResult = fn.apply(void 0, args);
|
|
765
|
+
}
|
|
766
|
+
|
|
767
|
+
if (trailing) argsForTrailingExecution = args;
|
|
768
|
+
|
|
769
|
+
var timeoutHandler = function timeoutHandler() {
|
|
770
|
+
if (argsForTrailingExecution) {
|
|
771
|
+
lastResult = fn.apply(void 0, _toConsumableArray__default['default'](argsForTrailingExecution));
|
|
772
|
+
argsForTrailingExecution = null;
|
|
773
|
+
}
|
|
774
|
+
|
|
775
|
+
runningTimeout = null;
|
|
776
|
+
};
|
|
777
|
+
|
|
778
|
+
runningTimeout = setTimeout(timeoutHandler, timeout);
|
|
779
|
+
return lastResult;
|
|
780
|
+
};
|
|
781
|
+
|
|
782
|
+
debouncedFn.cancel = function () {
|
|
783
|
+
if (runningTimeout) clearTimeout(runningTimeout);
|
|
784
|
+
};
|
|
785
|
+
|
|
786
|
+
debouncedFn.flush = function () {
|
|
787
|
+
if (runningTimeout) {
|
|
788
|
+
clearTimeout(runningTimeout);
|
|
789
|
+
runningTimeout = null;
|
|
790
|
+
|
|
791
|
+
if (argsForTrailingExecution) {
|
|
792
|
+
lastResult = fn.apply(void 0, _toConsumableArray__default['default'](argsForTrailingExecution));
|
|
793
|
+
}
|
|
794
|
+
}
|
|
795
|
+
|
|
796
|
+
return lastResult;
|
|
797
|
+
};
|
|
798
|
+
|
|
799
|
+
return debouncedFn;
|
|
800
|
+
}; // works exactly the same as lodash.throttle
|
|
801
|
+
|
|
802
|
+
var throttle = function throttle(fn) {
|
|
803
|
+
var timeout = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 200;
|
|
804
|
+
|
|
805
|
+
var _ref3 = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {},
|
|
806
|
+
_ref3$leading = _ref3.leading,
|
|
807
|
+
leading = _ref3$leading === void 0 ? true : _ref3$leading,
|
|
808
|
+
_ref3$trailing = _ref3.trailing,
|
|
809
|
+
trailing = _ref3$trailing === void 0 ? false : _ref3$trailing;
|
|
810
|
+
|
|
811
|
+
var runningTimeout = null;
|
|
812
|
+
var storedArgs = null;
|
|
813
|
+
return function () {
|
|
814
|
+
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
815
|
+
args[_key2] = arguments[_key2];
|
|
816
|
+
}
|
|
817
|
+
|
|
757
818
|
if (runningTimeout) {
|
|
758
819
|
if (trailing) storedArgs = args;
|
|
759
820
|
return;
|
|
@@ -802,13 +863,13 @@ function binarySearchByDateEqualOrNearestGreater(array, targetDate) {
|
|
|
802
863
|
return left;
|
|
803
864
|
}
|
|
804
865
|
|
|
805
|
-
var messagePaginationCreatedAtAround = function messagePaginationCreatedAtAround(
|
|
806
|
-
var parentSet =
|
|
807
|
-
requestedPageSize =
|
|
808
|
-
returnedPage =
|
|
809
|
-
messagePaginationOptions =
|
|
866
|
+
var messagePaginationCreatedAtAround = function messagePaginationCreatedAtAround(_ref4) {
|
|
867
|
+
var parentSet = _ref4.parentSet,
|
|
868
|
+
requestedPageSize = _ref4.requestedPageSize,
|
|
869
|
+
returnedPage = _ref4.returnedPage,
|
|
870
|
+
messagePaginationOptions = _ref4.messagePaginationOptions;
|
|
810
871
|
|
|
811
|
-
var newPagination = _objectSpread$
|
|
872
|
+
var newPagination = _objectSpread$d({}, parentSet.pagination);
|
|
812
873
|
|
|
813
874
|
if (!(messagePaginationOptions !== null && messagePaginationOptions !== void 0 && messagePaginationOptions.created_at_around)) return newPagination;
|
|
814
875
|
var hasPrev;
|
|
@@ -816,9 +877,9 @@ var messagePaginationCreatedAtAround = function messagePaginationCreatedAtAround
|
|
|
816
877
|
var updateHasPrev;
|
|
817
878
|
var updateHasNext;
|
|
818
879
|
var createdAtAroundDate = new Date(messagePaginationOptions.created_at_around);
|
|
819
|
-
var
|
|
820
|
-
firstPageMsg =
|
|
821
|
-
lastPageMsg =
|
|
880
|
+
var _ref5 = [returnedPage[0], returnedPage.slice(-1)[0]],
|
|
881
|
+
firstPageMsg = _ref5[0],
|
|
882
|
+
lastPageMsg = _ref5[1]; // expect ASC order (from oldest to newest)
|
|
822
883
|
|
|
823
884
|
var wholePageHasNewerMessages = !!(firstPageMsg !== null && firstPageMsg !== void 0 && firstPageMsg.created_at) && new Date(firstPageMsg.created_at) > createdAtAroundDate;
|
|
824
885
|
var wholePageHasOlderMessages = !!(lastPageMsg !== null && lastPageMsg !== void 0 && lastPageMsg.created_at) && new Date(lastPageMsg.created_at) < createdAtAroundDate;
|
|
@@ -865,25 +926,25 @@ var messagePaginationCreatedAtAround = function messagePaginationCreatedAtAround
|
|
|
865
926
|
return newPagination;
|
|
866
927
|
};
|
|
867
928
|
|
|
868
|
-
var messagePaginationIdAround = function messagePaginationIdAround(
|
|
929
|
+
var messagePaginationIdAround = function messagePaginationIdAround(_ref6) {
|
|
869
930
|
var _parentSet$messages$2, _parentSet$messages$s2;
|
|
870
931
|
|
|
871
|
-
var parentSet =
|
|
872
|
-
requestedPageSize =
|
|
873
|
-
returnedPage =
|
|
874
|
-
messagePaginationOptions =
|
|
932
|
+
var parentSet = _ref6.parentSet,
|
|
933
|
+
requestedPageSize = _ref6.requestedPageSize,
|
|
934
|
+
returnedPage = _ref6.returnedPage,
|
|
935
|
+
messagePaginationOptions = _ref6.messagePaginationOptions;
|
|
875
936
|
|
|
876
|
-
var newPagination = _objectSpread$
|
|
937
|
+
var newPagination = _objectSpread$d({}, parentSet.pagination);
|
|
877
938
|
|
|
878
|
-
var
|
|
879
|
-
id_around =
|
|
939
|
+
var _ref7 = messagePaginationOptions || {},
|
|
940
|
+
id_around = _ref7.id_around;
|
|
880
941
|
|
|
881
942
|
if (!id_around) return newPagination;
|
|
882
943
|
var hasPrev;
|
|
883
944
|
var hasNext;
|
|
884
|
-
var
|
|
885
|
-
firstPageMsg =
|
|
886
|
-
lastPageMsg =
|
|
945
|
+
var _ref8 = [returnedPage[0], returnedPage.slice(-1)[0]],
|
|
946
|
+
firstPageMsg = _ref8[0],
|
|
947
|
+
lastPageMsg = _ref8[1];
|
|
887
948
|
var firstPageMsgIsFirstInSet = (firstPageMsg === null || firstPageMsg === void 0 ? void 0 : firstPageMsg.id) === ((_parentSet$messages$2 = parentSet.messages[0]) === null || _parentSet$messages$2 === void 0 ? void 0 : _parentSet$messages$2.id),
|
|
888
949
|
lastPageMsgIsLastInSet = (lastPageMsg === null || lastPageMsg === void 0 ? void 0 : lastPageMsg.id) === ((_parentSet$messages$s2 = parentSet.messages.slice(-1)[0]) === null || _parentSet$messages$s2 === void 0 ? void 0 : _parentSet$messages$s2.id);
|
|
889
950
|
var updateHasPrev = firstPageMsgIsFirstInSet;
|
|
@@ -923,21 +984,21 @@ var messagePaginationIdAround = function messagePaginationIdAround(_ref5) {
|
|
|
923
984
|
return newPagination;
|
|
924
985
|
};
|
|
925
986
|
|
|
926
|
-
var messagePaginationLinear = function messagePaginationLinear(
|
|
987
|
+
var messagePaginationLinear = function messagePaginationLinear(_ref9) {
|
|
927
988
|
var _parentSet$messages$3, _parentSet$messages$s3;
|
|
928
989
|
|
|
929
|
-
var parentSet =
|
|
930
|
-
requestedPageSize =
|
|
931
|
-
returnedPage =
|
|
932
|
-
messagePaginationOptions =
|
|
990
|
+
var parentSet = _ref9.parentSet,
|
|
991
|
+
requestedPageSize = _ref9.requestedPageSize,
|
|
992
|
+
returnedPage = _ref9.returnedPage,
|
|
993
|
+
messagePaginationOptions = _ref9.messagePaginationOptions;
|
|
933
994
|
|
|
934
|
-
var newPagination = _objectSpread$
|
|
995
|
+
var newPagination = _objectSpread$d({}, parentSet.pagination);
|
|
935
996
|
|
|
936
997
|
var hasPrev;
|
|
937
998
|
var hasNext;
|
|
938
|
-
var
|
|
939
|
-
firstPageMsg =
|
|
940
|
-
lastPageMsg =
|
|
999
|
+
var _ref10 = [returnedPage[0], returnedPage.slice(-1)[0]],
|
|
1000
|
+
firstPageMsg = _ref10[0],
|
|
1001
|
+
lastPageMsg = _ref10[1];
|
|
941
1002
|
var firstPageMsgIsFirstInSet = (firstPageMsg === null || firstPageMsg === void 0 ? void 0 : firstPageMsg.id) && firstPageMsg.id === ((_parentSet$messages$3 = parentSet.messages[0]) === null || _parentSet$messages$3 === void 0 ? void 0 : _parentSet$messages$3.id),
|
|
942
1003
|
lastPageMsgIsLastInSet = (lastPageMsg === null || lastPageMsg === void 0 ? void 0 : lastPageMsg.id) && lastPageMsg.id === ((_parentSet$messages$s3 = parentSet.messages.slice(-1)[0]) === null || _parentSet$messages$s3 === void 0 ? void 0 : _parentSet$messages$s3.id);
|
|
943
1004
|
var queriedNextMessages = messagePaginationOptions && (messagePaginationOptions.created_at_after_or_equal || messagePaginationOptions.created_at_after || messagePaginationOptions.id_gt || messagePaginationOptions.id_gte);
|
|
@@ -985,9 +1046,9 @@ var DEFAULT_MESSAGE_SET_PAGINATION = {
|
|
|
985
1046
|
hasPrev: false
|
|
986
1047
|
};
|
|
987
1048
|
|
|
988
|
-
function ownKeys$
|
|
1049
|
+
function ownKeys$c(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
989
1050
|
|
|
990
|
-
function _objectSpread$
|
|
1051
|
+
function _objectSpread$c(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$c(Object(source), true).forEach(function (key) { _defineProperty__default['default'](target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$c(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
991
1052
|
|
|
992
1053
|
/**
|
|
993
1054
|
* ChannelState - A container class for the channel state.
|
|
@@ -1068,7 +1129,7 @@ var ChannelState = /*#__PURE__*/function () {
|
|
|
1068
1129
|
var m = messages[i];
|
|
1069
1130
|
|
|
1070
1131
|
if (((_m$user = m.user) === null || _m$user === void 0 ? void 0 : _m$user.id) === user.id) {
|
|
1071
|
-
messages[i] = _objectSpread$
|
|
1132
|
+
messages[i] = _objectSpread$c(_objectSpread$c({}, m), {}, {
|
|
1072
1133
|
user: user
|
|
1073
1134
|
});
|
|
1074
1135
|
}
|
|
@@ -1123,7 +1184,7 @@ var ChannelState = /*#__PURE__*/function () {
|
|
|
1123
1184
|
user: m.user
|
|
1124
1185
|
};
|
|
1125
1186
|
} else {
|
|
1126
|
-
messages[i] = _objectSpread$
|
|
1187
|
+
messages[i] = _objectSpread$c(_objectSpread$c({}, m), {}, {
|
|
1127
1188
|
type: 'deleted',
|
|
1128
1189
|
deleted_at: user.deleted_at ? new Date(user.deleted_at) : null
|
|
1129
1190
|
});
|
|
@@ -1441,7 +1502,7 @@ var ChannelState = /*#__PURE__*/function () {
|
|
|
1441
1502
|
var parseMessage = function parseMessage(m) {
|
|
1442
1503
|
var _m$pinned_at, _m$updated_at;
|
|
1443
1504
|
|
|
1444
|
-
return _objectSpread$
|
|
1505
|
+
return _objectSpread$c(_objectSpread$c({}, m), {}, {
|
|
1445
1506
|
created_at: m.created_at.toISOString(),
|
|
1446
1507
|
pinned_at: (_m$pinned_at = m.pinned_at) === null || _m$pinned_at === void 0 ? void 0 : _m$pinned_at.toISOString(),
|
|
1447
1508
|
updated_at: (_m$updated_at = m.updated_at) === null || _m$updated_at === void 0 ? void 0 : _m$updated_at.toISOString()
|
|
@@ -1451,8 +1512,8 @@ var ChannelState = /*#__PURE__*/function () {
|
|
|
1451
1512
|
var update = function update(messages) {
|
|
1452
1513
|
var updatedMessages = messages.reduce(function (acc, msg) {
|
|
1453
1514
|
if (msg.quoted_message_id === message.id) {
|
|
1454
|
-
acc.push(_objectSpread$
|
|
1455
|
-
quoted_message: remove ? _objectSpread$
|
|
1515
|
+
acc.push(_objectSpread$c(_objectSpread$c({}, parseMessage(msg)), {}, {
|
|
1516
|
+
quoted_message: remove ? _objectSpread$c(_objectSpread$c({}, message), {}, {
|
|
1456
1517
|
attachments: []
|
|
1457
1518
|
}) : message
|
|
1458
1519
|
}));
|
|
@@ -1941,9 +2002,9 @@ function _unsupportedIterableToArray$4(o, minLen) { if (!o) return; if (typeof o
|
|
|
1941
2002
|
|
|
1942
2003
|
function _arrayLikeToArray$4(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; }
|
|
1943
2004
|
|
|
1944
|
-
function ownKeys$
|
|
2005
|
+
function ownKeys$b(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
1945
2006
|
|
|
1946
|
-
function _objectSpread$
|
|
2007
|
+
function _objectSpread$b(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$b(Object(source), true).forEach(function (key) { _defineProperty__default['default'](target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$b(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
1947
2008
|
/**
|
|
1948
2009
|
* Channel - The Channel class manages it's own state.
|
|
1949
2010
|
*/
|
|
@@ -2018,7 +2079,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2018
2079
|
while (1) {
|
|
2019
2080
|
switch (_context.prev = _context.next) {
|
|
2020
2081
|
case 0:
|
|
2021
|
-
defaultOptions = _objectSpread$
|
|
2082
|
+
defaultOptions = _objectSpread$b(_objectSpread$b({}, options), {}, {
|
|
2022
2083
|
watch: false,
|
|
2023
2084
|
state: false,
|
|
2024
2085
|
presence: false
|
|
@@ -2090,7 +2151,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2090
2151
|
|
|
2091
2152
|
this.data = data; // this._data is used for the requests...
|
|
2092
2153
|
|
|
2093
|
-
this._data = _objectSpread$
|
|
2154
|
+
this._data = _objectSpread$b({}, data);
|
|
2094
2155
|
this.cid = "".concat(type, ":").concat(id);
|
|
2095
2156
|
this.listeners = {}; // perhaps the state variable should be private
|
|
2096
2157
|
|
|
@@ -2152,7 +2213,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2152
2213
|
switch (_context2.prev = _context2.next) {
|
|
2153
2214
|
case 0:
|
|
2154
2215
|
_context2.next = 2;
|
|
2155
|
-
return this.getClient().post(this._channelURL() + '/message', _objectSpread$
|
|
2216
|
+
return this.getClient().post(this._channelURL() + '/message', _objectSpread$b({
|
|
2156
2217
|
message: message
|
|
2157
2218
|
}, options));
|
|
2158
2219
|
|
|
@@ -2268,7 +2329,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2268
2329
|
|
|
2269
2330
|
case 3:
|
|
2270
2331
|
// Return a list of channels
|
|
2271
|
-
payload = _objectSpread$
|
|
2332
|
+
payload = _objectSpread$b(_objectSpread$b({
|
|
2272
2333
|
filter_conditions: {
|
|
2273
2334
|
cid: this.cid
|
|
2274
2335
|
}
|
|
@@ -2365,7 +2426,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2365
2426
|
|
|
2366
2427
|
_context5.next = 6;
|
|
2367
2428
|
return this.getClient().get(this.getClient().baseURL + '/members', {
|
|
2368
|
-
payload: _objectSpread$
|
|
2429
|
+
payload: _objectSpread$b({
|
|
2369
2430
|
type: type,
|
|
2370
2431
|
id: id,
|
|
2371
2432
|
members: members,
|
|
@@ -2471,7 +2532,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2471
2532
|
|
|
2472
2533
|
case 4:
|
|
2473
2534
|
_context7.next = 6;
|
|
2474
|
-
return this.getClient().post(this.getClient().baseURL + "/messages/".concat(encodeURIComponent(messageID), "/reaction"), _objectSpread$
|
|
2535
|
+
return this.getClient().post(this.getClient().baseURL + "/messages/".concat(encodeURIComponent(messageID), "/reaction"), _objectSpread$b({
|
|
2475
2536
|
reaction: reaction
|
|
2476
2537
|
}, options));
|
|
2477
2538
|
|
|
@@ -2552,7 +2613,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2552
2613
|
delete channelData[key];
|
|
2553
2614
|
});
|
|
2554
2615
|
_context8.next = 7;
|
|
2555
|
-
return this._update(_objectSpread$
|
|
2616
|
+
return this._update(_objectSpread$b({
|
|
2556
2617
|
message: updateMessage,
|
|
2557
2618
|
data: channelData
|
|
2558
2619
|
}, options));
|
|
@@ -2724,7 +2785,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2724
2785
|
case 0:
|
|
2725
2786
|
options = _args12.length > 0 && _args12[0] !== undefined ? _args12[0] : {};
|
|
2726
2787
|
_context12.next = 3;
|
|
2727
|
-
return this.getClient().delete(this._channelURL(), _objectSpread$
|
|
2788
|
+
return this.getClient().delete(this._channelURL(), _objectSpread$b({}, options));
|
|
2728
2789
|
|
|
2729
2790
|
case 3:
|
|
2730
2791
|
return _context12.abrupt("return", _context12.sent);
|
|
@@ -2800,7 +2861,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2800
2861
|
case 0:
|
|
2801
2862
|
options = _args14.length > 0 && _args14[0] !== undefined ? _args14[0] : {};
|
|
2802
2863
|
_context14.next = 3;
|
|
2803
|
-
return this._update(_objectSpread$
|
|
2864
|
+
return this._update(_objectSpread$b({
|
|
2804
2865
|
accept_invite: true
|
|
2805
2866
|
}, options));
|
|
2806
2867
|
|
|
@@ -2841,7 +2902,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2841
2902
|
case 0:
|
|
2842
2903
|
options = _args15.length > 0 && _args15[0] !== undefined ? _args15[0] : {};
|
|
2843
2904
|
_context15.next = 3;
|
|
2844
|
-
return this._update(_objectSpread$
|
|
2905
|
+
return this._update(_objectSpread$b({
|
|
2845
2906
|
reject_invite: true
|
|
2846
2907
|
}, options));
|
|
2847
2908
|
|
|
@@ -2883,7 +2944,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2883
2944
|
case 0:
|
|
2884
2945
|
options = _args16.length > 2 && _args16[2] !== undefined ? _args16[2] : {};
|
|
2885
2946
|
_context16.next = 3;
|
|
2886
|
-
return this._update(_objectSpread$
|
|
2947
|
+
return this._update(_objectSpread$b({
|
|
2887
2948
|
add_members: members,
|
|
2888
2949
|
message: message
|
|
2889
2950
|
}, options));
|
|
@@ -2926,7 +2987,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2926
2987
|
case 0:
|
|
2927
2988
|
options = _args17.length > 2 && _args17[2] !== undefined ? _args17[2] : {};
|
|
2928
2989
|
_context17.next = 3;
|
|
2929
|
-
return this._update(_objectSpread$
|
|
2990
|
+
return this._update(_objectSpread$b({
|
|
2930
2991
|
add_moderators: members,
|
|
2931
2992
|
message: message
|
|
2932
2993
|
}, options));
|
|
@@ -2969,7 +3030,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2969
3030
|
case 0:
|
|
2970
3031
|
options = _args18.length > 2 && _args18[2] !== undefined ? _args18[2] : {};
|
|
2971
3032
|
_context18.next = 3;
|
|
2972
|
-
return this._update(_objectSpread$
|
|
3033
|
+
return this._update(_objectSpread$b({
|
|
2973
3034
|
assign_roles: roles,
|
|
2974
3035
|
message: message
|
|
2975
3036
|
}, options));
|
|
@@ -3012,7 +3073,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
3012
3073
|
case 0:
|
|
3013
3074
|
options = _args19.length > 2 && _args19[2] !== undefined ? _args19[2] : {};
|
|
3014
3075
|
_context19.next = 3;
|
|
3015
|
-
return this._update(_objectSpread$
|
|
3076
|
+
return this._update(_objectSpread$b({
|
|
3016
3077
|
invites: members,
|
|
3017
3078
|
message: message
|
|
3018
3079
|
}, options));
|
|
@@ -3055,7 +3116,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
3055
3116
|
case 0:
|
|
3056
3117
|
options = _args20.length > 2 && _args20[2] !== undefined ? _args20[2] : {};
|
|
3057
3118
|
_context20.next = 3;
|
|
3058
|
-
return this._update(_objectSpread$
|
|
3119
|
+
return this._update(_objectSpread$b({
|
|
3059
3120
|
remove_members: members,
|
|
3060
3121
|
message: message
|
|
3061
3122
|
}, options));
|
|
@@ -3098,7 +3159,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
3098
3159
|
case 0:
|
|
3099
3160
|
options = _args21.length > 2 && _args21[2] !== undefined ? _args21[2] : {};
|
|
3100
3161
|
_context21.next = 3;
|
|
3101
|
-
return this._update(_objectSpread$
|
|
3162
|
+
return this._update(_objectSpread$b({
|
|
3102
3163
|
demote_moderators: members,
|
|
3103
3164
|
message: message
|
|
3104
3165
|
}, options));
|
|
@@ -3183,7 +3244,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
3183
3244
|
case 0:
|
|
3184
3245
|
opts = _args23.length > 0 && _args23[0] !== undefined ? _args23[0] : {};
|
|
3185
3246
|
_context23.next = 3;
|
|
3186
|
-
return this.getClient().post(this.getClient().baseURL + '/moderation/mute/channel', _objectSpread$
|
|
3247
|
+
return this.getClient().post(this.getClient().baseURL + '/moderation/mute/channel', _objectSpread$b({
|
|
3187
3248
|
channel_cid: this.cid
|
|
3188
3249
|
}, opts));
|
|
3189
3250
|
|
|
@@ -3225,7 +3286,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
3225
3286
|
case 0:
|
|
3226
3287
|
opts = _args24.length > 0 && _args24[0] !== undefined ? _args24[0] : {};
|
|
3227
3288
|
_context24.next = 3;
|
|
3228
|
-
return this.getClient().post(this.getClient().baseURL + '/moderation/unmute/channel', _objectSpread$
|
|
3289
|
+
return this.getClient().post(this.getClient().baseURL + '/moderation/unmute/channel', _objectSpread$b({
|
|
3229
3290
|
channel_cid: this.cid
|
|
3230
3291
|
}, opts));
|
|
3231
3292
|
|
|
@@ -3562,7 +3623,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
3562
3623
|
|
|
3563
3624
|
this.lastTypingEvent = new Date();
|
|
3564
3625
|
_context29.next = 10;
|
|
3565
|
-
return this.sendEvent(_objectSpread$
|
|
3626
|
+
return this.sendEvent(_objectSpread$b({
|
|
3566
3627
|
type: 'typing.start',
|
|
3567
3628
|
parent_id: parent_id
|
|
3568
3629
|
}, options || {}));
|
|
@@ -3602,7 +3663,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
3602
3663
|
case 0:
|
|
3603
3664
|
options = _args30.length > 2 && _args30[2] !== undefined ? _args30[2] : {};
|
|
3604
3665
|
_context30.next = 3;
|
|
3605
|
-
return this.sendEvent(_objectSpread$
|
|
3666
|
+
return this.sendEvent(_objectSpread$b(_objectSpread$b({}, options), {}, {
|
|
3606
3667
|
type: 'ai_indicator.update',
|
|
3607
3668
|
message_id: messageId,
|
|
3608
3669
|
ai_state: state
|
|
@@ -3711,7 +3772,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
3711
3772
|
this.lastTypingEvent = null;
|
|
3712
3773
|
this.isTyping = false;
|
|
3713
3774
|
_context33.next = 6;
|
|
3714
|
-
return this.sendEvent(_objectSpread$
|
|
3775
|
+
return this.sendEvent(_objectSpread$b({
|
|
3715
3776
|
type: 'typing.stop',
|
|
3716
3777
|
parent_id: parent_id
|
|
3717
3778
|
}, options || {}));
|
|
@@ -3798,7 +3859,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
3798
3859
|
|
|
3799
3860
|
case 4:
|
|
3800
3861
|
_context34.next = 6;
|
|
3801
|
-
return this.getClient().post(this._channelURL() + '/read', _objectSpread$
|
|
3862
|
+
return this.getClient().post(this._channelURL() + '/read', _objectSpread$b({}, data));
|
|
3802
3863
|
|
|
3803
3864
|
case 6:
|
|
3804
3865
|
return _context34.abrupt("return", _context34.sent);
|
|
@@ -3845,7 +3906,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
3845
3906
|
|
|
3846
3907
|
case 3:
|
|
3847
3908
|
_context35.next = 5;
|
|
3848
|
-
return this.getClient().post(this._channelURL() + '/unread', _objectSpread$
|
|
3909
|
+
return this.getClient().post(this._channelURL() + '/unread', _objectSpread$b({}, data));
|
|
3849
3910
|
|
|
3850
3911
|
case 5:
|
|
3851
3912
|
return _context35.abrupt("return", _context35.sent);
|
|
@@ -3913,7 +3974,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
3913
3974
|
defaultOptions.watch = false;
|
|
3914
3975
|
}
|
|
3915
3976
|
|
|
3916
|
-
combined = _objectSpread$
|
|
3977
|
+
combined = _objectSpread$b(_objectSpread$b({}, defaultOptions), options);
|
|
3917
3978
|
_context36.next = 7;
|
|
3918
3979
|
return this.query(combined, 'latest');
|
|
3919
3980
|
|
|
@@ -4007,7 +4068,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
4007
4068
|
case 0:
|
|
4008
4069
|
normalizedSort = sort ? normalizeQuerySort(sort) : undefined;
|
|
4009
4070
|
_context38.next = 3;
|
|
4010
|
-
return this.getClient().get(this.getClient().baseURL + "/messages/".concat(encodeURIComponent(parent_id), "/replies"), _objectSpread$
|
|
4071
|
+
return this.getClient().get(this.getClient().baseURL + "/messages/".concat(encodeURIComponent(parent_id), "/replies"), _objectSpread$b({
|
|
4011
4072
|
sort: normalizedSort
|
|
4012
4073
|
}, options));
|
|
4013
4074
|
|
|
@@ -4057,7 +4118,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
4057
4118
|
sort = _args39.length > 1 && _args39[1] !== undefined ? _args39[1] : [];
|
|
4058
4119
|
_context39.next = 3;
|
|
4059
4120
|
return this.getClient().get(this._channelURL() + '/pinned_messages', {
|
|
4060
|
-
payload: _objectSpread$
|
|
4121
|
+
payload: _objectSpread$b(_objectSpread$b({}, options), {}, {
|
|
4061
4122
|
sort: normalizeQuerySort(sort)
|
|
4062
4123
|
})
|
|
4063
4124
|
});
|
|
@@ -4091,7 +4152,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
4091
4152
|
}, {
|
|
4092
4153
|
key: "getReactions",
|
|
4093
4154
|
value: function getReactions(message_id, options) {
|
|
4094
|
-
return this.getClient().get(this.getClient().baseURL + "/messages/".concat(encodeURIComponent(message_id), "/reactions"), _objectSpread$
|
|
4155
|
+
return this.getClient().get(this.getClient().baseURL + "/messages/".concat(encodeURIComponent(message_id), "/reactions"), _objectSpread$b({}, options));
|
|
4095
4156
|
}
|
|
4096
4157
|
/**
|
|
4097
4158
|
* getMessagesById - Retrieves a list of messages by ID
|
|
@@ -4238,7 +4299,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
4238
4299
|
}
|
|
4239
4300
|
|
|
4240
4301
|
_context40.next = 7;
|
|
4241
|
-
return this.getClient().post(queryURL + '/query', _objectSpread$
|
|
4302
|
+
return this.getClient().post(queryURL + '/query', _objectSpread$b({
|
|
4242
4303
|
data: this._data,
|
|
4243
4304
|
state: true
|
|
4244
4305
|
}, options));
|
|
@@ -4273,7 +4334,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
4273
4334
|
|
|
4274
4335
|
|
|
4275
4336
|
_this$_initializeStat = this._initializeState(state, messageSetToAddToIfDoesNotExist), messageSet = _this$_initializeStat.messageSet;
|
|
4276
|
-
messageSet.pagination = _objectSpread$
|
|
4337
|
+
messageSet.pagination = _objectSpread$b(_objectSpread$b({}, messageSet.pagination), messageSetPagination({
|
|
4277
4338
|
parentSet: messageSet,
|
|
4278
4339
|
messagePaginationOptions: options === null || options === void 0 ? void 0 : options.messages,
|
|
4279
4340
|
requestedPageSize: (_options$messages$lim = options === null || options === void 0 ? void 0 : (_options$messages = options.messages) === null || _options$messages === void 0 ? void 0 : _options$messages.limit) !== null && _options$messages$lim !== void 0 ? _options$messages$lim : DEFAULT_QUERY_CHANNEL_MESSAGE_LIST_PAGE_SIZE,
|
|
@@ -4335,7 +4396,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
4335
4396
|
this._checkInitialized();
|
|
4336
4397
|
|
|
4337
4398
|
_context41.next = 3;
|
|
4338
|
-
return this.getClient().banUser(targetUserID, _objectSpread$
|
|
4399
|
+
return this.getClient().banUser(targetUserID, _objectSpread$b(_objectSpread$b({}, options), {}, {
|
|
4339
4400
|
type: this.type,
|
|
4340
4401
|
id: this.id
|
|
4341
4402
|
}));
|
|
@@ -4507,7 +4568,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
4507
4568
|
this._checkInitialized();
|
|
4508
4569
|
|
|
4509
4570
|
_context45.next = 3;
|
|
4510
|
-
return this.getClient().shadowBan(targetUserID, _objectSpread$
|
|
4571
|
+
return this.getClient().shadowBan(targetUserID, _objectSpread$b(_objectSpread$b({}, options), {}, {
|
|
4511
4572
|
type: this.type,
|
|
4512
4573
|
id: this.id
|
|
4513
4574
|
}));
|
|
@@ -4912,7 +4973,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
4912
4973
|
case 'member.added':
|
|
4913
4974
|
case 'member.updated':
|
|
4914
4975
|
if ((_event$member = event.member) !== null && _event$member !== void 0 && _event$member.user) {
|
|
4915
|
-
channelState.members = _objectSpread$
|
|
4976
|
+
channelState.members = _objectSpread$b(_objectSpread$b({}, channelState.members), {}, _defineProperty__default['default']({}, event.member.user.id, event.member));
|
|
4916
4977
|
}
|
|
4917
4978
|
|
|
4918
4979
|
if (typeof ((_channelState$members = channelState.membership.user) === null || _channelState$members === void 0 ? void 0 : _channelState$members.id) === 'string' && typeof ((_event$member2 = event.member) === null || _event$member2 === void 0 ? void 0 : (_event$member2$user = _event$member2.user) === null || _event$member2$user === void 0 ? void 0 : _event$member2$user.id) === 'string' && event.member.user.id === channelState.membership.user.id) {
|
|
@@ -4923,7 +4984,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
4923
4984
|
|
|
4924
4985
|
case 'member.removed':
|
|
4925
4986
|
if ((_event$user9 = event.user) !== null && _event$user9 !== void 0 && _event$user9.id) {
|
|
4926
|
-
var newMembers = _objectSpread$
|
|
4987
|
+
var newMembers = _objectSpread$b({}, channelState.members);
|
|
4927
4988
|
|
|
4928
4989
|
delete newMembers[event.user.id];
|
|
4929
4990
|
channelState.members = newMembers; // TODO?: unset membership
|
|
@@ -4968,7 +5029,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
4968
5029
|
});
|
|
4969
5030
|
}
|
|
4970
5031
|
|
|
4971
|
-
channel.data = _objectSpread$
|
|
5032
|
+
channel.data = _objectSpread$b(_objectSpread$b({}, event.channel), {}, {
|
|
4972
5033
|
hidden: (_event$channel$hidden = (_event$channel3 = event.channel) === null || _event$channel3 === void 0 ? void 0 : _event$channel3.hidden) !== null && _event$channel$hidden !== void 0 ? _event$channel$hidden : (_channel$data2 = channel.data) === null || _channel$data2 === void 0 ? void 0 : _channel$data2.hidden,
|
|
4973
5034
|
own_capabilities: (_event$channel$own_ca = (_event$channel4 = event.channel) === null || _event$channel4 === void 0 ? void 0 : _event$channel4.own_capabilities) !== null && _event$channel$own_ca !== void 0 ? _event$channel$own_ca : (_channel$data3 = channel.data) === null || _channel$data3 === void 0 ? void 0 : _channel$data3.own_capabilities
|
|
4974
5035
|
});
|
|
@@ -4999,7 +5060,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
4999
5060
|
break;
|
|
5000
5061
|
|
|
5001
5062
|
case 'channel.hidden':
|
|
5002
|
-
channel.data = _objectSpread$
|
|
5063
|
+
channel.data = _objectSpread$b(_objectSpread$b({}, channel.data), {}, {
|
|
5003
5064
|
hidden: true
|
|
5004
5065
|
});
|
|
5005
5066
|
|
|
@@ -5010,26 +5071,26 @@ var Channel = /*#__PURE__*/function () {
|
|
|
5010
5071
|
break;
|
|
5011
5072
|
|
|
5012
5073
|
case 'channel.visible':
|
|
5013
|
-
channel.data = _objectSpread$
|
|
5074
|
+
channel.data = _objectSpread$b(_objectSpread$b({}, channel.data), {}, {
|
|
5014
5075
|
hidden: false
|
|
5015
5076
|
});
|
|
5016
5077
|
break;
|
|
5017
5078
|
|
|
5018
5079
|
case 'user.banned':
|
|
5019
5080
|
if (!((_event$user11 = event.user) !== null && _event$user11 !== void 0 && _event$user11.id)) break;
|
|
5020
|
-
channelState.members[event.user.id] = _objectSpread$
|
|
5081
|
+
channelState.members[event.user.id] = _objectSpread$b(_objectSpread$b({}, channelState.members[event.user.id] || {}), {}, {
|
|
5021
5082
|
shadow_banned: !!event.shadow,
|
|
5022
5083
|
banned: !event.shadow,
|
|
5023
|
-
user: _objectSpread$
|
|
5084
|
+
user: _objectSpread$b(_objectSpread$b({}, ((_channelState$members2 = channelState.members[event.user.id]) === null || _channelState$members2 === void 0 ? void 0 : _channelState$members2.user) || {}), event.user)
|
|
5024
5085
|
});
|
|
5025
5086
|
break;
|
|
5026
5087
|
|
|
5027
5088
|
case 'user.unbanned':
|
|
5028
5089
|
if (!((_event$user12 = event.user) !== null && _event$user12 !== void 0 && _event$user12.id)) break;
|
|
5029
|
-
channelState.members[event.user.id] = _objectSpread$
|
|
5090
|
+
channelState.members[event.user.id] = _objectSpread$b(_objectSpread$b({}, channelState.members[event.user.id] || {}), {}, {
|
|
5030
5091
|
shadow_banned: false,
|
|
5031
5092
|
banned: false,
|
|
5032
|
-
user: _objectSpread$
|
|
5093
|
+
user: _objectSpread$b(_objectSpread$b({}, ((_channelState$members3 = channelState.members[event.user.id]) === null || _channelState$members3 === void 0 ? void 0 : _channelState$members3.user) || {}), event.user)
|
|
5033
5094
|
});
|
|
5034
5095
|
break;
|
|
5035
5096
|
} // any event can send over the online count
|
|
@@ -5203,7 +5264,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
5203
5264
|
if (overrideCurrentState) {
|
|
5204
5265
|
this.state.members = newMembersById;
|
|
5205
5266
|
} else if (!overrideCurrentState && members.length) {
|
|
5206
|
-
this.state.members = _objectSpread$
|
|
5267
|
+
this.state.members = _objectSpread$b(_objectSpread$b({}, this.state.members), newMembersById);
|
|
5207
5268
|
}
|
|
5208
5269
|
}
|
|
5209
5270
|
}, {
|
|
@@ -5302,9 +5363,9 @@ var ClientState = /*#__PURE__*/function () {
|
|
|
5302
5363
|
return ClientState;
|
|
5303
5364
|
}();
|
|
5304
5365
|
|
|
5305
|
-
function ownKeys$
|
|
5366
|
+
function ownKeys$a(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
5306
5367
|
|
|
5307
|
-
function _objectSpread$
|
|
5368
|
+
function _objectSpread$a(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$a(Object(source), true).forEach(function (key) { _defineProperty__default['default'](target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$a(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
5308
5369
|
var InsightMetrics = function InsightMetrics() {
|
|
5309
5370
|
_classCallCheck__default['default'](this, InsightMetrics);
|
|
5310
5371
|
|
|
@@ -5383,7 +5444,7 @@ var postInsights = /*#__PURE__*/function () {
|
|
|
5383
5444
|
};
|
|
5384
5445
|
}();
|
|
5385
5446
|
function buildWsFatalInsight(connection, event) {
|
|
5386
|
-
return _objectSpread$
|
|
5447
|
+
return _objectSpread$a(_objectSpread$a({}, event), buildWsBaseInsight(connection));
|
|
5387
5448
|
}
|
|
5388
5449
|
|
|
5389
5450
|
function buildWsBaseInsight(connection) {
|
|
@@ -5416,9 +5477,9 @@ function buildWsSuccessAfterFailureInsight(connection) {
|
|
|
5416
5477
|
return buildWsBaseInsight(connection);
|
|
5417
5478
|
}
|
|
5418
5479
|
|
|
5419
|
-
function ownKeys$
|
|
5480
|
+
function ownKeys$9(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
5420
5481
|
|
|
5421
|
-
function _objectSpread$
|
|
5482
|
+
function _objectSpread$9(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$9(Object(source), true).forEach(function (key) { _defineProperty__default['default'](target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$9(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
5422
5483
|
|
|
5423
5484
|
// Type guards to check WebSocket error type
|
|
5424
5485
|
var isCloseEvent = function isCloseEvent(res) {
|
|
@@ -5782,7 +5843,7 @@ var StableWSConnection = /*#__PURE__*/function () {
|
|
|
5782
5843
|
value: function _log(msg) {
|
|
5783
5844
|
var extra = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
5784
5845
|
var level = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'info';
|
|
5785
|
-
this.client.logger(level, 'connection:' + msg, _objectSpread$
|
|
5846
|
+
this.client.logger(level, 'connection:' + msg, _objectSpread$9({
|
|
5786
5847
|
tags: ['connection']
|
|
5787
5848
|
}, extra));
|
|
5788
5849
|
}
|
|
@@ -6373,9 +6434,9 @@ var StableWSConnection = /*#__PURE__*/function () {
|
|
|
6373
6434
|
return StableWSConnection;
|
|
6374
6435
|
}();
|
|
6375
6436
|
|
|
6376
|
-
function ownKeys$
|
|
6437
|
+
function ownKeys$8(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
6377
6438
|
|
|
6378
|
-
function _objectSpread$
|
|
6439
|
+
function _objectSpread$8(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$8(Object(source), true).forEach(function (key) { _defineProperty__default['default'](target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$8(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
6379
6440
|
|
|
6380
6441
|
/**
|
|
6381
6442
|
* Creates the JWT token that can be used for a UserSession
|
|
@@ -6396,7 +6457,7 @@ function JWTUserToken(apiSecret, userId) {
|
|
|
6396
6457
|
throw new TypeError('userId should be a string');
|
|
6397
6458
|
}
|
|
6398
6459
|
|
|
6399
|
-
var payload = _objectSpread$
|
|
6460
|
+
var payload = _objectSpread$8({
|
|
6400
6461
|
user_id: userId
|
|
6401
6462
|
}, extraData); // make sure we return a clear error when jwt is shimmed (ie. browser build)
|
|
6402
6463
|
|
|
@@ -6808,9 +6869,9 @@ function isErrorResponse(res) {
|
|
|
6808
6869
|
return !res.status || res.status < 200 || 300 <= res.status;
|
|
6809
6870
|
}
|
|
6810
6871
|
|
|
6811
|
-
function ownKeys$
|
|
6872
|
+
function ownKeys$7(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
6812
6873
|
|
|
6813
|
-
function _objectSpread$
|
|
6874
|
+
function _objectSpread$7(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$7(Object(source), true).forEach(function (key) { _defineProperty__default['default'](target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$7(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
6814
6875
|
var ConnectionState;
|
|
6815
6876
|
|
|
6816
6877
|
(function (ConnectionState) {
|
|
@@ -6873,7 +6934,7 @@ var WSConnectionFallback = /*#__PURE__*/function () {
|
|
|
6873
6934
|
_context.next = 4;
|
|
6874
6935
|
return _this.client.doAxiosRequest('get', _this.client.baseURL.replace(':3030', ':8900') + '/longpoll', // replace port if present for testing with local API
|
|
6875
6936
|
undefined, {
|
|
6876
|
-
config: _objectSpread$
|
|
6937
|
+
config: _objectSpread$7(_objectSpread$7({}, config), {}, {
|
|
6877
6938
|
cancelToken: (_this$cancelToken2 = _this.cancelToken) === null || _this$cancelToken2 === void 0 ? void 0 : _this$cancelToken2.token
|
|
6878
6939
|
}),
|
|
6879
6940
|
params: params
|
|
@@ -7151,7 +7212,7 @@ var WSConnectionFallback = /*#__PURE__*/function () {
|
|
|
7151
7212
|
value: function _log(msg) {
|
|
7152
7213
|
var extra = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
7153
7214
|
var level = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'info';
|
|
7154
|
-
this.client.logger(level, 'WSConnectionFallback:' + msg, _objectSpread$
|
|
7215
|
+
this.client.logger(level, 'WSConnectionFallback:' + msg, _objectSpread$7({
|
|
7155
7216
|
tags: ['connection_fallback', 'connection']
|
|
7156
7217
|
}, extra));
|
|
7157
7218
|
}
|
|
@@ -7430,9 +7491,9 @@ var Segment = /*#__PURE__*/function () {
|
|
|
7430
7491
|
return Segment;
|
|
7431
7492
|
}();
|
|
7432
7493
|
|
|
7433
|
-
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf__default['default'](Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf__default['default'](this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn__default['default'](this, result); }; }
|
|
7494
|
+
function _createSuper$1(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$1(); return function _createSuperInternal() { var Super = _getPrototypeOf__default['default'](Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf__default['default'](this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn__default['default'](this, result); }; }
|
|
7434
7495
|
|
|
7435
|
-
function _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; } }
|
|
7496
|
+
function _isNativeReflectConstruct$1() { 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; } }
|
|
7436
7497
|
|
|
7437
7498
|
/**
|
|
7438
7499
|
* Utility Types
|
|
@@ -7497,7 +7558,7 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
|
|
|
7497
7558
|
var ErrorFromResponse = /*#__PURE__*/function (_Error) {
|
|
7498
7559
|
_inherits__default['default'](ErrorFromResponse, _Error);
|
|
7499
7560
|
|
|
7500
|
-
var _super = _createSuper(ErrorFromResponse);
|
|
7561
|
+
var _super = _createSuper$1(ErrorFromResponse);
|
|
7501
7562
|
|
|
7502
7563
|
function ErrorFromResponse() {
|
|
7503
7564
|
var _this;
|
|
@@ -7528,9 +7589,9 @@ exports.VotingVisibility = void 0;
|
|
|
7528
7589
|
VotingVisibility["public"] = "public";
|
|
7529
7590
|
})(exports.VotingVisibility || (exports.VotingVisibility = {}));
|
|
7530
7591
|
|
|
7531
|
-
function ownKeys$
|
|
7592
|
+
function ownKeys$6(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
7532
7593
|
|
|
7533
|
-
function _objectSpread$
|
|
7594
|
+
function _objectSpread$6(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$6(Object(source), true).forEach(function (key) { _defineProperty__default['default'](target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$6(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
7534
7595
|
|
|
7535
7596
|
function isPatch(value) {
|
|
7536
7597
|
return typeof value === 'function';
|
|
@@ -7560,7 +7621,7 @@ var StateStore = function StateStore(value) {
|
|
|
7560
7621
|
|
|
7561
7622
|
_defineProperty__default['default'](this, "partialNext", function (partial) {
|
|
7562
7623
|
return _this.next(function (current) {
|
|
7563
|
-
return _objectSpread$
|
|
7624
|
+
return _objectSpread$6(_objectSpread$6({}, current), partial);
|
|
7564
7625
|
});
|
|
7565
7626
|
});
|
|
7566
7627
|
|
|
@@ -7610,11 +7671,11 @@ var StateStore = function StateStore(value) {
|
|
|
7610
7671
|
|
|
7611
7672
|
_defineProperty__default['default'](StateStore, "logCount", 5);
|
|
7612
7673
|
|
|
7613
|
-
var _excluded$
|
|
7674
|
+
var _excluded$3 = ["limit", "sort"];
|
|
7614
7675
|
|
|
7615
|
-
function ownKeys$
|
|
7676
|
+
function ownKeys$5(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
7616
7677
|
|
|
7617
|
-
function _objectSpread$
|
|
7678
|
+
function _objectSpread$5(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$5(Object(source), true).forEach(function (key) { _defineProperty__default['default'](target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$5(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
7618
7679
|
var DEFAULT_PAGE_LIMIT = 50;
|
|
7619
7680
|
var DEFAULT_SORT = [{
|
|
7620
7681
|
created_at: -1
|
|
@@ -7899,14 +7960,14 @@ var Thread = /*#__PURE__*/function () {
|
|
|
7899
7960
|
if (userId === ((_event$user2 = event.user) === null || _event$user2 === void 0 ? void 0 : _event$user2.id)) {
|
|
7900
7961
|
// The user who just sent a message to the thread has no unread messages
|
|
7901
7962
|
// in that thread
|
|
7902
|
-
nextUserRead = _objectSpread$
|
|
7963
|
+
nextUserRead = _objectSpread$5(_objectSpread$5({}, nextUserRead), {}, {
|
|
7903
7964
|
lastReadAt: event.created_at ? new Date(event.created_at) : new Date(),
|
|
7904
7965
|
user: event.user,
|
|
7905
7966
|
unreadMessageCount: 0
|
|
7906
7967
|
});
|
|
7907
7968
|
} else if (active && userId === _this.client.userID) ; else {
|
|
7908
7969
|
// Increment unread count for all users except the author of the new message
|
|
7909
|
-
nextUserRead = _objectSpread$
|
|
7970
|
+
nextUserRead = _objectSpread$5(_objectSpread$5({}, nextUserRead), {}, {
|
|
7910
7971
|
unreadMessageCount: userRead.unreadMessageCount + 1
|
|
7911
7972
|
});
|
|
7912
7973
|
}
|
|
@@ -7930,8 +7991,8 @@ var Thread = /*#__PURE__*/function () {
|
|
|
7930
7991
|
var user = event.user;
|
|
7931
7992
|
|
|
7932
7993
|
_this.state.next(function (current) {
|
|
7933
|
-
return _objectSpread$
|
|
7934
|
-
read: _objectSpread$
|
|
7994
|
+
return _objectSpread$5(_objectSpread$5({}, current), {}, {
|
|
7995
|
+
read: _objectSpread$5(_objectSpread$5({}, current.read), {}, _defineProperty__default['default']({}, userId, {
|
|
7935
7996
|
lastReadAt: new Date(createdAt),
|
|
7936
7997
|
user: user,
|
|
7937
7998
|
lastReadMessageId: event.last_read_message_id,
|
|
@@ -8044,7 +8105,7 @@ var Thread = /*#__PURE__*/function () {
|
|
|
8044
8105
|
}
|
|
8045
8106
|
|
|
8046
8107
|
_this.state.next(function (current) {
|
|
8047
|
-
return _objectSpread$
|
|
8108
|
+
return _objectSpread$5(_objectSpread$5({}, current), {}, {
|
|
8048
8109
|
replies: addToMessageList(current.replies, formattedMessage, timestampChanged)
|
|
8049
8110
|
});
|
|
8050
8111
|
});
|
|
@@ -8061,7 +8122,7 @@ var Thread = /*#__PURE__*/function () {
|
|
|
8061
8122
|
var _message$reply_count;
|
|
8062
8123
|
|
|
8063
8124
|
var formattedMessage = formatMessage(message);
|
|
8064
|
-
return _objectSpread$
|
|
8125
|
+
return _objectSpread$5(_objectSpread$5({}, current), {}, {
|
|
8065
8126
|
deletedAt: formattedMessage.deleted_at,
|
|
8066
8127
|
parentMessage: formattedMessage,
|
|
8067
8128
|
replyCount: (_message$reply_count = message.reply_count) !== null && _message$reply_count !== void 0 ? _message$reply_count : current.replyCount
|
|
@@ -8132,9 +8193,9 @@ var Thread = /*#__PURE__*/function () {
|
|
|
8132
8193
|
limit = _ref10$limit === void 0 ? DEFAULT_PAGE_LIMIT : _ref10$limit,
|
|
8133
8194
|
_ref10$sort = _ref10.sort,
|
|
8134
8195
|
sort = _ref10$sort === void 0 ? DEFAULT_SORT : _ref10$sort,
|
|
8135
|
-
otherOptions = _objectWithoutProperties__default['default'](_ref10, _excluded$
|
|
8196
|
+
otherOptions = _objectWithoutProperties__default['default'](_ref10, _excluded$3);
|
|
8136
8197
|
|
|
8137
|
-
return _this.channel.getReplies(_this.id, _objectSpread$
|
|
8198
|
+
return _this.channel.getReplies(_this.id, _objectSpread$5({
|
|
8138
8199
|
limit: limit
|
|
8139
8200
|
}, otherOptions), sort);
|
|
8140
8201
|
});
|
|
@@ -8178,12 +8239,12 @@ var Thread = /*#__PURE__*/function () {
|
|
|
8178
8239
|
limit = Math.abs(count);
|
|
8179
8240
|
|
|
8180
8241
|
_this.state.partialNext({
|
|
8181
|
-
pagination: _objectSpread$
|
|
8242
|
+
pagination: _objectSpread$5(_objectSpread$5({}, pagination), {}, _defineProperty__default['default']({}, loadingKey, true))
|
|
8182
8243
|
});
|
|
8183
8244
|
|
|
8184
8245
|
_context3.prev = 7;
|
|
8185
8246
|
_context3.next = 10;
|
|
8186
|
-
return _this.queryReplies(_objectSpread$
|
|
8247
|
+
return _this.queryReplies(_objectSpread$5(_objectSpread$5({}, queryOptions), {}, {
|
|
8187
8248
|
limit: limit
|
|
8188
8249
|
}));
|
|
8189
8250
|
|
|
@@ -8205,9 +8266,9 @@ var Thread = /*#__PURE__*/function () {
|
|
|
8205
8266
|
(_nextReplies = nextReplies)[insertionMethodKey].apply(_nextReplies, _toConsumableArray__default['default'](replies));
|
|
8206
8267
|
}
|
|
8207
8268
|
|
|
8208
|
-
return _objectSpread$
|
|
8269
|
+
return _objectSpread$5(_objectSpread$5({}, current), {}, {
|
|
8209
8270
|
replies: nextReplies,
|
|
8210
|
-
pagination: _objectSpread$
|
|
8271
|
+
pagination: _objectSpread$5(_objectSpread$5({}, current.pagination), {}, (_objectSpread4 = {}, _defineProperty__default['default'](_objectSpread4, cursorKey, data.messages.length < limit ? null : maybeNextCursor), _defineProperty__default['default'](_objectSpread4, loadingKey, false), _objectSpread4))
|
|
8211
8272
|
});
|
|
8212
8273
|
});
|
|
8213
8274
|
|
|
@@ -8221,8 +8282,8 @@ var Thread = /*#__PURE__*/function () {
|
|
|
8221
8282
|
_this.client.logger('error', _context3.t0.message);
|
|
8222
8283
|
|
|
8223
8284
|
_this.state.next(function (current) {
|
|
8224
|
-
return _objectSpread$
|
|
8225
|
-
pagination: _objectSpread$
|
|
8285
|
+
return _objectSpread$5(_objectSpread$5({}, current), {}, {
|
|
8286
|
+
pagination: _objectSpread$5(_objectSpread$5({}, current.pagination), {}, _defineProperty__default['default']({}, loadingKey, false))
|
|
8226
8287
|
});
|
|
8227
8288
|
});
|
|
8228
8289
|
|
|
@@ -8335,9 +8396,9 @@ var ownUnreadCountSelector = function ownUnreadCountSelector(currentUserId) {
|
|
|
8335
8396
|
};
|
|
8336
8397
|
};
|
|
8337
8398
|
|
|
8338
|
-
function ownKeys$
|
|
8399
|
+
function ownKeys$4(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
8339
8400
|
|
|
8340
|
-
function _objectSpread$
|
|
8401
|
+
function _objectSpread$4(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$4(Object(source), true).forEach(function (key) { _defineProperty__default['default'](target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$4(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
8341
8402
|
var MODERATION_ENTITY_TYPES = {
|
|
8342
8403
|
user: 'stream:user',
|
|
8343
8404
|
message: 'stream:chat:v1:message'
|
|
@@ -8454,7 +8515,7 @@ var Moderation = /*#__PURE__*/function () {
|
|
|
8454
8515
|
case 0:
|
|
8455
8516
|
options = _args3.length > 4 && _args3[4] !== undefined ? _args3[4] : {};
|
|
8456
8517
|
_context3.next = 3;
|
|
8457
|
-
return this.client.post(this.client.baseURL + '/api/v2/moderation/flag', _objectSpread$
|
|
8518
|
+
return this.client.post(this.client.baseURL + '/api/v2/moderation/flag', _objectSpread$4({
|
|
8458
8519
|
entity_type: entityType,
|
|
8459
8520
|
entity_id: entityId,
|
|
8460
8521
|
entity_creator_id: entityCreatorID,
|
|
@@ -8499,7 +8560,7 @@ var Moderation = /*#__PURE__*/function () {
|
|
|
8499
8560
|
case 0:
|
|
8500
8561
|
options = _args4.length > 1 && _args4[1] !== undefined ? _args4[1] : {};
|
|
8501
8562
|
_context4.next = 3;
|
|
8502
|
-
return this.client.post(this.client.baseURL + '/api/v2/moderation/mute', _objectSpread$
|
|
8563
|
+
return this.client.post(this.client.baseURL + '/api/v2/moderation/mute', _objectSpread$4({
|
|
8503
8564
|
target_ids: [targetID]
|
|
8504
8565
|
}, options));
|
|
8505
8566
|
|
|
@@ -8537,7 +8598,7 @@ var Moderation = /*#__PURE__*/function () {
|
|
|
8537
8598
|
switch (_context5.prev = _context5.next) {
|
|
8538
8599
|
case 0:
|
|
8539
8600
|
_context5.next = 2;
|
|
8540
|
-
return this.client.post(this.client.baseURL + '/api/v2/moderation/unmute', _objectSpread$
|
|
8601
|
+
return this.client.post(this.client.baseURL + '/api/v2/moderation/unmute', _objectSpread$4({
|
|
8541
8602
|
target_ids: [targetID]
|
|
8542
8603
|
}, options));
|
|
8543
8604
|
|
|
@@ -8579,7 +8640,7 @@ var Moderation = /*#__PURE__*/function () {
|
|
|
8579
8640
|
case 0:
|
|
8580
8641
|
options = _args6.length > 1 && _args6[1] !== undefined ? _args6[1] : {};
|
|
8581
8642
|
_context6.next = 3;
|
|
8582
|
-
return this.client.get(this.client.baseURL + "/api/v2/moderation/user_report", _objectSpread$
|
|
8643
|
+
return this.client.get(this.client.baseURL + "/api/v2/moderation/user_report", _objectSpread$4({
|
|
8583
8644
|
user_id: userID
|
|
8584
8645
|
}, options));
|
|
8585
8646
|
|
|
@@ -8623,7 +8684,7 @@ var Moderation = /*#__PURE__*/function () {
|
|
|
8623
8684
|
sort = _args7.length > 1 && _args7[1] !== undefined ? _args7[1] : [];
|
|
8624
8685
|
options = _args7.length > 2 && _args7[2] !== undefined ? _args7[2] : {};
|
|
8625
8686
|
_context7.next = 5;
|
|
8626
|
-
return this.client.post(this.client.baseURL + '/api/v2/moderation/review_queue', _objectSpread$
|
|
8687
|
+
return this.client.post(this.client.baseURL + '/api/v2/moderation/review_queue', _objectSpread$4({
|
|
8627
8688
|
filter: filterConditions,
|
|
8628
8689
|
sort: normalizeQuerySort(sort)
|
|
8629
8690
|
}, options));
|
|
@@ -8758,7 +8819,7 @@ var Moderation = /*#__PURE__*/function () {
|
|
|
8758
8819
|
case 0:
|
|
8759
8820
|
options = _args11.length > 2 && _args11[2] !== undefined ? _args11[2] : {};
|
|
8760
8821
|
_context11.next = 3;
|
|
8761
|
-
return this.client.post(this.client.baseURL + '/api/v2/moderation/configs', _objectSpread$
|
|
8822
|
+
return this.client.post(this.client.baseURL + '/api/v2/moderation/configs', _objectSpread$4({
|
|
8762
8823
|
filter: filterConditions,
|
|
8763
8824
|
sort: sort
|
|
8764
8825
|
}, options));
|
|
@@ -8792,7 +8853,7 @@ var Moderation = /*#__PURE__*/function () {
|
|
|
8792
8853
|
case 0:
|
|
8793
8854
|
options = _args12.length > 2 && _args12[2] !== undefined ? _args12[2] : {};
|
|
8794
8855
|
_context12.next = 3;
|
|
8795
|
-
return this.client.post(this.client.baseURL + '/api/v2/moderation/submit_action', _objectSpread$
|
|
8856
|
+
return this.client.post(this.client.baseURL + '/api/v2/moderation/submit_action', _objectSpread$4({
|
|
8796
8857
|
action_type: actionType,
|
|
8797
8858
|
item_id: itemID
|
|
8798
8859
|
}, options));
|
|
@@ -8956,9 +9017,9 @@ function _unsupportedIterableToArray$2(o, minLen) { if (!o) return; if (typeof o
|
|
|
8956
9017
|
|
|
8957
9018
|
function _arrayLikeToArray$2(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; }
|
|
8958
9019
|
|
|
8959
|
-
function ownKeys$
|
|
9020
|
+
function ownKeys$3(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
8960
9021
|
|
|
8961
|
-
function _objectSpread$
|
|
9022
|
+
function _objectSpread$3(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$3(Object(source), true).forEach(function (key) { _defineProperty__default['default'](target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$3(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
8962
9023
|
var DEFAULT_CONNECTION_RECOVERY_THROTTLE_DURATION = 1000;
|
|
8963
9024
|
var MAX_QUERY_THREADS_LIMIT = 25;
|
|
8964
9025
|
var THREAD_MANAGER_INITIAL_STATE = {
|
|
@@ -9139,7 +9200,7 @@ var ThreadManager = /*#__PURE__*/function () {
|
|
|
9139
9200
|
var unsubscribeConnectionDropped = _this.client.on('connection.changed', function (event) {
|
|
9140
9201
|
if (event.online === false) {
|
|
9141
9202
|
_this.state.next(function (current) {
|
|
9142
|
-
return current.lastConnectionDropAt ? current : _objectSpread$
|
|
9203
|
+
return current.lastConnectionDropAt ? current : _objectSpread$3(_objectSpread$3({}, current), {}, {
|
|
9143
9204
|
lastConnectionDropAt: new Date()
|
|
9144
9205
|
});
|
|
9145
9206
|
});
|
|
@@ -9226,8 +9287,8 @@ var ThreadManager = /*#__PURE__*/function () {
|
|
|
9226
9287
|
_context.prev = 7;
|
|
9227
9288
|
|
|
9228
9289
|
_this.state.next(function (current) {
|
|
9229
|
-
return _objectSpread$
|
|
9230
|
-
pagination: _objectSpread$
|
|
9290
|
+
return _objectSpread$3(_objectSpread$3({}, current), {}, {
|
|
9291
|
+
pagination: _objectSpread$3(_objectSpread$3({}, current.pagination), {}, {
|
|
9231
9292
|
isLoading: true
|
|
9232
9293
|
})
|
|
9233
9294
|
});
|
|
@@ -9269,11 +9330,11 @@ var ThreadManager = /*#__PURE__*/function () {
|
|
|
9269
9330
|
_this.state.next(function (current) {
|
|
9270
9331
|
var _response$next;
|
|
9271
9332
|
|
|
9272
|
-
return _objectSpread$
|
|
9333
|
+
return _objectSpread$3(_objectSpread$3({}, current), {}, {
|
|
9273
9334
|
threads: nextThreads,
|
|
9274
9335
|
unseenThreadIds: [],
|
|
9275
9336
|
isThreadOrderStale: false,
|
|
9276
|
-
pagination: _objectSpread$
|
|
9337
|
+
pagination: _objectSpread$3(_objectSpread$3({}, current.pagination), {}, {
|
|
9277
9338
|
isLoading: false,
|
|
9278
9339
|
nextCursor: (_response$next = response.next) !== null && _response$next !== void 0 ? _response$next : null
|
|
9279
9340
|
}),
|
|
@@ -9291,8 +9352,8 @@ var ThreadManager = /*#__PURE__*/function () {
|
|
|
9291
9352
|
_this.client.logger('error', _context.t0.message);
|
|
9292
9353
|
|
|
9293
9354
|
_this.state.next(function (current) {
|
|
9294
|
-
return _objectSpread$
|
|
9295
|
-
pagination: _objectSpread$
|
|
9355
|
+
return _objectSpread$3(_objectSpread$3({}, current), {}, {
|
|
9356
|
+
pagination: _objectSpread$3(_objectSpread$3({}, current.pagination), {}, {
|
|
9296
9357
|
isLoading: false
|
|
9297
9358
|
})
|
|
9298
9359
|
});
|
|
@@ -9308,7 +9369,7 @@ var ThreadManager = /*#__PURE__*/function () {
|
|
|
9308
9369
|
|
|
9309
9370
|
_defineProperty__default['default'](this, "queryThreads", function () {
|
|
9310
9371
|
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
9311
|
-
return _this.client.queryThreads(_objectSpread$
|
|
9372
|
+
return _this.client.queryThreads(_objectSpread$3({
|
|
9312
9373
|
limit: 25,
|
|
9313
9374
|
participant_limit: 10,
|
|
9314
9375
|
reply_limit: 10,
|
|
@@ -9341,13 +9402,13 @@ var ThreadManager = /*#__PURE__*/function () {
|
|
|
9341
9402
|
_context2.prev = 4;
|
|
9342
9403
|
|
|
9343
9404
|
_this.state.partialNext({
|
|
9344
|
-
pagination: _objectSpread$
|
|
9405
|
+
pagination: _objectSpread$3(_objectSpread$3({}, pagination), {}, {
|
|
9345
9406
|
isLoadingNext: true
|
|
9346
9407
|
})
|
|
9347
9408
|
});
|
|
9348
9409
|
|
|
9349
9410
|
_context2.next = 8;
|
|
9350
|
-
return _this.queryThreads(_objectSpread$
|
|
9411
|
+
return _this.queryThreads(_objectSpread$3(_objectSpread$3({}, options), {}, {
|
|
9351
9412
|
next: pagination.nextCursor
|
|
9352
9413
|
}));
|
|
9353
9414
|
|
|
@@ -9357,9 +9418,9 @@ var ThreadManager = /*#__PURE__*/function () {
|
|
|
9357
9418
|
_this.state.next(function (current) {
|
|
9358
9419
|
var _response$next2;
|
|
9359
9420
|
|
|
9360
|
-
return _objectSpread$
|
|
9421
|
+
return _objectSpread$3(_objectSpread$3({}, current), {}, {
|
|
9361
9422
|
threads: response.threads.length ? current.threads.concat(response.threads) : current.threads,
|
|
9362
|
-
pagination: _objectSpread$
|
|
9423
|
+
pagination: _objectSpread$3(_objectSpread$3({}, current.pagination), {}, {
|
|
9363
9424
|
nextCursor: (_response$next2 = response.next) !== null && _response$next2 !== void 0 ? _response$next2 : null,
|
|
9364
9425
|
isLoadingNext: false
|
|
9365
9426
|
})
|
|
@@ -9376,8 +9437,8 @@ var ThreadManager = /*#__PURE__*/function () {
|
|
|
9376
9437
|
_this.client.logger('error', _context2.t0.message);
|
|
9377
9438
|
|
|
9378
9439
|
_this.state.next(function (current) {
|
|
9379
|
-
return _objectSpread$
|
|
9380
|
-
pagination: _objectSpread$
|
|
9440
|
+
return _objectSpread$3(_objectSpread$3({}, current), {}, {
|
|
9441
|
+
pagination: _objectSpread$3(_objectSpread$3({}, current.pagination), {}, {
|
|
9381
9442
|
isLoadingNext: false
|
|
9382
9443
|
})
|
|
9383
9444
|
});
|
|
@@ -9422,12 +9483,12 @@ var ThreadManager = /*#__PURE__*/function () {
|
|
|
9422
9483
|
return ThreadManager;
|
|
9423
9484
|
}();
|
|
9424
9485
|
|
|
9425
|
-
var _excluded$
|
|
9486
|
+
var _excluded$2 = ["own_votes", "id"],
|
|
9426
9487
|
_excluded2$1 = ["id"];
|
|
9427
9488
|
|
|
9428
|
-
function ownKeys$
|
|
9489
|
+
function ownKeys$2(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
9429
9490
|
|
|
9430
|
-
function _objectSpread$
|
|
9491
|
+
function _objectSpread$2(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$2(Object(source), true).forEach(function (key) { _defineProperty__default['default'](target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$2(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
9431
9492
|
|
|
9432
9493
|
var isPollUpdatedEvent = function isPollUpdatedEvent(e) {
|
|
9433
9494
|
return e.type === 'poll.updated';
|
|
@@ -9475,7 +9536,7 @@ var Poll = /*#__PURE__*/function () {
|
|
|
9475
9536
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
9476
9537
|
var own_votes = poll.own_votes;
|
|
9477
9538
|
poll.id;
|
|
9478
|
-
var pollResponseForState = _objectWithoutProperties__default['default'](poll, _excluded$
|
|
9539
|
+
var pollResponseForState = _objectWithoutProperties__default['default'](poll, _excluded$2);
|
|
9479
9540
|
|
|
9480
9541
|
var _ref2 = (_own_votes$reduce = own_votes === null || own_votes === void 0 ? void 0 : own_votes.reduce(function (acc, voteOrAnswer) {
|
|
9481
9542
|
if (isVoteAnswer(voteOrAnswer)) {
|
|
@@ -9493,7 +9554,7 @@ var Poll = /*#__PURE__*/function () {
|
|
|
9493
9554
|
ownAnswer = _ref2.ownAnswer,
|
|
9494
9555
|
ownVotes = _ref2.ownVotes;
|
|
9495
9556
|
|
|
9496
|
-
return _objectSpread$
|
|
9557
|
+
return _objectSpread$2(_objectSpread$2({}, pollResponseForState), {}, {
|
|
9497
9558
|
lastActivityAt: new Date(),
|
|
9498
9559
|
maxVotedOptionIds: getMaxVotedOptionIds(pollResponseForState.vote_counts_by_option),
|
|
9499
9560
|
ownAnswer: ownAnswer,
|
|
@@ -9515,7 +9576,7 @@ var Poll = /*#__PURE__*/function () {
|
|
|
9515
9576
|
pollData = _objectWithoutProperties__default['default'](_extractPollData, _excluded2$1); // @ts-ignore
|
|
9516
9577
|
|
|
9517
9578
|
|
|
9518
|
-
_this.state.partialNext(_objectSpread$
|
|
9579
|
+
_this.state.partialNext(_objectSpread$2(_objectSpread$2({}, pollData), {}, {
|
|
9519
9580
|
lastActivityAt: new Date(event.created_at)
|
|
9520
9581
|
}));
|
|
9521
9582
|
});
|
|
@@ -9562,7 +9623,7 @@ var Poll = /*#__PURE__*/function () {
|
|
|
9562
9623
|
|
|
9563
9624
|
var pollEnrichData = extractPollEnrichedData(event.poll); // @ts-ignore
|
|
9564
9625
|
|
|
9565
|
-
_this.state.partialNext(_objectSpread$
|
|
9626
|
+
_this.state.partialNext(_objectSpread$2(_objectSpread$2({}, pollEnrichData), {}, {
|
|
9566
9627
|
latest_answers: latestAnswers,
|
|
9567
9628
|
lastActivityAt: new Date(event.created_at),
|
|
9568
9629
|
ownAnswer: ownAnswer,
|
|
@@ -9627,7 +9688,7 @@ var Poll = /*#__PURE__*/function () {
|
|
|
9627
9688
|
|
|
9628
9689
|
var pollEnrichData = extractPollEnrichedData(event.poll); // @ts-ignore
|
|
9629
9690
|
|
|
9630
|
-
_this.state.partialNext(_objectSpread$
|
|
9691
|
+
_this.state.partialNext(_objectSpread$2(_objectSpread$2({}, pollEnrichData), {}, {
|
|
9631
9692
|
latest_answers: latestAnswers,
|
|
9632
9693
|
lastActivityAt: new Date(event.created_at),
|
|
9633
9694
|
ownAnswer: ownAnswer,
|
|
@@ -9648,7 +9709,7 @@ var Poll = /*#__PURE__*/function () {
|
|
|
9648
9709
|
|
|
9649
9710
|
var ownAnswer = currentState.ownAnswer;
|
|
9650
9711
|
|
|
9651
|
-
var ownVotesByOptionId = _objectSpread$
|
|
9712
|
+
var ownVotesByOptionId = _objectSpread$2({}, currentState.ownVotesByOptionId);
|
|
9652
9713
|
|
|
9653
9714
|
var maxVotedOptionIds = currentState.maxVotedOptionIds;
|
|
9654
9715
|
|
|
@@ -9670,7 +9731,7 @@ var Poll = /*#__PURE__*/function () {
|
|
|
9670
9731
|
|
|
9671
9732
|
var pollEnrichData = extractPollEnrichedData(event.poll); // @ts-ignore
|
|
9672
9733
|
|
|
9673
|
-
_this.state.partialNext(_objectSpread$
|
|
9734
|
+
_this.state.partialNext(_objectSpread$2(_objectSpread$2({}, pollEnrichData), {}, {
|
|
9674
9735
|
latest_answers: latestAnswers,
|
|
9675
9736
|
lastActivityAt: new Date(event.created_at),
|
|
9676
9737
|
ownAnswer: ownAnswer,
|
|
@@ -9695,7 +9756,7 @@ var Poll = /*#__PURE__*/function () {
|
|
|
9695
9756
|
poll = _yield$_this$client$g.poll;
|
|
9696
9757
|
|
|
9697
9758
|
// @ts-ignore
|
|
9698
|
-
_this.state.partialNext(_objectSpread$
|
|
9759
|
+
_this.state.partialNext(_objectSpread$2(_objectSpread$2({}, poll), {}, {
|
|
9699
9760
|
lastActivityAt: new Date()
|
|
9700
9761
|
}));
|
|
9701
9762
|
|
|
@@ -9721,7 +9782,7 @@ var Poll = /*#__PURE__*/function () {
|
|
|
9721
9782
|
switch (_context2.prev = _context2.next) {
|
|
9722
9783
|
case 0:
|
|
9723
9784
|
_context2.next = 2;
|
|
9724
|
-
return _this.client.updatePoll(_objectSpread$
|
|
9785
|
+
return _this.client.updatePoll(_objectSpread$2(_objectSpread$2({}, data), {}, {
|
|
9725
9786
|
id: _this.id
|
|
9726
9787
|
}));
|
|
9727
9788
|
|
|
@@ -10432,7 +10493,7 @@ var PollManager = /*#__PURE__*/function () {
|
|
|
10432
10493
|
return PollManager;
|
|
10433
10494
|
}();
|
|
10434
10495
|
|
|
10435
|
-
var _excluded = ["created_at", "updated_at", "last_active", "online"],
|
|
10496
|
+
var _excluded$1 = ["created_at", "updated_at", "last_active", "online"],
|
|
10436
10497
|
_excluded2 = ["params", "headers"];
|
|
10437
10498
|
|
|
10438
10499
|
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _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; } } }; }
|
|
@@ -10441,9 +10502,9 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
|
|
|
10441
10502
|
|
|
10442
10503
|
function _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; }
|
|
10443
10504
|
|
|
10444
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
10505
|
+
function ownKeys$1(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
10445
10506
|
|
|
10446
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty__default['default'](target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
10507
|
+
function _objectSpread$1(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$1(Object(source), true).forEach(function (key) { _defineProperty__default['default'](target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$1(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
10447
10508
|
|
|
10448
10509
|
function isString(x) {
|
|
10449
10510
|
return typeof x === 'string' || x instanceof String;
|
|
@@ -11043,9 +11104,9 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
11043
11104
|
|
|
11044
11105
|
if (event.type === 'user.presence.changed' || event.type === 'user.updated') {
|
|
11045
11106
|
if (event.user.id === _this.userID) {
|
|
11046
|
-
var user = _objectSpread({}, _this.user || {});
|
|
11107
|
+
var user = _objectSpread$1({}, _this.user || {});
|
|
11047
11108
|
|
|
11048
|
-
var _user = _objectSpread({}, _this._user || {}); // Remove deleted properties from user objects.
|
|
11109
|
+
var _user = _objectSpread$1({}, _this._user || {}); // Remove deleted properties from user objects.
|
|
11049
11110
|
|
|
11050
11111
|
|
|
11051
11112
|
for (var _key2 in _this.user) {
|
|
@@ -11066,8 +11127,8 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
11066
11127
|
} // @ts-expect-error
|
|
11067
11128
|
|
|
11068
11129
|
|
|
11069
|
-
_this._user = _objectSpread({}, _user);
|
|
11070
|
-
_this.user = _objectSpread(_objectSpread({}, user), event.user);
|
|
11130
|
+
_this._user = _objectSpread$1({}, _user);
|
|
11131
|
+
_this.user = _objectSpread$1(_objectSpread$1({}, user), event.user);
|
|
11071
11132
|
}
|
|
11072
11133
|
|
|
11073
11134
|
_this.state.updateUser(event.user);
|
|
@@ -11223,8 +11284,8 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
11223
11284
|
var _channel6 = _this.activeChannels[cid];
|
|
11224
11285
|
|
|
11225
11286
|
if (Object.keys(custom).length > 0) {
|
|
11226
|
-
_channel6.data = _objectSpread(_objectSpread({}, _channel6.data), custom);
|
|
11227
|
-
_channel6._data = _objectSpread(_objectSpread({}, _channel6._data), custom);
|
|
11287
|
+
_channel6.data = _objectSpread$1(_objectSpread$1({}, _channel6.data), custom);
|
|
11288
|
+
_channel6._data = _objectSpread$1(_objectSpread$1({}, _channel6._data), custom);
|
|
11228
11289
|
}
|
|
11229
11290
|
|
|
11230
11291
|
return _channel6;
|
|
@@ -11283,7 +11344,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
11283
11344
|
var inputOptions = _options ? _options : secretOrOptions && !isString(secretOrOptions) ? secretOrOptions : {};
|
|
11284
11345
|
this.browser = typeof inputOptions.browser !== 'undefined' ? inputOptions.browser : typeof window !== 'undefined';
|
|
11285
11346
|
this.node = !this.browser;
|
|
11286
|
-
this.options = _objectSpread({
|
|
11347
|
+
this.options = _objectSpread$1({
|
|
11287
11348
|
timeout: 3000,
|
|
11288
11349
|
withCredentials: false,
|
|
11289
11350
|
// making sure cookies are not sent
|
|
@@ -11438,7 +11499,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
11438
11499
|
this.user = user;
|
|
11439
11500
|
this.userID = user.id; // this one is actually used for requests. This is a copy of current user provided to `connectUser` function.
|
|
11440
11501
|
|
|
11441
|
-
this._user = _objectSpread({}, user);
|
|
11502
|
+
this._user = _objectSpread$1({}, user);
|
|
11442
11503
|
}
|
|
11443
11504
|
/**
|
|
11444
11505
|
* Disconnects the websocket connection, without removing the user set on client.
|
|
@@ -11493,8 +11554,8 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
11493
11554
|
apn_config = options.apn_config;
|
|
11494
11555
|
|
|
11495
11556
|
if (apn_config !== null && apn_config !== void 0 && apn_config.p12_cert) {
|
|
11496
|
-
options = _objectSpread(_objectSpread({}, options), {}, {
|
|
11497
|
-
apn_config: _objectSpread(_objectSpread({}, apn_config), {}, {
|
|
11557
|
+
options = _objectSpread$1(_objectSpread$1({}, options), {}, {
|
|
11558
|
+
apn_config: _objectSpread$1(_objectSpread$1({}, apn_config), {}, {
|
|
11498
11559
|
p12_cert: Buffer.from(apn_config.p12_cert).toString('base64')
|
|
11499
11560
|
})
|
|
11500
11561
|
});
|
|
@@ -11705,7 +11766,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
11705
11766
|
case 0:
|
|
11706
11767
|
data = _args12.length > 1 && _args12[1] !== undefined ? _args12[1] : {};
|
|
11707
11768
|
_context12.next = 3;
|
|
11708
|
-
return this.post(this.baseURL + '/check_push', _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({
|
|
11769
|
+
return this.post(this.baseURL + '/check_push', _objectSpread$1(_objectSpread$1(_objectSpread$1(_objectSpread$1(_objectSpread$1(_objectSpread$1(_objectSpread$1({
|
|
11709
11770
|
user_id: userID
|
|
11710
11771
|
}, data.messageID ? {
|
|
11711
11772
|
message_id: data.messageID
|
|
@@ -11870,7 +11931,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
11870
11931
|
case 11:
|
|
11871
11932
|
this.anonymous = false; // eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
11872
11933
|
|
|
11873
|
-
_response$user = response.user, _response$user.created_at, _response$user.updated_at, _response$user.last_active, _response$user.online, guestUser = _objectWithoutProperties__default['default'](_response$user, _excluded);
|
|
11934
|
+
_response$user = response.user, _response$user.created_at, _response$user.updated_at, _response$user.last_active, _response$user.online, guestUser = _objectWithoutProperties__default['default'](_response$user, _excluded$1);
|
|
11874
11935
|
_context15.next = 15;
|
|
11875
11936
|
return this.connectUser(guestUser, response.access_token);
|
|
11876
11937
|
|
|
@@ -12354,7 +12415,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
12354
12415
|
|
|
12355
12416
|
_context17.next = 8;
|
|
12356
12417
|
return this.get(this.baseURL + '/users', {
|
|
12357
|
-
payload: _objectSpread(_objectSpread({
|
|
12418
|
+
payload: _objectSpread$1(_objectSpread$1({
|
|
12358
12419
|
filter_conditions: filterConditions,
|
|
12359
12420
|
sort: normalizeQuerySort(sort)
|
|
12360
12421
|
}, defaultOptions), options)
|
|
@@ -12406,7 +12467,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
12406
12467
|
options = _args18.length > 2 && _args18[2] !== undefined ? _args18[2] : {};
|
|
12407
12468
|
_context18.next = 5;
|
|
12408
12469
|
return this.get(this.baseURL + '/query_banned_users', {
|
|
12409
|
-
payload: _objectSpread({
|
|
12470
|
+
payload: _objectSpread$1({
|
|
12410
12471
|
filter_conditions: filterConditions,
|
|
12411
12472
|
sort: normalizeQuerySort(sort)
|
|
12412
12473
|
}, options)
|
|
@@ -12453,7 +12514,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
12453
12514
|
options = _args19.length > 1 && _args19[1] !== undefined ? _args19[1] : {};
|
|
12454
12515
|
_context19.next = 4;
|
|
12455
12516
|
return this.get(this.baseURL + '/moderation/flags/message', {
|
|
12456
|
-
payload: _objectSpread({
|
|
12517
|
+
payload: _objectSpread$1({
|
|
12457
12518
|
filter_conditions: filterConditions
|
|
12458
12519
|
}, options)
|
|
12459
12520
|
});
|
|
@@ -12521,7 +12582,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
12521
12582
|
} // Return a list of channels
|
|
12522
12583
|
|
|
12523
12584
|
|
|
12524
|
-
payload = _objectSpread(_objectSpread({
|
|
12585
|
+
payload = _objectSpread$1(_objectSpread$1({
|
|
12525
12586
|
filter_conditions: filterConditions,
|
|
12526
12587
|
sort: normalizeQuerySort(sort)
|
|
12527
12588
|
}, defaultOptions), options);
|
|
@@ -12582,7 +12643,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
12582
12643
|
|
|
12583
12644
|
case 4:
|
|
12584
12645
|
// Return a list of channels
|
|
12585
|
-
payload = _objectSpread({
|
|
12646
|
+
payload = _objectSpread$1({
|
|
12586
12647
|
filter: filter,
|
|
12587
12648
|
sort: normalizeQuerySort(sort)
|
|
12588
12649
|
}, options);
|
|
@@ -12648,7 +12709,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
12648
12709
|
}
|
|
12649
12710
|
|
|
12650
12711
|
if (updatedMessagesSet) {
|
|
12651
|
-
updatedMessagesSet.pagination = _objectSpread(_objectSpread({}, updatedMessagesSet.pagination), messageSetPagination({
|
|
12712
|
+
updatedMessagesSet.pagination = _objectSpread$1(_objectSpread$1({}, updatedMessagesSet.pagination), messageSetPagination({
|
|
12652
12713
|
parentSet: updatedMessagesSet,
|
|
12653
12714
|
requestedPageSize: (queryChannelsOptions === null || queryChannelsOptions === void 0 ? void 0 : queryChannelsOptions.message_limit) || DEFAULT_QUERY_CHANNELS_MESSAGE_LIST_PAGE_SIZE,
|
|
12654
12715
|
returnedPage: channelState.messages,
|
|
@@ -12698,7 +12759,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
12698
12759
|
throw Error("Cannot specify offset with next");
|
|
12699
12760
|
|
|
12700
12761
|
case 3:
|
|
12701
|
-
payload = _objectSpread(_objectSpread({
|
|
12762
|
+
payload = _objectSpread$1(_objectSpread$1({
|
|
12702
12763
|
filter_conditions: filterConditions
|
|
12703
12764
|
}, options), {}, {
|
|
12704
12765
|
sort: options.sort ? normalizeQuerySort(options.sort) : undefined
|
|
@@ -12792,7 +12853,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
12792
12853
|
switch (_context23.prev = _context23.next) {
|
|
12793
12854
|
case 0:
|
|
12794
12855
|
_context23.next = 2;
|
|
12795
|
-
return this.post(this.baseURL + '/devices', _objectSpread(_objectSpread({
|
|
12856
|
+
return this.post(this.baseURL + '/devices', _objectSpread$1(_objectSpread$1({
|
|
12796
12857
|
id: id,
|
|
12797
12858
|
push_provider: push_provider
|
|
12798
12859
|
}, userID != null ? {
|
|
@@ -12987,7 +13048,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
12987
13048
|
switch (_context28.prev = _context28.next) {
|
|
12988
13049
|
case 0:
|
|
12989
13050
|
_context28.next = 2;
|
|
12990
|
-
return this.delete(this.baseURL + '/devices', _objectSpread({
|
|
13051
|
+
return this.delete(this.baseURL + '/devices', _objectSpread$1({
|
|
12991
13052
|
id: id
|
|
12992
13053
|
}, userID ? {
|
|
12993
13054
|
user_id: userID
|
|
@@ -13447,7 +13508,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
13447
13508
|
switch (_context35.prev = _context35.next) {
|
|
13448
13509
|
case 0:
|
|
13449
13510
|
_context35.next = 2;
|
|
13450
|
-
return this.post(this.baseURL + "/users/".concat(encodeURIComponent(userID), "/reactivate"), _objectSpread({}, options));
|
|
13511
|
+
return this.post(this.baseURL + "/users/".concat(encodeURIComponent(userID), "/reactivate"), _objectSpread$1({}, options));
|
|
13451
13512
|
|
|
13452
13513
|
case 2:
|
|
13453
13514
|
return _context35.abrupt("return", _context35.sent);
|
|
@@ -13484,7 +13545,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
13484
13545
|
switch (_context36.prev = _context36.next) {
|
|
13485
13546
|
case 0:
|
|
13486
13547
|
_context36.next = 2;
|
|
13487
|
-
return this.post(this.baseURL + "/users/reactivate", _objectSpread({
|
|
13548
|
+
return this.post(this.baseURL + "/users/reactivate", _objectSpread$1({
|
|
13488
13549
|
user_ids: user_ids
|
|
13489
13550
|
}, options));
|
|
13490
13551
|
|
|
@@ -13523,7 +13584,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
13523
13584
|
switch (_context37.prev = _context37.next) {
|
|
13524
13585
|
case 0:
|
|
13525
13586
|
_context37.next = 2;
|
|
13526
|
-
return this.post(this.baseURL + "/users/".concat(encodeURIComponent(userID), "/deactivate"), _objectSpread({}, options));
|
|
13587
|
+
return this.post(this.baseURL + "/users/".concat(encodeURIComponent(userID), "/deactivate"), _objectSpread$1({}, options));
|
|
13527
13588
|
|
|
13528
13589
|
case 2:
|
|
13529
13590
|
return _context37.abrupt("return", _context37.sent);
|
|
@@ -13560,7 +13621,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
13560
13621
|
switch (_context38.prev = _context38.next) {
|
|
13561
13622
|
case 0:
|
|
13562
13623
|
_context38.next = 2;
|
|
13563
|
-
return this.post(this.baseURL + "/users/deactivate", _objectSpread({
|
|
13624
|
+
return this.post(this.baseURL + "/users/deactivate", _objectSpread$1({
|
|
13564
13625
|
user_ids: user_ids
|
|
13565
13626
|
}, options));
|
|
13566
13627
|
|
|
@@ -13590,7 +13651,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
13590
13651
|
switch (_context39.prev = _context39.next) {
|
|
13591
13652
|
case 0:
|
|
13592
13653
|
_context39.next = 2;
|
|
13593
|
-
return this.get(this.baseURL + "/users/".concat(encodeURIComponent(userID), "/export"), _objectSpread({}, options));
|
|
13654
|
+
return this.get(this.baseURL + "/users/".concat(encodeURIComponent(userID), "/export"), _objectSpread$1({}, options));
|
|
13594
13655
|
|
|
13595
13656
|
case 2:
|
|
13596
13657
|
return _context39.abrupt("return", _context39.sent);
|
|
@@ -13625,7 +13686,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
13625
13686
|
switch (_context40.prev = _context40.next) {
|
|
13626
13687
|
case 0:
|
|
13627
13688
|
_context40.next = 2;
|
|
13628
|
-
return this.post(this.baseURL + '/moderation/ban', _objectSpread({
|
|
13689
|
+
return this.post(this.baseURL + '/moderation/ban', _objectSpread$1({
|
|
13629
13690
|
target_user_id: targetUserID
|
|
13630
13691
|
}, options));
|
|
13631
13692
|
|
|
@@ -13662,7 +13723,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
13662
13723
|
switch (_context41.prev = _context41.next) {
|
|
13663
13724
|
case 0:
|
|
13664
13725
|
_context41.next = 2;
|
|
13665
|
-
return this.delete(this.baseURL + '/moderation/ban', _objectSpread({
|
|
13726
|
+
return this.delete(this.baseURL + '/moderation/ban', _objectSpread$1({
|
|
13666
13727
|
target_user_id: targetUserID
|
|
13667
13728
|
}, options));
|
|
13668
13729
|
|
|
@@ -13699,7 +13760,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
13699
13760
|
switch (_context42.prev = _context42.next) {
|
|
13700
13761
|
case 0:
|
|
13701
13762
|
_context42.next = 2;
|
|
13702
|
-
return this.banUser(targetUserID, _objectSpread({
|
|
13763
|
+
return this.banUser(targetUserID, _objectSpread$1({
|
|
13703
13764
|
shadow: true
|
|
13704
13765
|
}, options));
|
|
13705
13766
|
|
|
@@ -13736,7 +13797,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
13736
13797
|
switch (_context43.prev = _context43.next) {
|
|
13737
13798
|
case 0:
|
|
13738
13799
|
_context43.next = 2;
|
|
13739
|
-
return this.unbanUser(targetUserID, _objectSpread({
|
|
13800
|
+
return this.unbanUser(targetUserID, _objectSpread$1({
|
|
13740
13801
|
shadow: true
|
|
13741
13802
|
}, options));
|
|
13742
13803
|
|
|
@@ -13766,7 +13827,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
13766
13827
|
switch (_context44.prev = _context44.next) {
|
|
13767
13828
|
case 0:
|
|
13768
13829
|
_context44.next = 2;
|
|
13769
|
-
return this.post(this.baseURL + '/users/block', _objectSpread({
|
|
13830
|
+
return this.post(this.baseURL + '/users/block', _objectSpread$1({
|
|
13770
13831
|
blocked_user_id: blockedUserID
|
|
13771
13832
|
}, user_id ? {
|
|
13772
13833
|
user_id: user_id
|
|
@@ -13798,7 +13859,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
13798
13859
|
switch (_context45.prev = _context45.next) {
|
|
13799
13860
|
case 0:
|
|
13800
13861
|
_context45.next = 2;
|
|
13801
|
-
return this.get(this.baseURL + '/users/block', _objectSpread({}, user_id ? {
|
|
13862
|
+
return this.get(this.baseURL + '/users/block', _objectSpread$1({}, user_id ? {
|
|
13802
13863
|
user_id: user_id
|
|
13803
13864
|
} : {}));
|
|
13804
13865
|
|
|
@@ -13828,7 +13889,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
13828
13889
|
switch (_context46.prev = _context46.next) {
|
|
13829
13890
|
case 0:
|
|
13830
13891
|
_context46.next = 2;
|
|
13831
|
-
return this.post(this.baseURL + '/users/unblock', _objectSpread({
|
|
13892
|
+
return this.post(this.baseURL + '/users/unblock', _objectSpread$1({
|
|
13832
13893
|
blocked_user_id: blockedUserID
|
|
13833
13894
|
}, userID ? {
|
|
13834
13895
|
user_id: userID
|
|
@@ -13871,7 +13932,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
13871
13932
|
case 0:
|
|
13872
13933
|
options = _args47.length > 2 && _args47[2] !== undefined ? _args47[2] : {};
|
|
13873
13934
|
_context47.next = 3;
|
|
13874
|
-
return this.post(this.baseURL + '/moderation/mute', _objectSpread(_objectSpread({
|
|
13935
|
+
return this.post(this.baseURL + '/moderation/mute', _objectSpread$1(_objectSpread$1({
|
|
13875
13936
|
target_id: targetID
|
|
13876
13937
|
}, userID ? {
|
|
13877
13938
|
user_id: userID
|
|
@@ -13910,7 +13971,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
13910
13971
|
switch (_context48.prev = _context48.next) {
|
|
13911
13972
|
case 0:
|
|
13912
13973
|
_context48.next = 2;
|
|
13913
|
-
return this.post(this.baseURL + '/moderation/unmute', _objectSpread({
|
|
13974
|
+
return this.post(this.baseURL + '/moderation/unmute', _objectSpread$1({
|
|
13914
13975
|
target_id: targetID
|
|
13915
13976
|
}, currentUserID ? {
|
|
13916
13977
|
user_id: currentUserID
|
|
@@ -13971,7 +14032,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
13971
14032
|
case 0:
|
|
13972
14033
|
options = _args49.length > 1 && _args49[1] !== undefined ? _args49[1] : {};
|
|
13973
14034
|
_context49.next = 3;
|
|
13974
|
-
return this.post(this.baseURL + '/moderation/flag', _objectSpread({
|
|
14035
|
+
return this.post(this.baseURL + '/moderation/flag', _objectSpread$1({
|
|
13975
14036
|
target_message_id: targetMessageID
|
|
13976
14037
|
}, options));
|
|
13977
14038
|
|
|
@@ -14011,7 +14072,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
14011
14072
|
case 0:
|
|
14012
14073
|
options = _args50.length > 1 && _args50[1] !== undefined ? _args50[1] : {};
|
|
14013
14074
|
_context50.next = 3;
|
|
14014
|
-
return this.post(this.baseURL + '/moderation/flag', _objectSpread({
|
|
14075
|
+
return this.post(this.baseURL + '/moderation/flag', _objectSpread$1({
|
|
14015
14076
|
target_user_id: targetID
|
|
14016
14077
|
}, options));
|
|
14017
14078
|
|
|
@@ -14051,7 +14112,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
14051
14112
|
case 0:
|
|
14052
14113
|
options = _args51.length > 1 && _args51[1] !== undefined ? _args51[1] : {};
|
|
14053
14114
|
_context51.next = 3;
|
|
14054
|
-
return this.post(this.baseURL + '/moderation/unflag', _objectSpread({
|
|
14115
|
+
return this.post(this.baseURL + '/moderation/unflag', _objectSpread$1({
|
|
14055
14116
|
target_message_id: targetMessageID
|
|
14056
14117
|
}, options));
|
|
14057
14118
|
|
|
@@ -14091,7 +14152,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
14091
14152
|
case 0:
|
|
14092
14153
|
options = _args52.length > 1 && _args52[1] !== undefined ? _args52[1] : {};
|
|
14093
14154
|
_context52.next = 3;
|
|
14094
|
-
return this.post(this.baseURL + '/moderation/unflag', _objectSpread({
|
|
14155
|
+
return this.post(this.baseURL + '/moderation/unflag', _objectSpread$1({
|
|
14095
14156
|
target_user_id: targetID
|
|
14096
14157
|
}, options));
|
|
14097
14158
|
|
|
@@ -14132,7 +14193,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
14132
14193
|
case 0:
|
|
14133
14194
|
options = _args53.length > 1 && _args53[1] !== undefined ? _args53[1] : {};
|
|
14134
14195
|
_context53.next = 3;
|
|
14135
|
-
return this.post(this.baseURL + "/calls/".concat(encodeURIComponent(callID)), _objectSpread({}, options));
|
|
14196
|
+
return this.post(this.baseURL + "/calls/".concat(encodeURIComponent(callID)), _objectSpread$1({}, options));
|
|
14136
14197
|
|
|
14137
14198
|
case 3:
|
|
14138
14199
|
return _context53.abrupt("return", _context53.sent);
|
|
@@ -14179,7 +14240,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
14179
14240
|
filterConditions = _args54.length > 0 && _args54[0] !== undefined ? _args54[0] : {};
|
|
14180
14241
|
options = _args54.length > 1 && _args54[1] !== undefined ? _args54[1] : {};
|
|
14181
14242
|
_context54.next = 4;
|
|
14182
|
-
return this.post(this.baseURL + '/moderation/flags', _objectSpread({
|
|
14243
|
+
return this.post(this.baseURL + '/moderation/flags', _objectSpread$1({
|
|
14183
14244
|
filter_conditions: filterConditions
|
|
14184
14245
|
}, options));
|
|
14185
14246
|
|
|
@@ -14228,7 +14289,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
14228
14289
|
filterConditions = _args55.length > 0 && _args55[0] !== undefined ? _args55[0] : {};
|
|
14229
14290
|
options = _args55.length > 1 && _args55[1] !== undefined ? _args55[1] : {};
|
|
14230
14291
|
_context55.next = 4;
|
|
14231
|
-
return this.post(this.baseURL + '/moderation/reports', _objectSpread({
|
|
14292
|
+
return this.post(this.baseURL + '/moderation/reports', _objectSpread$1({
|
|
14232
14293
|
filter_conditions: filterConditions
|
|
14233
14294
|
}, options));
|
|
14234
14295
|
|
|
@@ -14276,7 +14337,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
14276
14337
|
case 0:
|
|
14277
14338
|
options = _args56.length > 2 && _args56[2] !== undefined ? _args56[2] : {};
|
|
14278
14339
|
_context56.next = 3;
|
|
14279
|
-
return this.patch(this.baseURL + "/moderation/reports/".concat(encodeURIComponent(id)), _objectSpread({
|
|
14340
|
+
return this.patch(this.baseURL + "/moderation/reports/".concat(encodeURIComponent(id)), _objectSpread$1({
|
|
14280
14341
|
review_result: reviewResult
|
|
14281
14342
|
}, options));
|
|
14282
14343
|
|
|
@@ -14318,7 +14379,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
14318
14379
|
case 0:
|
|
14319
14380
|
options = _args57.length > 1 && _args57[1] !== undefined ? _args57[1] : {};
|
|
14320
14381
|
_context57.next = 3;
|
|
14321
|
-
return this.post(this.baseURL + '/moderation/unblock_message', _objectSpread({
|
|
14382
|
+
return this.post(this.baseURL + '/moderation/unblock_message', _objectSpread$1({
|
|
14322
14383
|
target_message_id: targetMessageID
|
|
14323
14384
|
}, options));
|
|
14324
14385
|
|
|
@@ -14361,7 +14422,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
14361
14422
|
case 0:
|
|
14362
14423
|
data = _args58.length > 0 && _args58[0] !== undefined ? _args58[0] : {};
|
|
14363
14424
|
_context58.next = 3;
|
|
14364
|
-
return this.post(this.baseURL + '/channels/read', _objectSpread({}, data));
|
|
14425
|
+
return this.post(this.baseURL + '/channels/read', _objectSpread$1({}, data));
|
|
14365
14426
|
|
|
14366
14427
|
case 3:
|
|
14367
14428
|
case "end":
|
|
@@ -14653,7 +14714,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
14653
14714
|
}
|
|
14654
14715
|
|
|
14655
14716
|
_context61.next = 10;
|
|
14656
|
-
return this.post(this.baseURL + "/messages/".concat(encodeURIComponent(message.id)), _objectSpread({
|
|
14717
|
+
return this.post(this.baseURL + "/messages/".concat(encodeURIComponent(message.id)), _objectSpread$1({
|
|
14657
14718
|
message: clonedMessage
|
|
14658
14719
|
}, options));
|
|
14659
14720
|
|
|
@@ -14714,7 +14775,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
14714
14775
|
}
|
|
14715
14776
|
|
|
14716
14777
|
_context62.next = 6;
|
|
14717
|
-
return this.put(this.baseURL + "/messages/".concat(encodeURIComponent(id)), _objectSpread(_objectSpread(_objectSpread({}, partialMessageObject), options), {}, {
|
|
14778
|
+
return this.put(this.baseURL + "/messages/".concat(encodeURIComponent(id)), _objectSpread$1(_objectSpread$1(_objectSpread$1({}, partialMessageObject), options), {}, {
|
|
14718
14779
|
user: user
|
|
14719
14780
|
}));
|
|
14720
14781
|
|
|
@@ -14824,7 +14885,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
14824
14885
|
switch (_context65.prev = _context65.next) {
|
|
14825
14886
|
case 0:
|
|
14826
14887
|
_context65.next = 2;
|
|
14827
|
-
return this.get(this.baseURL + "/messages/".concat(encodeURIComponent(messageID)), _objectSpread({}, options));
|
|
14888
|
+
return this.get(this.baseURL + "/messages/".concat(encodeURIComponent(messageID)), _objectSpread$1({}, options));
|
|
14828
14889
|
|
|
14829
14890
|
case 2:
|
|
14830
14891
|
return _context65.abrupt("return", _context65.sent);
|
|
@@ -14870,7 +14931,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
14870
14931
|
switch (_context66.prev = _context66.next) {
|
|
14871
14932
|
case 0:
|
|
14872
14933
|
options = _args66.length > 0 && _args66[0] !== undefined ? _args66[0] : {};
|
|
14873
|
-
optionsWithDefaults = _objectSpread({
|
|
14934
|
+
optionsWithDefaults = _objectSpread$1({
|
|
14874
14935
|
limit: 10,
|
|
14875
14936
|
participant_limit: 10,
|
|
14876
14937
|
reply_limit: 3,
|
|
@@ -14939,7 +15000,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
14939
15000
|
throw Error('Please specify the messageId when calling getThread');
|
|
14940
15001
|
|
|
14941
15002
|
case 3:
|
|
14942
|
-
optionsWithDefaults = _objectSpread({
|
|
15003
|
+
optionsWithDefaults = _objectSpread$1({
|
|
14943
15004
|
participant_limit: 100,
|
|
14944
15005
|
reply_limit: 3,
|
|
14945
15006
|
watch: true
|
|
@@ -14998,7 +15059,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
14998
15059
|
// check for reserved fields from ThreadResponse type within partialThreadObject's set and unset.
|
|
14999
15060
|
// Throw error if any of the reserved field is found.
|
|
15000
15061
|
reservedThreadFields = ['created_at', 'id', 'last_message_at', 'type', 'updated_at', 'user', 'reply_count', 'participants', 'channel', 'custom'];
|
|
15001
|
-
_context68.t0 = _regeneratorRuntime__default['default'].keys(_objectSpread(_objectSpread({}, partialThreadObject.set), partialThreadObject.unset));
|
|
15062
|
+
_context68.t0 = _regeneratorRuntime__default['default'].keys(_objectSpread$1(_objectSpread$1({}, partialThreadObject.set), partialThreadObject.unset));
|
|
15002
15063
|
|
|
15003
15064
|
case 4:
|
|
15004
15065
|
if ((_context68.t1 = _context68.t0()).done) {
|
|
@@ -15043,7 +15104,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
15043
15104
|
}, {
|
|
15044
15105
|
key: "getUserAgent",
|
|
15045
15106
|
value: function getUserAgent() {
|
|
15046
|
-
return this.userAgent || "stream-chat-javascript-client-".concat(this.node ? 'node' : 'browser', "-", "8.
|
|
15107
|
+
return this.userAgent || "stream-chat-javascript-client-".concat(this.node ? 'node' : 'browser', "-", "8.55.0");
|
|
15047
15108
|
}
|
|
15048
15109
|
}, {
|
|
15049
15110
|
key: "setUserAgent",
|
|
@@ -15078,7 +15139,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
15078
15139
|
}
|
|
15079
15140
|
|
|
15080
15141
|
if (!((_options$headers = options.headers) !== null && _options$headers !== void 0 && _options$headers['x-client-request-id'])) {
|
|
15081
|
-
options.headers = _objectSpread(_objectSpread({}, options.headers), {}, {
|
|
15142
|
+
options.headers = _objectSpread$1(_objectSpread$1({}, options.headers), {}, {
|
|
15082
15143
|
'x-client-request-id': randomId()
|
|
15083
15144
|
});
|
|
15084
15145
|
}
|
|
@@ -15088,13 +15149,13 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
15088
15149
|
axiosRequestConfigHeaders = _ref9.headers,
|
|
15089
15150
|
axiosRequestConfigRest = _objectWithoutProperties__default['default'](_ref9, _excluded2);
|
|
15090
15151
|
|
|
15091
|
-
return _objectSpread(_objectSpread(_objectSpread({
|
|
15092
|
-
params: _objectSpread(_objectSpread({
|
|
15152
|
+
return _objectSpread$1(_objectSpread$1(_objectSpread$1({
|
|
15153
|
+
params: _objectSpread$1(_objectSpread$1({
|
|
15093
15154
|
user_id: this.userID,
|
|
15094
15155
|
connection_id: this._getConnectionID(),
|
|
15095
15156
|
api_key: this.key
|
|
15096
15157
|
}, options.params), axiosRequestConfigParams || {}),
|
|
15097
|
-
headers: _objectSpread(_objectSpread(_objectSpread({}, authorization), {}, {
|
|
15158
|
+
headers: _objectSpread$1(_objectSpread$1(_objectSpread$1({}, authorization), {}, {
|
|
15098
15159
|
'stream-auth-type': this.getAuthType(),
|
|
15099
15160
|
'X-Stream-Client': this.getUserAgent()
|
|
15100
15161
|
}, options.headers), axiosRequestConfigHeaders || {})
|
|
@@ -15164,7 +15225,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
15164
15225
|
}, {
|
|
15165
15226
|
key: "createPermission",
|
|
15166
15227
|
value: function createPermission(permissionData) {
|
|
15167
|
-
return this.post("".concat(this.baseURL, "/permissions"), _objectSpread({}, permissionData));
|
|
15228
|
+
return this.post("".concat(this.baseURL, "/permissions"), _objectSpread$1({}, permissionData));
|
|
15168
15229
|
}
|
|
15169
15230
|
/** updatePermission - updates an existing custom permission
|
|
15170
15231
|
*
|
|
@@ -15176,7 +15237,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
15176
15237
|
}, {
|
|
15177
15238
|
key: "updatePermission",
|
|
15178
15239
|
value: function updatePermission(id, permissionData) {
|
|
15179
|
-
return this.put("".concat(this.baseURL, "/permissions/").concat(encodeURIComponent(id)), _objectSpread({}, permissionData));
|
|
15240
|
+
return this.put("".concat(this.baseURL, "/permissions/").concat(encodeURIComponent(id)), _objectSpread$1({}, permissionData));
|
|
15180
15241
|
}
|
|
15181
15242
|
/** deletePermission - deletes a custom permission
|
|
15182
15243
|
*
|
|
@@ -15245,7 +15306,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
15245
15306
|
key: "sync",
|
|
15246
15307
|
value: function sync(channel_cids, last_sync_at) {
|
|
15247
15308
|
var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
15248
|
-
return this.post("".concat(this.baseURL, "/sync"), _objectSpread({
|
|
15309
|
+
return this.post("".concat(this.baseURL, "/sync"), _objectSpread$1({
|
|
15249
15310
|
channel_cids: channel_cids,
|
|
15250
15311
|
last_sync_at: last_sync_at
|
|
15251
15312
|
}, options));
|
|
@@ -15370,7 +15431,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
15370
15431
|
value: function exportChannels(request) {
|
|
15371
15432
|
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
15372
15433
|
|
|
15373
|
-
var payload = _objectSpread({
|
|
15434
|
+
var payload = _objectSpread$1({
|
|
15374
15435
|
channels: request
|
|
15375
15436
|
}, options);
|
|
15376
15437
|
|
|
@@ -15438,7 +15499,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
15438
15499
|
switch (_context70.prev = _context70.next) {
|
|
15439
15500
|
case 0:
|
|
15440
15501
|
this.validateServerSideAuth();
|
|
15441
|
-
body = _objectSpread({
|
|
15502
|
+
body = _objectSpread$1({
|
|
15442
15503
|
id: id,
|
|
15443
15504
|
type: type
|
|
15444
15505
|
}, data);
|
|
@@ -15641,7 +15702,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
15641
15702
|
sort = _args76.length > 2 && _args76[2] !== undefined ? _args76[2] : [];
|
|
15642
15703
|
options = _args76.length > 3 && _args76[3] !== undefined ? _args76[3] : {};
|
|
15643
15704
|
this.validateServerSideAuth();
|
|
15644
|
-
return _context76.abrupt("return", this.post(this.baseURL + "/segments/".concat(encodeURIComponent(id), "/targets/query"), _objectSpread({
|
|
15705
|
+
return _context76.abrupt("return", this.post(this.baseURL + "/segments/".concat(encodeURIComponent(id), "/targets/query"), _objectSpread$1({
|
|
15645
15706
|
filter: filter || {},
|
|
15646
15707
|
sort: sort || []
|
|
15647
15708
|
}, options)));
|
|
@@ -15719,7 +15780,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
15719
15780
|
case 0:
|
|
15720
15781
|
options = _args78.length > 2 && _args78[2] !== undefined ? _args78[2] : {};
|
|
15721
15782
|
this.validateServerSideAuth();
|
|
15722
|
-
return _context78.abrupt("return", this.post(this.baseURL + "/segments/query", _objectSpread({
|
|
15783
|
+
return _context78.abrupt("return", this.post(this.baseURL + "/segments/query", _objectSpread$1({
|
|
15723
15784
|
filter: filter,
|
|
15724
15785
|
sort: sort
|
|
15725
15786
|
}, options)));
|
|
@@ -15822,7 +15883,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
15822
15883
|
switch (_context81.prev = _context81.next) {
|
|
15823
15884
|
case 0:
|
|
15824
15885
|
this.validateServerSideAuth();
|
|
15825
|
-
return _context81.abrupt("return", this.post(this.baseURL + "/campaigns", _objectSpread({}, params)));
|
|
15886
|
+
return _context81.abrupt("return", this.post(this.baseURL + "/campaigns", _objectSpread$1({}, params)));
|
|
15826
15887
|
|
|
15827
15888
|
case 2:
|
|
15828
15889
|
case "end":
|
|
@@ -15908,7 +15969,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
15908
15969
|
case 0:
|
|
15909
15970
|
this.validateServerSideAuth();
|
|
15910
15971
|
_context84.next = 3;
|
|
15911
|
-
return this.post(this.baseURL + "/campaigns/query", _objectSpread({
|
|
15972
|
+
return this.post(this.baseURL + "/campaigns/query", _objectSpread$1({
|
|
15912
15973
|
filter: filter,
|
|
15913
15974
|
sort: sort
|
|
15914
15975
|
}, options || {}));
|
|
@@ -16116,7 +16177,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
16116
16177
|
case 0:
|
|
16117
16178
|
options = _args90.length > 1 && _args90[1] !== undefined ? _args90[1] : {};
|
|
16118
16179
|
_context90.next = 3;
|
|
16119
|
-
return this.post(this.baseURL + "/channels/delete", _objectSpread({
|
|
16180
|
+
return this.post(this.baseURL + "/channels/delete", _objectSpread$1({
|
|
16120
16181
|
cids: cids
|
|
16121
16182
|
}, options));
|
|
16122
16183
|
|
|
@@ -16183,7 +16244,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
16183
16244
|
|
|
16184
16245
|
case 7:
|
|
16185
16246
|
_context91.next = 9;
|
|
16186
|
-
return this.post(this.baseURL + "/users/delete", _objectSpread({
|
|
16247
|
+
return this.post(this.baseURL + "/users/delete", _objectSpread$1({
|
|
16187
16248
|
user_ids: user_ids
|
|
16188
16249
|
}, options));
|
|
16189
16250
|
|
|
@@ -16273,7 +16334,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
16273
16334
|
mode: 'upsert'
|
|
16274
16335
|
};
|
|
16275
16336
|
_context93.next = 3;
|
|
16276
|
-
return this.post(this.baseURL + "/imports", _objectSpread({
|
|
16337
|
+
return this.post(this.baseURL + "/imports", _objectSpread$1({
|
|
16277
16338
|
path: path
|
|
16278
16339
|
}, options));
|
|
16279
16340
|
|
|
@@ -16552,7 +16613,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
16552
16613
|
switch (_context100.prev = _context100.next) {
|
|
16553
16614
|
case 0:
|
|
16554
16615
|
_context100.next = 2;
|
|
16555
|
-
return this.post(this.baseURL + "/polls", _objectSpread(_objectSpread({}, poll), userId ? {
|
|
16616
|
+
return this.post(this.baseURL + "/polls", _objectSpread$1(_objectSpread$1({}, poll), userId ? {
|
|
16556
16617
|
user_id: userId
|
|
16557
16618
|
} : {}));
|
|
16558
16619
|
|
|
@@ -16626,7 +16687,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
16626
16687
|
switch (_context102.prev = _context102.next) {
|
|
16627
16688
|
case 0:
|
|
16628
16689
|
_context102.next = 2;
|
|
16629
|
-
return this.put(this.baseURL + "/polls", _objectSpread(_objectSpread({}, poll), userId ? {
|
|
16690
|
+
return this.put(this.baseURL + "/polls", _objectSpread$1(_objectSpread$1({}, poll), userId ? {
|
|
16630
16691
|
user_id: userId
|
|
16631
16692
|
} : {}));
|
|
16632
16693
|
|
|
@@ -16665,7 +16726,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
16665
16726
|
switch (_context103.prev = _context103.next) {
|
|
16666
16727
|
case 0:
|
|
16667
16728
|
_context103.next = 2;
|
|
16668
|
-
return this.patch(this.baseURL + "/polls/".concat(encodeURIComponent(id)), _objectSpread(_objectSpread({}, partialPollObject), userId ? {
|
|
16729
|
+
return this.patch(this.baseURL + "/polls/".concat(encodeURIComponent(id)), _objectSpread$1(_objectSpread$1({}, partialPollObject), userId ? {
|
|
16669
16730
|
user_id: userId
|
|
16670
16731
|
} : {}));
|
|
16671
16732
|
|
|
@@ -16702,7 +16763,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
16702
16763
|
switch (_context104.prev = _context104.next) {
|
|
16703
16764
|
case 0:
|
|
16704
16765
|
_context104.next = 2;
|
|
16705
|
-
return this.delete(this.baseURL + "/polls/".concat(encodeURIComponent(id)), _objectSpread({}, userId ? {
|
|
16766
|
+
return this.delete(this.baseURL + "/polls/".concat(encodeURIComponent(id)), _objectSpread$1({}, userId ? {
|
|
16706
16767
|
user_id: userId
|
|
16707
16768
|
} : {}));
|
|
16708
16769
|
|
|
@@ -16775,7 +16836,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
16775
16836
|
switch (_context106.prev = _context106.next) {
|
|
16776
16837
|
case 0:
|
|
16777
16838
|
_context106.next = 2;
|
|
16778
|
-
return this.post(this.baseURL + "/polls/".concat(encodeURIComponent(pollId), "/options"), _objectSpread(_objectSpread({}, option), userId ? {
|
|
16839
|
+
return this.post(this.baseURL + "/polls/".concat(encodeURIComponent(pollId), "/options"), _objectSpread$1(_objectSpread$1({}, option), userId ? {
|
|
16779
16840
|
user_id: userId
|
|
16780
16841
|
} : {}));
|
|
16781
16842
|
|
|
@@ -16851,7 +16912,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
16851
16912
|
switch (_context108.prev = _context108.next) {
|
|
16852
16913
|
case 0:
|
|
16853
16914
|
_context108.next = 2;
|
|
16854
|
-
return this.put(this.baseURL + "/polls/".concat(encodeURIComponent(pollId), "/options"), _objectSpread(_objectSpread({}, option), userId ? {
|
|
16915
|
+
return this.put(this.baseURL + "/polls/".concat(encodeURIComponent(pollId), "/options"), _objectSpread$1(_objectSpread$1({}, option), userId ? {
|
|
16855
16916
|
user_id: userId
|
|
16856
16917
|
} : {}));
|
|
16857
16918
|
|
|
@@ -16928,7 +16989,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
16928
16989
|
switch (_context110.prev = _context110.next) {
|
|
16929
16990
|
case 0:
|
|
16930
16991
|
_context110.next = 2;
|
|
16931
|
-
return this.post(this.baseURL + "/messages/".concat(encodeURIComponent(messageId), "/polls/").concat(encodeURIComponent(pollId), "/vote"), _objectSpread({
|
|
16992
|
+
return this.post(this.baseURL + "/messages/".concat(encodeURIComponent(messageId), "/polls/").concat(encodeURIComponent(pollId), "/vote"), _objectSpread$1({
|
|
16932
16993
|
vote: vote
|
|
16933
16994
|
}, userId ? {
|
|
16934
16995
|
user_id: userId
|
|
@@ -16994,7 +17055,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
16994
17055
|
switch (_context112.prev = _context112.next) {
|
|
16995
17056
|
case 0:
|
|
16996
17057
|
_context112.next = 2;
|
|
16997
|
-
return this.delete(this.baseURL + "/messages/".concat(encodeURIComponent(messageId), "/polls/").concat(encodeURIComponent(pollId), "/vote/").concat(encodeURIComponent(voteId)), _objectSpread({}, userId ? {
|
|
17058
|
+
return this.delete(this.baseURL + "/messages/".concat(encodeURIComponent(messageId), "/polls/").concat(encodeURIComponent(pollId), "/vote/").concat(encodeURIComponent(voteId)), _objectSpread$1({}, userId ? {
|
|
16998
17059
|
user_id: userId
|
|
16999
17060
|
} : {}));
|
|
17000
17061
|
|
|
@@ -17044,7 +17105,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
17044
17105
|
userId = _args113.length > 3 ? _args113[3] : undefined;
|
|
17045
17106
|
q = userId ? "?user_id=".concat(userId) : '';
|
|
17046
17107
|
_context113.next = 7;
|
|
17047
|
-
return this.post(this.baseURL + "/polls/query".concat(q), _objectSpread({
|
|
17108
|
+
return this.post(this.baseURL + "/polls/query".concat(q), _objectSpread$1({
|
|
17048
17109
|
filter: filter,
|
|
17049
17110
|
sort: normalizeQuerySort(sort)
|
|
17050
17111
|
}, options));
|
|
@@ -17096,7 +17157,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
17096
17157
|
userId = _args114.length > 4 ? _args114[4] : undefined;
|
|
17097
17158
|
q = userId ? "?user_id=".concat(userId) : '';
|
|
17098
17159
|
_context114.next = 7;
|
|
17099
|
-
return this.post(this.baseURL + "/polls/".concat(encodeURIComponent(pollId), "/votes").concat(q), _objectSpread({
|
|
17160
|
+
return this.post(this.baseURL + "/polls/".concat(encodeURIComponent(pollId), "/votes").concat(q), _objectSpread$1({
|
|
17100
17161
|
filter: filter,
|
|
17101
17162
|
sort: normalizeQuerySort(sort)
|
|
17102
17163
|
}, options));
|
|
@@ -17148,8 +17209,8 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
17148
17209
|
userId = _args115.length > 4 ? _args115[4] : undefined;
|
|
17149
17210
|
q = userId ? "?user_id=".concat(userId) : '';
|
|
17150
17211
|
_context115.next = 7;
|
|
17151
|
-
return this.post(this.baseURL + "/polls/".concat(encodeURIComponent(pollId), "/votes").concat(q), _objectSpread({
|
|
17152
|
-
filter: _objectSpread(_objectSpread({}, filter), {}, {
|
|
17212
|
+
return this.post(this.baseURL + "/polls/".concat(encodeURIComponent(pollId), "/votes").concat(q), _objectSpread$1({
|
|
17213
|
+
filter: _objectSpread$1(_objectSpread$1({}, filter), {}, {
|
|
17153
17214
|
is_answer: true
|
|
17154
17215
|
}),
|
|
17155
17216
|
sort: normalizeQuerySort(sort)
|
|
@@ -17196,7 +17257,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
17196
17257
|
sort = _args116.length > 1 && _args116[1] !== undefined ? _args116[1] : [];
|
|
17197
17258
|
options = _args116.length > 2 && _args116[2] !== undefined ? _args116[2] : {};
|
|
17198
17259
|
_context116.next = 5;
|
|
17199
|
-
return this.post(this.baseURL + '/messages/history', _objectSpread({
|
|
17260
|
+
return this.post(this.baseURL + '/messages/history', _objectSpread$1({
|
|
17200
17261
|
filter: filter,
|
|
17201
17262
|
sort: normalizeQuerySort(sort)
|
|
17202
17263
|
}, options));
|
|
@@ -17239,7 +17300,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
17239
17300
|
case 0:
|
|
17240
17301
|
options = _args117.length > 2 && _args117[2] !== undefined ? _args117[2] : {};
|
|
17241
17302
|
_context117.next = 3;
|
|
17242
|
-
return this.post(this.baseURL + '/automod/v1/moderation/update_flags', _objectSpread({
|
|
17303
|
+
return this.post(this.baseURL + '/automod/v1/moderation/update_flags', _objectSpread$1({
|
|
17243
17304
|
message_ids: message_ids,
|
|
17244
17305
|
reviewed_by: reviewed_by
|
|
17245
17306
|
}, options));
|
|
@@ -17418,14 +17479,772 @@ var BuiltinPermissions = {
|
|
|
17418
17479
|
UseFrozenChannel: 'Send messages and reactions to frozen channels'
|
|
17419
17480
|
};
|
|
17420
17481
|
|
|
17482
|
+
var _excluded = ["lastQueryError"];
|
|
17483
|
+
|
|
17484
|
+
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf__default['default'](Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf__default['default'](this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn__default['default'](this, result); }; }
|
|
17485
|
+
|
|
17486
|
+
function _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; } }
|
|
17487
|
+
|
|
17488
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
17489
|
+
|
|
17490
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty__default['default'](target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
17491
|
+
var DEFAULT_SEARCH_SOURCE_OPTIONS = {
|
|
17492
|
+
debounceMs: 300,
|
|
17493
|
+
pageSize: 10
|
|
17494
|
+
};
|
|
17495
|
+
var BaseSearchSource = /*#__PURE__*/function () {
|
|
17496
|
+
function BaseSearchSource(options) {
|
|
17497
|
+
var _this = this;
|
|
17498
|
+
|
|
17499
|
+
_classCallCheck__default['default'](this, BaseSearchSource);
|
|
17500
|
+
|
|
17501
|
+
_defineProperty__default['default'](this, "state", void 0);
|
|
17502
|
+
|
|
17503
|
+
_defineProperty__default['default'](this, "pageSize", void 0);
|
|
17504
|
+
|
|
17505
|
+
_defineProperty__default['default'](this, "type", void 0);
|
|
17506
|
+
|
|
17507
|
+
_defineProperty__default['default'](this, "searchDebounced", void 0);
|
|
17508
|
+
|
|
17509
|
+
_defineProperty__default['default'](this, "setDebounceOptions", function (_ref) {
|
|
17510
|
+
var debounceMs = _ref.debounceMs;
|
|
17511
|
+
_this.searchDebounced = debounce(_this.executeQuery.bind(_this), debounceMs);
|
|
17512
|
+
});
|
|
17513
|
+
|
|
17514
|
+
_defineProperty__default['default'](this, "activate", function () {
|
|
17515
|
+
if (_this.isActive) return;
|
|
17516
|
+
|
|
17517
|
+
_this.state.partialNext({
|
|
17518
|
+
isActive: true
|
|
17519
|
+
});
|
|
17520
|
+
});
|
|
17521
|
+
|
|
17522
|
+
_defineProperty__default['default'](this, "deactivate", function () {
|
|
17523
|
+
if (!_this.isActive) return;
|
|
17524
|
+
|
|
17525
|
+
_this.state.partialNext({
|
|
17526
|
+
isActive: false
|
|
17527
|
+
});
|
|
17528
|
+
});
|
|
17529
|
+
|
|
17530
|
+
_defineProperty__default['default'](this, "search", function (searchQuery) {
|
|
17531
|
+
_this.searchDebounced(searchQuery);
|
|
17532
|
+
});
|
|
17533
|
+
|
|
17534
|
+
var _DEFAULT_SEARCH_SOURC = _objectSpread(_objectSpread({}, DEFAULT_SEARCH_SOURCE_OPTIONS), options),
|
|
17535
|
+
_debounceMs = _DEFAULT_SEARCH_SOURC.debounceMs,
|
|
17536
|
+
pageSize = _DEFAULT_SEARCH_SOURC.pageSize;
|
|
17537
|
+
|
|
17538
|
+
this.pageSize = pageSize;
|
|
17539
|
+
this.state = new StateStore(this.initialState);
|
|
17540
|
+
this.setDebounceOptions({
|
|
17541
|
+
debounceMs: _debounceMs
|
|
17542
|
+
});
|
|
17543
|
+
}
|
|
17544
|
+
|
|
17545
|
+
_createClass__default['default'](BaseSearchSource, [{
|
|
17546
|
+
key: "lastQueryError",
|
|
17547
|
+
get: function get() {
|
|
17548
|
+
return this.state.getLatestValue().lastQueryError;
|
|
17549
|
+
}
|
|
17550
|
+
}, {
|
|
17551
|
+
key: "hasNext",
|
|
17552
|
+
get: function get() {
|
|
17553
|
+
return this.state.getLatestValue().hasNext;
|
|
17554
|
+
}
|
|
17555
|
+
}, {
|
|
17556
|
+
key: "hasResults",
|
|
17557
|
+
get: function get() {
|
|
17558
|
+
return Array.isArray(this.state.getLatestValue().items);
|
|
17559
|
+
}
|
|
17560
|
+
}, {
|
|
17561
|
+
key: "isActive",
|
|
17562
|
+
get: function get() {
|
|
17563
|
+
return this.state.getLatestValue().isActive;
|
|
17564
|
+
}
|
|
17565
|
+
}, {
|
|
17566
|
+
key: "isLoading",
|
|
17567
|
+
get: function get() {
|
|
17568
|
+
return this.state.getLatestValue().isLoading;
|
|
17569
|
+
}
|
|
17570
|
+
}, {
|
|
17571
|
+
key: "initialState",
|
|
17572
|
+
get: function get() {
|
|
17573
|
+
return {
|
|
17574
|
+
hasNext: true,
|
|
17575
|
+
isActive: false,
|
|
17576
|
+
isLoading: false,
|
|
17577
|
+
items: undefined,
|
|
17578
|
+
lastQueryError: undefined,
|
|
17579
|
+
next: undefined,
|
|
17580
|
+
offset: 0,
|
|
17581
|
+
searchQuery: ''
|
|
17582
|
+
};
|
|
17583
|
+
}
|
|
17584
|
+
}, {
|
|
17585
|
+
key: "items",
|
|
17586
|
+
get: function get() {
|
|
17587
|
+
return this.state.getLatestValue().items;
|
|
17588
|
+
}
|
|
17589
|
+
}, {
|
|
17590
|
+
key: "next",
|
|
17591
|
+
get: function get() {
|
|
17592
|
+
return this.state.getLatestValue().next;
|
|
17593
|
+
}
|
|
17594
|
+
}, {
|
|
17595
|
+
key: "offset",
|
|
17596
|
+
get: function get() {
|
|
17597
|
+
return this.state.getLatestValue().offset;
|
|
17598
|
+
}
|
|
17599
|
+
}, {
|
|
17600
|
+
key: "searchQuery",
|
|
17601
|
+
get: function get() {
|
|
17602
|
+
return this.state.getLatestValue().searchQuery;
|
|
17603
|
+
}
|
|
17604
|
+
}, {
|
|
17605
|
+
key: "executeQuery",
|
|
17606
|
+
value: function () {
|
|
17607
|
+
var _executeQuery = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee(newSearchString) {
|
|
17608
|
+
var hasNewSearchQuery, searchString, stateUpdate, results, _items, next, _this$offset;
|
|
17609
|
+
|
|
17610
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee$(_context) {
|
|
17611
|
+
while (1) {
|
|
17612
|
+
switch (_context.prev = _context.next) {
|
|
17613
|
+
case 0:
|
|
17614
|
+
hasNewSearchQuery = typeof newSearchString !== 'undefined';
|
|
17615
|
+
searchString = newSearchString !== null && newSearchString !== void 0 ? newSearchString : this.searchQuery;
|
|
17616
|
+
|
|
17617
|
+
if (!(!this.isActive || this.isLoading || !this.hasNext && !hasNewSearchQuery || !searchString)) {
|
|
17618
|
+
_context.next = 4;
|
|
17619
|
+
break;
|
|
17620
|
+
}
|
|
17621
|
+
|
|
17622
|
+
return _context.abrupt("return");
|
|
17623
|
+
|
|
17624
|
+
case 4:
|
|
17625
|
+
if (hasNewSearchQuery) {
|
|
17626
|
+
this.state.next(_objectSpread(_objectSpread({}, this.initialState), {}, {
|
|
17627
|
+
isActive: this.isActive,
|
|
17628
|
+
isLoading: true,
|
|
17629
|
+
searchQuery: newSearchString !== null && newSearchString !== void 0 ? newSearchString : ''
|
|
17630
|
+
}));
|
|
17631
|
+
} else {
|
|
17632
|
+
this.state.partialNext({
|
|
17633
|
+
isLoading: true
|
|
17634
|
+
});
|
|
17635
|
+
}
|
|
17636
|
+
|
|
17637
|
+
stateUpdate = {};
|
|
17638
|
+
_context.prev = 6;
|
|
17639
|
+
_context.next = 9;
|
|
17640
|
+
return this.query(searchString);
|
|
17641
|
+
|
|
17642
|
+
case 9:
|
|
17643
|
+
results = _context.sent;
|
|
17644
|
+
|
|
17645
|
+
if (results) {
|
|
17646
|
+
_context.next = 12;
|
|
17647
|
+
break;
|
|
17648
|
+
}
|
|
17649
|
+
|
|
17650
|
+
return _context.abrupt("return");
|
|
17651
|
+
|
|
17652
|
+
case 12:
|
|
17653
|
+
_items = results.items, next = results.next;
|
|
17654
|
+
|
|
17655
|
+
if (next) {
|
|
17656
|
+
stateUpdate.next = next;
|
|
17657
|
+
stateUpdate.hasNext = !!next;
|
|
17658
|
+
} else {
|
|
17659
|
+
stateUpdate.offset = ((_this$offset = this.offset) !== null && _this$offset !== void 0 ? _this$offset : 0) + _items.length;
|
|
17660
|
+
stateUpdate.hasNext = _items.length === this.pageSize;
|
|
17661
|
+
}
|
|
17662
|
+
|
|
17663
|
+
_context.next = 16;
|
|
17664
|
+
return this.filterQueryResults(_items);
|
|
17665
|
+
|
|
17666
|
+
case 16:
|
|
17667
|
+
stateUpdate.items = _context.sent;
|
|
17668
|
+
_context.next = 22;
|
|
17669
|
+
break;
|
|
17670
|
+
|
|
17671
|
+
case 19:
|
|
17672
|
+
_context.prev = 19;
|
|
17673
|
+
_context.t0 = _context["catch"](6);
|
|
17674
|
+
stateUpdate.lastQueryError = _context.t0;
|
|
17675
|
+
|
|
17676
|
+
case 22:
|
|
17677
|
+
_context.prev = 22;
|
|
17678
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
17679
|
+
this.state.next(function (_ref2) {
|
|
17680
|
+
var _current$items;
|
|
17681
|
+
|
|
17682
|
+
_ref2.lastQueryError;
|
|
17683
|
+
var current = _objectWithoutProperties__default['default'](_ref2, _excluded);
|
|
17684
|
+
|
|
17685
|
+
return _objectSpread(_objectSpread(_objectSpread({}, current), stateUpdate), {}, {
|
|
17686
|
+
isLoading: false,
|
|
17687
|
+
items: [].concat(_toConsumableArray__default['default']((_current$items = current.items) !== null && _current$items !== void 0 ? _current$items : []), _toConsumableArray__default['default'](stateUpdate.items || []))
|
|
17688
|
+
});
|
|
17689
|
+
});
|
|
17690
|
+
return _context.finish(22);
|
|
17691
|
+
|
|
17692
|
+
case 25:
|
|
17693
|
+
case "end":
|
|
17694
|
+
return _context.stop();
|
|
17695
|
+
}
|
|
17696
|
+
}
|
|
17697
|
+
}, _callee, this, [[6, 19, 22, 25]]);
|
|
17698
|
+
}));
|
|
17699
|
+
|
|
17700
|
+
function executeQuery(_x) {
|
|
17701
|
+
return _executeQuery.apply(this, arguments);
|
|
17702
|
+
}
|
|
17703
|
+
|
|
17704
|
+
return executeQuery;
|
|
17705
|
+
}()
|
|
17706
|
+
}, {
|
|
17707
|
+
key: "resetState",
|
|
17708
|
+
value: function resetState() {
|
|
17709
|
+
this.state.next(this.initialState);
|
|
17710
|
+
}
|
|
17711
|
+
}]);
|
|
17712
|
+
|
|
17713
|
+
return BaseSearchSource;
|
|
17714
|
+
}();
|
|
17715
|
+
var UserSearchSource = /*#__PURE__*/function (_BaseSearchSource) {
|
|
17716
|
+
_inherits__default['default'](UserSearchSource, _BaseSearchSource);
|
|
17717
|
+
|
|
17718
|
+
var _super = _createSuper(UserSearchSource);
|
|
17719
|
+
|
|
17720
|
+
function UserSearchSource(client, options) {
|
|
17721
|
+
var _this2;
|
|
17722
|
+
|
|
17723
|
+
_classCallCheck__default['default'](this, UserSearchSource);
|
|
17724
|
+
|
|
17725
|
+
_this2 = _super.call(this, options);
|
|
17726
|
+
|
|
17727
|
+
_defineProperty__default['default'](_assertThisInitialized__default['default'](_this2), "type", 'users');
|
|
17728
|
+
|
|
17729
|
+
_defineProperty__default['default'](_assertThisInitialized__default['default'](_this2), "client", void 0);
|
|
17730
|
+
|
|
17731
|
+
_defineProperty__default['default'](_assertThisInitialized__default['default'](_this2), "filters", void 0);
|
|
17732
|
+
|
|
17733
|
+
_defineProperty__default['default'](_assertThisInitialized__default['default'](_this2), "sort", void 0);
|
|
17734
|
+
|
|
17735
|
+
_defineProperty__default['default'](_assertThisInitialized__default['default'](_this2), "searchOptions", void 0);
|
|
17736
|
+
|
|
17737
|
+
_this2.client = client;
|
|
17738
|
+
return _this2;
|
|
17739
|
+
}
|
|
17740
|
+
|
|
17741
|
+
_createClass__default['default'](UserSearchSource, [{
|
|
17742
|
+
key: "query",
|
|
17743
|
+
value: function () {
|
|
17744
|
+
var _query = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee2(searchQuery) {
|
|
17745
|
+
var filters, sort, options, _yield$this$client$qu, users;
|
|
17746
|
+
|
|
17747
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee2$(_context2) {
|
|
17748
|
+
while (1) {
|
|
17749
|
+
switch (_context2.prev = _context2.next) {
|
|
17750
|
+
case 0:
|
|
17751
|
+
filters = _objectSpread({
|
|
17752
|
+
$or: [{
|
|
17753
|
+
id: {
|
|
17754
|
+
$autocomplete: searchQuery
|
|
17755
|
+
}
|
|
17756
|
+
}, {
|
|
17757
|
+
name: {
|
|
17758
|
+
$autocomplete: searchQuery
|
|
17759
|
+
}
|
|
17760
|
+
}]
|
|
17761
|
+
}, this.filters);
|
|
17762
|
+
sort = _objectSpread({
|
|
17763
|
+
id: 1
|
|
17764
|
+
}, this.sort);
|
|
17765
|
+
options = _objectSpread(_objectSpread({}, this.searchOptions), {}, {
|
|
17766
|
+
limit: this.pageSize,
|
|
17767
|
+
offset: this.offset
|
|
17768
|
+
});
|
|
17769
|
+
_context2.next = 5;
|
|
17770
|
+
return this.client.queryUsers(filters, sort, options);
|
|
17771
|
+
|
|
17772
|
+
case 5:
|
|
17773
|
+
_yield$this$client$qu = _context2.sent;
|
|
17774
|
+
users = _yield$this$client$qu.users;
|
|
17775
|
+
return _context2.abrupt("return", {
|
|
17776
|
+
items: users
|
|
17777
|
+
});
|
|
17778
|
+
|
|
17779
|
+
case 8:
|
|
17780
|
+
case "end":
|
|
17781
|
+
return _context2.stop();
|
|
17782
|
+
}
|
|
17783
|
+
}
|
|
17784
|
+
}, _callee2, this);
|
|
17785
|
+
}));
|
|
17786
|
+
|
|
17787
|
+
function query(_x2) {
|
|
17788
|
+
return _query.apply(this, arguments);
|
|
17789
|
+
}
|
|
17790
|
+
|
|
17791
|
+
return query;
|
|
17792
|
+
}()
|
|
17793
|
+
}, {
|
|
17794
|
+
key: "filterQueryResults",
|
|
17795
|
+
value: function filterQueryResults(items) {
|
|
17796
|
+
var _this3 = this;
|
|
17797
|
+
|
|
17798
|
+
return items.filter(function (u) {
|
|
17799
|
+
var _this3$client$user;
|
|
17800
|
+
|
|
17801
|
+
return u.id !== ((_this3$client$user = _this3.client.user) === null || _this3$client$user === void 0 ? void 0 : _this3$client$user.id);
|
|
17802
|
+
});
|
|
17803
|
+
}
|
|
17804
|
+
}]);
|
|
17805
|
+
|
|
17806
|
+
return UserSearchSource;
|
|
17807
|
+
}(BaseSearchSource);
|
|
17808
|
+
var ChannelSearchSource = /*#__PURE__*/function (_BaseSearchSource2) {
|
|
17809
|
+
_inherits__default['default'](ChannelSearchSource, _BaseSearchSource2);
|
|
17810
|
+
|
|
17811
|
+
var _super2 = _createSuper(ChannelSearchSource);
|
|
17812
|
+
|
|
17813
|
+
function ChannelSearchSource(client, options) {
|
|
17814
|
+
var _this4;
|
|
17815
|
+
|
|
17816
|
+
_classCallCheck__default['default'](this, ChannelSearchSource);
|
|
17817
|
+
|
|
17818
|
+
_this4 = _super2.call(this, options);
|
|
17819
|
+
|
|
17820
|
+
_defineProperty__default['default'](_assertThisInitialized__default['default'](_this4), "type", 'channels');
|
|
17821
|
+
|
|
17822
|
+
_defineProperty__default['default'](_assertThisInitialized__default['default'](_this4), "client", void 0);
|
|
17823
|
+
|
|
17824
|
+
_defineProperty__default['default'](_assertThisInitialized__default['default'](_this4), "filters", void 0);
|
|
17825
|
+
|
|
17826
|
+
_defineProperty__default['default'](_assertThisInitialized__default['default'](_this4), "sort", void 0);
|
|
17827
|
+
|
|
17828
|
+
_defineProperty__default['default'](_assertThisInitialized__default['default'](_this4), "searchOptions", void 0);
|
|
17829
|
+
|
|
17830
|
+
_this4.client = client;
|
|
17831
|
+
return _this4;
|
|
17832
|
+
}
|
|
17833
|
+
|
|
17834
|
+
_createClass__default['default'](ChannelSearchSource, [{
|
|
17835
|
+
key: "query",
|
|
17836
|
+
value: function () {
|
|
17837
|
+
var _query2 = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee3(searchQuery) {
|
|
17838
|
+
var _this$sort;
|
|
17839
|
+
|
|
17840
|
+
var filters, sort, options, items;
|
|
17841
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee3$(_context3) {
|
|
17842
|
+
while (1) {
|
|
17843
|
+
switch (_context3.prev = _context3.next) {
|
|
17844
|
+
case 0:
|
|
17845
|
+
filters = _objectSpread({
|
|
17846
|
+
members: {
|
|
17847
|
+
$in: [this.client.userID]
|
|
17848
|
+
},
|
|
17849
|
+
name: {
|
|
17850
|
+
$autocomplete: searchQuery
|
|
17851
|
+
}
|
|
17852
|
+
}, this.filters);
|
|
17853
|
+
sort = (_this$sort = this.sort) !== null && _this$sort !== void 0 ? _this$sort : {};
|
|
17854
|
+
options = _objectSpread(_objectSpread({}, this.searchOptions), {}, {
|
|
17855
|
+
limit: this.pageSize,
|
|
17856
|
+
offset: this.offset
|
|
17857
|
+
});
|
|
17858
|
+
_context3.next = 5;
|
|
17859
|
+
return this.client.queryChannels(filters, sort, options);
|
|
17860
|
+
|
|
17861
|
+
case 5:
|
|
17862
|
+
items = _context3.sent;
|
|
17863
|
+
return _context3.abrupt("return", {
|
|
17864
|
+
items: items
|
|
17865
|
+
});
|
|
17866
|
+
|
|
17867
|
+
case 7:
|
|
17868
|
+
case "end":
|
|
17869
|
+
return _context3.stop();
|
|
17870
|
+
}
|
|
17871
|
+
}
|
|
17872
|
+
}, _callee3, this);
|
|
17873
|
+
}));
|
|
17874
|
+
|
|
17875
|
+
function query(_x3) {
|
|
17876
|
+
return _query2.apply(this, arguments);
|
|
17877
|
+
}
|
|
17878
|
+
|
|
17879
|
+
return query;
|
|
17880
|
+
}()
|
|
17881
|
+
}, {
|
|
17882
|
+
key: "filterQueryResults",
|
|
17883
|
+
value: function filterQueryResults(items) {
|
|
17884
|
+
return items;
|
|
17885
|
+
}
|
|
17886
|
+
}]);
|
|
17887
|
+
|
|
17888
|
+
return ChannelSearchSource;
|
|
17889
|
+
}(BaseSearchSource);
|
|
17890
|
+
var MessageSearchSource = /*#__PURE__*/function (_BaseSearchSource3) {
|
|
17891
|
+
_inherits__default['default'](MessageSearchSource, _BaseSearchSource3);
|
|
17892
|
+
|
|
17893
|
+
var _super3 = _createSuper(MessageSearchSource);
|
|
17894
|
+
|
|
17895
|
+
function MessageSearchSource(client, options) {
|
|
17896
|
+
var _this5;
|
|
17897
|
+
|
|
17898
|
+
_classCallCheck__default['default'](this, MessageSearchSource);
|
|
17899
|
+
|
|
17900
|
+
_this5 = _super3.call(this, options);
|
|
17901
|
+
|
|
17902
|
+
_defineProperty__default['default'](_assertThisInitialized__default['default'](_this5), "type", 'messages');
|
|
17903
|
+
|
|
17904
|
+
_defineProperty__default['default'](_assertThisInitialized__default['default'](_this5), "client", void 0);
|
|
17905
|
+
|
|
17906
|
+
_defineProperty__default['default'](_assertThisInitialized__default['default'](_this5), "messageSearchChannelFilters", void 0);
|
|
17907
|
+
|
|
17908
|
+
_defineProperty__default['default'](_assertThisInitialized__default['default'](_this5), "messageSearchFilters", void 0);
|
|
17909
|
+
|
|
17910
|
+
_defineProperty__default['default'](_assertThisInitialized__default['default'](_this5), "messageSearchSort", void 0);
|
|
17911
|
+
|
|
17912
|
+
_defineProperty__default['default'](_assertThisInitialized__default['default'](_this5), "channelQueryFilters", void 0);
|
|
17913
|
+
|
|
17914
|
+
_defineProperty__default['default'](_assertThisInitialized__default['default'](_this5), "channelQuerySort", void 0);
|
|
17915
|
+
|
|
17916
|
+
_defineProperty__default['default'](_assertThisInitialized__default['default'](_this5), "channelQueryOptions", void 0);
|
|
17917
|
+
|
|
17918
|
+
_this5.client = client;
|
|
17919
|
+
return _this5;
|
|
17920
|
+
}
|
|
17921
|
+
|
|
17922
|
+
_createClass__default['default'](MessageSearchSource, [{
|
|
17923
|
+
key: "query",
|
|
17924
|
+
value: function () {
|
|
17925
|
+
var _query3 = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee4(searchQuery) {
|
|
17926
|
+
var _this6 = this;
|
|
17927
|
+
|
|
17928
|
+
var channelFilters, messageFilters, sort, options, _yield$this$client$se, next, results, items, cids, allChannelsLoadedLocally;
|
|
17929
|
+
|
|
17930
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee4$(_context4) {
|
|
17931
|
+
while (1) {
|
|
17932
|
+
switch (_context4.prev = _context4.next) {
|
|
17933
|
+
case 0:
|
|
17934
|
+
if (this.client.userID) {
|
|
17935
|
+
_context4.next = 2;
|
|
17936
|
+
break;
|
|
17937
|
+
}
|
|
17938
|
+
|
|
17939
|
+
return _context4.abrupt("return", {
|
|
17940
|
+
items: []
|
|
17941
|
+
});
|
|
17942
|
+
|
|
17943
|
+
case 2:
|
|
17944
|
+
channelFilters = _objectSpread({
|
|
17945
|
+
members: {
|
|
17946
|
+
$in: [this.client.userID]
|
|
17947
|
+
}
|
|
17948
|
+
}, this.messageSearchChannelFilters);
|
|
17949
|
+
messageFilters = _objectSpread({
|
|
17950
|
+
text: searchQuery,
|
|
17951
|
+
type: 'regular'
|
|
17952
|
+
}, this.messageSearchFilters);
|
|
17953
|
+
sort = _objectSpread({
|
|
17954
|
+
created_at: -1
|
|
17955
|
+
}, this.messageSearchSort);
|
|
17956
|
+
options = {
|
|
17957
|
+
limit: this.pageSize,
|
|
17958
|
+
next: this.next,
|
|
17959
|
+
sort: sort
|
|
17960
|
+
};
|
|
17961
|
+
_context4.next = 8;
|
|
17962
|
+
return this.client.search(channelFilters, messageFilters, options);
|
|
17963
|
+
|
|
17964
|
+
case 8:
|
|
17965
|
+
_yield$this$client$se = _context4.sent;
|
|
17966
|
+
next = _yield$this$client$se.next;
|
|
17967
|
+
results = _yield$this$client$se.results;
|
|
17968
|
+
items = results.map(function (_ref3) {
|
|
17969
|
+
var message = _ref3.message;
|
|
17970
|
+
return message;
|
|
17971
|
+
});
|
|
17972
|
+
cids = Array.from(items.reduce(function (acc, message) {
|
|
17973
|
+
if (message.cid && !_this6.client.activeChannels[message.cid]) acc.add(message.cid);
|
|
17974
|
+
return acc;
|
|
17975
|
+
}, new Set()) // keep the cids unique
|
|
17976
|
+
);
|
|
17977
|
+
allChannelsLoadedLocally = cids.length === 0;
|
|
17978
|
+
|
|
17979
|
+
if (allChannelsLoadedLocally) {
|
|
17980
|
+
_context4.next = 17;
|
|
17981
|
+
break;
|
|
17982
|
+
}
|
|
17983
|
+
|
|
17984
|
+
_context4.next = 17;
|
|
17985
|
+
return this.client.queryChannels(_objectSpread({
|
|
17986
|
+
cid: {
|
|
17987
|
+
$in: cids
|
|
17988
|
+
}
|
|
17989
|
+
}, this.channelQueryFilters), _objectSpread({
|
|
17990
|
+
last_message_at: -1
|
|
17991
|
+
}, this.channelQuerySort), this.channelQueryOptions);
|
|
17992
|
+
|
|
17993
|
+
case 17:
|
|
17994
|
+
return _context4.abrupt("return", {
|
|
17995
|
+
items: items,
|
|
17996
|
+
next: next
|
|
17997
|
+
});
|
|
17998
|
+
|
|
17999
|
+
case 18:
|
|
18000
|
+
case "end":
|
|
18001
|
+
return _context4.stop();
|
|
18002
|
+
}
|
|
18003
|
+
}
|
|
18004
|
+
}, _callee4, this);
|
|
18005
|
+
}));
|
|
18006
|
+
|
|
18007
|
+
function query(_x4) {
|
|
18008
|
+
return _query3.apply(this, arguments);
|
|
18009
|
+
}
|
|
18010
|
+
|
|
18011
|
+
return query;
|
|
18012
|
+
}()
|
|
18013
|
+
}, {
|
|
18014
|
+
key: "filterQueryResults",
|
|
18015
|
+
value: function filterQueryResults(items) {
|
|
18016
|
+
return items;
|
|
18017
|
+
}
|
|
18018
|
+
}]);
|
|
18019
|
+
|
|
18020
|
+
return MessageSearchSource;
|
|
18021
|
+
}(BaseSearchSource);
|
|
18022
|
+
var SearchController = /*#__PURE__*/function () {
|
|
18023
|
+
/**
|
|
18024
|
+
* Not intended for direct use by integrators, might be removed without notice resulting in
|
|
18025
|
+
* broken integrations.
|
|
18026
|
+
*/
|
|
18027
|
+
function SearchController() {
|
|
18028
|
+
var _this7 = this;
|
|
18029
|
+
|
|
18030
|
+
var _ref4 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
|
18031
|
+
config = _ref4.config,
|
|
18032
|
+
sources = _ref4.sources;
|
|
18033
|
+
|
|
18034
|
+
_classCallCheck__default['default'](this, SearchController);
|
|
18035
|
+
|
|
18036
|
+
_defineProperty__default['default'](this, "_internalState", void 0);
|
|
18037
|
+
|
|
18038
|
+
_defineProperty__default['default'](this, "state", void 0);
|
|
18039
|
+
|
|
18040
|
+
_defineProperty__default['default'](this, "config", void 0);
|
|
18041
|
+
|
|
18042
|
+
_defineProperty__default['default'](this, "addSource", function (source) {
|
|
18043
|
+
_this7.state.partialNext({
|
|
18044
|
+
sources: [].concat(_toConsumableArray__default['default'](_this7.sources), [source])
|
|
18045
|
+
});
|
|
18046
|
+
});
|
|
18047
|
+
|
|
18048
|
+
_defineProperty__default['default'](this, "getSource", function (sourceType) {
|
|
18049
|
+
return _this7.sources.find(function (s) {
|
|
18050
|
+
return s.type === sourceType;
|
|
18051
|
+
});
|
|
18052
|
+
});
|
|
18053
|
+
|
|
18054
|
+
_defineProperty__default['default'](this, "removeSource", function (sourceType) {
|
|
18055
|
+
var newSources = _this7.sources.filter(function (s) {
|
|
18056
|
+
return s.type !== sourceType;
|
|
18057
|
+
});
|
|
18058
|
+
|
|
18059
|
+
if (newSources.length === _this7.sources.length) return;
|
|
18060
|
+
|
|
18061
|
+
_this7.state.partialNext({
|
|
18062
|
+
sources: newSources
|
|
18063
|
+
});
|
|
18064
|
+
});
|
|
18065
|
+
|
|
18066
|
+
_defineProperty__default['default'](this, "activateSource", function (sourceType) {
|
|
18067
|
+
var source = _this7.getSource(sourceType);
|
|
18068
|
+
|
|
18069
|
+
if (!source || source.isActive) return;
|
|
18070
|
+
|
|
18071
|
+
if (_this7.config.keepSingleActiveSource) {
|
|
18072
|
+
_this7.sources.forEach(function (s) {
|
|
18073
|
+
if (s.type !== sourceType) {
|
|
18074
|
+
s.deactivate();
|
|
18075
|
+
}
|
|
18076
|
+
});
|
|
18077
|
+
}
|
|
18078
|
+
|
|
18079
|
+
source.activate();
|
|
18080
|
+
|
|
18081
|
+
_this7.state.partialNext({
|
|
18082
|
+
sources: _toConsumableArray__default['default'](_this7.sources)
|
|
18083
|
+
});
|
|
18084
|
+
});
|
|
18085
|
+
|
|
18086
|
+
_defineProperty__default['default'](this, "deactivateSource", function (sourceType) {
|
|
18087
|
+
var source = _this7.getSource(sourceType);
|
|
18088
|
+
|
|
18089
|
+
if (!(source !== null && source !== void 0 && source.isActive)) return;
|
|
18090
|
+
if (_this7.activeSources.length === 1) return;
|
|
18091
|
+
source.deactivate();
|
|
18092
|
+
|
|
18093
|
+
_this7.state.partialNext({
|
|
18094
|
+
sources: _toConsumableArray__default['default'](_this7.sources)
|
|
18095
|
+
});
|
|
18096
|
+
});
|
|
18097
|
+
|
|
18098
|
+
_defineProperty__default['default'](this, "activate", function () {
|
|
18099
|
+
if (!_this7.activeSources.length) {
|
|
18100
|
+
var sourcesToActivate = _this7.config.keepSingleActiveSource ? _this7.sources.slice(0, 1) : _this7.sources;
|
|
18101
|
+
sourcesToActivate.forEach(function (s) {
|
|
18102
|
+
return s.activate();
|
|
18103
|
+
});
|
|
18104
|
+
}
|
|
18105
|
+
|
|
18106
|
+
if (_this7.isActive) return;
|
|
18107
|
+
|
|
18108
|
+
_this7.state.partialNext({
|
|
18109
|
+
isActive: true
|
|
18110
|
+
});
|
|
18111
|
+
});
|
|
18112
|
+
|
|
18113
|
+
_defineProperty__default['default'](this, "search", /*#__PURE__*/function () {
|
|
18114
|
+
var _ref5 = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee5(searchQuery) {
|
|
18115
|
+
var searchedSources;
|
|
18116
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee5$(_context5) {
|
|
18117
|
+
while (1) {
|
|
18118
|
+
switch (_context5.prev = _context5.next) {
|
|
18119
|
+
case 0:
|
|
18120
|
+
searchedSources = _this7.activeSources;
|
|
18121
|
+
|
|
18122
|
+
_this7.state.partialNext({
|
|
18123
|
+
searchQuery: searchQuery
|
|
18124
|
+
});
|
|
18125
|
+
|
|
18126
|
+
_context5.next = 4;
|
|
18127
|
+
return Promise.all(searchedSources.map(function (source) {
|
|
18128
|
+
return source.search(searchQuery);
|
|
18129
|
+
}));
|
|
18130
|
+
|
|
18131
|
+
case 4:
|
|
18132
|
+
case "end":
|
|
18133
|
+
return _context5.stop();
|
|
18134
|
+
}
|
|
18135
|
+
}
|
|
18136
|
+
}, _callee5);
|
|
18137
|
+
}));
|
|
18138
|
+
|
|
18139
|
+
return function (_x5) {
|
|
18140
|
+
return _ref5.apply(this, arguments);
|
|
18141
|
+
};
|
|
18142
|
+
}());
|
|
18143
|
+
|
|
18144
|
+
_defineProperty__default['default'](this, "cancelSearchQueries", function () {
|
|
18145
|
+
_this7.activeSources.forEach(function (s) {
|
|
18146
|
+
return s.searchDebounced.cancel();
|
|
18147
|
+
});
|
|
18148
|
+
});
|
|
18149
|
+
|
|
18150
|
+
_defineProperty__default['default'](this, "clear", function () {
|
|
18151
|
+
_this7.cancelSearchQueries();
|
|
18152
|
+
|
|
18153
|
+
_this7.sources.forEach(function (source) {
|
|
18154
|
+
return source.state.next(_objectSpread(_objectSpread({}, source.initialState), {}, {
|
|
18155
|
+
isActive: source.isActive
|
|
18156
|
+
}));
|
|
18157
|
+
});
|
|
18158
|
+
|
|
18159
|
+
_this7.state.next(function (current) {
|
|
18160
|
+
return _objectSpread(_objectSpread({}, current), {}, {
|
|
18161
|
+
isActive: true,
|
|
18162
|
+
queriesInProgress: [],
|
|
18163
|
+
searchQuery: ''
|
|
18164
|
+
});
|
|
18165
|
+
});
|
|
18166
|
+
});
|
|
18167
|
+
|
|
18168
|
+
_defineProperty__default['default'](this, "exit", function () {
|
|
18169
|
+
_this7.cancelSearchQueries();
|
|
18170
|
+
|
|
18171
|
+
_this7.sources.forEach(function (source) {
|
|
18172
|
+
return source.state.next(_objectSpread(_objectSpread({}, source.initialState), {}, {
|
|
18173
|
+
isActive: source.isActive
|
|
18174
|
+
}));
|
|
18175
|
+
});
|
|
18176
|
+
|
|
18177
|
+
_this7.state.next(function (current) {
|
|
18178
|
+
return _objectSpread(_objectSpread({}, current), {}, {
|
|
18179
|
+
isActive: false,
|
|
18180
|
+
queriesInProgress: [],
|
|
18181
|
+
searchQuery: ''
|
|
18182
|
+
});
|
|
18183
|
+
});
|
|
18184
|
+
});
|
|
18185
|
+
|
|
18186
|
+
this.state = new StateStore({
|
|
18187
|
+
isActive: false,
|
|
18188
|
+
searchQuery: '',
|
|
18189
|
+
sources: sources !== null && sources !== void 0 ? sources : []
|
|
18190
|
+
});
|
|
18191
|
+
this._internalState = new StateStore({});
|
|
18192
|
+
this.config = _objectSpread({
|
|
18193
|
+
keepSingleActiveSource: true
|
|
18194
|
+
}, config);
|
|
18195
|
+
}
|
|
18196
|
+
|
|
18197
|
+
_createClass__default['default'](SearchController, [{
|
|
18198
|
+
key: "hasNext",
|
|
18199
|
+
get: function get() {
|
|
18200
|
+
return this.sources.some(function (source) {
|
|
18201
|
+
return source.hasNext;
|
|
18202
|
+
});
|
|
18203
|
+
}
|
|
18204
|
+
}, {
|
|
18205
|
+
key: "sources",
|
|
18206
|
+
get: function get() {
|
|
18207
|
+
return this.state.getLatestValue().sources;
|
|
18208
|
+
}
|
|
18209
|
+
}, {
|
|
18210
|
+
key: "activeSources",
|
|
18211
|
+
get: function get() {
|
|
18212
|
+
return this.state.getLatestValue().sources.filter(function (s) {
|
|
18213
|
+
return s.isActive;
|
|
18214
|
+
});
|
|
18215
|
+
}
|
|
18216
|
+
}, {
|
|
18217
|
+
key: "isActive",
|
|
18218
|
+
get: function get() {
|
|
18219
|
+
return this.state.getLatestValue().isActive;
|
|
18220
|
+
}
|
|
18221
|
+
}, {
|
|
18222
|
+
key: "searchQuery",
|
|
18223
|
+
get: function get() {
|
|
18224
|
+
return this.state.getLatestValue().searchQuery;
|
|
18225
|
+
}
|
|
18226
|
+
}, {
|
|
18227
|
+
key: "searchSourceTypes",
|
|
18228
|
+
get: function get() {
|
|
18229
|
+
return this.sources.map(function (s) {
|
|
18230
|
+
return s.type;
|
|
18231
|
+
});
|
|
18232
|
+
}
|
|
18233
|
+
}]);
|
|
18234
|
+
|
|
18235
|
+
return SearchController;
|
|
18236
|
+
}();
|
|
18237
|
+
|
|
17421
18238
|
exports.Allow = Allow;
|
|
17422
18239
|
exports.AllowAll = AllowAll;
|
|
17423
18240
|
exports.AnyResource = AnyResource;
|
|
17424
18241
|
exports.AnyRole = AnyRole;
|
|
18242
|
+
exports.BaseSearchSource = BaseSearchSource;
|
|
17425
18243
|
exports.BuiltinPermissions = BuiltinPermissions;
|
|
17426
18244
|
exports.BuiltinRoles = BuiltinRoles;
|
|
17427
18245
|
exports.Campaign = Campaign;
|
|
17428
18246
|
exports.Channel = Channel;
|
|
18247
|
+
exports.ChannelSearchSource = ChannelSearchSource;
|
|
17429
18248
|
exports.ChannelState = ChannelState;
|
|
17430
18249
|
exports.CheckSignature = CheckSignature;
|
|
17431
18250
|
exports.ClientState = ClientState;
|
|
@@ -17439,11 +18258,13 @@ exports.JWTServerToken = JWTServerToken;
|
|
|
17439
18258
|
exports.JWTUserToken = JWTUserToken;
|
|
17440
18259
|
exports.MODERATION_ENTITY_TYPES = MODERATION_ENTITY_TYPES;
|
|
17441
18260
|
exports.MaxPriority = MaxPriority;
|
|
18261
|
+
exports.MessageSearchSource = MessageSearchSource;
|
|
17442
18262
|
exports.MinPriority = MinPriority;
|
|
17443
18263
|
exports.Moderation = Moderation;
|
|
17444
18264
|
exports.Permission = Permission;
|
|
17445
18265
|
exports.Poll = Poll;
|
|
17446
18266
|
exports.PollManager = PollManager;
|
|
18267
|
+
exports.SearchController = SearchController;
|
|
17447
18268
|
exports.Segment = Segment;
|
|
17448
18269
|
exports.StableWSConnection = StableWSConnection;
|
|
17449
18270
|
exports.StateStore = StateStore;
|
|
@@ -17453,6 +18274,7 @@ exports.Thread = Thread;
|
|
|
17453
18274
|
exports.ThreadManager = ThreadManager;
|
|
17454
18275
|
exports.TokenManager = TokenManager;
|
|
17455
18276
|
exports.UserFromToken = UserFromToken;
|
|
18277
|
+
exports.UserSearchSource = UserSearchSource;
|
|
17456
18278
|
exports.buildWsFatalInsight = buildWsFatalInsight;
|
|
17457
18279
|
exports.buildWsSuccessAfterFailureInsight = buildWsSuccessAfterFailureInsight;
|
|
17458
18280
|
exports.chatCodes = chatCodes;
|