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/browser.js
CHANGED
|
@@ -324,9 +324,9 @@ var Campaign = /*#__PURE__*/function () {
|
|
|
324
324
|
|
|
325
325
|
var https = null;
|
|
326
326
|
|
|
327
|
-
function ownKeys$
|
|
327
|
+
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; }
|
|
328
328
|
|
|
329
|
-
function _objectSpread$
|
|
329
|
+
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; }
|
|
330
330
|
|
|
331
331
|
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; } } }; }
|
|
332
332
|
|
|
@@ -588,7 +588,7 @@ var axiosParamsSerializer = function axiosParamsSerializer(params) {
|
|
|
588
588
|
*/
|
|
589
589
|
|
|
590
590
|
function formatMessage(message) {
|
|
591
|
-
return _objectSpread$
|
|
591
|
+
return _objectSpread$d(_objectSpread$d({}, message), {}, {
|
|
592
592
|
/**
|
|
593
593
|
* @deprecated please use `html`
|
|
594
594
|
*/
|
|
@@ -731,25 +731,86 @@ function maybeGetReactionGroupsFallback(groups, counts, scores) {
|
|
|
731
731
|
}
|
|
732
732
|
|
|
733
733
|
return null;
|
|
734
|
-
} //
|
|
734
|
+
} // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
735
735
|
|
|
736
736
|
|
|
737
|
-
|
|
738
|
-
|
|
737
|
+
// works exactly the same as lodash.debounce
|
|
738
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
739
|
+
var debounce = function debounce(fn) {
|
|
740
|
+
var timeout = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
739
741
|
|
|
740
742
|
var _ref2 = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {},
|
|
741
743
|
_ref2$leading = _ref2.leading,
|
|
742
|
-
leading = _ref2$leading === void 0 ?
|
|
744
|
+
leading = _ref2$leading === void 0 ? false : _ref2$leading,
|
|
743
745
|
_ref2$trailing = _ref2.trailing,
|
|
744
|
-
trailing = _ref2$trailing === void 0 ?
|
|
746
|
+
trailing = _ref2$trailing === void 0 ? true : _ref2$trailing;
|
|
745
747
|
|
|
746
748
|
var runningTimeout = null;
|
|
747
|
-
var
|
|
748
|
-
|
|
749
|
+
var argsForTrailingExecution = null;
|
|
750
|
+
var lastResult;
|
|
751
|
+
|
|
752
|
+
var debouncedFn = function debouncedFn() {
|
|
749
753
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
750
754
|
args[_key] = arguments[_key];
|
|
751
755
|
}
|
|
752
756
|
|
|
757
|
+
if (runningTimeout) {
|
|
758
|
+
clearTimeout(runningTimeout);
|
|
759
|
+
} else if (leading) {
|
|
760
|
+
lastResult = fn.apply(void 0, args);
|
|
761
|
+
}
|
|
762
|
+
|
|
763
|
+
if (trailing) argsForTrailingExecution = args;
|
|
764
|
+
|
|
765
|
+
var timeoutHandler = function timeoutHandler() {
|
|
766
|
+
if (argsForTrailingExecution) {
|
|
767
|
+
lastResult = fn.apply(void 0, _toConsumableArray__default['default'](argsForTrailingExecution));
|
|
768
|
+
argsForTrailingExecution = null;
|
|
769
|
+
}
|
|
770
|
+
|
|
771
|
+
runningTimeout = null;
|
|
772
|
+
};
|
|
773
|
+
|
|
774
|
+
runningTimeout = setTimeout(timeoutHandler, timeout);
|
|
775
|
+
return lastResult;
|
|
776
|
+
};
|
|
777
|
+
|
|
778
|
+
debouncedFn.cancel = function () {
|
|
779
|
+
if (runningTimeout) clearTimeout(runningTimeout);
|
|
780
|
+
};
|
|
781
|
+
|
|
782
|
+
debouncedFn.flush = function () {
|
|
783
|
+
if (runningTimeout) {
|
|
784
|
+
clearTimeout(runningTimeout);
|
|
785
|
+
runningTimeout = null;
|
|
786
|
+
|
|
787
|
+
if (argsForTrailingExecution) {
|
|
788
|
+
lastResult = fn.apply(void 0, _toConsumableArray__default['default'](argsForTrailingExecution));
|
|
789
|
+
}
|
|
790
|
+
}
|
|
791
|
+
|
|
792
|
+
return lastResult;
|
|
793
|
+
};
|
|
794
|
+
|
|
795
|
+
return debouncedFn;
|
|
796
|
+
}; // works exactly the same as lodash.throttle
|
|
797
|
+
|
|
798
|
+
var throttle = function throttle(fn) {
|
|
799
|
+
var timeout = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 200;
|
|
800
|
+
|
|
801
|
+
var _ref3 = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {},
|
|
802
|
+
_ref3$leading = _ref3.leading,
|
|
803
|
+
leading = _ref3$leading === void 0 ? true : _ref3$leading,
|
|
804
|
+
_ref3$trailing = _ref3.trailing,
|
|
805
|
+
trailing = _ref3$trailing === void 0 ? false : _ref3$trailing;
|
|
806
|
+
|
|
807
|
+
var runningTimeout = null;
|
|
808
|
+
var storedArgs = null;
|
|
809
|
+
return function () {
|
|
810
|
+
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
811
|
+
args[_key2] = arguments[_key2];
|
|
812
|
+
}
|
|
813
|
+
|
|
753
814
|
if (runningTimeout) {
|
|
754
815
|
if (trailing) storedArgs = args;
|
|
755
816
|
return;
|
|
@@ -798,13 +859,13 @@ function binarySearchByDateEqualOrNearestGreater(array, targetDate) {
|
|
|
798
859
|
return left;
|
|
799
860
|
}
|
|
800
861
|
|
|
801
|
-
var messagePaginationCreatedAtAround = function messagePaginationCreatedAtAround(
|
|
802
|
-
var parentSet =
|
|
803
|
-
requestedPageSize =
|
|
804
|
-
returnedPage =
|
|
805
|
-
messagePaginationOptions =
|
|
862
|
+
var messagePaginationCreatedAtAround = function messagePaginationCreatedAtAround(_ref4) {
|
|
863
|
+
var parentSet = _ref4.parentSet,
|
|
864
|
+
requestedPageSize = _ref4.requestedPageSize,
|
|
865
|
+
returnedPage = _ref4.returnedPage,
|
|
866
|
+
messagePaginationOptions = _ref4.messagePaginationOptions;
|
|
806
867
|
|
|
807
|
-
var newPagination = _objectSpread$
|
|
868
|
+
var newPagination = _objectSpread$d({}, parentSet.pagination);
|
|
808
869
|
|
|
809
870
|
if (!(messagePaginationOptions !== null && messagePaginationOptions !== void 0 && messagePaginationOptions.created_at_around)) return newPagination;
|
|
810
871
|
var hasPrev;
|
|
@@ -812,9 +873,9 @@ var messagePaginationCreatedAtAround = function messagePaginationCreatedAtAround
|
|
|
812
873
|
var updateHasPrev;
|
|
813
874
|
var updateHasNext;
|
|
814
875
|
var createdAtAroundDate = new Date(messagePaginationOptions.created_at_around);
|
|
815
|
-
var
|
|
816
|
-
firstPageMsg =
|
|
817
|
-
lastPageMsg =
|
|
876
|
+
var _ref5 = [returnedPage[0], returnedPage.slice(-1)[0]],
|
|
877
|
+
firstPageMsg = _ref5[0],
|
|
878
|
+
lastPageMsg = _ref5[1]; // expect ASC order (from oldest to newest)
|
|
818
879
|
|
|
819
880
|
var wholePageHasNewerMessages = !!(firstPageMsg !== null && firstPageMsg !== void 0 && firstPageMsg.created_at) && new Date(firstPageMsg.created_at) > createdAtAroundDate;
|
|
820
881
|
var wholePageHasOlderMessages = !!(lastPageMsg !== null && lastPageMsg !== void 0 && lastPageMsg.created_at) && new Date(lastPageMsg.created_at) < createdAtAroundDate;
|
|
@@ -861,25 +922,25 @@ var messagePaginationCreatedAtAround = function messagePaginationCreatedAtAround
|
|
|
861
922
|
return newPagination;
|
|
862
923
|
};
|
|
863
924
|
|
|
864
|
-
var messagePaginationIdAround = function messagePaginationIdAround(
|
|
925
|
+
var messagePaginationIdAround = function messagePaginationIdAround(_ref6) {
|
|
865
926
|
var _parentSet$messages$2, _parentSet$messages$s2;
|
|
866
927
|
|
|
867
|
-
var parentSet =
|
|
868
|
-
requestedPageSize =
|
|
869
|
-
returnedPage =
|
|
870
|
-
messagePaginationOptions =
|
|
928
|
+
var parentSet = _ref6.parentSet,
|
|
929
|
+
requestedPageSize = _ref6.requestedPageSize,
|
|
930
|
+
returnedPage = _ref6.returnedPage,
|
|
931
|
+
messagePaginationOptions = _ref6.messagePaginationOptions;
|
|
871
932
|
|
|
872
|
-
var newPagination = _objectSpread$
|
|
933
|
+
var newPagination = _objectSpread$d({}, parentSet.pagination);
|
|
873
934
|
|
|
874
|
-
var
|
|
875
|
-
id_around =
|
|
935
|
+
var _ref7 = messagePaginationOptions || {},
|
|
936
|
+
id_around = _ref7.id_around;
|
|
876
937
|
|
|
877
938
|
if (!id_around) return newPagination;
|
|
878
939
|
var hasPrev;
|
|
879
940
|
var hasNext;
|
|
880
|
-
var
|
|
881
|
-
firstPageMsg =
|
|
882
|
-
lastPageMsg =
|
|
941
|
+
var _ref8 = [returnedPage[0], returnedPage.slice(-1)[0]],
|
|
942
|
+
firstPageMsg = _ref8[0],
|
|
943
|
+
lastPageMsg = _ref8[1];
|
|
883
944
|
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),
|
|
884
945
|
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);
|
|
885
946
|
var updateHasPrev = firstPageMsgIsFirstInSet;
|
|
@@ -919,21 +980,21 @@ var messagePaginationIdAround = function messagePaginationIdAround(_ref5) {
|
|
|
919
980
|
return newPagination;
|
|
920
981
|
};
|
|
921
982
|
|
|
922
|
-
var messagePaginationLinear = function messagePaginationLinear(
|
|
983
|
+
var messagePaginationLinear = function messagePaginationLinear(_ref9) {
|
|
923
984
|
var _parentSet$messages$3, _parentSet$messages$s3;
|
|
924
985
|
|
|
925
|
-
var parentSet =
|
|
926
|
-
requestedPageSize =
|
|
927
|
-
returnedPage =
|
|
928
|
-
messagePaginationOptions =
|
|
986
|
+
var parentSet = _ref9.parentSet,
|
|
987
|
+
requestedPageSize = _ref9.requestedPageSize,
|
|
988
|
+
returnedPage = _ref9.returnedPage,
|
|
989
|
+
messagePaginationOptions = _ref9.messagePaginationOptions;
|
|
929
990
|
|
|
930
|
-
var newPagination = _objectSpread$
|
|
991
|
+
var newPagination = _objectSpread$d({}, parentSet.pagination);
|
|
931
992
|
|
|
932
993
|
var hasPrev;
|
|
933
994
|
var hasNext;
|
|
934
|
-
var
|
|
935
|
-
firstPageMsg =
|
|
936
|
-
lastPageMsg =
|
|
995
|
+
var _ref10 = [returnedPage[0], returnedPage.slice(-1)[0]],
|
|
996
|
+
firstPageMsg = _ref10[0],
|
|
997
|
+
lastPageMsg = _ref10[1];
|
|
937
998
|
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),
|
|
938
999
|
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);
|
|
939
1000
|
var queriedNextMessages = messagePaginationOptions && (messagePaginationOptions.created_at_after_or_equal || messagePaginationOptions.created_at_after || messagePaginationOptions.id_gt || messagePaginationOptions.id_gte);
|
|
@@ -981,9 +1042,9 @@ var DEFAULT_MESSAGE_SET_PAGINATION = {
|
|
|
981
1042
|
hasPrev: false
|
|
982
1043
|
};
|
|
983
1044
|
|
|
984
|
-
function ownKeys$
|
|
1045
|
+
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; }
|
|
985
1046
|
|
|
986
|
-
function _objectSpread$
|
|
1047
|
+
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; }
|
|
987
1048
|
|
|
988
1049
|
/**
|
|
989
1050
|
* ChannelState - A container class for the channel state.
|
|
@@ -1064,7 +1125,7 @@ var ChannelState = /*#__PURE__*/function () {
|
|
|
1064
1125
|
var m = messages[i];
|
|
1065
1126
|
|
|
1066
1127
|
if (((_m$user = m.user) === null || _m$user === void 0 ? void 0 : _m$user.id) === user.id) {
|
|
1067
|
-
messages[i] = _objectSpread$
|
|
1128
|
+
messages[i] = _objectSpread$c(_objectSpread$c({}, m), {}, {
|
|
1068
1129
|
user: user
|
|
1069
1130
|
});
|
|
1070
1131
|
}
|
|
@@ -1119,7 +1180,7 @@ var ChannelState = /*#__PURE__*/function () {
|
|
|
1119
1180
|
user: m.user
|
|
1120
1181
|
};
|
|
1121
1182
|
} else {
|
|
1122
|
-
messages[i] = _objectSpread$
|
|
1183
|
+
messages[i] = _objectSpread$c(_objectSpread$c({}, m), {}, {
|
|
1123
1184
|
type: 'deleted',
|
|
1124
1185
|
deleted_at: user.deleted_at ? new Date(user.deleted_at) : null
|
|
1125
1186
|
});
|
|
@@ -1437,7 +1498,7 @@ var ChannelState = /*#__PURE__*/function () {
|
|
|
1437
1498
|
var parseMessage = function parseMessage(m) {
|
|
1438
1499
|
var _m$pinned_at, _m$updated_at;
|
|
1439
1500
|
|
|
1440
|
-
return _objectSpread$
|
|
1501
|
+
return _objectSpread$c(_objectSpread$c({}, m), {}, {
|
|
1441
1502
|
created_at: m.created_at.toISOString(),
|
|
1442
1503
|
pinned_at: (_m$pinned_at = m.pinned_at) === null || _m$pinned_at === void 0 ? void 0 : _m$pinned_at.toISOString(),
|
|
1443
1504
|
updated_at: (_m$updated_at = m.updated_at) === null || _m$updated_at === void 0 ? void 0 : _m$updated_at.toISOString()
|
|
@@ -1447,8 +1508,8 @@ var ChannelState = /*#__PURE__*/function () {
|
|
|
1447
1508
|
var update = function update(messages) {
|
|
1448
1509
|
var updatedMessages = messages.reduce(function (acc, msg) {
|
|
1449
1510
|
if (msg.quoted_message_id === message.id) {
|
|
1450
|
-
acc.push(_objectSpread$
|
|
1451
|
-
quoted_message: remove ? _objectSpread$
|
|
1511
|
+
acc.push(_objectSpread$c(_objectSpread$c({}, parseMessage(msg)), {}, {
|
|
1512
|
+
quoted_message: remove ? _objectSpread$c(_objectSpread$c({}, message), {}, {
|
|
1452
1513
|
attachments: []
|
|
1453
1514
|
}) : message
|
|
1454
1515
|
}));
|
|
@@ -1937,9 +1998,9 @@ function _unsupportedIterableToArray$4(o, minLen) { if (!o) return; if (typeof o
|
|
|
1937
1998
|
|
|
1938
1999
|
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; }
|
|
1939
2000
|
|
|
1940
|
-
function ownKeys$
|
|
2001
|
+
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; }
|
|
1941
2002
|
|
|
1942
|
-
function _objectSpread$
|
|
2003
|
+
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; }
|
|
1943
2004
|
/**
|
|
1944
2005
|
* Channel - The Channel class manages it's own state.
|
|
1945
2006
|
*/
|
|
@@ -2014,7 +2075,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2014
2075
|
while (1) {
|
|
2015
2076
|
switch (_context.prev = _context.next) {
|
|
2016
2077
|
case 0:
|
|
2017
|
-
defaultOptions = _objectSpread$
|
|
2078
|
+
defaultOptions = _objectSpread$b(_objectSpread$b({}, options), {}, {
|
|
2018
2079
|
watch: false,
|
|
2019
2080
|
state: false,
|
|
2020
2081
|
presence: false
|
|
@@ -2086,7 +2147,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2086
2147
|
|
|
2087
2148
|
this.data = data; // this._data is used for the requests...
|
|
2088
2149
|
|
|
2089
|
-
this._data = _objectSpread$
|
|
2150
|
+
this._data = _objectSpread$b({}, data);
|
|
2090
2151
|
this.cid = "".concat(type, ":").concat(id);
|
|
2091
2152
|
this.listeners = {}; // perhaps the state variable should be private
|
|
2092
2153
|
|
|
@@ -2148,7 +2209,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2148
2209
|
switch (_context2.prev = _context2.next) {
|
|
2149
2210
|
case 0:
|
|
2150
2211
|
_context2.next = 2;
|
|
2151
|
-
return this.getClient().post(this._channelURL() + '/message', _objectSpread$
|
|
2212
|
+
return this.getClient().post(this._channelURL() + '/message', _objectSpread$b({
|
|
2152
2213
|
message: message
|
|
2153
2214
|
}, options));
|
|
2154
2215
|
|
|
@@ -2264,7 +2325,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2264
2325
|
|
|
2265
2326
|
case 3:
|
|
2266
2327
|
// Return a list of channels
|
|
2267
|
-
payload = _objectSpread$
|
|
2328
|
+
payload = _objectSpread$b(_objectSpread$b({
|
|
2268
2329
|
filter_conditions: {
|
|
2269
2330
|
cid: this.cid
|
|
2270
2331
|
}
|
|
@@ -2361,7 +2422,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2361
2422
|
|
|
2362
2423
|
_context5.next = 6;
|
|
2363
2424
|
return this.getClient().get(this.getClient().baseURL + '/members', {
|
|
2364
|
-
payload: _objectSpread$
|
|
2425
|
+
payload: _objectSpread$b({
|
|
2365
2426
|
type: type,
|
|
2366
2427
|
id: id,
|
|
2367
2428
|
members: members,
|
|
@@ -2467,7 +2528,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2467
2528
|
|
|
2468
2529
|
case 4:
|
|
2469
2530
|
_context7.next = 6;
|
|
2470
|
-
return this.getClient().post(this.getClient().baseURL + "/messages/".concat(encodeURIComponent(messageID), "/reaction"), _objectSpread$
|
|
2531
|
+
return this.getClient().post(this.getClient().baseURL + "/messages/".concat(encodeURIComponent(messageID), "/reaction"), _objectSpread$b({
|
|
2471
2532
|
reaction: reaction
|
|
2472
2533
|
}, options));
|
|
2473
2534
|
|
|
@@ -2548,7 +2609,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2548
2609
|
delete channelData[key];
|
|
2549
2610
|
});
|
|
2550
2611
|
_context8.next = 7;
|
|
2551
|
-
return this._update(_objectSpread$
|
|
2612
|
+
return this._update(_objectSpread$b({
|
|
2552
2613
|
message: updateMessage,
|
|
2553
2614
|
data: channelData
|
|
2554
2615
|
}, options));
|
|
@@ -2720,7 +2781,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2720
2781
|
case 0:
|
|
2721
2782
|
options = _args12.length > 0 && _args12[0] !== undefined ? _args12[0] : {};
|
|
2722
2783
|
_context12.next = 3;
|
|
2723
|
-
return this.getClient().delete(this._channelURL(), _objectSpread$
|
|
2784
|
+
return this.getClient().delete(this._channelURL(), _objectSpread$b({}, options));
|
|
2724
2785
|
|
|
2725
2786
|
case 3:
|
|
2726
2787
|
return _context12.abrupt("return", _context12.sent);
|
|
@@ -2796,7 +2857,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2796
2857
|
case 0:
|
|
2797
2858
|
options = _args14.length > 0 && _args14[0] !== undefined ? _args14[0] : {};
|
|
2798
2859
|
_context14.next = 3;
|
|
2799
|
-
return this._update(_objectSpread$
|
|
2860
|
+
return this._update(_objectSpread$b({
|
|
2800
2861
|
accept_invite: true
|
|
2801
2862
|
}, options));
|
|
2802
2863
|
|
|
@@ -2837,7 +2898,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2837
2898
|
case 0:
|
|
2838
2899
|
options = _args15.length > 0 && _args15[0] !== undefined ? _args15[0] : {};
|
|
2839
2900
|
_context15.next = 3;
|
|
2840
|
-
return this._update(_objectSpread$
|
|
2901
|
+
return this._update(_objectSpread$b({
|
|
2841
2902
|
reject_invite: true
|
|
2842
2903
|
}, options));
|
|
2843
2904
|
|
|
@@ -2879,7 +2940,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2879
2940
|
case 0:
|
|
2880
2941
|
options = _args16.length > 2 && _args16[2] !== undefined ? _args16[2] : {};
|
|
2881
2942
|
_context16.next = 3;
|
|
2882
|
-
return this._update(_objectSpread$
|
|
2943
|
+
return this._update(_objectSpread$b({
|
|
2883
2944
|
add_members: members,
|
|
2884
2945
|
message: message
|
|
2885
2946
|
}, options));
|
|
@@ -2922,7 +2983,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2922
2983
|
case 0:
|
|
2923
2984
|
options = _args17.length > 2 && _args17[2] !== undefined ? _args17[2] : {};
|
|
2924
2985
|
_context17.next = 3;
|
|
2925
|
-
return this._update(_objectSpread$
|
|
2986
|
+
return this._update(_objectSpread$b({
|
|
2926
2987
|
add_moderators: members,
|
|
2927
2988
|
message: message
|
|
2928
2989
|
}, options));
|
|
@@ -2965,7 +3026,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2965
3026
|
case 0:
|
|
2966
3027
|
options = _args18.length > 2 && _args18[2] !== undefined ? _args18[2] : {};
|
|
2967
3028
|
_context18.next = 3;
|
|
2968
|
-
return this._update(_objectSpread$
|
|
3029
|
+
return this._update(_objectSpread$b({
|
|
2969
3030
|
assign_roles: roles,
|
|
2970
3031
|
message: message
|
|
2971
3032
|
}, options));
|
|
@@ -3008,7 +3069,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
3008
3069
|
case 0:
|
|
3009
3070
|
options = _args19.length > 2 && _args19[2] !== undefined ? _args19[2] : {};
|
|
3010
3071
|
_context19.next = 3;
|
|
3011
|
-
return this._update(_objectSpread$
|
|
3072
|
+
return this._update(_objectSpread$b({
|
|
3012
3073
|
invites: members,
|
|
3013
3074
|
message: message
|
|
3014
3075
|
}, options));
|
|
@@ -3051,7 +3112,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
3051
3112
|
case 0:
|
|
3052
3113
|
options = _args20.length > 2 && _args20[2] !== undefined ? _args20[2] : {};
|
|
3053
3114
|
_context20.next = 3;
|
|
3054
|
-
return this._update(_objectSpread$
|
|
3115
|
+
return this._update(_objectSpread$b({
|
|
3055
3116
|
remove_members: members,
|
|
3056
3117
|
message: message
|
|
3057
3118
|
}, options));
|
|
@@ -3094,7 +3155,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
3094
3155
|
case 0:
|
|
3095
3156
|
options = _args21.length > 2 && _args21[2] !== undefined ? _args21[2] : {};
|
|
3096
3157
|
_context21.next = 3;
|
|
3097
|
-
return this._update(_objectSpread$
|
|
3158
|
+
return this._update(_objectSpread$b({
|
|
3098
3159
|
demote_moderators: members,
|
|
3099
3160
|
message: message
|
|
3100
3161
|
}, options));
|
|
@@ -3179,7 +3240,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
3179
3240
|
case 0:
|
|
3180
3241
|
opts = _args23.length > 0 && _args23[0] !== undefined ? _args23[0] : {};
|
|
3181
3242
|
_context23.next = 3;
|
|
3182
|
-
return this.getClient().post(this.getClient().baseURL + '/moderation/mute/channel', _objectSpread$
|
|
3243
|
+
return this.getClient().post(this.getClient().baseURL + '/moderation/mute/channel', _objectSpread$b({
|
|
3183
3244
|
channel_cid: this.cid
|
|
3184
3245
|
}, opts));
|
|
3185
3246
|
|
|
@@ -3221,7 +3282,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
3221
3282
|
case 0:
|
|
3222
3283
|
opts = _args24.length > 0 && _args24[0] !== undefined ? _args24[0] : {};
|
|
3223
3284
|
_context24.next = 3;
|
|
3224
|
-
return this.getClient().post(this.getClient().baseURL + '/moderation/unmute/channel', _objectSpread$
|
|
3285
|
+
return this.getClient().post(this.getClient().baseURL + '/moderation/unmute/channel', _objectSpread$b({
|
|
3225
3286
|
channel_cid: this.cid
|
|
3226
3287
|
}, opts));
|
|
3227
3288
|
|
|
@@ -3558,7 +3619,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
3558
3619
|
|
|
3559
3620
|
this.lastTypingEvent = new Date();
|
|
3560
3621
|
_context29.next = 10;
|
|
3561
|
-
return this.sendEvent(_objectSpread$
|
|
3622
|
+
return this.sendEvent(_objectSpread$b({
|
|
3562
3623
|
type: 'typing.start',
|
|
3563
3624
|
parent_id: parent_id
|
|
3564
3625
|
}, options || {}));
|
|
@@ -3598,7 +3659,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
3598
3659
|
case 0:
|
|
3599
3660
|
options = _args30.length > 2 && _args30[2] !== undefined ? _args30[2] : {};
|
|
3600
3661
|
_context30.next = 3;
|
|
3601
|
-
return this.sendEvent(_objectSpread$
|
|
3662
|
+
return this.sendEvent(_objectSpread$b(_objectSpread$b({}, options), {}, {
|
|
3602
3663
|
type: 'ai_indicator.update',
|
|
3603
3664
|
message_id: messageId,
|
|
3604
3665
|
ai_state: state
|
|
@@ -3707,7 +3768,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
3707
3768
|
this.lastTypingEvent = null;
|
|
3708
3769
|
this.isTyping = false;
|
|
3709
3770
|
_context33.next = 6;
|
|
3710
|
-
return this.sendEvent(_objectSpread$
|
|
3771
|
+
return this.sendEvent(_objectSpread$b({
|
|
3711
3772
|
type: 'typing.stop',
|
|
3712
3773
|
parent_id: parent_id
|
|
3713
3774
|
}, options || {}));
|
|
@@ -3794,7 +3855,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
3794
3855
|
|
|
3795
3856
|
case 4:
|
|
3796
3857
|
_context34.next = 6;
|
|
3797
|
-
return this.getClient().post(this._channelURL() + '/read', _objectSpread$
|
|
3858
|
+
return this.getClient().post(this._channelURL() + '/read', _objectSpread$b({}, data));
|
|
3798
3859
|
|
|
3799
3860
|
case 6:
|
|
3800
3861
|
return _context34.abrupt("return", _context34.sent);
|
|
@@ -3841,7 +3902,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
3841
3902
|
|
|
3842
3903
|
case 3:
|
|
3843
3904
|
_context35.next = 5;
|
|
3844
|
-
return this.getClient().post(this._channelURL() + '/unread', _objectSpread$
|
|
3905
|
+
return this.getClient().post(this._channelURL() + '/unread', _objectSpread$b({}, data));
|
|
3845
3906
|
|
|
3846
3907
|
case 5:
|
|
3847
3908
|
return _context35.abrupt("return", _context35.sent);
|
|
@@ -3909,7 +3970,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
3909
3970
|
defaultOptions.watch = false;
|
|
3910
3971
|
}
|
|
3911
3972
|
|
|
3912
|
-
combined = _objectSpread$
|
|
3973
|
+
combined = _objectSpread$b(_objectSpread$b({}, defaultOptions), options);
|
|
3913
3974
|
_context36.next = 7;
|
|
3914
3975
|
return this.query(combined, 'latest');
|
|
3915
3976
|
|
|
@@ -4003,7 +4064,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
4003
4064
|
case 0:
|
|
4004
4065
|
normalizedSort = sort ? normalizeQuerySort(sort) : undefined;
|
|
4005
4066
|
_context38.next = 3;
|
|
4006
|
-
return this.getClient().get(this.getClient().baseURL + "/messages/".concat(encodeURIComponent(parent_id), "/replies"), _objectSpread$
|
|
4067
|
+
return this.getClient().get(this.getClient().baseURL + "/messages/".concat(encodeURIComponent(parent_id), "/replies"), _objectSpread$b({
|
|
4007
4068
|
sort: normalizedSort
|
|
4008
4069
|
}, options));
|
|
4009
4070
|
|
|
@@ -4053,7 +4114,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
4053
4114
|
sort = _args39.length > 1 && _args39[1] !== undefined ? _args39[1] : [];
|
|
4054
4115
|
_context39.next = 3;
|
|
4055
4116
|
return this.getClient().get(this._channelURL() + '/pinned_messages', {
|
|
4056
|
-
payload: _objectSpread$
|
|
4117
|
+
payload: _objectSpread$b(_objectSpread$b({}, options), {}, {
|
|
4057
4118
|
sort: normalizeQuerySort(sort)
|
|
4058
4119
|
})
|
|
4059
4120
|
});
|
|
@@ -4087,7 +4148,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
4087
4148
|
}, {
|
|
4088
4149
|
key: "getReactions",
|
|
4089
4150
|
value: function getReactions(message_id, options) {
|
|
4090
|
-
return this.getClient().get(this.getClient().baseURL + "/messages/".concat(encodeURIComponent(message_id), "/reactions"), _objectSpread$
|
|
4151
|
+
return this.getClient().get(this.getClient().baseURL + "/messages/".concat(encodeURIComponent(message_id), "/reactions"), _objectSpread$b({}, options));
|
|
4091
4152
|
}
|
|
4092
4153
|
/**
|
|
4093
4154
|
* getMessagesById - Retrieves a list of messages by ID
|
|
@@ -4234,7 +4295,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
4234
4295
|
}
|
|
4235
4296
|
|
|
4236
4297
|
_context40.next = 7;
|
|
4237
|
-
return this.getClient().post(queryURL + '/query', _objectSpread$
|
|
4298
|
+
return this.getClient().post(queryURL + '/query', _objectSpread$b({
|
|
4238
4299
|
data: this._data,
|
|
4239
4300
|
state: true
|
|
4240
4301
|
}, options));
|
|
@@ -4269,7 +4330,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
4269
4330
|
|
|
4270
4331
|
|
|
4271
4332
|
_this$_initializeStat = this._initializeState(state, messageSetToAddToIfDoesNotExist), messageSet = _this$_initializeStat.messageSet;
|
|
4272
|
-
messageSet.pagination = _objectSpread$
|
|
4333
|
+
messageSet.pagination = _objectSpread$b(_objectSpread$b({}, messageSet.pagination), messageSetPagination({
|
|
4273
4334
|
parentSet: messageSet,
|
|
4274
4335
|
messagePaginationOptions: options === null || options === void 0 ? void 0 : options.messages,
|
|
4275
4336
|
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,
|
|
@@ -4331,7 +4392,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
4331
4392
|
this._checkInitialized();
|
|
4332
4393
|
|
|
4333
4394
|
_context41.next = 3;
|
|
4334
|
-
return this.getClient().banUser(targetUserID, _objectSpread$
|
|
4395
|
+
return this.getClient().banUser(targetUserID, _objectSpread$b(_objectSpread$b({}, options), {}, {
|
|
4335
4396
|
type: this.type,
|
|
4336
4397
|
id: this.id
|
|
4337
4398
|
}));
|
|
@@ -4503,7 +4564,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
4503
4564
|
this._checkInitialized();
|
|
4504
4565
|
|
|
4505
4566
|
_context45.next = 3;
|
|
4506
|
-
return this.getClient().shadowBan(targetUserID, _objectSpread$
|
|
4567
|
+
return this.getClient().shadowBan(targetUserID, _objectSpread$b(_objectSpread$b({}, options), {}, {
|
|
4507
4568
|
type: this.type,
|
|
4508
4569
|
id: this.id
|
|
4509
4570
|
}));
|
|
@@ -4908,7 +4969,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
4908
4969
|
case 'member.added':
|
|
4909
4970
|
case 'member.updated':
|
|
4910
4971
|
if ((_event$member = event.member) !== null && _event$member !== void 0 && _event$member.user) {
|
|
4911
|
-
channelState.members = _objectSpread$
|
|
4972
|
+
channelState.members = _objectSpread$b(_objectSpread$b({}, channelState.members), {}, _defineProperty__default['default']({}, event.member.user.id, event.member));
|
|
4912
4973
|
}
|
|
4913
4974
|
|
|
4914
4975
|
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) {
|
|
@@ -4919,7 +4980,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
4919
4980
|
|
|
4920
4981
|
case 'member.removed':
|
|
4921
4982
|
if ((_event$user9 = event.user) !== null && _event$user9 !== void 0 && _event$user9.id) {
|
|
4922
|
-
var newMembers = _objectSpread$
|
|
4983
|
+
var newMembers = _objectSpread$b({}, channelState.members);
|
|
4923
4984
|
|
|
4924
4985
|
delete newMembers[event.user.id];
|
|
4925
4986
|
channelState.members = newMembers; // TODO?: unset membership
|
|
@@ -4964,7 +5025,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
4964
5025
|
});
|
|
4965
5026
|
}
|
|
4966
5027
|
|
|
4967
|
-
channel.data = _objectSpread$
|
|
5028
|
+
channel.data = _objectSpread$b(_objectSpread$b({}, event.channel), {}, {
|
|
4968
5029
|
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,
|
|
4969
5030
|
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
|
|
4970
5031
|
});
|
|
@@ -4995,7 +5056,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
4995
5056
|
break;
|
|
4996
5057
|
|
|
4997
5058
|
case 'channel.hidden':
|
|
4998
|
-
channel.data = _objectSpread$
|
|
5059
|
+
channel.data = _objectSpread$b(_objectSpread$b({}, channel.data), {}, {
|
|
4999
5060
|
hidden: true
|
|
5000
5061
|
});
|
|
5001
5062
|
|
|
@@ -5006,26 +5067,26 @@ var Channel = /*#__PURE__*/function () {
|
|
|
5006
5067
|
break;
|
|
5007
5068
|
|
|
5008
5069
|
case 'channel.visible':
|
|
5009
|
-
channel.data = _objectSpread$
|
|
5070
|
+
channel.data = _objectSpread$b(_objectSpread$b({}, channel.data), {}, {
|
|
5010
5071
|
hidden: false
|
|
5011
5072
|
});
|
|
5012
5073
|
break;
|
|
5013
5074
|
|
|
5014
5075
|
case 'user.banned':
|
|
5015
5076
|
if (!((_event$user11 = event.user) !== null && _event$user11 !== void 0 && _event$user11.id)) break;
|
|
5016
|
-
channelState.members[event.user.id] = _objectSpread$
|
|
5077
|
+
channelState.members[event.user.id] = _objectSpread$b(_objectSpread$b({}, channelState.members[event.user.id] || {}), {}, {
|
|
5017
5078
|
shadow_banned: !!event.shadow,
|
|
5018
5079
|
banned: !event.shadow,
|
|
5019
|
-
user: _objectSpread$
|
|
5080
|
+
user: _objectSpread$b(_objectSpread$b({}, ((_channelState$members2 = channelState.members[event.user.id]) === null || _channelState$members2 === void 0 ? void 0 : _channelState$members2.user) || {}), event.user)
|
|
5020
5081
|
});
|
|
5021
5082
|
break;
|
|
5022
5083
|
|
|
5023
5084
|
case 'user.unbanned':
|
|
5024
5085
|
if (!((_event$user12 = event.user) !== null && _event$user12 !== void 0 && _event$user12.id)) break;
|
|
5025
|
-
channelState.members[event.user.id] = _objectSpread$
|
|
5086
|
+
channelState.members[event.user.id] = _objectSpread$b(_objectSpread$b({}, channelState.members[event.user.id] || {}), {}, {
|
|
5026
5087
|
shadow_banned: false,
|
|
5027
5088
|
banned: false,
|
|
5028
|
-
user: _objectSpread$
|
|
5089
|
+
user: _objectSpread$b(_objectSpread$b({}, ((_channelState$members3 = channelState.members[event.user.id]) === null || _channelState$members3 === void 0 ? void 0 : _channelState$members3.user) || {}), event.user)
|
|
5029
5090
|
});
|
|
5030
5091
|
break;
|
|
5031
5092
|
} // any event can send over the online count
|
|
@@ -5199,7 +5260,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
5199
5260
|
if (overrideCurrentState) {
|
|
5200
5261
|
this.state.members = newMembersById;
|
|
5201
5262
|
} else if (!overrideCurrentState && members.length) {
|
|
5202
|
-
this.state.members = _objectSpread$
|
|
5263
|
+
this.state.members = _objectSpread$b(_objectSpread$b({}, this.state.members), newMembersById);
|
|
5203
5264
|
}
|
|
5204
5265
|
}
|
|
5205
5266
|
}, {
|
|
@@ -5298,9 +5359,9 @@ var ClientState = /*#__PURE__*/function () {
|
|
|
5298
5359
|
return ClientState;
|
|
5299
5360
|
}();
|
|
5300
5361
|
|
|
5301
|
-
function ownKeys$
|
|
5362
|
+
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; }
|
|
5302
5363
|
|
|
5303
|
-
function _objectSpread$
|
|
5364
|
+
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; }
|
|
5304
5365
|
var InsightMetrics = function InsightMetrics() {
|
|
5305
5366
|
_classCallCheck__default['default'](this, InsightMetrics);
|
|
5306
5367
|
|
|
@@ -5379,7 +5440,7 @@ var postInsights = /*#__PURE__*/function () {
|
|
|
5379
5440
|
};
|
|
5380
5441
|
}();
|
|
5381
5442
|
function buildWsFatalInsight(connection, event) {
|
|
5382
|
-
return _objectSpread$
|
|
5443
|
+
return _objectSpread$a(_objectSpread$a({}, event), buildWsBaseInsight(connection));
|
|
5383
5444
|
}
|
|
5384
5445
|
|
|
5385
5446
|
function buildWsBaseInsight(connection) {
|
|
@@ -5412,9 +5473,9 @@ function buildWsSuccessAfterFailureInsight(connection) {
|
|
|
5412
5473
|
return buildWsBaseInsight(connection);
|
|
5413
5474
|
}
|
|
5414
5475
|
|
|
5415
|
-
function ownKeys$
|
|
5476
|
+
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; }
|
|
5416
5477
|
|
|
5417
|
-
function _objectSpread$
|
|
5478
|
+
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; }
|
|
5418
5479
|
|
|
5419
5480
|
// Type guards to check WebSocket error type
|
|
5420
5481
|
var isCloseEvent = function isCloseEvent(res) {
|
|
@@ -5778,7 +5839,7 @@ var StableWSConnection = /*#__PURE__*/function () {
|
|
|
5778
5839
|
value: function _log(msg) {
|
|
5779
5840
|
var extra = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
5780
5841
|
var level = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'info';
|
|
5781
|
-
this.client.logger(level, 'connection:' + msg, _objectSpread$
|
|
5842
|
+
this.client.logger(level, 'connection:' + msg, _objectSpread$9({
|
|
5782
5843
|
tags: ['connection']
|
|
5783
5844
|
}, extra));
|
|
5784
5845
|
}
|
|
@@ -6373,9 +6434,9 @@ var jwt = null;
|
|
|
6373
6434
|
|
|
6374
6435
|
var crypto$1 = null;
|
|
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
|
|
|
@@ -6802,9 +6863,9 @@ function isErrorResponse(res) {
|
|
|
6802
6863
|
return !res.status || res.status < 200 || 300 <= res.status;
|
|
6803
6864
|
}
|
|
6804
6865
|
|
|
6805
|
-
function ownKeys$
|
|
6866
|
+
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; }
|
|
6806
6867
|
|
|
6807
|
-
function _objectSpread$
|
|
6868
|
+
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; }
|
|
6808
6869
|
var ConnectionState;
|
|
6809
6870
|
|
|
6810
6871
|
(function (ConnectionState) {
|
|
@@ -6867,7 +6928,7 @@ var WSConnectionFallback = /*#__PURE__*/function () {
|
|
|
6867
6928
|
_context.next = 4;
|
|
6868
6929
|
return _this.client.doAxiosRequest('get', _this.client.baseURL.replace(':3030', ':8900') + '/longpoll', // replace port if present for testing with local API
|
|
6869
6930
|
undefined, {
|
|
6870
|
-
config: _objectSpread$
|
|
6931
|
+
config: _objectSpread$7(_objectSpread$7({}, config), {}, {
|
|
6871
6932
|
cancelToken: (_this$cancelToken2 = _this.cancelToken) === null || _this$cancelToken2 === void 0 ? void 0 : _this$cancelToken2.token
|
|
6872
6933
|
}),
|
|
6873
6934
|
params: params
|
|
@@ -7145,7 +7206,7 @@ var WSConnectionFallback = /*#__PURE__*/function () {
|
|
|
7145
7206
|
value: function _log(msg) {
|
|
7146
7207
|
var extra = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
7147
7208
|
var level = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'info';
|
|
7148
|
-
this.client.logger(level, 'WSConnectionFallback:' + msg, _objectSpread$
|
|
7209
|
+
this.client.logger(level, 'WSConnectionFallback:' + msg, _objectSpread$7({
|
|
7149
7210
|
tags: ['connection_fallback', 'connection']
|
|
7150
7211
|
}, extra));
|
|
7151
7212
|
}
|
|
@@ -7424,9 +7485,9 @@ var Segment = /*#__PURE__*/function () {
|
|
|
7424
7485
|
return Segment;
|
|
7425
7486
|
}();
|
|
7426
7487
|
|
|
7427
|
-
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); }; }
|
|
7488
|
+
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); }; }
|
|
7428
7489
|
|
|
7429
|
-
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; } }
|
|
7490
|
+
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; } }
|
|
7430
7491
|
|
|
7431
7492
|
/**
|
|
7432
7493
|
* Utility Types
|
|
@@ -7491,7 +7552,7 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
|
|
|
7491
7552
|
var ErrorFromResponse = /*#__PURE__*/function (_Error) {
|
|
7492
7553
|
_inherits__default['default'](ErrorFromResponse, _Error);
|
|
7493
7554
|
|
|
7494
|
-
var _super = _createSuper(ErrorFromResponse);
|
|
7555
|
+
var _super = _createSuper$1(ErrorFromResponse);
|
|
7495
7556
|
|
|
7496
7557
|
function ErrorFromResponse() {
|
|
7497
7558
|
var _this;
|
|
@@ -7522,9 +7583,9 @@ exports.VotingVisibility = void 0;
|
|
|
7522
7583
|
VotingVisibility["public"] = "public";
|
|
7523
7584
|
})(exports.VotingVisibility || (exports.VotingVisibility = {}));
|
|
7524
7585
|
|
|
7525
|
-
function ownKeys$
|
|
7586
|
+
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; }
|
|
7526
7587
|
|
|
7527
|
-
function _objectSpread$
|
|
7588
|
+
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; }
|
|
7528
7589
|
|
|
7529
7590
|
function isPatch(value) {
|
|
7530
7591
|
return typeof value === 'function';
|
|
@@ -7554,7 +7615,7 @@ var StateStore = function StateStore(value) {
|
|
|
7554
7615
|
|
|
7555
7616
|
_defineProperty__default['default'](this, "partialNext", function (partial) {
|
|
7556
7617
|
return _this.next(function (current) {
|
|
7557
|
-
return _objectSpread$
|
|
7618
|
+
return _objectSpread$6(_objectSpread$6({}, current), partial);
|
|
7558
7619
|
});
|
|
7559
7620
|
});
|
|
7560
7621
|
|
|
@@ -7604,11 +7665,11 @@ var StateStore = function StateStore(value) {
|
|
|
7604
7665
|
|
|
7605
7666
|
_defineProperty__default['default'](StateStore, "logCount", 5);
|
|
7606
7667
|
|
|
7607
|
-
var _excluded$
|
|
7668
|
+
var _excluded$3 = ["limit", "sort"];
|
|
7608
7669
|
|
|
7609
|
-
function ownKeys$
|
|
7670
|
+
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; }
|
|
7610
7671
|
|
|
7611
|
-
function _objectSpread$
|
|
7672
|
+
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; }
|
|
7612
7673
|
var DEFAULT_PAGE_LIMIT = 50;
|
|
7613
7674
|
var DEFAULT_SORT = [{
|
|
7614
7675
|
created_at: -1
|
|
@@ -7893,14 +7954,14 @@ var Thread = /*#__PURE__*/function () {
|
|
|
7893
7954
|
if (userId === ((_event$user2 = event.user) === null || _event$user2 === void 0 ? void 0 : _event$user2.id)) {
|
|
7894
7955
|
// The user who just sent a message to the thread has no unread messages
|
|
7895
7956
|
// in that thread
|
|
7896
|
-
nextUserRead = _objectSpread$
|
|
7957
|
+
nextUserRead = _objectSpread$5(_objectSpread$5({}, nextUserRead), {}, {
|
|
7897
7958
|
lastReadAt: event.created_at ? new Date(event.created_at) : new Date(),
|
|
7898
7959
|
user: event.user,
|
|
7899
7960
|
unreadMessageCount: 0
|
|
7900
7961
|
});
|
|
7901
7962
|
} else if (active && userId === _this.client.userID) ; else {
|
|
7902
7963
|
// Increment unread count for all users except the author of the new message
|
|
7903
|
-
nextUserRead = _objectSpread$
|
|
7964
|
+
nextUserRead = _objectSpread$5(_objectSpread$5({}, nextUserRead), {}, {
|
|
7904
7965
|
unreadMessageCount: userRead.unreadMessageCount + 1
|
|
7905
7966
|
});
|
|
7906
7967
|
}
|
|
@@ -7924,8 +7985,8 @@ var Thread = /*#__PURE__*/function () {
|
|
|
7924
7985
|
var user = event.user;
|
|
7925
7986
|
|
|
7926
7987
|
_this.state.next(function (current) {
|
|
7927
|
-
return _objectSpread$
|
|
7928
|
-
read: _objectSpread$
|
|
7988
|
+
return _objectSpread$5(_objectSpread$5({}, current), {}, {
|
|
7989
|
+
read: _objectSpread$5(_objectSpread$5({}, current.read), {}, _defineProperty__default['default']({}, userId, {
|
|
7929
7990
|
lastReadAt: new Date(createdAt),
|
|
7930
7991
|
user: user,
|
|
7931
7992
|
lastReadMessageId: event.last_read_message_id,
|
|
@@ -8038,7 +8099,7 @@ var Thread = /*#__PURE__*/function () {
|
|
|
8038
8099
|
}
|
|
8039
8100
|
|
|
8040
8101
|
_this.state.next(function (current) {
|
|
8041
|
-
return _objectSpread$
|
|
8102
|
+
return _objectSpread$5(_objectSpread$5({}, current), {}, {
|
|
8042
8103
|
replies: addToMessageList(current.replies, formattedMessage, timestampChanged)
|
|
8043
8104
|
});
|
|
8044
8105
|
});
|
|
@@ -8055,7 +8116,7 @@ var Thread = /*#__PURE__*/function () {
|
|
|
8055
8116
|
var _message$reply_count;
|
|
8056
8117
|
|
|
8057
8118
|
var formattedMessage = formatMessage(message);
|
|
8058
|
-
return _objectSpread$
|
|
8119
|
+
return _objectSpread$5(_objectSpread$5({}, current), {}, {
|
|
8059
8120
|
deletedAt: formattedMessage.deleted_at,
|
|
8060
8121
|
parentMessage: formattedMessage,
|
|
8061
8122
|
replyCount: (_message$reply_count = message.reply_count) !== null && _message$reply_count !== void 0 ? _message$reply_count : current.replyCount
|
|
@@ -8126,9 +8187,9 @@ var Thread = /*#__PURE__*/function () {
|
|
|
8126
8187
|
limit = _ref10$limit === void 0 ? DEFAULT_PAGE_LIMIT : _ref10$limit,
|
|
8127
8188
|
_ref10$sort = _ref10.sort,
|
|
8128
8189
|
sort = _ref10$sort === void 0 ? DEFAULT_SORT : _ref10$sort,
|
|
8129
|
-
otherOptions = _objectWithoutProperties__default['default'](_ref10, _excluded$
|
|
8190
|
+
otherOptions = _objectWithoutProperties__default['default'](_ref10, _excluded$3);
|
|
8130
8191
|
|
|
8131
|
-
return _this.channel.getReplies(_this.id, _objectSpread$
|
|
8192
|
+
return _this.channel.getReplies(_this.id, _objectSpread$5({
|
|
8132
8193
|
limit: limit
|
|
8133
8194
|
}, otherOptions), sort);
|
|
8134
8195
|
});
|
|
@@ -8172,12 +8233,12 @@ var Thread = /*#__PURE__*/function () {
|
|
|
8172
8233
|
limit = Math.abs(count);
|
|
8173
8234
|
|
|
8174
8235
|
_this.state.partialNext({
|
|
8175
|
-
pagination: _objectSpread$
|
|
8236
|
+
pagination: _objectSpread$5(_objectSpread$5({}, pagination), {}, _defineProperty__default['default']({}, loadingKey, true))
|
|
8176
8237
|
});
|
|
8177
8238
|
|
|
8178
8239
|
_context3.prev = 7;
|
|
8179
8240
|
_context3.next = 10;
|
|
8180
|
-
return _this.queryReplies(_objectSpread$
|
|
8241
|
+
return _this.queryReplies(_objectSpread$5(_objectSpread$5({}, queryOptions), {}, {
|
|
8181
8242
|
limit: limit
|
|
8182
8243
|
}));
|
|
8183
8244
|
|
|
@@ -8199,9 +8260,9 @@ var Thread = /*#__PURE__*/function () {
|
|
|
8199
8260
|
(_nextReplies = nextReplies)[insertionMethodKey].apply(_nextReplies, _toConsumableArray__default['default'](replies));
|
|
8200
8261
|
}
|
|
8201
8262
|
|
|
8202
|
-
return _objectSpread$
|
|
8263
|
+
return _objectSpread$5(_objectSpread$5({}, current), {}, {
|
|
8203
8264
|
replies: nextReplies,
|
|
8204
|
-
pagination: _objectSpread$
|
|
8265
|
+
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))
|
|
8205
8266
|
});
|
|
8206
8267
|
});
|
|
8207
8268
|
|
|
@@ -8215,8 +8276,8 @@ var Thread = /*#__PURE__*/function () {
|
|
|
8215
8276
|
_this.client.logger('error', _context3.t0.message);
|
|
8216
8277
|
|
|
8217
8278
|
_this.state.next(function (current) {
|
|
8218
|
-
return _objectSpread$
|
|
8219
|
-
pagination: _objectSpread$
|
|
8279
|
+
return _objectSpread$5(_objectSpread$5({}, current), {}, {
|
|
8280
|
+
pagination: _objectSpread$5(_objectSpread$5({}, current.pagination), {}, _defineProperty__default['default']({}, loadingKey, false))
|
|
8220
8281
|
});
|
|
8221
8282
|
});
|
|
8222
8283
|
|
|
@@ -8329,9 +8390,9 @@ var ownUnreadCountSelector = function ownUnreadCountSelector(currentUserId) {
|
|
|
8329
8390
|
};
|
|
8330
8391
|
};
|
|
8331
8392
|
|
|
8332
|
-
function ownKeys$
|
|
8393
|
+
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; }
|
|
8333
8394
|
|
|
8334
|
-
function _objectSpread$
|
|
8395
|
+
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; }
|
|
8335
8396
|
var MODERATION_ENTITY_TYPES = {
|
|
8336
8397
|
user: 'stream:user',
|
|
8337
8398
|
message: 'stream:chat:v1:message'
|
|
@@ -8448,7 +8509,7 @@ var Moderation = /*#__PURE__*/function () {
|
|
|
8448
8509
|
case 0:
|
|
8449
8510
|
options = _args3.length > 4 && _args3[4] !== undefined ? _args3[4] : {};
|
|
8450
8511
|
_context3.next = 3;
|
|
8451
|
-
return this.client.post(this.client.baseURL + '/api/v2/moderation/flag', _objectSpread$
|
|
8512
|
+
return this.client.post(this.client.baseURL + '/api/v2/moderation/flag', _objectSpread$4({
|
|
8452
8513
|
entity_type: entityType,
|
|
8453
8514
|
entity_id: entityId,
|
|
8454
8515
|
entity_creator_id: entityCreatorID,
|
|
@@ -8493,7 +8554,7 @@ var Moderation = /*#__PURE__*/function () {
|
|
|
8493
8554
|
case 0:
|
|
8494
8555
|
options = _args4.length > 1 && _args4[1] !== undefined ? _args4[1] : {};
|
|
8495
8556
|
_context4.next = 3;
|
|
8496
|
-
return this.client.post(this.client.baseURL + '/api/v2/moderation/mute', _objectSpread$
|
|
8557
|
+
return this.client.post(this.client.baseURL + '/api/v2/moderation/mute', _objectSpread$4({
|
|
8497
8558
|
target_ids: [targetID]
|
|
8498
8559
|
}, options));
|
|
8499
8560
|
|
|
@@ -8531,7 +8592,7 @@ var Moderation = /*#__PURE__*/function () {
|
|
|
8531
8592
|
switch (_context5.prev = _context5.next) {
|
|
8532
8593
|
case 0:
|
|
8533
8594
|
_context5.next = 2;
|
|
8534
|
-
return this.client.post(this.client.baseURL + '/api/v2/moderation/unmute', _objectSpread$
|
|
8595
|
+
return this.client.post(this.client.baseURL + '/api/v2/moderation/unmute', _objectSpread$4({
|
|
8535
8596
|
target_ids: [targetID]
|
|
8536
8597
|
}, options));
|
|
8537
8598
|
|
|
@@ -8573,7 +8634,7 @@ var Moderation = /*#__PURE__*/function () {
|
|
|
8573
8634
|
case 0:
|
|
8574
8635
|
options = _args6.length > 1 && _args6[1] !== undefined ? _args6[1] : {};
|
|
8575
8636
|
_context6.next = 3;
|
|
8576
|
-
return this.client.get(this.client.baseURL + "/api/v2/moderation/user_report", _objectSpread$
|
|
8637
|
+
return this.client.get(this.client.baseURL + "/api/v2/moderation/user_report", _objectSpread$4({
|
|
8577
8638
|
user_id: userID
|
|
8578
8639
|
}, options));
|
|
8579
8640
|
|
|
@@ -8617,7 +8678,7 @@ var Moderation = /*#__PURE__*/function () {
|
|
|
8617
8678
|
sort = _args7.length > 1 && _args7[1] !== undefined ? _args7[1] : [];
|
|
8618
8679
|
options = _args7.length > 2 && _args7[2] !== undefined ? _args7[2] : {};
|
|
8619
8680
|
_context7.next = 5;
|
|
8620
|
-
return this.client.post(this.client.baseURL + '/api/v2/moderation/review_queue', _objectSpread$
|
|
8681
|
+
return this.client.post(this.client.baseURL + '/api/v2/moderation/review_queue', _objectSpread$4({
|
|
8621
8682
|
filter: filterConditions,
|
|
8622
8683
|
sort: normalizeQuerySort(sort)
|
|
8623
8684
|
}, options));
|
|
@@ -8752,7 +8813,7 @@ var Moderation = /*#__PURE__*/function () {
|
|
|
8752
8813
|
case 0:
|
|
8753
8814
|
options = _args11.length > 2 && _args11[2] !== undefined ? _args11[2] : {};
|
|
8754
8815
|
_context11.next = 3;
|
|
8755
|
-
return this.client.post(this.client.baseURL + '/api/v2/moderation/configs', _objectSpread$
|
|
8816
|
+
return this.client.post(this.client.baseURL + '/api/v2/moderation/configs', _objectSpread$4({
|
|
8756
8817
|
filter: filterConditions,
|
|
8757
8818
|
sort: sort
|
|
8758
8819
|
}, options));
|
|
@@ -8786,7 +8847,7 @@ var Moderation = /*#__PURE__*/function () {
|
|
|
8786
8847
|
case 0:
|
|
8787
8848
|
options = _args12.length > 2 && _args12[2] !== undefined ? _args12[2] : {};
|
|
8788
8849
|
_context12.next = 3;
|
|
8789
|
-
return this.client.post(this.client.baseURL + '/api/v2/moderation/submit_action', _objectSpread$
|
|
8850
|
+
return this.client.post(this.client.baseURL + '/api/v2/moderation/submit_action', _objectSpread$4({
|
|
8790
8851
|
action_type: actionType,
|
|
8791
8852
|
item_id: itemID
|
|
8792
8853
|
}, options));
|
|
@@ -8950,9 +9011,9 @@ function _unsupportedIterableToArray$2(o, minLen) { if (!o) return; if (typeof o
|
|
|
8950
9011
|
|
|
8951
9012
|
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; }
|
|
8952
9013
|
|
|
8953
|
-
function ownKeys$
|
|
9014
|
+
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; }
|
|
8954
9015
|
|
|
8955
|
-
function _objectSpread$
|
|
9016
|
+
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; }
|
|
8956
9017
|
var DEFAULT_CONNECTION_RECOVERY_THROTTLE_DURATION = 1000;
|
|
8957
9018
|
var MAX_QUERY_THREADS_LIMIT = 25;
|
|
8958
9019
|
var THREAD_MANAGER_INITIAL_STATE = {
|
|
@@ -9133,7 +9194,7 @@ var ThreadManager = /*#__PURE__*/function () {
|
|
|
9133
9194
|
var unsubscribeConnectionDropped = _this.client.on('connection.changed', function (event) {
|
|
9134
9195
|
if (event.online === false) {
|
|
9135
9196
|
_this.state.next(function (current) {
|
|
9136
|
-
return current.lastConnectionDropAt ? current : _objectSpread$
|
|
9197
|
+
return current.lastConnectionDropAt ? current : _objectSpread$3(_objectSpread$3({}, current), {}, {
|
|
9137
9198
|
lastConnectionDropAt: new Date()
|
|
9138
9199
|
});
|
|
9139
9200
|
});
|
|
@@ -9220,8 +9281,8 @@ var ThreadManager = /*#__PURE__*/function () {
|
|
|
9220
9281
|
_context.prev = 7;
|
|
9221
9282
|
|
|
9222
9283
|
_this.state.next(function (current) {
|
|
9223
|
-
return _objectSpread$
|
|
9224
|
-
pagination: _objectSpread$
|
|
9284
|
+
return _objectSpread$3(_objectSpread$3({}, current), {}, {
|
|
9285
|
+
pagination: _objectSpread$3(_objectSpread$3({}, current.pagination), {}, {
|
|
9225
9286
|
isLoading: true
|
|
9226
9287
|
})
|
|
9227
9288
|
});
|
|
@@ -9263,11 +9324,11 @@ var ThreadManager = /*#__PURE__*/function () {
|
|
|
9263
9324
|
_this.state.next(function (current) {
|
|
9264
9325
|
var _response$next;
|
|
9265
9326
|
|
|
9266
|
-
return _objectSpread$
|
|
9327
|
+
return _objectSpread$3(_objectSpread$3({}, current), {}, {
|
|
9267
9328
|
threads: nextThreads,
|
|
9268
9329
|
unseenThreadIds: [],
|
|
9269
9330
|
isThreadOrderStale: false,
|
|
9270
|
-
pagination: _objectSpread$
|
|
9331
|
+
pagination: _objectSpread$3(_objectSpread$3({}, current.pagination), {}, {
|
|
9271
9332
|
isLoading: false,
|
|
9272
9333
|
nextCursor: (_response$next = response.next) !== null && _response$next !== void 0 ? _response$next : null
|
|
9273
9334
|
}),
|
|
@@ -9285,8 +9346,8 @@ var ThreadManager = /*#__PURE__*/function () {
|
|
|
9285
9346
|
_this.client.logger('error', _context.t0.message);
|
|
9286
9347
|
|
|
9287
9348
|
_this.state.next(function (current) {
|
|
9288
|
-
return _objectSpread$
|
|
9289
|
-
pagination: _objectSpread$
|
|
9349
|
+
return _objectSpread$3(_objectSpread$3({}, current), {}, {
|
|
9350
|
+
pagination: _objectSpread$3(_objectSpread$3({}, current.pagination), {}, {
|
|
9290
9351
|
isLoading: false
|
|
9291
9352
|
})
|
|
9292
9353
|
});
|
|
@@ -9302,7 +9363,7 @@ var ThreadManager = /*#__PURE__*/function () {
|
|
|
9302
9363
|
|
|
9303
9364
|
_defineProperty__default['default'](this, "queryThreads", function () {
|
|
9304
9365
|
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
9305
|
-
return _this.client.queryThreads(_objectSpread$
|
|
9366
|
+
return _this.client.queryThreads(_objectSpread$3({
|
|
9306
9367
|
limit: 25,
|
|
9307
9368
|
participant_limit: 10,
|
|
9308
9369
|
reply_limit: 10,
|
|
@@ -9335,13 +9396,13 @@ var ThreadManager = /*#__PURE__*/function () {
|
|
|
9335
9396
|
_context2.prev = 4;
|
|
9336
9397
|
|
|
9337
9398
|
_this.state.partialNext({
|
|
9338
|
-
pagination: _objectSpread$
|
|
9399
|
+
pagination: _objectSpread$3(_objectSpread$3({}, pagination), {}, {
|
|
9339
9400
|
isLoadingNext: true
|
|
9340
9401
|
})
|
|
9341
9402
|
});
|
|
9342
9403
|
|
|
9343
9404
|
_context2.next = 8;
|
|
9344
|
-
return _this.queryThreads(_objectSpread$
|
|
9405
|
+
return _this.queryThreads(_objectSpread$3(_objectSpread$3({}, options), {}, {
|
|
9345
9406
|
next: pagination.nextCursor
|
|
9346
9407
|
}));
|
|
9347
9408
|
|
|
@@ -9351,9 +9412,9 @@ var ThreadManager = /*#__PURE__*/function () {
|
|
|
9351
9412
|
_this.state.next(function (current) {
|
|
9352
9413
|
var _response$next2;
|
|
9353
9414
|
|
|
9354
|
-
return _objectSpread$
|
|
9415
|
+
return _objectSpread$3(_objectSpread$3({}, current), {}, {
|
|
9355
9416
|
threads: response.threads.length ? current.threads.concat(response.threads) : current.threads,
|
|
9356
|
-
pagination: _objectSpread$
|
|
9417
|
+
pagination: _objectSpread$3(_objectSpread$3({}, current.pagination), {}, {
|
|
9357
9418
|
nextCursor: (_response$next2 = response.next) !== null && _response$next2 !== void 0 ? _response$next2 : null,
|
|
9358
9419
|
isLoadingNext: false
|
|
9359
9420
|
})
|
|
@@ -9370,8 +9431,8 @@ var ThreadManager = /*#__PURE__*/function () {
|
|
|
9370
9431
|
_this.client.logger('error', _context2.t0.message);
|
|
9371
9432
|
|
|
9372
9433
|
_this.state.next(function (current) {
|
|
9373
|
-
return _objectSpread$
|
|
9374
|
-
pagination: _objectSpread$
|
|
9434
|
+
return _objectSpread$3(_objectSpread$3({}, current), {}, {
|
|
9435
|
+
pagination: _objectSpread$3(_objectSpread$3({}, current.pagination), {}, {
|
|
9375
9436
|
isLoadingNext: false
|
|
9376
9437
|
})
|
|
9377
9438
|
});
|
|
@@ -9416,12 +9477,12 @@ var ThreadManager = /*#__PURE__*/function () {
|
|
|
9416
9477
|
return ThreadManager;
|
|
9417
9478
|
}();
|
|
9418
9479
|
|
|
9419
|
-
var _excluded$
|
|
9480
|
+
var _excluded$2 = ["own_votes", "id"],
|
|
9420
9481
|
_excluded2$1 = ["id"];
|
|
9421
9482
|
|
|
9422
|
-
function ownKeys$
|
|
9483
|
+
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; }
|
|
9423
9484
|
|
|
9424
|
-
function _objectSpread$
|
|
9485
|
+
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; }
|
|
9425
9486
|
|
|
9426
9487
|
var isPollUpdatedEvent = function isPollUpdatedEvent(e) {
|
|
9427
9488
|
return e.type === 'poll.updated';
|
|
@@ -9469,7 +9530,7 @@ var Poll = /*#__PURE__*/function () {
|
|
|
9469
9530
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
9470
9531
|
var own_votes = poll.own_votes;
|
|
9471
9532
|
poll.id;
|
|
9472
|
-
var pollResponseForState = _objectWithoutProperties__default['default'](poll, _excluded$
|
|
9533
|
+
var pollResponseForState = _objectWithoutProperties__default['default'](poll, _excluded$2);
|
|
9473
9534
|
|
|
9474
9535
|
var _ref2 = (_own_votes$reduce = own_votes === null || own_votes === void 0 ? void 0 : own_votes.reduce(function (acc, voteOrAnswer) {
|
|
9475
9536
|
if (isVoteAnswer(voteOrAnswer)) {
|
|
@@ -9487,7 +9548,7 @@ var Poll = /*#__PURE__*/function () {
|
|
|
9487
9548
|
ownAnswer = _ref2.ownAnswer,
|
|
9488
9549
|
ownVotes = _ref2.ownVotes;
|
|
9489
9550
|
|
|
9490
|
-
return _objectSpread$
|
|
9551
|
+
return _objectSpread$2(_objectSpread$2({}, pollResponseForState), {}, {
|
|
9491
9552
|
lastActivityAt: new Date(),
|
|
9492
9553
|
maxVotedOptionIds: getMaxVotedOptionIds(pollResponseForState.vote_counts_by_option),
|
|
9493
9554
|
ownAnswer: ownAnswer,
|
|
@@ -9509,7 +9570,7 @@ var Poll = /*#__PURE__*/function () {
|
|
|
9509
9570
|
pollData = _objectWithoutProperties__default['default'](_extractPollData, _excluded2$1); // @ts-ignore
|
|
9510
9571
|
|
|
9511
9572
|
|
|
9512
|
-
_this.state.partialNext(_objectSpread$
|
|
9573
|
+
_this.state.partialNext(_objectSpread$2(_objectSpread$2({}, pollData), {}, {
|
|
9513
9574
|
lastActivityAt: new Date(event.created_at)
|
|
9514
9575
|
}));
|
|
9515
9576
|
});
|
|
@@ -9556,7 +9617,7 @@ var Poll = /*#__PURE__*/function () {
|
|
|
9556
9617
|
|
|
9557
9618
|
var pollEnrichData = extractPollEnrichedData(event.poll); // @ts-ignore
|
|
9558
9619
|
|
|
9559
|
-
_this.state.partialNext(_objectSpread$
|
|
9620
|
+
_this.state.partialNext(_objectSpread$2(_objectSpread$2({}, pollEnrichData), {}, {
|
|
9560
9621
|
latest_answers: latestAnswers,
|
|
9561
9622
|
lastActivityAt: new Date(event.created_at),
|
|
9562
9623
|
ownAnswer: ownAnswer,
|
|
@@ -9621,7 +9682,7 @@ var Poll = /*#__PURE__*/function () {
|
|
|
9621
9682
|
|
|
9622
9683
|
var pollEnrichData = extractPollEnrichedData(event.poll); // @ts-ignore
|
|
9623
9684
|
|
|
9624
|
-
_this.state.partialNext(_objectSpread$
|
|
9685
|
+
_this.state.partialNext(_objectSpread$2(_objectSpread$2({}, pollEnrichData), {}, {
|
|
9625
9686
|
latest_answers: latestAnswers,
|
|
9626
9687
|
lastActivityAt: new Date(event.created_at),
|
|
9627
9688
|
ownAnswer: ownAnswer,
|
|
@@ -9642,7 +9703,7 @@ var Poll = /*#__PURE__*/function () {
|
|
|
9642
9703
|
|
|
9643
9704
|
var ownAnswer = currentState.ownAnswer;
|
|
9644
9705
|
|
|
9645
|
-
var ownVotesByOptionId = _objectSpread$
|
|
9706
|
+
var ownVotesByOptionId = _objectSpread$2({}, currentState.ownVotesByOptionId);
|
|
9646
9707
|
|
|
9647
9708
|
var maxVotedOptionIds = currentState.maxVotedOptionIds;
|
|
9648
9709
|
|
|
@@ -9664,7 +9725,7 @@ var Poll = /*#__PURE__*/function () {
|
|
|
9664
9725
|
|
|
9665
9726
|
var pollEnrichData = extractPollEnrichedData(event.poll); // @ts-ignore
|
|
9666
9727
|
|
|
9667
|
-
_this.state.partialNext(_objectSpread$
|
|
9728
|
+
_this.state.partialNext(_objectSpread$2(_objectSpread$2({}, pollEnrichData), {}, {
|
|
9668
9729
|
latest_answers: latestAnswers,
|
|
9669
9730
|
lastActivityAt: new Date(event.created_at),
|
|
9670
9731
|
ownAnswer: ownAnswer,
|
|
@@ -9689,7 +9750,7 @@ var Poll = /*#__PURE__*/function () {
|
|
|
9689
9750
|
poll = _yield$_this$client$g.poll;
|
|
9690
9751
|
|
|
9691
9752
|
// @ts-ignore
|
|
9692
|
-
_this.state.partialNext(_objectSpread$
|
|
9753
|
+
_this.state.partialNext(_objectSpread$2(_objectSpread$2({}, poll), {}, {
|
|
9693
9754
|
lastActivityAt: new Date()
|
|
9694
9755
|
}));
|
|
9695
9756
|
|
|
@@ -9715,7 +9776,7 @@ var Poll = /*#__PURE__*/function () {
|
|
|
9715
9776
|
switch (_context2.prev = _context2.next) {
|
|
9716
9777
|
case 0:
|
|
9717
9778
|
_context2.next = 2;
|
|
9718
|
-
return _this.client.updatePoll(_objectSpread$
|
|
9779
|
+
return _this.client.updatePoll(_objectSpread$2(_objectSpread$2({}, data), {}, {
|
|
9719
9780
|
id: _this.id
|
|
9720
9781
|
}));
|
|
9721
9782
|
|
|
@@ -10426,7 +10487,7 @@ var PollManager = /*#__PURE__*/function () {
|
|
|
10426
10487
|
return PollManager;
|
|
10427
10488
|
}();
|
|
10428
10489
|
|
|
10429
|
-
var _excluded = ["created_at", "updated_at", "last_active", "online"],
|
|
10490
|
+
var _excluded$1 = ["created_at", "updated_at", "last_active", "online"],
|
|
10430
10491
|
_excluded2 = ["params", "headers"];
|
|
10431
10492
|
|
|
10432
10493
|
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; } } }; }
|
|
@@ -10435,9 +10496,9 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
|
|
|
10435
10496
|
|
|
10436
10497
|
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; }
|
|
10437
10498
|
|
|
10438
|
-
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; }
|
|
10499
|
+
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; }
|
|
10439
10500
|
|
|
10440
|
-
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; }
|
|
10501
|
+
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; }
|
|
10441
10502
|
|
|
10442
10503
|
function isString(x) {
|
|
10443
10504
|
return typeof x === 'string' || x instanceof String;
|
|
@@ -11037,9 +11098,9 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
11037
11098
|
|
|
11038
11099
|
if (event.type === 'user.presence.changed' || event.type === 'user.updated') {
|
|
11039
11100
|
if (event.user.id === _this.userID) {
|
|
11040
|
-
var user = _objectSpread({}, _this.user || {});
|
|
11101
|
+
var user = _objectSpread$1({}, _this.user || {});
|
|
11041
11102
|
|
|
11042
|
-
var _user = _objectSpread({}, _this._user || {}); // Remove deleted properties from user objects.
|
|
11103
|
+
var _user = _objectSpread$1({}, _this._user || {}); // Remove deleted properties from user objects.
|
|
11043
11104
|
|
|
11044
11105
|
|
|
11045
11106
|
for (var _key2 in _this.user) {
|
|
@@ -11060,8 +11121,8 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
11060
11121
|
} // @ts-expect-error
|
|
11061
11122
|
|
|
11062
11123
|
|
|
11063
|
-
_this._user = _objectSpread({}, _user);
|
|
11064
|
-
_this.user = _objectSpread(_objectSpread({}, user), event.user);
|
|
11124
|
+
_this._user = _objectSpread$1({}, _user);
|
|
11125
|
+
_this.user = _objectSpread$1(_objectSpread$1({}, user), event.user);
|
|
11065
11126
|
}
|
|
11066
11127
|
|
|
11067
11128
|
_this.state.updateUser(event.user);
|
|
@@ -11217,8 +11278,8 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
11217
11278
|
var _channel6 = _this.activeChannels[cid];
|
|
11218
11279
|
|
|
11219
11280
|
if (Object.keys(custom).length > 0) {
|
|
11220
|
-
_channel6.data = _objectSpread(_objectSpread({}, _channel6.data), custom);
|
|
11221
|
-
_channel6._data = _objectSpread(_objectSpread({}, _channel6._data), custom);
|
|
11281
|
+
_channel6.data = _objectSpread$1(_objectSpread$1({}, _channel6.data), custom);
|
|
11282
|
+
_channel6._data = _objectSpread$1(_objectSpread$1({}, _channel6._data), custom);
|
|
11222
11283
|
}
|
|
11223
11284
|
|
|
11224
11285
|
return _channel6;
|
|
@@ -11277,7 +11338,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
11277
11338
|
var inputOptions = _options ? _options : secretOrOptions && !isString(secretOrOptions) ? secretOrOptions : {};
|
|
11278
11339
|
this.browser = typeof inputOptions.browser !== 'undefined' ? inputOptions.browser : typeof window !== 'undefined';
|
|
11279
11340
|
this.node = !this.browser;
|
|
11280
|
-
this.options = _objectSpread({
|
|
11341
|
+
this.options = _objectSpread$1({
|
|
11281
11342
|
timeout: 3000,
|
|
11282
11343
|
withCredentials: false,
|
|
11283
11344
|
// making sure cookies are not sent
|
|
@@ -11432,7 +11493,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
11432
11493
|
this.user = user;
|
|
11433
11494
|
this.userID = user.id; // this one is actually used for requests. This is a copy of current user provided to `connectUser` function.
|
|
11434
11495
|
|
|
11435
|
-
this._user = _objectSpread({}, user);
|
|
11496
|
+
this._user = _objectSpread$1({}, user);
|
|
11436
11497
|
}
|
|
11437
11498
|
/**
|
|
11438
11499
|
* Disconnects the websocket connection, without removing the user set on client.
|
|
@@ -11487,8 +11548,8 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
11487
11548
|
apn_config = options.apn_config;
|
|
11488
11549
|
|
|
11489
11550
|
if (apn_config !== null && apn_config !== void 0 && apn_config.p12_cert) {
|
|
11490
|
-
options = _objectSpread(_objectSpread({}, options), {}, {
|
|
11491
|
-
apn_config: _objectSpread(_objectSpread({}, apn_config), {}, {
|
|
11551
|
+
options = _objectSpread$1(_objectSpread$1({}, options), {}, {
|
|
11552
|
+
apn_config: _objectSpread$1(_objectSpread$1({}, apn_config), {}, {
|
|
11492
11553
|
p12_cert: Buffer.from(apn_config.p12_cert).toString('base64')
|
|
11493
11554
|
})
|
|
11494
11555
|
});
|
|
@@ -11699,7 +11760,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
11699
11760
|
case 0:
|
|
11700
11761
|
data = _args12.length > 1 && _args12[1] !== undefined ? _args12[1] : {};
|
|
11701
11762
|
_context12.next = 3;
|
|
11702
|
-
return this.post(this.baseURL + '/check_push', _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({
|
|
11763
|
+
return this.post(this.baseURL + '/check_push', _objectSpread$1(_objectSpread$1(_objectSpread$1(_objectSpread$1(_objectSpread$1(_objectSpread$1(_objectSpread$1({
|
|
11703
11764
|
user_id: userID
|
|
11704
11765
|
}, data.messageID ? {
|
|
11705
11766
|
message_id: data.messageID
|
|
@@ -11864,7 +11925,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
11864
11925
|
case 11:
|
|
11865
11926
|
this.anonymous = false; // eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
11866
11927
|
|
|
11867
|
-
_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);
|
|
11928
|
+
_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);
|
|
11868
11929
|
_context15.next = 15;
|
|
11869
11930
|
return this.connectUser(guestUser, response.access_token);
|
|
11870
11931
|
|
|
@@ -12348,7 +12409,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
12348
12409
|
|
|
12349
12410
|
_context17.next = 8;
|
|
12350
12411
|
return this.get(this.baseURL + '/users', {
|
|
12351
|
-
payload: _objectSpread(_objectSpread({
|
|
12412
|
+
payload: _objectSpread$1(_objectSpread$1({
|
|
12352
12413
|
filter_conditions: filterConditions,
|
|
12353
12414
|
sort: normalizeQuerySort(sort)
|
|
12354
12415
|
}, defaultOptions), options)
|
|
@@ -12400,7 +12461,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
12400
12461
|
options = _args18.length > 2 && _args18[2] !== undefined ? _args18[2] : {};
|
|
12401
12462
|
_context18.next = 5;
|
|
12402
12463
|
return this.get(this.baseURL + '/query_banned_users', {
|
|
12403
|
-
payload: _objectSpread({
|
|
12464
|
+
payload: _objectSpread$1({
|
|
12404
12465
|
filter_conditions: filterConditions,
|
|
12405
12466
|
sort: normalizeQuerySort(sort)
|
|
12406
12467
|
}, options)
|
|
@@ -12447,7 +12508,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
12447
12508
|
options = _args19.length > 1 && _args19[1] !== undefined ? _args19[1] : {};
|
|
12448
12509
|
_context19.next = 4;
|
|
12449
12510
|
return this.get(this.baseURL + '/moderation/flags/message', {
|
|
12450
|
-
payload: _objectSpread({
|
|
12511
|
+
payload: _objectSpread$1({
|
|
12451
12512
|
filter_conditions: filterConditions
|
|
12452
12513
|
}, options)
|
|
12453
12514
|
});
|
|
@@ -12515,7 +12576,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
12515
12576
|
} // Return a list of channels
|
|
12516
12577
|
|
|
12517
12578
|
|
|
12518
|
-
payload = _objectSpread(_objectSpread({
|
|
12579
|
+
payload = _objectSpread$1(_objectSpread$1({
|
|
12519
12580
|
filter_conditions: filterConditions,
|
|
12520
12581
|
sort: normalizeQuerySort(sort)
|
|
12521
12582
|
}, defaultOptions), options);
|
|
@@ -12576,7 +12637,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
12576
12637
|
|
|
12577
12638
|
case 4:
|
|
12578
12639
|
// Return a list of channels
|
|
12579
|
-
payload = _objectSpread({
|
|
12640
|
+
payload = _objectSpread$1({
|
|
12580
12641
|
filter: filter,
|
|
12581
12642
|
sort: normalizeQuerySort(sort)
|
|
12582
12643
|
}, options);
|
|
@@ -12642,7 +12703,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
12642
12703
|
}
|
|
12643
12704
|
|
|
12644
12705
|
if (updatedMessagesSet) {
|
|
12645
|
-
updatedMessagesSet.pagination = _objectSpread(_objectSpread({}, updatedMessagesSet.pagination), messageSetPagination({
|
|
12706
|
+
updatedMessagesSet.pagination = _objectSpread$1(_objectSpread$1({}, updatedMessagesSet.pagination), messageSetPagination({
|
|
12646
12707
|
parentSet: updatedMessagesSet,
|
|
12647
12708
|
requestedPageSize: (queryChannelsOptions === null || queryChannelsOptions === void 0 ? void 0 : queryChannelsOptions.message_limit) || DEFAULT_QUERY_CHANNELS_MESSAGE_LIST_PAGE_SIZE,
|
|
12648
12709
|
returnedPage: channelState.messages,
|
|
@@ -12692,7 +12753,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
12692
12753
|
throw Error("Cannot specify offset with next");
|
|
12693
12754
|
|
|
12694
12755
|
case 3:
|
|
12695
|
-
payload = _objectSpread(_objectSpread({
|
|
12756
|
+
payload = _objectSpread$1(_objectSpread$1({
|
|
12696
12757
|
filter_conditions: filterConditions
|
|
12697
12758
|
}, options), {}, {
|
|
12698
12759
|
sort: options.sort ? normalizeQuerySort(options.sort) : undefined
|
|
@@ -12786,7 +12847,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
12786
12847
|
switch (_context23.prev = _context23.next) {
|
|
12787
12848
|
case 0:
|
|
12788
12849
|
_context23.next = 2;
|
|
12789
|
-
return this.post(this.baseURL + '/devices', _objectSpread(_objectSpread({
|
|
12850
|
+
return this.post(this.baseURL + '/devices', _objectSpread$1(_objectSpread$1({
|
|
12790
12851
|
id: id,
|
|
12791
12852
|
push_provider: push_provider
|
|
12792
12853
|
}, userID != null ? {
|
|
@@ -12981,7 +13042,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
12981
13042
|
switch (_context28.prev = _context28.next) {
|
|
12982
13043
|
case 0:
|
|
12983
13044
|
_context28.next = 2;
|
|
12984
|
-
return this.delete(this.baseURL + '/devices', _objectSpread({
|
|
13045
|
+
return this.delete(this.baseURL + '/devices', _objectSpread$1({
|
|
12985
13046
|
id: id
|
|
12986
13047
|
}, userID ? {
|
|
12987
13048
|
user_id: userID
|
|
@@ -13441,7 +13502,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
13441
13502
|
switch (_context35.prev = _context35.next) {
|
|
13442
13503
|
case 0:
|
|
13443
13504
|
_context35.next = 2;
|
|
13444
|
-
return this.post(this.baseURL + "/users/".concat(encodeURIComponent(userID), "/reactivate"), _objectSpread({}, options));
|
|
13505
|
+
return this.post(this.baseURL + "/users/".concat(encodeURIComponent(userID), "/reactivate"), _objectSpread$1({}, options));
|
|
13445
13506
|
|
|
13446
13507
|
case 2:
|
|
13447
13508
|
return _context35.abrupt("return", _context35.sent);
|
|
@@ -13478,7 +13539,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
13478
13539
|
switch (_context36.prev = _context36.next) {
|
|
13479
13540
|
case 0:
|
|
13480
13541
|
_context36.next = 2;
|
|
13481
|
-
return this.post(this.baseURL + "/users/reactivate", _objectSpread({
|
|
13542
|
+
return this.post(this.baseURL + "/users/reactivate", _objectSpread$1({
|
|
13482
13543
|
user_ids: user_ids
|
|
13483
13544
|
}, options));
|
|
13484
13545
|
|
|
@@ -13517,7 +13578,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
13517
13578
|
switch (_context37.prev = _context37.next) {
|
|
13518
13579
|
case 0:
|
|
13519
13580
|
_context37.next = 2;
|
|
13520
|
-
return this.post(this.baseURL + "/users/".concat(encodeURIComponent(userID), "/deactivate"), _objectSpread({}, options));
|
|
13581
|
+
return this.post(this.baseURL + "/users/".concat(encodeURIComponent(userID), "/deactivate"), _objectSpread$1({}, options));
|
|
13521
13582
|
|
|
13522
13583
|
case 2:
|
|
13523
13584
|
return _context37.abrupt("return", _context37.sent);
|
|
@@ -13554,7 +13615,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
13554
13615
|
switch (_context38.prev = _context38.next) {
|
|
13555
13616
|
case 0:
|
|
13556
13617
|
_context38.next = 2;
|
|
13557
|
-
return this.post(this.baseURL + "/users/deactivate", _objectSpread({
|
|
13618
|
+
return this.post(this.baseURL + "/users/deactivate", _objectSpread$1({
|
|
13558
13619
|
user_ids: user_ids
|
|
13559
13620
|
}, options));
|
|
13560
13621
|
|
|
@@ -13584,7 +13645,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
13584
13645
|
switch (_context39.prev = _context39.next) {
|
|
13585
13646
|
case 0:
|
|
13586
13647
|
_context39.next = 2;
|
|
13587
|
-
return this.get(this.baseURL + "/users/".concat(encodeURIComponent(userID), "/export"), _objectSpread({}, options));
|
|
13648
|
+
return this.get(this.baseURL + "/users/".concat(encodeURIComponent(userID), "/export"), _objectSpread$1({}, options));
|
|
13588
13649
|
|
|
13589
13650
|
case 2:
|
|
13590
13651
|
return _context39.abrupt("return", _context39.sent);
|
|
@@ -13619,7 +13680,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
13619
13680
|
switch (_context40.prev = _context40.next) {
|
|
13620
13681
|
case 0:
|
|
13621
13682
|
_context40.next = 2;
|
|
13622
|
-
return this.post(this.baseURL + '/moderation/ban', _objectSpread({
|
|
13683
|
+
return this.post(this.baseURL + '/moderation/ban', _objectSpread$1({
|
|
13623
13684
|
target_user_id: targetUserID
|
|
13624
13685
|
}, options));
|
|
13625
13686
|
|
|
@@ -13656,7 +13717,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
13656
13717
|
switch (_context41.prev = _context41.next) {
|
|
13657
13718
|
case 0:
|
|
13658
13719
|
_context41.next = 2;
|
|
13659
|
-
return this.delete(this.baseURL + '/moderation/ban', _objectSpread({
|
|
13720
|
+
return this.delete(this.baseURL + '/moderation/ban', _objectSpread$1({
|
|
13660
13721
|
target_user_id: targetUserID
|
|
13661
13722
|
}, options));
|
|
13662
13723
|
|
|
@@ -13693,7 +13754,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
13693
13754
|
switch (_context42.prev = _context42.next) {
|
|
13694
13755
|
case 0:
|
|
13695
13756
|
_context42.next = 2;
|
|
13696
|
-
return this.banUser(targetUserID, _objectSpread({
|
|
13757
|
+
return this.banUser(targetUserID, _objectSpread$1({
|
|
13697
13758
|
shadow: true
|
|
13698
13759
|
}, options));
|
|
13699
13760
|
|
|
@@ -13730,7 +13791,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
13730
13791
|
switch (_context43.prev = _context43.next) {
|
|
13731
13792
|
case 0:
|
|
13732
13793
|
_context43.next = 2;
|
|
13733
|
-
return this.unbanUser(targetUserID, _objectSpread({
|
|
13794
|
+
return this.unbanUser(targetUserID, _objectSpread$1({
|
|
13734
13795
|
shadow: true
|
|
13735
13796
|
}, options));
|
|
13736
13797
|
|
|
@@ -13760,7 +13821,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
13760
13821
|
switch (_context44.prev = _context44.next) {
|
|
13761
13822
|
case 0:
|
|
13762
13823
|
_context44.next = 2;
|
|
13763
|
-
return this.post(this.baseURL + '/users/block', _objectSpread({
|
|
13824
|
+
return this.post(this.baseURL + '/users/block', _objectSpread$1({
|
|
13764
13825
|
blocked_user_id: blockedUserID
|
|
13765
13826
|
}, user_id ? {
|
|
13766
13827
|
user_id: user_id
|
|
@@ -13792,7 +13853,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
13792
13853
|
switch (_context45.prev = _context45.next) {
|
|
13793
13854
|
case 0:
|
|
13794
13855
|
_context45.next = 2;
|
|
13795
|
-
return this.get(this.baseURL + '/users/block', _objectSpread({}, user_id ? {
|
|
13856
|
+
return this.get(this.baseURL + '/users/block', _objectSpread$1({}, user_id ? {
|
|
13796
13857
|
user_id: user_id
|
|
13797
13858
|
} : {}));
|
|
13798
13859
|
|
|
@@ -13822,7 +13883,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
13822
13883
|
switch (_context46.prev = _context46.next) {
|
|
13823
13884
|
case 0:
|
|
13824
13885
|
_context46.next = 2;
|
|
13825
|
-
return this.post(this.baseURL + '/users/unblock', _objectSpread({
|
|
13886
|
+
return this.post(this.baseURL + '/users/unblock', _objectSpread$1({
|
|
13826
13887
|
blocked_user_id: blockedUserID
|
|
13827
13888
|
}, userID ? {
|
|
13828
13889
|
user_id: userID
|
|
@@ -13865,7 +13926,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
13865
13926
|
case 0:
|
|
13866
13927
|
options = _args47.length > 2 && _args47[2] !== undefined ? _args47[2] : {};
|
|
13867
13928
|
_context47.next = 3;
|
|
13868
|
-
return this.post(this.baseURL + '/moderation/mute', _objectSpread(_objectSpread({
|
|
13929
|
+
return this.post(this.baseURL + '/moderation/mute', _objectSpread$1(_objectSpread$1({
|
|
13869
13930
|
target_id: targetID
|
|
13870
13931
|
}, userID ? {
|
|
13871
13932
|
user_id: userID
|
|
@@ -13904,7 +13965,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
13904
13965
|
switch (_context48.prev = _context48.next) {
|
|
13905
13966
|
case 0:
|
|
13906
13967
|
_context48.next = 2;
|
|
13907
|
-
return this.post(this.baseURL + '/moderation/unmute', _objectSpread({
|
|
13968
|
+
return this.post(this.baseURL + '/moderation/unmute', _objectSpread$1({
|
|
13908
13969
|
target_id: targetID
|
|
13909
13970
|
}, currentUserID ? {
|
|
13910
13971
|
user_id: currentUserID
|
|
@@ -13965,7 +14026,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
13965
14026
|
case 0:
|
|
13966
14027
|
options = _args49.length > 1 && _args49[1] !== undefined ? _args49[1] : {};
|
|
13967
14028
|
_context49.next = 3;
|
|
13968
|
-
return this.post(this.baseURL + '/moderation/flag', _objectSpread({
|
|
14029
|
+
return this.post(this.baseURL + '/moderation/flag', _objectSpread$1({
|
|
13969
14030
|
target_message_id: targetMessageID
|
|
13970
14031
|
}, options));
|
|
13971
14032
|
|
|
@@ -14005,7 +14066,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
14005
14066
|
case 0:
|
|
14006
14067
|
options = _args50.length > 1 && _args50[1] !== undefined ? _args50[1] : {};
|
|
14007
14068
|
_context50.next = 3;
|
|
14008
|
-
return this.post(this.baseURL + '/moderation/flag', _objectSpread({
|
|
14069
|
+
return this.post(this.baseURL + '/moderation/flag', _objectSpread$1({
|
|
14009
14070
|
target_user_id: targetID
|
|
14010
14071
|
}, options));
|
|
14011
14072
|
|
|
@@ -14045,7 +14106,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
14045
14106
|
case 0:
|
|
14046
14107
|
options = _args51.length > 1 && _args51[1] !== undefined ? _args51[1] : {};
|
|
14047
14108
|
_context51.next = 3;
|
|
14048
|
-
return this.post(this.baseURL + '/moderation/unflag', _objectSpread({
|
|
14109
|
+
return this.post(this.baseURL + '/moderation/unflag', _objectSpread$1({
|
|
14049
14110
|
target_message_id: targetMessageID
|
|
14050
14111
|
}, options));
|
|
14051
14112
|
|
|
@@ -14085,7 +14146,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
14085
14146
|
case 0:
|
|
14086
14147
|
options = _args52.length > 1 && _args52[1] !== undefined ? _args52[1] : {};
|
|
14087
14148
|
_context52.next = 3;
|
|
14088
|
-
return this.post(this.baseURL + '/moderation/unflag', _objectSpread({
|
|
14149
|
+
return this.post(this.baseURL + '/moderation/unflag', _objectSpread$1({
|
|
14089
14150
|
target_user_id: targetID
|
|
14090
14151
|
}, options));
|
|
14091
14152
|
|
|
@@ -14126,7 +14187,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
14126
14187
|
case 0:
|
|
14127
14188
|
options = _args53.length > 1 && _args53[1] !== undefined ? _args53[1] : {};
|
|
14128
14189
|
_context53.next = 3;
|
|
14129
|
-
return this.post(this.baseURL + "/calls/".concat(encodeURIComponent(callID)), _objectSpread({}, options));
|
|
14190
|
+
return this.post(this.baseURL + "/calls/".concat(encodeURIComponent(callID)), _objectSpread$1({}, options));
|
|
14130
14191
|
|
|
14131
14192
|
case 3:
|
|
14132
14193
|
return _context53.abrupt("return", _context53.sent);
|
|
@@ -14173,7 +14234,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
14173
14234
|
filterConditions = _args54.length > 0 && _args54[0] !== undefined ? _args54[0] : {};
|
|
14174
14235
|
options = _args54.length > 1 && _args54[1] !== undefined ? _args54[1] : {};
|
|
14175
14236
|
_context54.next = 4;
|
|
14176
|
-
return this.post(this.baseURL + '/moderation/flags', _objectSpread({
|
|
14237
|
+
return this.post(this.baseURL + '/moderation/flags', _objectSpread$1({
|
|
14177
14238
|
filter_conditions: filterConditions
|
|
14178
14239
|
}, options));
|
|
14179
14240
|
|
|
@@ -14222,7 +14283,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
14222
14283
|
filterConditions = _args55.length > 0 && _args55[0] !== undefined ? _args55[0] : {};
|
|
14223
14284
|
options = _args55.length > 1 && _args55[1] !== undefined ? _args55[1] : {};
|
|
14224
14285
|
_context55.next = 4;
|
|
14225
|
-
return this.post(this.baseURL + '/moderation/reports', _objectSpread({
|
|
14286
|
+
return this.post(this.baseURL + '/moderation/reports', _objectSpread$1({
|
|
14226
14287
|
filter_conditions: filterConditions
|
|
14227
14288
|
}, options));
|
|
14228
14289
|
|
|
@@ -14270,7 +14331,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
14270
14331
|
case 0:
|
|
14271
14332
|
options = _args56.length > 2 && _args56[2] !== undefined ? _args56[2] : {};
|
|
14272
14333
|
_context56.next = 3;
|
|
14273
|
-
return this.patch(this.baseURL + "/moderation/reports/".concat(encodeURIComponent(id)), _objectSpread({
|
|
14334
|
+
return this.patch(this.baseURL + "/moderation/reports/".concat(encodeURIComponent(id)), _objectSpread$1({
|
|
14274
14335
|
review_result: reviewResult
|
|
14275
14336
|
}, options));
|
|
14276
14337
|
|
|
@@ -14312,7 +14373,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
14312
14373
|
case 0:
|
|
14313
14374
|
options = _args57.length > 1 && _args57[1] !== undefined ? _args57[1] : {};
|
|
14314
14375
|
_context57.next = 3;
|
|
14315
|
-
return this.post(this.baseURL + '/moderation/unblock_message', _objectSpread({
|
|
14376
|
+
return this.post(this.baseURL + '/moderation/unblock_message', _objectSpread$1({
|
|
14316
14377
|
target_message_id: targetMessageID
|
|
14317
14378
|
}, options));
|
|
14318
14379
|
|
|
@@ -14355,7 +14416,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
14355
14416
|
case 0:
|
|
14356
14417
|
data = _args58.length > 0 && _args58[0] !== undefined ? _args58[0] : {};
|
|
14357
14418
|
_context58.next = 3;
|
|
14358
|
-
return this.post(this.baseURL + '/channels/read', _objectSpread({}, data));
|
|
14419
|
+
return this.post(this.baseURL + '/channels/read', _objectSpread$1({}, data));
|
|
14359
14420
|
|
|
14360
14421
|
case 3:
|
|
14361
14422
|
case "end":
|
|
@@ -14647,7 +14708,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
14647
14708
|
}
|
|
14648
14709
|
|
|
14649
14710
|
_context61.next = 10;
|
|
14650
|
-
return this.post(this.baseURL + "/messages/".concat(encodeURIComponent(message.id)), _objectSpread({
|
|
14711
|
+
return this.post(this.baseURL + "/messages/".concat(encodeURIComponent(message.id)), _objectSpread$1({
|
|
14651
14712
|
message: clonedMessage
|
|
14652
14713
|
}, options));
|
|
14653
14714
|
|
|
@@ -14708,7 +14769,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
14708
14769
|
}
|
|
14709
14770
|
|
|
14710
14771
|
_context62.next = 6;
|
|
14711
|
-
return this.put(this.baseURL + "/messages/".concat(encodeURIComponent(id)), _objectSpread(_objectSpread(_objectSpread({}, partialMessageObject), options), {}, {
|
|
14772
|
+
return this.put(this.baseURL + "/messages/".concat(encodeURIComponent(id)), _objectSpread$1(_objectSpread$1(_objectSpread$1({}, partialMessageObject), options), {}, {
|
|
14712
14773
|
user: user
|
|
14713
14774
|
}));
|
|
14714
14775
|
|
|
@@ -14818,7 +14879,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
14818
14879
|
switch (_context65.prev = _context65.next) {
|
|
14819
14880
|
case 0:
|
|
14820
14881
|
_context65.next = 2;
|
|
14821
|
-
return this.get(this.baseURL + "/messages/".concat(encodeURIComponent(messageID)), _objectSpread({}, options));
|
|
14882
|
+
return this.get(this.baseURL + "/messages/".concat(encodeURIComponent(messageID)), _objectSpread$1({}, options));
|
|
14822
14883
|
|
|
14823
14884
|
case 2:
|
|
14824
14885
|
return _context65.abrupt("return", _context65.sent);
|
|
@@ -14864,7 +14925,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
14864
14925
|
switch (_context66.prev = _context66.next) {
|
|
14865
14926
|
case 0:
|
|
14866
14927
|
options = _args66.length > 0 && _args66[0] !== undefined ? _args66[0] : {};
|
|
14867
|
-
optionsWithDefaults = _objectSpread({
|
|
14928
|
+
optionsWithDefaults = _objectSpread$1({
|
|
14868
14929
|
limit: 10,
|
|
14869
14930
|
participant_limit: 10,
|
|
14870
14931
|
reply_limit: 3,
|
|
@@ -14933,7 +14994,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
14933
14994
|
throw Error('Please specify the messageId when calling getThread');
|
|
14934
14995
|
|
|
14935
14996
|
case 3:
|
|
14936
|
-
optionsWithDefaults = _objectSpread({
|
|
14997
|
+
optionsWithDefaults = _objectSpread$1({
|
|
14937
14998
|
participant_limit: 100,
|
|
14938
14999
|
reply_limit: 3,
|
|
14939
15000
|
watch: true
|
|
@@ -14992,7 +15053,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
14992
15053
|
// check for reserved fields from ThreadResponse type within partialThreadObject's set and unset.
|
|
14993
15054
|
// Throw error if any of the reserved field is found.
|
|
14994
15055
|
reservedThreadFields = ['created_at', 'id', 'last_message_at', 'type', 'updated_at', 'user', 'reply_count', 'participants', 'channel', 'custom'];
|
|
14995
|
-
_context68.t0 = _regeneratorRuntime__default['default'].keys(_objectSpread(_objectSpread({}, partialThreadObject.set), partialThreadObject.unset));
|
|
15056
|
+
_context68.t0 = _regeneratorRuntime__default['default'].keys(_objectSpread$1(_objectSpread$1({}, partialThreadObject.set), partialThreadObject.unset));
|
|
14996
15057
|
|
|
14997
15058
|
case 4:
|
|
14998
15059
|
if ((_context68.t1 = _context68.t0()).done) {
|
|
@@ -15037,7 +15098,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
15037
15098
|
}, {
|
|
15038
15099
|
key: "getUserAgent",
|
|
15039
15100
|
value: function getUserAgent() {
|
|
15040
|
-
return this.userAgent || "stream-chat-javascript-client-".concat(this.node ? 'node' : 'browser', "-", "8.
|
|
15101
|
+
return this.userAgent || "stream-chat-javascript-client-".concat(this.node ? 'node' : 'browser', "-", "8.55.0");
|
|
15041
15102
|
}
|
|
15042
15103
|
}, {
|
|
15043
15104
|
key: "setUserAgent",
|
|
@@ -15072,7 +15133,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
15072
15133
|
}
|
|
15073
15134
|
|
|
15074
15135
|
if (!((_options$headers = options.headers) !== null && _options$headers !== void 0 && _options$headers['x-client-request-id'])) {
|
|
15075
|
-
options.headers = _objectSpread(_objectSpread({}, options.headers), {}, {
|
|
15136
|
+
options.headers = _objectSpread$1(_objectSpread$1({}, options.headers), {}, {
|
|
15076
15137
|
'x-client-request-id': randomId()
|
|
15077
15138
|
});
|
|
15078
15139
|
}
|
|
@@ -15082,13 +15143,13 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
15082
15143
|
axiosRequestConfigHeaders = _ref9.headers,
|
|
15083
15144
|
axiosRequestConfigRest = _objectWithoutProperties__default['default'](_ref9, _excluded2);
|
|
15084
15145
|
|
|
15085
|
-
return _objectSpread(_objectSpread(_objectSpread({
|
|
15086
|
-
params: _objectSpread(_objectSpread({
|
|
15146
|
+
return _objectSpread$1(_objectSpread$1(_objectSpread$1({
|
|
15147
|
+
params: _objectSpread$1(_objectSpread$1({
|
|
15087
15148
|
user_id: this.userID,
|
|
15088
15149
|
connection_id: this._getConnectionID(),
|
|
15089
15150
|
api_key: this.key
|
|
15090
15151
|
}, options.params), axiosRequestConfigParams || {}),
|
|
15091
|
-
headers: _objectSpread(_objectSpread(_objectSpread({}, authorization), {}, {
|
|
15152
|
+
headers: _objectSpread$1(_objectSpread$1(_objectSpread$1({}, authorization), {}, {
|
|
15092
15153
|
'stream-auth-type': this.getAuthType(),
|
|
15093
15154
|
'X-Stream-Client': this.getUserAgent()
|
|
15094
15155
|
}, options.headers), axiosRequestConfigHeaders || {})
|
|
@@ -15158,7 +15219,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
15158
15219
|
}, {
|
|
15159
15220
|
key: "createPermission",
|
|
15160
15221
|
value: function createPermission(permissionData) {
|
|
15161
|
-
return this.post("".concat(this.baseURL, "/permissions"), _objectSpread({}, permissionData));
|
|
15222
|
+
return this.post("".concat(this.baseURL, "/permissions"), _objectSpread$1({}, permissionData));
|
|
15162
15223
|
}
|
|
15163
15224
|
/** updatePermission - updates an existing custom permission
|
|
15164
15225
|
*
|
|
@@ -15170,7 +15231,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
15170
15231
|
}, {
|
|
15171
15232
|
key: "updatePermission",
|
|
15172
15233
|
value: function updatePermission(id, permissionData) {
|
|
15173
|
-
return this.put("".concat(this.baseURL, "/permissions/").concat(encodeURIComponent(id)), _objectSpread({}, permissionData));
|
|
15234
|
+
return this.put("".concat(this.baseURL, "/permissions/").concat(encodeURIComponent(id)), _objectSpread$1({}, permissionData));
|
|
15174
15235
|
}
|
|
15175
15236
|
/** deletePermission - deletes a custom permission
|
|
15176
15237
|
*
|
|
@@ -15239,7 +15300,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
15239
15300
|
key: "sync",
|
|
15240
15301
|
value: function sync(channel_cids, last_sync_at) {
|
|
15241
15302
|
var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
15242
|
-
return this.post("".concat(this.baseURL, "/sync"), _objectSpread({
|
|
15303
|
+
return this.post("".concat(this.baseURL, "/sync"), _objectSpread$1({
|
|
15243
15304
|
channel_cids: channel_cids,
|
|
15244
15305
|
last_sync_at: last_sync_at
|
|
15245
15306
|
}, options));
|
|
@@ -15364,7 +15425,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
15364
15425
|
value: function exportChannels(request) {
|
|
15365
15426
|
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
15366
15427
|
|
|
15367
|
-
var payload = _objectSpread({
|
|
15428
|
+
var payload = _objectSpread$1({
|
|
15368
15429
|
channels: request
|
|
15369
15430
|
}, options);
|
|
15370
15431
|
|
|
@@ -15432,7 +15493,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
15432
15493
|
switch (_context70.prev = _context70.next) {
|
|
15433
15494
|
case 0:
|
|
15434
15495
|
this.validateServerSideAuth();
|
|
15435
|
-
body = _objectSpread({
|
|
15496
|
+
body = _objectSpread$1({
|
|
15436
15497
|
id: id,
|
|
15437
15498
|
type: type
|
|
15438
15499
|
}, data);
|
|
@@ -15635,7 +15696,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
15635
15696
|
sort = _args76.length > 2 && _args76[2] !== undefined ? _args76[2] : [];
|
|
15636
15697
|
options = _args76.length > 3 && _args76[3] !== undefined ? _args76[3] : {};
|
|
15637
15698
|
this.validateServerSideAuth();
|
|
15638
|
-
return _context76.abrupt("return", this.post(this.baseURL + "/segments/".concat(encodeURIComponent(id), "/targets/query"), _objectSpread({
|
|
15699
|
+
return _context76.abrupt("return", this.post(this.baseURL + "/segments/".concat(encodeURIComponent(id), "/targets/query"), _objectSpread$1({
|
|
15639
15700
|
filter: filter || {},
|
|
15640
15701
|
sort: sort || []
|
|
15641
15702
|
}, options)));
|
|
@@ -15713,7 +15774,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
15713
15774
|
case 0:
|
|
15714
15775
|
options = _args78.length > 2 && _args78[2] !== undefined ? _args78[2] : {};
|
|
15715
15776
|
this.validateServerSideAuth();
|
|
15716
|
-
return _context78.abrupt("return", this.post(this.baseURL + "/segments/query", _objectSpread({
|
|
15777
|
+
return _context78.abrupt("return", this.post(this.baseURL + "/segments/query", _objectSpread$1({
|
|
15717
15778
|
filter: filter,
|
|
15718
15779
|
sort: sort
|
|
15719
15780
|
}, options)));
|
|
@@ -15816,7 +15877,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
15816
15877
|
switch (_context81.prev = _context81.next) {
|
|
15817
15878
|
case 0:
|
|
15818
15879
|
this.validateServerSideAuth();
|
|
15819
|
-
return _context81.abrupt("return", this.post(this.baseURL + "/campaigns", _objectSpread({}, params)));
|
|
15880
|
+
return _context81.abrupt("return", this.post(this.baseURL + "/campaigns", _objectSpread$1({}, params)));
|
|
15820
15881
|
|
|
15821
15882
|
case 2:
|
|
15822
15883
|
case "end":
|
|
@@ -15902,7 +15963,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
15902
15963
|
case 0:
|
|
15903
15964
|
this.validateServerSideAuth();
|
|
15904
15965
|
_context84.next = 3;
|
|
15905
|
-
return this.post(this.baseURL + "/campaigns/query", _objectSpread({
|
|
15966
|
+
return this.post(this.baseURL + "/campaigns/query", _objectSpread$1({
|
|
15906
15967
|
filter: filter,
|
|
15907
15968
|
sort: sort
|
|
15908
15969
|
}, options || {}));
|
|
@@ -16110,7 +16171,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
16110
16171
|
case 0:
|
|
16111
16172
|
options = _args90.length > 1 && _args90[1] !== undefined ? _args90[1] : {};
|
|
16112
16173
|
_context90.next = 3;
|
|
16113
|
-
return this.post(this.baseURL + "/channels/delete", _objectSpread({
|
|
16174
|
+
return this.post(this.baseURL + "/channels/delete", _objectSpread$1({
|
|
16114
16175
|
cids: cids
|
|
16115
16176
|
}, options));
|
|
16116
16177
|
|
|
@@ -16177,7 +16238,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
16177
16238
|
|
|
16178
16239
|
case 7:
|
|
16179
16240
|
_context91.next = 9;
|
|
16180
|
-
return this.post(this.baseURL + "/users/delete", _objectSpread({
|
|
16241
|
+
return this.post(this.baseURL + "/users/delete", _objectSpread$1({
|
|
16181
16242
|
user_ids: user_ids
|
|
16182
16243
|
}, options));
|
|
16183
16244
|
|
|
@@ -16267,7 +16328,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
16267
16328
|
mode: 'upsert'
|
|
16268
16329
|
};
|
|
16269
16330
|
_context93.next = 3;
|
|
16270
|
-
return this.post(this.baseURL + "/imports", _objectSpread({
|
|
16331
|
+
return this.post(this.baseURL + "/imports", _objectSpread$1({
|
|
16271
16332
|
path: path
|
|
16272
16333
|
}, options));
|
|
16273
16334
|
|
|
@@ -16546,7 +16607,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
16546
16607
|
switch (_context100.prev = _context100.next) {
|
|
16547
16608
|
case 0:
|
|
16548
16609
|
_context100.next = 2;
|
|
16549
|
-
return this.post(this.baseURL + "/polls", _objectSpread(_objectSpread({}, poll), userId ? {
|
|
16610
|
+
return this.post(this.baseURL + "/polls", _objectSpread$1(_objectSpread$1({}, poll), userId ? {
|
|
16550
16611
|
user_id: userId
|
|
16551
16612
|
} : {}));
|
|
16552
16613
|
|
|
@@ -16620,7 +16681,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
16620
16681
|
switch (_context102.prev = _context102.next) {
|
|
16621
16682
|
case 0:
|
|
16622
16683
|
_context102.next = 2;
|
|
16623
|
-
return this.put(this.baseURL + "/polls", _objectSpread(_objectSpread({}, poll), userId ? {
|
|
16684
|
+
return this.put(this.baseURL + "/polls", _objectSpread$1(_objectSpread$1({}, poll), userId ? {
|
|
16624
16685
|
user_id: userId
|
|
16625
16686
|
} : {}));
|
|
16626
16687
|
|
|
@@ -16659,7 +16720,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
16659
16720
|
switch (_context103.prev = _context103.next) {
|
|
16660
16721
|
case 0:
|
|
16661
16722
|
_context103.next = 2;
|
|
16662
|
-
return this.patch(this.baseURL + "/polls/".concat(encodeURIComponent(id)), _objectSpread(_objectSpread({}, partialPollObject), userId ? {
|
|
16723
|
+
return this.patch(this.baseURL + "/polls/".concat(encodeURIComponent(id)), _objectSpread$1(_objectSpread$1({}, partialPollObject), userId ? {
|
|
16663
16724
|
user_id: userId
|
|
16664
16725
|
} : {}));
|
|
16665
16726
|
|
|
@@ -16696,7 +16757,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
16696
16757
|
switch (_context104.prev = _context104.next) {
|
|
16697
16758
|
case 0:
|
|
16698
16759
|
_context104.next = 2;
|
|
16699
|
-
return this.delete(this.baseURL + "/polls/".concat(encodeURIComponent(id)), _objectSpread({}, userId ? {
|
|
16760
|
+
return this.delete(this.baseURL + "/polls/".concat(encodeURIComponent(id)), _objectSpread$1({}, userId ? {
|
|
16700
16761
|
user_id: userId
|
|
16701
16762
|
} : {}));
|
|
16702
16763
|
|
|
@@ -16769,7 +16830,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
16769
16830
|
switch (_context106.prev = _context106.next) {
|
|
16770
16831
|
case 0:
|
|
16771
16832
|
_context106.next = 2;
|
|
16772
|
-
return this.post(this.baseURL + "/polls/".concat(encodeURIComponent(pollId), "/options"), _objectSpread(_objectSpread({}, option), userId ? {
|
|
16833
|
+
return this.post(this.baseURL + "/polls/".concat(encodeURIComponent(pollId), "/options"), _objectSpread$1(_objectSpread$1({}, option), userId ? {
|
|
16773
16834
|
user_id: userId
|
|
16774
16835
|
} : {}));
|
|
16775
16836
|
|
|
@@ -16845,7 +16906,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
16845
16906
|
switch (_context108.prev = _context108.next) {
|
|
16846
16907
|
case 0:
|
|
16847
16908
|
_context108.next = 2;
|
|
16848
|
-
return this.put(this.baseURL + "/polls/".concat(encodeURIComponent(pollId), "/options"), _objectSpread(_objectSpread({}, option), userId ? {
|
|
16909
|
+
return this.put(this.baseURL + "/polls/".concat(encodeURIComponent(pollId), "/options"), _objectSpread$1(_objectSpread$1({}, option), userId ? {
|
|
16849
16910
|
user_id: userId
|
|
16850
16911
|
} : {}));
|
|
16851
16912
|
|
|
@@ -16922,7 +16983,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
16922
16983
|
switch (_context110.prev = _context110.next) {
|
|
16923
16984
|
case 0:
|
|
16924
16985
|
_context110.next = 2;
|
|
16925
|
-
return this.post(this.baseURL + "/messages/".concat(encodeURIComponent(messageId), "/polls/").concat(encodeURIComponent(pollId), "/vote"), _objectSpread({
|
|
16986
|
+
return this.post(this.baseURL + "/messages/".concat(encodeURIComponent(messageId), "/polls/").concat(encodeURIComponent(pollId), "/vote"), _objectSpread$1({
|
|
16926
16987
|
vote: vote
|
|
16927
16988
|
}, userId ? {
|
|
16928
16989
|
user_id: userId
|
|
@@ -16988,7 +17049,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
16988
17049
|
switch (_context112.prev = _context112.next) {
|
|
16989
17050
|
case 0:
|
|
16990
17051
|
_context112.next = 2;
|
|
16991
|
-
return this.delete(this.baseURL + "/messages/".concat(encodeURIComponent(messageId), "/polls/").concat(encodeURIComponent(pollId), "/vote/").concat(encodeURIComponent(voteId)), _objectSpread({}, userId ? {
|
|
17052
|
+
return this.delete(this.baseURL + "/messages/".concat(encodeURIComponent(messageId), "/polls/").concat(encodeURIComponent(pollId), "/vote/").concat(encodeURIComponent(voteId)), _objectSpread$1({}, userId ? {
|
|
16992
17053
|
user_id: userId
|
|
16993
17054
|
} : {}));
|
|
16994
17055
|
|
|
@@ -17038,7 +17099,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
17038
17099
|
userId = _args113.length > 3 ? _args113[3] : undefined;
|
|
17039
17100
|
q = userId ? "?user_id=".concat(userId) : '';
|
|
17040
17101
|
_context113.next = 7;
|
|
17041
|
-
return this.post(this.baseURL + "/polls/query".concat(q), _objectSpread({
|
|
17102
|
+
return this.post(this.baseURL + "/polls/query".concat(q), _objectSpread$1({
|
|
17042
17103
|
filter: filter,
|
|
17043
17104
|
sort: normalizeQuerySort(sort)
|
|
17044
17105
|
}, options));
|
|
@@ -17090,7 +17151,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
17090
17151
|
userId = _args114.length > 4 ? _args114[4] : undefined;
|
|
17091
17152
|
q = userId ? "?user_id=".concat(userId) : '';
|
|
17092
17153
|
_context114.next = 7;
|
|
17093
|
-
return this.post(this.baseURL + "/polls/".concat(encodeURIComponent(pollId), "/votes").concat(q), _objectSpread({
|
|
17154
|
+
return this.post(this.baseURL + "/polls/".concat(encodeURIComponent(pollId), "/votes").concat(q), _objectSpread$1({
|
|
17094
17155
|
filter: filter,
|
|
17095
17156
|
sort: normalizeQuerySort(sort)
|
|
17096
17157
|
}, options));
|
|
@@ -17142,8 +17203,8 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
17142
17203
|
userId = _args115.length > 4 ? _args115[4] : undefined;
|
|
17143
17204
|
q = userId ? "?user_id=".concat(userId) : '';
|
|
17144
17205
|
_context115.next = 7;
|
|
17145
|
-
return this.post(this.baseURL + "/polls/".concat(encodeURIComponent(pollId), "/votes").concat(q), _objectSpread({
|
|
17146
|
-
filter: _objectSpread(_objectSpread({}, filter), {}, {
|
|
17206
|
+
return this.post(this.baseURL + "/polls/".concat(encodeURIComponent(pollId), "/votes").concat(q), _objectSpread$1({
|
|
17207
|
+
filter: _objectSpread$1(_objectSpread$1({}, filter), {}, {
|
|
17147
17208
|
is_answer: true
|
|
17148
17209
|
}),
|
|
17149
17210
|
sort: normalizeQuerySort(sort)
|
|
@@ -17190,7 +17251,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
17190
17251
|
sort = _args116.length > 1 && _args116[1] !== undefined ? _args116[1] : [];
|
|
17191
17252
|
options = _args116.length > 2 && _args116[2] !== undefined ? _args116[2] : {};
|
|
17192
17253
|
_context116.next = 5;
|
|
17193
|
-
return this.post(this.baseURL + '/messages/history', _objectSpread({
|
|
17254
|
+
return this.post(this.baseURL + '/messages/history', _objectSpread$1({
|
|
17194
17255
|
filter: filter,
|
|
17195
17256
|
sort: normalizeQuerySort(sort)
|
|
17196
17257
|
}, options));
|
|
@@ -17233,7 +17294,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
17233
17294
|
case 0:
|
|
17234
17295
|
options = _args117.length > 2 && _args117[2] !== undefined ? _args117[2] : {};
|
|
17235
17296
|
_context117.next = 3;
|
|
17236
|
-
return this.post(this.baseURL + '/automod/v1/moderation/update_flags', _objectSpread({
|
|
17297
|
+
return this.post(this.baseURL + '/automod/v1/moderation/update_flags', _objectSpread$1({
|
|
17237
17298
|
message_ids: message_ids,
|
|
17238
17299
|
reviewed_by: reviewed_by
|
|
17239
17300
|
}, options));
|
|
@@ -17412,14 +17473,772 @@ var BuiltinPermissions = {
|
|
|
17412
17473
|
UseFrozenChannel: 'Send messages and reactions to frozen channels'
|
|
17413
17474
|
};
|
|
17414
17475
|
|
|
17476
|
+
var _excluded = ["lastQueryError"];
|
|
17477
|
+
|
|
17478
|
+
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); }; }
|
|
17479
|
+
|
|
17480
|
+
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; } }
|
|
17481
|
+
|
|
17482
|
+
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; }
|
|
17483
|
+
|
|
17484
|
+
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; }
|
|
17485
|
+
var DEFAULT_SEARCH_SOURCE_OPTIONS = {
|
|
17486
|
+
debounceMs: 300,
|
|
17487
|
+
pageSize: 10
|
|
17488
|
+
};
|
|
17489
|
+
var BaseSearchSource = /*#__PURE__*/function () {
|
|
17490
|
+
function BaseSearchSource(options) {
|
|
17491
|
+
var _this = this;
|
|
17492
|
+
|
|
17493
|
+
_classCallCheck__default['default'](this, BaseSearchSource);
|
|
17494
|
+
|
|
17495
|
+
_defineProperty__default['default'](this, "state", void 0);
|
|
17496
|
+
|
|
17497
|
+
_defineProperty__default['default'](this, "pageSize", void 0);
|
|
17498
|
+
|
|
17499
|
+
_defineProperty__default['default'](this, "type", void 0);
|
|
17500
|
+
|
|
17501
|
+
_defineProperty__default['default'](this, "searchDebounced", void 0);
|
|
17502
|
+
|
|
17503
|
+
_defineProperty__default['default'](this, "setDebounceOptions", function (_ref) {
|
|
17504
|
+
var debounceMs = _ref.debounceMs;
|
|
17505
|
+
_this.searchDebounced = debounce(_this.executeQuery.bind(_this), debounceMs);
|
|
17506
|
+
});
|
|
17507
|
+
|
|
17508
|
+
_defineProperty__default['default'](this, "activate", function () {
|
|
17509
|
+
if (_this.isActive) return;
|
|
17510
|
+
|
|
17511
|
+
_this.state.partialNext({
|
|
17512
|
+
isActive: true
|
|
17513
|
+
});
|
|
17514
|
+
});
|
|
17515
|
+
|
|
17516
|
+
_defineProperty__default['default'](this, "deactivate", function () {
|
|
17517
|
+
if (!_this.isActive) return;
|
|
17518
|
+
|
|
17519
|
+
_this.state.partialNext({
|
|
17520
|
+
isActive: false
|
|
17521
|
+
});
|
|
17522
|
+
});
|
|
17523
|
+
|
|
17524
|
+
_defineProperty__default['default'](this, "search", function (searchQuery) {
|
|
17525
|
+
_this.searchDebounced(searchQuery);
|
|
17526
|
+
});
|
|
17527
|
+
|
|
17528
|
+
var _DEFAULT_SEARCH_SOURC = _objectSpread(_objectSpread({}, DEFAULT_SEARCH_SOURCE_OPTIONS), options),
|
|
17529
|
+
_debounceMs = _DEFAULT_SEARCH_SOURC.debounceMs,
|
|
17530
|
+
pageSize = _DEFAULT_SEARCH_SOURC.pageSize;
|
|
17531
|
+
|
|
17532
|
+
this.pageSize = pageSize;
|
|
17533
|
+
this.state = new StateStore(this.initialState);
|
|
17534
|
+
this.setDebounceOptions({
|
|
17535
|
+
debounceMs: _debounceMs
|
|
17536
|
+
});
|
|
17537
|
+
}
|
|
17538
|
+
|
|
17539
|
+
_createClass__default['default'](BaseSearchSource, [{
|
|
17540
|
+
key: "lastQueryError",
|
|
17541
|
+
get: function get() {
|
|
17542
|
+
return this.state.getLatestValue().lastQueryError;
|
|
17543
|
+
}
|
|
17544
|
+
}, {
|
|
17545
|
+
key: "hasNext",
|
|
17546
|
+
get: function get() {
|
|
17547
|
+
return this.state.getLatestValue().hasNext;
|
|
17548
|
+
}
|
|
17549
|
+
}, {
|
|
17550
|
+
key: "hasResults",
|
|
17551
|
+
get: function get() {
|
|
17552
|
+
return Array.isArray(this.state.getLatestValue().items);
|
|
17553
|
+
}
|
|
17554
|
+
}, {
|
|
17555
|
+
key: "isActive",
|
|
17556
|
+
get: function get() {
|
|
17557
|
+
return this.state.getLatestValue().isActive;
|
|
17558
|
+
}
|
|
17559
|
+
}, {
|
|
17560
|
+
key: "isLoading",
|
|
17561
|
+
get: function get() {
|
|
17562
|
+
return this.state.getLatestValue().isLoading;
|
|
17563
|
+
}
|
|
17564
|
+
}, {
|
|
17565
|
+
key: "initialState",
|
|
17566
|
+
get: function get() {
|
|
17567
|
+
return {
|
|
17568
|
+
hasNext: true,
|
|
17569
|
+
isActive: false,
|
|
17570
|
+
isLoading: false,
|
|
17571
|
+
items: undefined,
|
|
17572
|
+
lastQueryError: undefined,
|
|
17573
|
+
next: undefined,
|
|
17574
|
+
offset: 0,
|
|
17575
|
+
searchQuery: ''
|
|
17576
|
+
};
|
|
17577
|
+
}
|
|
17578
|
+
}, {
|
|
17579
|
+
key: "items",
|
|
17580
|
+
get: function get() {
|
|
17581
|
+
return this.state.getLatestValue().items;
|
|
17582
|
+
}
|
|
17583
|
+
}, {
|
|
17584
|
+
key: "next",
|
|
17585
|
+
get: function get() {
|
|
17586
|
+
return this.state.getLatestValue().next;
|
|
17587
|
+
}
|
|
17588
|
+
}, {
|
|
17589
|
+
key: "offset",
|
|
17590
|
+
get: function get() {
|
|
17591
|
+
return this.state.getLatestValue().offset;
|
|
17592
|
+
}
|
|
17593
|
+
}, {
|
|
17594
|
+
key: "searchQuery",
|
|
17595
|
+
get: function get() {
|
|
17596
|
+
return this.state.getLatestValue().searchQuery;
|
|
17597
|
+
}
|
|
17598
|
+
}, {
|
|
17599
|
+
key: "executeQuery",
|
|
17600
|
+
value: function () {
|
|
17601
|
+
var _executeQuery = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee(newSearchString) {
|
|
17602
|
+
var hasNewSearchQuery, searchString, stateUpdate, results, _items, next, _this$offset;
|
|
17603
|
+
|
|
17604
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee$(_context) {
|
|
17605
|
+
while (1) {
|
|
17606
|
+
switch (_context.prev = _context.next) {
|
|
17607
|
+
case 0:
|
|
17608
|
+
hasNewSearchQuery = typeof newSearchString !== 'undefined';
|
|
17609
|
+
searchString = newSearchString !== null && newSearchString !== void 0 ? newSearchString : this.searchQuery;
|
|
17610
|
+
|
|
17611
|
+
if (!(!this.isActive || this.isLoading || !this.hasNext && !hasNewSearchQuery || !searchString)) {
|
|
17612
|
+
_context.next = 4;
|
|
17613
|
+
break;
|
|
17614
|
+
}
|
|
17615
|
+
|
|
17616
|
+
return _context.abrupt("return");
|
|
17617
|
+
|
|
17618
|
+
case 4:
|
|
17619
|
+
if (hasNewSearchQuery) {
|
|
17620
|
+
this.state.next(_objectSpread(_objectSpread({}, this.initialState), {}, {
|
|
17621
|
+
isActive: this.isActive,
|
|
17622
|
+
isLoading: true,
|
|
17623
|
+
searchQuery: newSearchString !== null && newSearchString !== void 0 ? newSearchString : ''
|
|
17624
|
+
}));
|
|
17625
|
+
} else {
|
|
17626
|
+
this.state.partialNext({
|
|
17627
|
+
isLoading: true
|
|
17628
|
+
});
|
|
17629
|
+
}
|
|
17630
|
+
|
|
17631
|
+
stateUpdate = {};
|
|
17632
|
+
_context.prev = 6;
|
|
17633
|
+
_context.next = 9;
|
|
17634
|
+
return this.query(searchString);
|
|
17635
|
+
|
|
17636
|
+
case 9:
|
|
17637
|
+
results = _context.sent;
|
|
17638
|
+
|
|
17639
|
+
if (results) {
|
|
17640
|
+
_context.next = 12;
|
|
17641
|
+
break;
|
|
17642
|
+
}
|
|
17643
|
+
|
|
17644
|
+
return _context.abrupt("return");
|
|
17645
|
+
|
|
17646
|
+
case 12:
|
|
17647
|
+
_items = results.items, next = results.next;
|
|
17648
|
+
|
|
17649
|
+
if (next) {
|
|
17650
|
+
stateUpdate.next = next;
|
|
17651
|
+
stateUpdate.hasNext = !!next;
|
|
17652
|
+
} else {
|
|
17653
|
+
stateUpdate.offset = ((_this$offset = this.offset) !== null && _this$offset !== void 0 ? _this$offset : 0) + _items.length;
|
|
17654
|
+
stateUpdate.hasNext = _items.length === this.pageSize;
|
|
17655
|
+
}
|
|
17656
|
+
|
|
17657
|
+
_context.next = 16;
|
|
17658
|
+
return this.filterQueryResults(_items);
|
|
17659
|
+
|
|
17660
|
+
case 16:
|
|
17661
|
+
stateUpdate.items = _context.sent;
|
|
17662
|
+
_context.next = 22;
|
|
17663
|
+
break;
|
|
17664
|
+
|
|
17665
|
+
case 19:
|
|
17666
|
+
_context.prev = 19;
|
|
17667
|
+
_context.t0 = _context["catch"](6);
|
|
17668
|
+
stateUpdate.lastQueryError = _context.t0;
|
|
17669
|
+
|
|
17670
|
+
case 22:
|
|
17671
|
+
_context.prev = 22;
|
|
17672
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
17673
|
+
this.state.next(function (_ref2) {
|
|
17674
|
+
var _current$items;
|
|
17675
|
+
|
|
17676
|
+
_ref2.lastQueryError;
|
|
17677
|
+
var current = _objectWithoutProperties__default['default'](_ref2, _excluded);
|
|
17678
|
+
|
|
17679
|
+
return _objectSpread(_objectSpread(_objectSpread({}, current), stateUpdate), {}, {
|
|
17680
|
+
isLoading: false,
|
|
17681
|
+
items: [].concat(_toConsumableArray__default['default']((_current$items = current.items) !== null && _current$items !== void 0 ? _current$items : []), _toConsumableArray__default['default'](stateUpdate.items || []))
|
|
17682
|
+
});
|
|
17683
|
+
});
|
|
17684
|
+
return _context.finish(22);
|
|
17685
|
+
|
|
17686
|
+
case 25:
|
|
17687
|
+
case "end":
|
|
17688
|
+
return _context.stop();
|
|
17689
|
+
}
|
|
17690
|
+
}
|
|
17691
|
+
}, _callee, this, [[6, 19, 22, 25]]);
|
|
17692
|
+
}));
|
|
17693
|
+
|
|
17694
|
+
function executeQuery(_x) {
|
|
17695
|
+
return _executeQuery.apply(this, arguments);
|
|
17696
|
+
}
|
|
17697
|
+
|
|
17698
|
+
return executeQuery;
|
|
17699
|
+
}()
|
|
17700
|
+
}, {
|
|
17701
|
+
key: "resetState",
|
|
17702
|
+
value: function resetState() {
|
|
17703
|
+
this.state.next(this.initialState);
|
|
17704
|
+
}
|
|
17705
|
+
}]);
|
|
17706
|
+
|
|
17707
|
+
return BaseSearchSource;
|
|
17708
|
+
}();
|
|
17709
|
+
var UserSearchSource = /*#__PURE__*/function (_BaseSearchSource) {
|
|
17710
|
+
_inherits__default['default'](UserSearchSource, _BaseSearchSource);
|
|
17711
|
+
|
|
17712
|
+
var _super = _createSuper(UserSearchSource);
|
|
17713
|
+
|
|
17714
|
+
function UserSearchSource(client, options) {
|
|
17715
|
+
var _this2;
|
|
17716
|
+
|
|
17717
|
+
_classCallCheck__default['default'](this, UserSearchSource);
|
|
17718
|
+
|
|
17719
|
+
_this2 = _super.call(this, options);
|
|
17720
|
+
|
|
17721
|
+
_defineProperty__default['default'](_assertThisInitialized__default['default'](_this2), "type", 'users');
|
|
17722
|
+
|
|
17723
|
+
_defineProperty__default['default'](_assertThisInitialized__default['default'](_this2), "client", void 0);
|
|
17724
|
+
|
|
17725
|
+
_defineProperty__default['default'](_assertThisInitialized__default['default'](_this2), "filters", void 0);
|
|
17726
|
+
|
|
17727
|
+
_defineProperty__default['default'](_assertThisInitialized__default['default'](_this2), "sort", void 0);
|
|
17728
|
+
|
|
17729
|
+
_defineProperty__default['default'](_assertThisInitialized__default['default'](_this2), "searchOptions", void 0);
|
|
17730
|
+
|
|
17731
|
+
_this2.client = client;
|
|
17732
|
+
return _this2;
|
|
17733
|
+
}
|
|
17734
|
+
|
|
17735
|
+
_createClass__default['default'](UserSearchSource, [{
|
|
17736
|
+
key: "query",
|
|
17737
|
+
value: function () {
|
|
17738
|
+
var _query = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee2(searchQuery) {
|
|
17739
|
+
var filters, sort, options, _yield$this$client$qu, users;
|
|
17740
|
+
|
|
17741
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee2$(_context2) {
|
|
17742
|
+
while (1) {
|
|
17743
|
+
switch (_context2.prev = _context2.next) {
|
|
17744
|
+
case 0:
|
|
17745
|
+
filters = _objectSpread({
|
|
17746
|
+
$or: [{
|
|
17747
|
+
id: {
|
|
17748
|
+
$autocomplete: searchQuery
|
|
17749
|
+
}
|
|
17750
|
+
}, {
|
|
17751
|
+
name: {
|
|
17752
|
+
$autocomplete: searchQuery
|
|
17753
|
+
}
|
|
17754
|
+
}]
|
|
17755
|
+
}, this.filters);
|
|
17756
|
+
sort = _objectSpread({
|
|
17757
|
+
id: 1
|
|
17758
|
+
}, this.sort);
|
|
17759
|
+
options = _objectSpread(_objectSpread({}, this.searchOptions), {}, {
|
|
17760
|
+
limit: this.pageSize,
|
|
17761
|
+
offset: this.offset
|
|
17762
|
+
});
|
|
17763
|
+
_context2.next = 5;
|
|
17764
|
+
return this.client.queryUsers(filters, sort, options);
|
|
17765
|
+
|
|
17766
|
+
case 5:
|
|
17767
|
+
_yield$this$client$qu = _context2.sent;
|
|
17768
|
+
users = _yield$this$client$qu.users;
|
|
17769
|
+
return _context2.abrupt("return", {
|
|
17770
|
+
items: users
|
|
17771
|
+
});
|
|
17772
|
+
|
|
17773
|
+
case 8:
|
|
17774
|
+
case "end":
|
|
17775
|
+
return _context2.stop();
|
|
17776
|
+
}
|
|
17777
|
+
}
|
|
17778
|
+
}, _callee2, this);
|
|
17779
|
+
}));
|
|
17780
|
+
|
|
17781
|
+
function query(_x2) {
|
|
17782
|
+
return _query.apply(this, arguments);
|
|
17783
|
+
}
|
|
17784
|
+
|
|
17785
|
+
return query;
|
|
17786
|
+
}()
|
|
17787
|
+
}, {
|
|
17788
|
+
key: "filterQueryResults",
|
|
17789
|
+
value: function filterQueryResults(items) {
|
|
17790
|
+
var _this3 = this;
|
|
17791
|
+
|
|
17792
|
+
return items.filter(function (u) {
|
|
17793
|
+
var _this3$client$user;
|
|
17794
|
+
|
|
17795
|
+
return u.id !== ((_this3$client$user = _this3.client.user) === null || _this3$client$user === void 0 ? void 0 : _this3$client$user.id);
|
|
17796
|
+
});
|
|
17797
|
+
}
|
|
17798
|
+
}]);
|
|
17799
|
+
|
|
17800
|
+
return UserSearchSource;
|
|
17801
|
+
}(BaseSearchSource);
|
|
17802
|
+
var ChannelSearchSource = /*#__PURE__*/function (_BaseSearchSource2) {
|
|
17803
|
+
_inherits__default['default'](ChannelSearchSource, _BaseSearchSource2);
|
|
17804
|
+
|
|
17805
|
+
var _super2 = _createSuper(ChannelSearchSource);
|
|
17806
|
+
|
|
17807
|
+
function ChannelSearchSource(client, options) {
|
|
17808
|
+
var _this4;
|
|
17809
|
+
|
|
17810
|
+
_classCallCheck__default['default'](this, ChannelSearchSource);
|
|
17811
|
+
|
|
17812
|
+
_this4 = _super2.call(this, options);
|
|
17813
|
+
|
|
17814
|
+
_defineProperty__default['default'](_assertThisInitialized__default['default'](_this4), "type", 'channels');
|
|
17815
|
+
|
|
17816
|
+
_defineProperty__default['default'](_assertThisInitialized__default['default'](_this4), "client", void 0);
|
|
17817
|
+
|
|
17818
|
+
_defineProperty__default['default'](_assertThisInitialized__default['default'](_this4), "filters", void 0);
|
|
17819
|
+
|
|
17820
|
+
_defineProperty__default['default'](_assertThisInitialized__default['default'](_this4), "sort", void 0);
|
|
17821
|
+
|
|
17822
|
+
_defineProperty__default['default'](_assertThisInitialized__default['default'](_this4), "searchOptions", void 0);
|
|
17823
|
+
|
|
17824
|
+
_this4.client = client;
|
|
17825
|
+
return _this4;
|
|
17826
|
+
}
|
|
17827
|
+
|
|
17828
|
+
_createClass__default['default'](ChannelSearchSource, [{
|
|
17829
|
+
key: "query",
|
|
17830
|
+
value: function () {
|
|
17831
|
+
var _query2 = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee3(searchQuery) {
|
|
17832
|
+
var _this$sort;
|
|
17833
|
+
|
|
17834
|
+
var filters, sort, options, items;
|
|
17835
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee3$(_context3) {
|
|
17836
|
+
while (1) {
|
|
17837
|
+
switch (_context3.prev = _context3.next) {
|
|
17838
|
+
case 0:
|
|
17839
|
+
filters = _objectSpread({
|
|
17840
|
+
members: {
|
|
17841
|
+
$in: [this.client.userID]
|
|
17842
|
+
},
|
|
17843
|
+
name: {
|
|
17844
|
+
$autocomplete: searchQuery
|
|
17845
|
+
}
|
|
17846
|
+
}, this.filters);
|
|
17847
|
+
sort = (_this$sort = this.sort) !== null && _this$sort !== void 0 ? _this$sort : {};
|
|
17848
|
+
options = _objectSpread(_objectSpread({}, this.searchOptions), {}, {
|
|
17849
|
+
limit: this.pageSize,
|
|
17850
|
+
offset: this.offset
|
|
17851
|
+
});
|
|
17852
|
+
_context3.next = 5;
|
|
17853
|
+
return this.client.queryChannels(filters, sort, options);
|
|
17854
|
+
|
|
17855
|
+
case 5:
|
|
17856
|
+
items = _context3.sent;
|
|
17857
|
+
return _context3.abrupt("return", {
|
|
17858
|
+
items: items
|
|
17859
|
+
});
|
|
17860
|
+
|
|
17861
|
+
case 7:
|
|
17862
|
+
case "end":
|
|
17863
|
+
return _context3.stop();
|
|
17864
|
+
}
|
|
17865
|
+
}
|
|
17866
|
+
}, _callee3, this);
|
|
17867
|
+
}));
|
|
17868
|
+
|
|
17869
|
+
function query(_x3) {
|
|
17870
|
+
return _query2.apply(this, arguments);
|
|
17871
|
+
}
|
|
17872
|
+
|
|
17873
|
+
return query;
|
|
17874
|
+
}()
|
|
17875
|
+
}, {
|
|
17876
|
+
key: "filterQueryResults",
|
|
17877
|
+
value: function filterQueryResults(items) {
|
|
17878
|
+
return items;
|
|
17879
|
+
}
|
|
17880
|
+
}]);
|
|
17881
|
+
|
|
17882
|
+
return ChannelSearchSource;
|
|
17883
|
+
}(BaseSearchSource);
|
|
17884
|
+
var MessageSearchSource = /*#__PURE__*/function (_BaseSearchSource3) {
|
|
17885
|
+
_inherits__default['default'](MessageSearchSource, _BaseSearchSource3);
|
|
17886
|
+
|
|
17887
|
+
var _super3 = _createSuper(MessageSearchSource);
|
|
17888
|
+
|
|
17889
|
+
function MessageSearchSource(client, options) {
|
|
17890
|
+
var _this5;
|
|
17891
|
+
|
|
17892
|
+
_classCallCheck__default['default'](this, MessageSearchSource);
|
|
17893
|
+
|
|
17894
|
+
_this5 = _super3.call(this, options);
|
|
17895
|
+
|
|
17896
|
+
_defineProperty__default['default'](_assertThisInitialized__default['default'](_this5), "type", 'messages');
|
|
17897
|
+
|
|
17898
|
+
_defineProperty__default['default'](_assertThisInitialized__default['default'](_this5), "client", void 0);
|
|
17899
|
+
|
|
17900
|
+
_defineProperty__default['default'](_assertThisInitialized__default['default'](_this5), "messageSearchChannelFilters", void 0);
|
|
17901
|
+
|
|
17902
|
+
_defineProperty__default['default'](_assertThisInitialized__default['default'](_this5), "messageSearchFilters", void 0);
|
|
17903
|
+
|
|
17904
|
+
_defineProperty__default['default'](_assertThisInitialized__default['default'](_this5), "messageSearchSort", void 0);
|
|
17905
|
+
|
|
17906
|
+
_defineProperty__default['default'](_assertThisInitialized__default['default'](_this5), "channelQueryFilters", void 0);
|
|
17907
|
+
|
|
17908
|
+
_defineProperty__default['default'](_assertThisInitialized__default['default'](_this5), "channelQuerySort", void 0);
|
|
17909
|
+
|
|
17910
|
+
_defineProperty__default['default'](_assertThisInitialized__default['default'](_this5), "channelQueryOptions", void 0);
|
|
17911
|
+
|
|
17912
|
+
_this5.client = client;
|
|
17913
|
+
return _this5;
|
|
17914
|
+
}
|
|
17915
|
+
|
|
17916
|
+
_createClass__default['default'](MessageSearchSource, [{
|
|
17917
|
+
key: "query",
|
|
17918
|
+
value: function () {
|
|
17919
|
+
var _query3 = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee4(searchQuery) {
|
|
17920
|
+
var _this6 = this;
|
|
17921
|
+
|
|
17922
|
+
var channelFilters, messageFilters, sort, options, _yield$this$client$se, next, results, items, cids, allChannelsLoadedLocally;
|
|
17923
|
+
|
|
17924
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee4$(_context4) {
|
|
17925
|
+
while (1) {
|
|
17926
|
+
switch (_context4.prev = _context4.next) {
|
|
17927
|
+
case 0:
|
|
17928
|
+
if (this.client.userID) {
|
|
17929
|
+
_context4.next = 2;
|
|
17930
|
+
break;
|
|
17931
|
+
}
|
|
17932
|
+
|
|
17933
|
+
return _context4.abrupt("return", {
|
|
17934
|
+
items: []
|
|
17935
|
+
});
|
|
17936
|
+
|
|
17937
|
+
case 2:
|
|
17938
|
+
channelFilters = _objectSpread({
|
|
17939
|
+
members: {
|
|
17940
|
+
$in: [this.client.userID]
|
|
17941
|
+
}
|
|
17942
|
+
}, this.messageSearchChannelFilters);
|
|
17943
|
+
messageFilters = _objectSpread({
|
|
17944
|
+
text: searchQuery,
|
|
17945
|
+
type: 'regular'
|
|
17946
|
+
}, this.messageSearchFilters);
|
|
17947
|
+
sort = _objectSpread({
|
|
17948
|
+
created_at: -1
|
|
17949
|
+
}, this.messageSearchSort);
|
|
17950
|
+
options = {
|
|
17951
|
+
limit: this.pageSize,
|
|
17952
|
+
next: this.next,
|
|
17953
|
+
sort: sort
|
|
17954
|
+
};
|
|
17955
|
+
_context4.next = 8;
|
|
17956
|
+
return this.client.search(channelFilters, messageFilters, options);
|
|
17957
|
+
|
|
17958
|
+
case 8:
|
|
17959
|
+
_yield$this$client$se = _context4.sent;
|
|
17960
|
+
next = _yield$this$client$se.next;
|
|
17961
|
+
results = _yield$this$client$se.results;
|
|
17962
|
+
items = results.map(function (_ref3) {
|
|
17963
|
+
var message = _ref3.message;
|
|
17964
|
+
return message;
|
|
17965
|
+
});
|
|
17966
|
+
cids = Array.from(items.reduce(function (acc, message) {
|
|
17967
|
+
if (message.cid && !_this6.client.activeChannels[message.cid]) acc.add(message.cid);
|
|
17968
|
+
return acc;
|
|
17969
|
+
}, new Set()) // keep the cids unique
|
|
17970
|
+
);
|
|
17971
|
+
allChannelsLoadedLocally = cids.length === 0;
|
|
17972
|
+
|
|
17973
|
+
if (allChannelsLoadedLocally) {
|
|
17974
|
+
_context4.next = 17;
|
|
17975
|
+
break;
|
|
17976
|
+
}
|
|
17977
|
+
|
|
17978
|
+
_context4.next = 17;
|
|
17979
|
+
return this.client.queryChannels(_objectSpread({
|
|
17980
|
+
cid: {
|
|
17981
|
+
$in: cids
|
|
17982
|
+
}
|
|
17983
|
+
}, this.channelQueryFilters), _objectSpread({
|
|
17984
|
+
last_message_at: -1
|
|
17985
|
+
}, this.channelQuerySort), this.channelQueryOptions);
|
|
17986
|
+
|
|
17987
|
+
case 17:
|
|
17988
|
+
return _context4.abrupt("return", {
|
|
17989
|
+
items: items,
|
|
17990
|
+
next: next
|
|
17991
|
+
});
|
|
17992
|
+
|
|
17993
|
+
case 18:
|
|
17994
|
+
case "end":
|
|
17995
|
+
return _context4.stop();
|
|
17996
|
+
}
|
|
17997
|
+
}
|
|
17998
|
+
}, _callee4, this);
|
|
17999
|
+
}));
|
|
18000
|
+
|
|
18001
|
+
function query(_x4) {
|
|
18002
|
+
return _query3.apply(this, arguments);
|
|
18003
|
+
}
|
|
18004
|
+
|
|
18005
|
+
return query;
|
|
18006
|
+
}()
|
|
18007
|
+
}, {
|
|
18008
|
+
key: "filterQueryResults",
|
|
18009
|
+
value: function filterQueryResults(items) {
|
|
18010
|
+
return items;
|
|
18011
|
+
}
|
|
18012
|
+
}]);
|
|
18013
|
+
|
|
18014
|
+
return MessageSearchSource;
|
|
18015
|
+
}(BaseSearchSource);
|
|
18016
|
+
var SearchController = /*#__PURE__*/function () {
|
|
18017
|
+
/**
|
|
18018
|
+
* Not intended for direct use by integrators, might be removed without notice resulting in
|
|
18019
|
+
* broken integrations.
|
|
18020
|
+
*/
|
|
18021
|
+
function SearchController() {
|
|
18022
|
+
var _this7 = this;
|
|
18023
|
+
|
|
18024
|
+
var _ref4 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
|
18025
|
+
config = _ref4.config,
|
|
18026
|
+
sources = _ref4.sources;
|
|
18027
|
+
|
|
18028
|
+
_classCallCheck__default['default'](this, SearchController);
|
|
18029
|
+
|
|
18030
|
+
_defineProperty__default['default'](this, "_internalState", void 0);
|
|
18031
|
+
|
|
18032
|
+
_defineProperty__default['default'](this, "state", void 0);
|
|
18033
|
+
|
|
18034
|
+
_defineProperty__default['default'](this, "config", void 0);
|
|
18035
|
+
|
|
18036
|
+
_defineProperty__default['default'](this, "addSource", function (source) {
|
|
18037
|
+
_this7.state.partialNext({
|
|
18038
|
+
sources: [].concat(_toConsumableArray__default['default'](_this7.sources), [source])
|
|
18039
|
+
});
|
|
18040
|
+
});
|
|
18041
|
+
|
|
18042
|
+
_defineProperty__default['default'](this, "getSource", function (sourceType) {
|
|
18043
|
+
return _this7.sources.find(function (s) {
|
|
18044
|
+
return s.type === sourceType;
|
|
18045
|
+
});
|
|
18046
|
+
});
|
|
18047
|
+
|
|
18048
|
+
_defineProperty__default['default'](this, "removeSource", function (sourceType) {
|
|
18049
|
+
var newSources = _this7.sources.filter(function (s) {
|
|
18050
|
+
return s.type !== sourceType;
|
|
18051
|
+
});
|
|
18052
|
+
|
|
18053
|
+
if (newSources.length === _this7.sources.length) return;
|
|
18054
|
+
|
|
18055
|
+
_this7.state.partialNext({
|
|
18056
|
+
sources: newSources
|
|
18057
|
+
});
|
|
18058
|
+
});
|
|
18059
|
+
|
|
18060
|
+
_defineProperty__default['default'](this, "activateSource", function (sourceType) {
|
|
18061
|
+
var source = _this7.getSource(sourceType);
|
|
18062
|
+
|
|
18063
|
+
if (!source || source.isActive) return;
|
|
18064
|
+
|
|
18065
|
+
if (_this7.config.keepSingleActiveSource) {
|
|
18066
|
+
_this7.sources.forEach(function (s) {
|
|
18067
|
+
if (s.type !== sourceType) {
|
|
18068
|
+
s.deactivate();
|
|
18069
|
+
}
|
|
18070
|
+
});
|
|
18071
|
+
}
|
|
18072
|
+
|
|
18073
|
+
source.activate();
|
|
18074
|
+
|
|
18075
|
+
_this7.state.partialNext({
|
|
18076
|
+
sources: _toConsumableArray__default['default'](_this7.sources)
|
|
18077
|
+
});
|
|
18078
|
+
});
|
|
18079
|
+
|
|
18080
|
+
_defineProperty__default['default'](this, "deactivateSource", function (sourceType) {
|
|
18081
|
+
var source = _this7.getSource(sourceType);
|
|
18082
|
+
|
|
18083
|
+
if (!(source !== null && source !== void 0 && source.isActive)) return;
|
|
18084
|
+
if (_this7.activeSources.length === 1) return;
|
|
18085
|
+
source.deactivate();
|
|
18086
|
+
|
|
18087
|
+
_this7.state.partialNext({
|
|
18088
|
+
sources: _toConsumableArray__default['default'](_this7.sources)
|
|
18089
|
+
});
|
|
18090
|
+
});
|
|
18091
|
+
|
|
18092
|
+
_defineProperty__default['default'](this, "activate", function () {
|
|
18093
|
+
if (!_this7.activeSources.length) {
|
|
18094
|
+
var sourcesToActivate = _this7.config.keepSingleActiveSource ? _this7.sources.slice(0, 1) : _this7.sources;
|
|
18095
|
+
sourcesToActivate.forEach(function (s) {
|
|
18096
|
+
return s.activate();
|
|
18097
|
+
});
|
|
18098
|
+
}
|
|
18099
|
+
|
|
18100
|
+
if (_this7.isActive) return;
|
|
18101
|
+
|
|
18102
|
+
_this7.state.partialNext({
|
|
18103
|
+
isActive: true
|
|
18104
|
+
});
|
|
18105
|
+
});
|
|
18106
|
+
|
|
18107
|
+
_defineProperty__default['default'](this, "search", /*#__PURE__*/function () {
|
|
18108
|
+
var _ref5 = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee5(searchQuery) {
|
|
18109
|
+
var searchedSources;
|
|
18110
|
+
return _regeneratorRuntime__default['default'].wrap(function _callee5$(_context5) {
|
|
18111
|
+
while (1) {
|
|
18112
|
+
switch (_context5.prev = _context5.next) {
|
|
18113
|
+
case 0:
|
|
18114
|
+
searchedSources = _this7.activeSources;
|
|
18115
|
+
|
|
18116
|
+
_this7.state.partialNext({
|
|
18117
|
+
searchQuery: searchQuery
|
|
18118
|
+
});
|
|
18119
|
+
|
|
18120
|
+
_context5.next = 4;
|
|
18121
|
+
return Promise.all(searchedSources.map(function (source) {
|
|
18122
|
+
return source.search(searchQuery);
|
|
18123
|
+
}));
|
|
18124
|
+
|
|
18125
|
+
case 4:
|
|
18126
|
+
case "end":
|
|
18127
|
+
return _context5.stop();
|
|
18128
|
+
}
|
|
18129
|
+
}
|
|
18130
|
+
}, _callee5);
|
|
18131
|
+
}));
|
|
18132
|
+
|
|
18133
|
+
return function (_x5) {
|
|
18134
|
+
return _ref5.apply(this, arguments);
|
|
18135
|
+
};
|
|
18136
|
+
}());
|
|
18137
|
+
|
|
18138
|
+
_defineProperty__default['default'](this, "cancelSearchQueries", function () {
|
|
18139
|
+
_this7.activeSources.forEach(function (s) {
|
|
18140
|
+
return s.searchDebounced.cancel();
|
|
18141
|
+
});
|
|
18142
|
+
});
|
|
18143
|
+
|
|
18144
|
+
_defineProperty__default['default'](this, "clear", function () {
|
|
18145
|
+
_this7.cancelSearchQueries();
|
|
18146
|
+
|
|
18147
|
+
_this7.sources.forEach(function (source) {
|
|
18148
|
+
return source.state.next(_objectSpread(_objectSpread({}, source.initialState), {}, {
|
|
18149
|
+
isActive: source.isActive
|
|
18150
|
+
}));
|
|
18151
|
+
});
|
|
18152
|
+
|
|
18153
|
+
_this7.state.next(function (current) {
|
|
18154
|
+
return _objectSpread(_objectSpread({}, current), {}, {
|
|
18155
|
+
isActive: true,
|
|
18156
|
+
queriesInProgress: [],
|
|
18157
|
+
searchQuery: ''
|
|
18158
|
+
});
|
|
18159
|
+
});
|
|
18160
|
+
});
|
|
18161
|
+
|
|
18162
|
+
_defineProperty__default['default'](this, "exit", function () {
|
|
18163
|
+
_this7.cancelSearchQueries();
|
|
18164
|
+
|
|
18165
|
+
_this7.sources.forEach(function (source) {
|
|
18166
|
+
return source.state.next(_objectSpread(_objectSpread({}, source.initialState), {}, {
|
|
18167
|
+
isActive: source.isActive
|
|
18168
|
+
}));
|
|
18169
|
+
});
|
|
18170
|
+
|
|
18171
|
+
_this7.state.next(function (current) {
|
|
18172
|
+
return _objectSpread(_objectSpread({}, current), {}, {
|
|
18173
|
+
isActive: false,
|
|
18174
|
+
queriesInProgress: [],
|
|
18175
|
+
searchQuery: ''
|
|
18176
|
+
});
|
|
18177
|
+
});
|
|
18178
|
+
});
|
|
18179
|
+
|
|
18180
|
+
this.state = new StateStore({
|
|
18181
|
+
isActive: false,
|
|
18182
|
+
searchQuery: '',
|
|
18183
|
+
sources: sources !== null && sources !== void 0 ? sources : []
|
|
18184
|
+
});
|
|
18185
|
+
this._internalState = new StateStore({});
|
|
18186
|
+
this.config = _objectSpread({
|
|
18187
|
+
keepSingleActiveSource: true
|
|
18188
|
+
}, config);
|
|
18189
|
+
}
|
|
18190
|
+
|
|
18191
|
+
_createClass__default['default'](SearchController, [{
|
|
18192
|
+
key: "hasNext",
|
|
18193
|
+
get: function get() {
|
|
18194
|
+
return this.sources.some(function (source) {
|
|
18195
|
+
return source.hasNext;
|
|
18196
|
+
});
|
|
18197
|
+
}
|
|
18198
|
+
}, {
|
|
18199
|
+
key: "sources",
|
|
18200
|
+
get: function get() {
|
|
18201
|
+
return this.state.getLatestValue().sources;
|
|
18202
|
+
}
|
|
18203
|
+
}, {
|
|
18204
|
+
key: "activeSources",
|
|
18205
|
+
get: function get() {
|
|
18206
|
+
return this.state.getLatestValue().sources.filter(function (s) {
|
|
18207
|
+
return s.isActive;
|
|
18208
|
+
});
|
|
18209
|
+
}
|
|
18210
|
+
}, {
|
|
18211
|
+
key: "isActive",
|
|
18212
|
+
get: function get() {
|
|
18213
|
+
return this.state.getLatestValue().isActive;
|
|
18214
|
+
}
|
|
18215
|
+
}, {
|
|
18216
|
+
key: "searchQuery",
|
|
18217
|
+
get: function get() {
|
|
18218
|
+
return this.state.getLatestValue().searchQuery;
|
|
18219
|
+
}
|
|
18220
|
+
}, {
|
|
18221
|
+
key: "searchSourceTypes",
|
|
18222
|
+
get: function get() {
|
|
18223
|
+
return this.sources.map(function (s) {
|
|
18224
|
+
return s.type;
|
|
18225
|
+
});
|
|
18226
|
+
}
|
|
18227
|
+
}]);
|
|
18228
|
+
|
|
18229
|
+
return SearchController;
|
|
18230
|
+
}();
|
|
18231
|
+
|
|
17415
18232
|
exports.Allow = Allow;
|
|
17416
18233
|
exports.AllowAll = AllowAll;
|
|
17417
18234
|
exports.AnyResource = AnyResource;
|
|
17418
18235
|
exports.AnyRole = AnyRole;
|
|
18236
|
+
exports.BaseSearchSource = BaseSearchSource;
|
|
17419
18237
|
exports.BuiltinPermissions = BuiltinPermissions;
|
|
17420
18238
|
exports.BuiltinRoles = BuiltinRoles;
|
|
17421
18239
|
exports.Campaign = Campaign;
|
|
17422
18240
|
exports.Channel = Channel;
|
|
18241
|
+
exports.ChannelSearchSource = ChannelSearchSource;
|
|
17423
18242
|
exports.ChannelState = ChannelState;
|
|
17424
18243
|
exports.CheckSignature = CheckSignature;
|
|
17425
18244
|
exports.ClientState = ClientState;
|
|
@@ -17433,11 +18252,13 @@ exports.JWTServerToken = JWTServerToken;
|
|
|
17433
18252
|
exports.JWTUserToken = JWTUserToken;
|
|
17434
18253
|
exports.MODERATION_ENTITY_TYPES = MODERATION_ENTITY_TYPES;
|
|
17435
18254
|
exports.MaxPriority = MaxPriority;
|
|
18255
|
+
exports.MessageSearchSource = MessageSearchSource;
|
|
17436
18256
|
exports.MinPriority = MinPriority;
|
|
17437
18257
|
exports.Moderation = Moderation;
|
|
17438
18258
|
exports.Permission = Permission;
|
|
17439
18259
|
exports.Poll = Poll;
|
|
17440
18260
|
exports.PollManager = PollManager;
|
|
18261
|
+
exports.SearchController = SearchController;
|
|
17441
18262
|
exports.Segment = Segment;
|
|
17442
18263
|
exports.StableWSConnection = StableWSConnection;
|
|
17443
18264
|
exports.StateStore = StateStore;
|
|
@@ -17447,6 +18268,7 @@ exports.Thread = Thread;
|
|
|
17447
18268
|
exports.ThreadManager = ThreadManager;
|
|
17448
18269
|
exports.TokenManager = TokenManager;
|
|
17449
18270
|
exports.UserFromToken = UserFromToken;
|
|
18271
|
+
exports.UserSearchSource = UserSearchSource;
|
|
17450
18272
|
exports.buildWsFatalInsight = buildWsFatalInsight;
|
|
17451
18273
|
exports.buildWsSuccessAfterFailureInsight = buildWsSuccessAfterFailureInsight;
|
|
17452
18274
|
exports.chatCodes = chatCodes;
|