@amityco/ts-sdk-react-native 6.8.2-d546836.0 → 6.9.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/@types/domains/message.d.ts +1 -1
- package/dist/@types/domains/message.d.ts.map +1 -1
- package/dist/client/api/login.d.ts.map +1 -1
- package/dist/commentRepository/observers/getComments.d.ts.map +1 -1
- package/dist/index.cjs.js +129 -75
- package/dist/index.d.ts +0 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.esm.js +130 -72
- package/dist/index.umd.js +2 -2
- package/dist/marker/events/onMessageMarked.d.ts.map +1 -1
- package/dist/messageRepository/observers/getMessages.d.ts +1 -0
- package/dist/messageRepository/observers/getMessages.d.ts.map +1 -1
- package/dist/userRepository/observers/getUsers.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/@types/domains/message.ts +1 -0
- package/src/client/api/login.ts +42 -38
- package/src/commentRepository/observers/getComments.ts +3 -1
- package/src/index.ts +0 -3
- package/src/marker/events/onMessageMarked.ts +17 -10
- package/src/messageRepository/observers/getMessages.ts +79 -19
- package/src/userRepository/observers/getUsers.ts +2 -1
- package/src/userRepository/observers/tests/getUsers.test.ts +5 -1
|
@@ -44,7 +44,7 @@ declare global {
|
|
|
44
44
|
readCount: number;
|
|
45
45
|
deliveredCount: number;
|
|
46
46
|
referenceId?: string;
|
|
47
|
-
} & Amity.Content<T> & Amity.Mentionable<'user' | 'channel'> & Amity.Metadata & Amity.Reactable & Amity.SoftDelete & Amity.Subscribable & Amity.Timestamps & Amity.Taggable;
|
|
47
|
+
} & Amity.Content<T> & Amity.Flaggable & Amity.Mentionable<'user' | 'channel'> & Amity.Metadata & Amity.Reactable & Amity.SoftDelete & Amity.Subscribable & Amity.Timestamps & Amity.Taggable;
|
|
48
48
|
type QueryMessages = {
|
|
49
49
|
subChannelId: Amity.SubChannel['subChannelId'];
|
|
50
50
|
dataType?: Amity.MessageContentType;
|
|
@@ -1 +1 @@
|
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AC1B,QAAQ,CAAC,EAAE,KAAK,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;YACrC,MAAM,CAAC,EAAE,YAAY,GAAG,aAAa,CAAC;YACtC,IAAI,CAAC,EAAE,KAAK,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;SAC/B,CAAC;QAEF,KAAK,cAAc,GAAG;YACpB,SAAS,EAAE,KAAK,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;YACtC,WAAW,CAAC,EAAE,CAAC,QAAQ,GAAG,QAAQ,GAAG,OAAO,GAAG,YAAY,GAAG,SAAS,CAAC,EAAE,CAAC;YAC3E,IAAI,CAAC,EAAE,KAAK,CAAC,IAAI,CAAC;SACnB,CAAC;QAEF,KAAK,mBAAmB,GAAG;YACzB,SAAS,EAAE,KAAK,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;YACtC,WAAW,CAAC,EAAE,CAAC,QAAQ,GAAG,QAAQ,GAAG,OAAO,GAAG,YAAY,GAAG,SAAS,CAAC,EAAE,CAAC;YAC3E,IAAI,CAAC,EAAE,KAAK,CAAC,IAAI,CAAC;SACnB,CAAC;QAEF,KAAK,sBAAsB,GAAG,KAAK,CAAC,oBAAoB,CAAC,IAAI,CAAC,aAAa,EAAE,MAAM,CAAC,CAAC,CAAC;QAEtF,KAAK,0BAA0B,GAAG,KAAK,CAAC,mBAAmB,CACzD,KAAK,CAAC,OAAO,CAAC,cAAc,CAAC,EAC7B,IAAI,CAAC,aAAa,EAAE,MAAM,CAAC,CAC5B,CAAC;KACH;CACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"login.d.ts","sourceRoot":"","sources":["../../../src/client/api/login.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"login.d.ts","sourceRoot":"","sources":["../../../src/client/api/login.ts"],"names":[],"mappings":"AAwCA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAO,MAAM,KAAK,WACR,MAAM,mBAAmB,kBACjB,MAAM,cAAc,WAC3B,MAAM,mBAAmB,KACjC,QAAQ,OAAO,CAiHjB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getComments.d.ts","sourceRoot":"","sources":["../../../src/commentRepository/observers/getComments.ts"],"names":[],"mappings":"AAmCA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAO,MAAM,WAAW,WACd,MAAM,qBAAqB,YACzB,MAAM,sBAAsB,CAAC,MAAM,eAAe,CAAC,WACpD,MAAM,oBAAoB,KAClC,MAAM,
|
|
1
|
+
{"version":3,"file":"getComments.d.ts","sourceRoot":"","sources":["../../../src/commentRepository/observers/getComments.ts"],"names":[],"mappings":"AAmCA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAO,MAAM,WAAW,WACd,MAAM,qBAAqB,YACzB,MAAM,sBAAsB,CAAC,MAAM,eAAe,CAAC,WACpD,MAAM,oBAAoB,KAClC,MAAM,YA2HR,CAAC"}
|
package/dist/index.cjs.js
CHANGED
|
@@ -114,8 +114,8 @@ const PostContentType = Object.freeze({
|
|
|
114
114
|
|
|
115
115
|
function getVersion() {
|
|
116
116
|
try {
|
|
117
|
-
// the string ''v6.
|
|
118
|
-
return 'v6.
|
|
117
|
+
// the string ''v6.9.0-cjs'' should be replaced by actual value by @rollup/plugin-replace
|
|
118
|
+
return 'v6.9.0-cjs';
|
|
119
119
|
}
|
|
120
120
|
catch (error) {
|
|
121
121
|
return '__dev__';
|
|
@@ -6015,7 +6015,10 @@ const removeChannelMarkerCache = (channel) => {
|
|
|
6015
6015
|
* than the one already connected, in which case the existing subscriptions need
|
|
6016
6016
|
* to be cleared
|
|
6017
6017
|
*/
|
|
6018
|
-
|
|
6018
|
+
let subscriptions = [];
|
|
6019
|
+
async function runMqtt() {
|
|
6020
|
+
await modifyMqttConnection();
|
|
6021
|
+
}
|
|
6019
6022
|
/* begin_public_function
|
|
6020
6023
|
id: client.login
|
|
6021
6024
|
*/
|
|
@@ -6049,6 +6052,7 @@ const login = async (params, sessionHandler, config) => {
|
|
|
6049
6052
|
await logout();
|
|
6050
6053
|
// Remove subscription to ban and delete
|
|
6051
6054
|
subscriptions.forEach(fn => fn());
|
|
6055
|
+
subscriptions = [];
|
|
6052
6056
|
}
|
|
6053
6057
|
// default values
|
|
6054
6058
|
(_a = params.deviceId) !== null && _a !== void 0 ? _a : (params.deviceId = await getDeviceId());
|
|
@@ -6059,10 +6063,7 @@ const login = async (params, sessionHandler, config) => {
|
|
|
6059
6063
|
// FIXME: events are duplicated if connectClient is called few times without disconnectClient
|
|
6060
6064
|
// wire websocket events to our event emitter
|
|
6061
6065
|
proxyWebsocketEvents(client.ws, client.emitter);
|
|
6062
|
-
|
|
6063
|
-
// to be connected "on demand" rather than "by default"
|
|
6064
|
-
await new Promise(resolve => {
|
|
6065
|
-
client.ws.once('connect', resolve);
|
|
6066
|
+
client.ws.once('connect', () => {
|
|
6066
6067
|
client.ws.open();
|
|
6067
6068
|
});
|
|
6068
6069
|
client.userId = params.userId;
|
|
@@ -6084,34 +6085,36 @@ const login = async (params, sessionHandler, config) => {
|
|
|
6084
6085
|
throw error;
|
|
6085
6086
|
}
|
|
6086
6087
|
if ((config === null || config === void 0 ? void 0 : config.disableRTE) !== true) {
|
|
6087
|
-
|
|
6088
|
+
runMqtt();
|
|
6088
6089
|
}
|
|
6089
|
-
subscriptions.
|
|
6090
|
-
|
|
6091
|
-
|
|
6092
|
-
|
|
6093
|
-
|
|
6094
|
-
unsubWatcher();
|
|
6095
|
-
}), onTokenTerminated(_ => {
|
|
6096
|
-
terminateClient();
|
|
6097
|
-
subscriptions.forEach(fn => fn());
|
|
6098
|
-
unsubWatcher();
|
|
6099
|
-
}), onUserDeleted((user) => {
|
|
6100
|
-
if (user.userId === client.userId) {
|
|
6101
|
-
terminateClient("userDeleted" /* Amity.TokenTerminationReason.USER_DELETED */);
|
|
6090
|
+
if (subscriptions.length === 0) {
|
|
6091
|
+
subscriptions.push(
|
|
6092
|
+
// GLOBAL_BAN
|
|
6093
|
+
onClientBanned((_) => {
|
|
6094
|
+
terminateClient("globalBan" /* Amity.TokenTerminationReason.GLOBAL_BAN */);
|
|
6102
6095
|
subscriptions.forEach(fn => fn());
|
|
6103
6096
|
unsubWatcher();
|
|
6104
|
-
}
|
|
6105
|
-
|
|
6106
|
-
|
|
6107
|
-
|
|
6108
|
-
|
|
6109
|
-
|
|
6110
|
-
|
|
6111
|
-
|
|
6112
|
-
|
|
6113
|
-
|
|
6114
|
-
|
|
6097
|
+
}), onTokenTerminated(_ => {
|
|
6098
|
+
terminateClient();
|
|
6099
|
+
subscriptions.forEach(fn => fn());
|
|
6100
|
+
unsubWatcher();
|
|
6101
|
+
}), onUserDeleted((user) => {
|
|
6102
|
+
if (user.userId === client.userId) {
|
|
6103
|
+
terminateClient("userDeleted" /* Amity.TokenTerminationReason.USER_DELETED */);
|
|
6104
|
+
subscriptions.forEach(fn => fn());
|
|
6105
|
+
unsubWatcher();
|
|
6106
|
+
}
|
|
6107
|
+
}), onTokenExpired(state => {
|
|
6108
|
+
setSessionState(state);
|
|
6109
|
+
logout();
|
|
6110
|
+
subscriptions.forEach(fn => fn());
|
|
6111
|
+
}),
|
|
6112
|
+
// NOTE: This is a temporary solution to handle the channel marker when the user is forced to leave
|
|
6113
|
+
// the channel because currently backend can't handle this, so every time a user is banned from
|
|
6114
|
+
// a channel or the channel is deleted the channel's unread count will not be reset to zero
|
|
6115
|
+
onChannelDeleted(removeChannelMarkerCache), onChannelMemberBanned(removeChannelMarkerCache), markReadEngineOnLoginHandler());
|
|
6116
|
+
}
|
|
6117
|
+
return true;
|
|
6115
6118
|
};
|
|
6116
6119
|
/* end_public_function */
|
|
6117
6120
|
|
|
@@ -6572,24 +6575,31 @@ const onMessageMarked = (callback) => {
|
|
|
6572
6575
|
var _a, _b;
|
|
6573
6576
|
ingestInCache(payload);
|
|
6574
6577
|
const cacheCollection = queryCache(['message', 'collection']);
|
|
6575
|
-
|
|
6576
|
-
|
|
6578
|
+
const { contentMarkers, feedMarkers } = payload;
|
|
6579
|
+
if (cacheCollection && (cacheCollection === null || cacheCollection === void 0 ? void 0 : cacheCollection.length) > 0 && (feedMarkers === null || feedMarkers === void 0 ? void 0 : feedMarkers.length) > 0) {
|
|
6580
|
+
/**
|
|
6581
|
+
* in case of read the message collection,
|
|
6582
|
+
* use feedId of the feedMarkers to check if it equal to subChannelId.
|
|
6583
|
+
*/
|
|
6577
6584
|
const currentMessageCollection = cacheCollection.filter(currentMessage => {
|
|
6578
|
-
|
|
6585
|
+
const cacheKey = currentMessage.key;
|
|
6586
|
+
if (!isObject(cacheKey[2]))
|
|
6579
6587
|
return false;
|
|
6580
|
-
|
|
6588
|
+
const queryParams = cacheKey[2];
|
|
6589
|
+
return queryParams.subChannelId === feedMarkers[0].feedId;
|
|
6581
6590
|
});
|
|
6582
|
-
if (currentMessageCollection.length > 0) {
|
|
6591
|
+
if (currentMessageCollection.length > 0 && (contentMarkers === null || contentMarkers === void 0 ? void 0 : contentMarkers.length) > 0) {
|
|
6583
6592
|
const currentMessages = ((_b = (_a = currentMessageCollection[0].data) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.map(messageId => {
|
|
6584
6593
|
return pullFromCache(['message', 'get', messageId]);
|
|
6585
6594
|
})) || [];
|
|
6586
6595
|
currentMessages.forEach(message => {
|
|
6587
|
-
|
|
6588
|
-
const
|
|
6589
|
-
const
|
|
6596
|
+
var _a;
|
|
6597
|
+
const isSameSubChannelId = contentMarkers[0].feedId === (message === null || message === void 0 ? void 0 : message.data.subChannelId);
|
|
6598
|
+
const isReadCountLatest = contentMarkers[0].readCount > (message === null || message === void 0 ? void 0 : message.data.readCount);
|
|
6599
|
+
const isDeliveredCountLatest = ((_a = contentMarkers[0]) === null || _a === void 0 ? void 0 : _a.deliveredCount) > (message === null || message === void 0 ? void 0 : message.data.deliveredCount);
|
|
6590
6600
|
if (isSameSubChannelId) {
|
|
6591
|
-
pushToCache(['message', 'get', message.data.messageId], Object.assign(Object.assign({}, message.data), { readCount: isReadCountLatest ?
|
|
6592
|
-
?
|
|
6601
|
+
pushToCache(['message', 'get', message.data.messageId], Object.assign(Object.assign({}, message.data), { readCount: isReadCountLatest ? contentMarkers[0].readCount : message === null || message === void 0 ? void 0 : message.data.readCount, deliveredCount: isDeliveredCountLatest
|
|
6602
|
+
? contentMarkers[0].deliveredCount
|
|
6593
6603
|
: message === null || message === void 0 ? void 0 : message.data.deliveredCount }));
|
|
6594
6604
|
}
|
|
6595
6605
|
});
|
|
@@ -7827,7 +7837,7 @@ queryChannelMembers.locally = (query) => {
|
|
|
7827
7837
|
* Exported for testing
|
|
7828
7838
|
* @hidden
|
|
7829
7839
|
*/
|
|
7830
|
-
const applyFilter$
|
|
7840
|
+
const applyFilter$3 = (data, params) => {
|
|
7831
7841
|
let channelMembers = filterByPropIntersection(data, 'roles', params.roles);
|
|
7832
7842
|
if (params.memberships) {
|
|
7833
7843
|
/*
|
|
@@ -7902,7 +7912,7 @@ const getMembers$1 = (params, callback, config) => {
|
|
|
7902
7912
|
/*
|
|
7903
7913
|
* Only apply filter to RTE Model
|
|
7904
7914
|
*/
|
|
7905
|
-
data: isEventModel ? applyFilter$
|
|
7915
|
+
data: isEventModel ? applyFilter$3(channelMembers, params) : channelMembers,
|
|
7906
7916
|
hasNextPage: !!((_b = data.params) === null || _b === void 0 ? void 0 : _b.page),
|
|
7907
7917
|
loading: data.loading,
|
|
7908
7918
|
error: data.error,
|
|
@@ -7992,7 +8002,7 @@ var index$i = /*#__PURE__*/Object.freeze({
|
|
|
7992
8002
|
__proto__: null,
|
|
7993
8003
|
addMembers: addMembers$1,
|
|
7994
8004
|
removeMembers: removeMembers$1,
|
|
7995
|
-
applyFilter: applyFilter$
|
|
8005
|
+
applyFilter: applyFilter$3,
|
|
7996
8006
|
getMembers: getMembers$1,
|
|
7997
8007
|
searchMembers: searchMembers
|
|
7998
8008
|
});
|
|
@@ -10317,7 +10327,7 @@ queryUsers.locally = (query = {}) => {
|
|
|
10317
10327
|
* Exported for testing
|
|
10318
10328
|
* @hidden
|
|
10319
10329
|
*/
|
|
10320
|
-
const applyFilter$
|
|
10330
|
+
const applyFilter$2 = (data, params) => {
|
|
10321
10331
|
let users = filterByStringComparePartially(data, 'displayName', params.displayName);
|
|
10322
10332
|
switch (params.sortBy) {
|
|
10323
10333
|
case 'firstCreated':
|
|
@@ -10366,7 +10376,7 @@ const getUsers = (params, callback, config) => {
|
|
|
10366
10376
|
const limit = queryLimit !== null && queryLimit !== void 0 ? queryLimit : COLLECTION_DEFAULT_PAGINATION_LIMIT;
|
|
10367
10377
|
const { policy = COLLECTION_DEFAULT_CACHING_POLICY } = config !== null && config !== void 0 ? config : {};
|
|
10368
10378
|
const disposers = [];
|
|
10369
|
-
const cacheKey = ['user', 'collection',
|
|
10379
|
+
const cacheKey = ['user', 'collection', uuid()];
|
|
10370
10380
|
const responder = (data, isEventModel = false) => {
|
|
10371
10381
|
var _a, _b;
|
|
10372
10382
|
const users = (_a = data.data
|
|
@@ -10378,7 +10388,7 @@ const getUsers = (params, callback, config) => {
|
|
|
10378
10388
|
/*
|
|
10379
10389
|
* Only apply filter to RTE Model
|
|
10380
10390
|
*/
|
|
10381
|
-
data: isEventModel ? applyFilter$
|
|
10391
|
+
data: isEventModel ? applyFilter$2(users, params) : users,
|
|
10382
10392
|
hasNextPage: !!((_b = data.params) === null || _b === void 0 ? void 0 : _b.page),
|
|
10383
10393
|
loading: data.loading,
|
|
10384
10394
|
error: data.error,
|
|
@@ -13188,6 +13198,50 @@ const queryMessages = async (query) => {
|
|
|
13188
13198
|
};
|
|
13189
13199
|
/* end_public_function */
|
|
13190
13200
|
|
|
13201
|
+
/*
|
|
13202
|
+
* Exported for testing
|
|
13203
|
+
* @hidden
|
|
13204
|
+
*/
|
|
13205
|
+
const applyFilter$1 = (data, params) => {
|
|
13206
|
+
let messages = data;
|
|
13207
|
+
messages = messages.filter(m => {
|
|
13208
|
+
if (params.tags) {
|
|
13209
|
+
return params.tags.find(value => {
|
|
13210
|
+
if (!m.tags)
|
|
13211
|
+
return false;
|
|
13212
|
+
return m.tags.includes(value);
|
|
13213
|
+
});
|
|
13214
|
+
}
|
|
13215
|
+
return true;
|
|
13216
|
+
});
|
|
13217
|
+
messages = messages.filter(m => {
|
|
13218
|
+
if (params.excludeTags) {
|
|
13219
|
+
return (params.excludeTags || []).find(value => {
|
|
13220
|
+
if (!m.tags)
|
|
13221
|
+
return true;
|
|
13222
|
+
return !m.tags.includes(value);
|
|
13223
|
+
});
|
|
13224
|
+
}
|
|
13225
|
+
return true;
|
|
13226
|
+
});
|
|
13227
|
+
/*
|
|
13228
|
+
* for cases when message is deleted via RTE, this flag is used to get
|
|
13229
|
+
* items from cache that are !deleted
|
|
13230
|
+
*/
|
|
13231
|
+
if (!params.includeDeleted) {
|
|
13232
|
+
messages = filterByPropEquality(messages, 'isDeleted', false);
|
|
13233
|
+
}
|
|
13234
|
+
messages = messages.sort((message1, message2) => {
|
|
13235
|
+
if (params.sortBy === 'segmentAsc') {
|
|
13236
|
+
return message1.channelSegment - message2.channelSegment;
|
|
13237
|
+
}
|
|
13238
|
+
if (params.sortBy === 'segmentDesc') {
|
|
13239
|
+
return message2.channelSegment - message1.channelSegment;
|
|
13240
|
+
}
|
|
13241
|
+
return 0;
|
|
13242
|
+
});
|
|
13243
|
+
return messages;
|
|
13244
|
+
};
|
|
13191
13245
|
/* begin_public_function
|
|
13192
13246
|
id: message.query
|
|
13193
13247
|
*/
|
|
@@ -13221,30 +13275,14 @@ const getMessages = (params, callback, config) => {
|
|
|
13221
13275
|
const limit = queryLimit !== null && queryLimit !== void 0 ? queryLimit : COLLECTION_DEFAULT_PAGINATION_LIMIT;
|
|
13222
13276
|
const { policy = COLLECTION_DEFAULT_CACHING_POLICY } = config !== null && config !== void 0 ? config : {};
|
|
13223
13277
|
const disposers = [];
|
|
13224
|
-
const
|
|
13278
|
+
const uniqueId = uuid();
|
|
13279
|
+
const cacheKey = ['message', 'collection', params, uniqueId];
|
|
13225
13280
|
const responder = (data) => {
|
|
13226
13281
|
var _a, _b;
|
|
13227
|
-
|
|
13282
|
+
const messages = applyFilter$1((_a = data.data
|
|
13228
13283
|
.map(messageId => pullFromCache(['message', 'get', messageId]))
|
|
13229
13284
|
.filter(Boolean)
|
|
13230
|
-
.
|
|
13231
|
-
if (!params.tags)
|
|
13232
|
-
return true;
|
|
13233
|
-
return params.tags.find(value => {
|
|
13234
|
-
var _a;
|
|
13235
|
-
if (!((_a = item.data) === null || _a === void 0 ? void 0 : _a.tags))
|
|
13236
|
-
return false;
|
|
13237
|
-
return item.data.tags.includes(value);
|
|
13238
|
-
});
|
|
13239
|
-
})
|
|
13240
|
-
.map(({ data }) => data)) !== null && _a !== void 0 ? _a : [];
|
|
13241
|
-
/*
|
|
13242
|
-
* for cases when message is deleted via RTE, this flag is used to get
|
|
13243
|
-
* items from cache that are !deleted
|
|
13244
|
-
*/
|
|
13245
|
-
if (!params.includeDeleted) {
|
|
13246
|
-
messages = filterByPropEquality(messages, 'isDeleted', false);
|
|
13247
|
-
}
|
|
13285
|
+
.map(({ data }) => data)) !== null && _a !== void 0 ? _a : [], params);
|
|
13248
13286
|
callback({
|
|
13249
13287
|
onNextPage: onFetch,
|
|
13250
13288
|
data: messages,
|
|
@@ -13254,10 +13292,28 @@ const getMessages = (params, callback, config) => {
|
|
|
13254
13292
|
});
|
|
13255
13293
|
};
|
|
13256
13294
|
const realtimeRouter = (action) => (message) => {
|
|
13257
|
-
var _a;
|
|
13295
|
+
var _a, _b, _c;
|
|
13258
13296
|
const collection = (_a = pullFromCache(cacheKey)) === null || _a === void 0 ? void 0 : _a.data;
|
|
13259
13297
|
if (params.subChannelId !== (message === null || message === void 0 ? void 0 : message.subChannelId) || !collection)
|
|
13260
13298
|
return;
|
|
13299
|
+
// /*
|
|
13300
|
+
// * check if RTE message event payload is with the params in order to update in the colleciton cache
|
|
13301
|
+
// */
|
|
13302
|
+
if (params.dataType && params.dataType !== message.dataType)
|
|
13303
|
+
return;
|
|
13304
|
+
if (params.excludeTags && ((_b = params.excludeTags) === null || _b === void 0 ? void 0 : _b.some(value => { var _a; return (_a = message.tags) === null || _a === void 0 ? void 0 : _a.includes(value); })))
|
|
13305
|
+
return;
|
|
13306
|
+
if (!!params.hasFlags !== !!message.flagCount)
|
|
13307
|
+
return;
|
|
13308
|
+
if (params.parentId && params.parentId !== message.parentId)
|
|
13309
|
+
return;
|
|
13310
|
+
if (params.hasOwnProperty('includeDeleted') && !params.includeDeleted && message.isDeleted)
|
|
13311
|
+
return;
|
|
13312
|
+
if (params.tags && !((_c = params.tags) === null || _c === void 0 ? void 0 : _c.some(value => { var _a; return (_a = message.tags) === null || _a === void 0 ? void 0 : _a.includes(value); })))
|
|
13313
|
+
return;
|
|
13314
|
+
if (!collection.data.includes(message.messageId) && action === 'onCreate') {
|
|
13315
|
+
collection.data = [...new Set([message.messageId, ...collection.data])];
|
|
13316
|
+
}
|
|
13261
13317
|
pushToCache(cacheKey, collection);
|
|
13262
13318
|
responder(collection);
|
|
13263
13319
|
};
|
|
@@ -13282,7 +13338,7 @@ const getMessages = (params, callback, config) => {
|
|
|
13282
13338
|
responder(data);
|
|
13283
13339
|
}, queryOptions(policy, CACHE_SHORTEN_LIFESPAN));
|
|
13284
13340
|
};
|
|
13285
|
-
disposers.push(onMessageFetched(realtimeRouter()), onMessageCreated(realtimeRouter()), onMessageUpdated(realtimeRouter()), onMessageDeleted(realtimeRouter()), onMessageFlagged(realtimeRouter()), onMessageUnflagged(realtimeRouter()), onMessageFlagCleared(realtimeRouter()), onMessageReactionAdded(realtimeRouter()), onMessageReactionRemoved(realtimeRouter()), convertEventPayload(onMessageMarkerFetched, 'contentId', 'message')(realtimeRouter()), convertEventPayload(onMessageMarked, 'contentId', 'message')(realtimeRouter()));
|
|
13341
|
+
disposers.push(onMessageFetched(realtimeRouter('onFetch')), onMessageCreated(realtimeRouter('onCreate')), onMessageUpdated(realtimeRouter('onUpdate')), onMessageDeleted(realtimeRouter('onDelete')), onMessageFlagged(realtimeRouter('onFlagged')), onMessageUnflagged(realtimeRouter('onUnflagged')), onMessageFlagCleared(realtimeRouter('onFlagCleared')), onMessageReactionAdded(realtimeRouter('onReactionAdded')), onMessageReactionRemoved(realtimeRouter('onReactionRemoved')), convertEventPayload(onMessageMarkerFetched, 'contentId', 'message')(realtimeRouter('onUpdate')), convertEventPayload(onMessageMarked, 'contentId', 'message')(realtimeRouter('onUpdate')));
|
|
13286
13342
|
onFetch(true);
|
|
13287
13343
|
disposers.push(() => dropFromCache(cacheKey));
|
|
13288
13344
|
return () => {
|
|
@@ -17306,8 +17362,10 @@ const getComments = (params, callback, config) => {
|
|
|
17306
17362
|
const collection = (_a = pullFromCache(cacheKey)) === null || _a === void 0 ? void 0 : _a.data;
|
|
17307
17363
|
if (params.referenceId !== comment.referenceId ||
|
|
17308
17364
|
params.referenceType !== comment.referenceType ||
|
|
17309
|
-
|
|
17365
|
+
params.parentId !== comment.parentId ||
|
|
17366
|
+
!collection) {
|
|
17310
17367
|
return;
|
|
17368
|
+
}
|
|
17311
17369
|
if (action === 'onCreate') {
|
|
17312
17370
|
collection.data = [...new Set([comment.commentId, ...collection.data])];
|
|
17313
17371
|
}
|
|
@@ -18227,10 +18285,6 @@ exports.getChannelMarkers = getChannelMarkers;
|
|
|
18227
18285
|
exports.getChannelTopic = getChannelTopic;
|
|
18228
18286
|
exports.getCommentTopic = getCommentTopic;
|
|
18229
18287
|
exports.getCommunityTopic = getCommunityTopic;
|
|
18230
|
-
exports.getDeviceId = getDeviceId;
|
|
18231
|
-
exports.getDeviceInfo = getDeviceInfo;
|
|
18232
|
-
exports.getDeviceModel = getDeviceModel;
|
|
18233
|
-
exports.getMQTTClientId = getMQTTClientId;
|
|
18234
18288
|
exports.getMarkedMessageTopic = getMarkedMessageTopic;
|
|
18235
18289
|
exports.getMessageMarkers = getMessageMarkers;
|
|
18236
18290
|
exports.getMessageTopic = getMessageTopic;
|
package/dist/index.d.ts
CHANGED
|
@@ -23,5 +23,4 @@ export * as CommentRepository from './commentRepository';
|
|
|
23
23
|
export * as StreamRepository from './streamRepository';
|
|
24
24
|
export * as PollRepository from './pollRepository';
|
|
25
25
|
export * from './external/api';
|
|
26
|
-
export * from './core/device';
|
|
27
26
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,cAAc,UAAU,CAAC;AAEzB,cAAc,WAAW,CAAC;AAG1B,cAAc,cAAc,CAAC;AAC7B,cAAc,qBAAqB,CAAC;AACpC,cAAc,aAAa,CAAC;AAE5B,OAAO,KAAK,MAAM,MAAM,UAAU,CAAC;AACnC,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAGvD,OAAO,KAAK,cAAc,MAAM,kBAAkB,CAAC;AAEnD,OAAO,KAAK,cAAc,MAAM,kBAAkB,CAAC;AAEnD,cAAc,YAAY,CAAC;AAG3B,OAAO,KAAK,kBAAkB,MAAM,sBAAsB,CAAC;AAE3D,cAAc,cAAc,CAAC;AAG7B,OAAO,KAAK,iBAAiB,MAAM,oBAAoB,CAAC;AACxD,OAAO,KAAK,iBAAiB,MAAM,qBAAqB,CAAC;AACzD,OAAO,KAAK,oBAAoB,MAAM,wBAAwB,CAAC;AAE/D,cAAc,cAAc,CAAC;AAC7B,cAAc,iBAAiB,CAAC;AAGhC,OAAO,KAAK,mBAAmB,MAAM,uBAAuB,CAAC;AAC7D,OAAO,KAAK,kBAAkB,MAAM,sBAAsB,CAAC;AAC3D,OAAO,KAAK,cAAc,MAAM,kBAAkB,CAAC;AACnD,OAAO,KAAK,cAAc,MAAM,kBAAkB,CAAC;AACnD,OAAO,KAAK,iBAAiB,MAAM,qBAAqB,CAAC;AACzD,OAAO,KAAK,gBAAgB,MAAM,oBAAoB,CAAC;AAEvD,OAAO,KAAK,cAAc,MAAM,kBAAkB,CAAC;AAG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