@amityco/ts-sdk 6.6.0 → 6.7.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/core/payload.d.ts +1 -0
- package/dist/@types/core/payload.d.ts.map +1 -1
- package/dist/@types/domains/reaction.d.ts +0 -4
- package/dist/@types/domains/reaction.d.ts.map +1 -1
- package/dist/communityRepository/api/getRecommendedCommunities.d.ts.map +1 -1
- package/dist/communityRepository/api/getTrendingCommunities.d.ts.map +1 -1
- package/dist/core/query/paging.d.ts.map +1 -1
- package/dist/index.cjs.js +56 -63
- package/dist/index.esm.js +56 -63
- package/dist/index.umd.js +4 -4
- package/dist/messageRepository/events/onMessageCreated.d.ts.map +1 -1
- package/dist/messageRepository/observers/getMessages.d.ts.map +1 -1
- package/dist/messageRepository/utils/prepareMessagePayload.d.ts +2 -2
- package/dist/messageRepository/utils/prepareMessagePayload.d.ts.map +1 -1
- package/dist/reactionRepository/events/onReactorAdded.d.ts.map +1 -1
- package/dist/reactionRepository/events/onReactorRemoved.d.ts.map +1 -1
- package/dist/reactionRepository/utils/prepareMessagePayloadForCache.d.ts +1 -1
- package/dist/reactionRepository/utils/prepareMessagePayloadForCache.d.ts.map +1 -1
- package/dist/utils/tests/dummy/comment.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/@types/core/payload.ts +1 -0
- package/src/@types/domains/reaction.ts +0 -6
- package/src/categoryRepository/observers/tests/getCategories.test.ts +2 -11
- package/src/channelRepsitory/observers/tests/getChannels.test.ts +1 -0
- package/src/communityRepository/api/getRecommendedCommunities.ts +0 -2
- package/src/communityRepository/api/getTrendingCommunities.ts +0 -2
- package/src/communityRepository/api/test/getRecommendedCommunities.test.ts +5 -51
- package/src/communityRepository/api/test/getTrendingCommunities.test.ts +6 -52
- package/src/core/query/paging.ts +9 -6
- package/src/messageRepository/api/tests/createMessage.test.ts +1 -0
- package/src/messageRepository/events/onMessageCreated.ts +9 -0
- package/src/messageRepository/events/onMessageReactionAdded.ts +1 -1
- package/src/messageRepository/events/onMessageReactionRemoved.ts +1 -1
- package/src/messageRepository/events/tests/events.test.ts +2 -0
- package/src/messageRepository/observers/getMessages.ts +3 -1
- package/src/messageRepository/observers/tests/getMessages.test.ts +3 -0
- package/src/messageRepository/utils/prepareMessagePayload.ts +20 -8
- package/src/reactionRepository/events/onReactorAdded.ts +2 -10
- package/src/reactionRepository/events/onReactorRemoved.ts +2 -10
- package/src/reactionRepository/utils/prepareMessagePayloadForCache.ts +8 -4
- package/src/reactionRepository/utils/prepareReactionPayloadFormEvent.ts +8 -8
- package/src/subChannelRepository/api/querySubChannels.ts +1 -1
- package/src/subChannelRepository/observers/getSubChannels.ts +1 -1
- package/src/subChannelRepository/utils/prepareSubChannelPayload.ts +1 -1
- package/src/utils/tests/dummy/comment.ts +1 -0
|
@@ -168,6 +168,7 @@ declare global {
|
|
|
168
168
|
messages: Amity.Message<T>[];
|
|
169
169
|
users: Amity.User[];
|
|
170
170
|
files: Amity.File[];
|
|
171
|
+
reactions: Amity.Reactor[];
|
|
171
172
|
};
|
|
172
173
|
type MessagePayload<T extends Amity.MessageContentType = any> = Omit<ProcessedMessagePayload<T>, 'messages'> & {
|
|
173
174
|
messages: Amity.RawMessage<T>[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"payload.d.ts","sourceRoot":"","sources":["../../../src/@types/core/payload.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC;AAEV,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,KAAK,CAAC;QACd,KAAK,QAAQ,GAAG;YACd,IAAI,EAAE,KAAK,CAAC,WAAW,CAAC;YACxB,IAAI,EAAE,KAAK,CAAC,WAAW,CAAC;YACxB,IAAI,EAAE,KAAK,CAAC,WAAW,CAAC;YACxB,OAAO,EAAE,KAAK,CAAC,cAAc,CAAC;YAC9B,UAAU,EAAE,KAAK,CAAC,iBAAiB,CAAC;YACpC,WAAW,EAAE,KAAK,CAAC,wB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WAAW,CAAC;QAEhE,KAAK,iBAAiB,GAAG,mBAAmB,GAAG,KAAK,CAAC,mBAAmB,CAAC;QAEzE,KAAK,cAAc,GAAG;YACpB,OAAO,EAAE,KAAK,CAAC,mBAAmB,CAAC,SAAS,CAAC,CAAC;YAC9C,YAAY,EAAE,KAAK,CAAC,WAAW,EAAE,CAAC;SACnC,CAAC;QAEF,KAAK,kBAAkB,GAAG,KAAK,CAAC,mBAAmB,EAAE,GACnD,KAAK,CAAC,WAAW,GACjB,KAAK,CAAC,gBAAgB,CAAC;KAC1B;CACF"}
|
|
@@ -12,10 +12,6 @@ declare global {
|
|
|
12
12
|
reactionsCount: number;
|
|
13
13
|
reactions: Record<string, number>;
|
|
14
14
|
myReactions?: string[];
|
|
15
|
-
latestReaction?: Amity.Reactor & Amity.Relationship<ReactableType> & {
|
|
16
|
-
eventName: 'add' | 'remove';
|
|
17
|
-
userDisplayName: string;
|
|
18
|
-
};
|
|
19
15
|
};
|
|
20
16
|
type Reaction = {
|
|
21
17
|
reactors: Reactor[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reaction.d.ts","sourceRoot":"","sources":["../../../src/@types/domains/reaction.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC;AAEV,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,KAAK,CAAC;QACd,KAAK,aAAa,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,CAAC;QAEpD,KAAK,kBAAkB,GAAG,SAAS,GAAG,WAAW,CAAC;QAElD,KAAK,OAAO,GAAG;YACb,UAAU,EAAE,MAAM,CAAC;YACnB,YAAY,EAAE,MAAM,CAAC;YACrB,MAAM,EAAE,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;SAC9B,GAAG,KAAK,CAAC,UAAU,CAAC;QAErB,KAAK,SAAS,GAAG;YACf,cAAc,EAAE,MAAM,CAAC;YACvB,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CA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CAC1D,KAAK,CAAC,OAAO,CAAC,YAAY,CAAC,EAC3B,IAAI,CAAC,cAAc,EAAE,MAAM,CAAC,CAC7B,CAAC;KACH;CACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getRecommendedCommunities.d.ts","sourceRoot":"","sources":["../../../src/communityRepository/api/getRecommendedCommunities.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"getRecommendedCommunities.d.ts","sourceRoot":"","sources":["../../../src/communityRepository/api/getRecommendedCommunities.ts"],"names":[],"mappings":"AAUA;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,yBAAyB,WAC5B,MAAM,SAAS,KACtB,QAAQ,MAAM,MAAM,CAAC,MAAM,SAAS,EAAE,CAAC,CAuBzC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getTrendingCommunities.d.ts","sourceRoot":"","sources":["../../../src/communityRepository/api/getTrendingCommunities.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"getTrendingCommunities.d.ts","sourceRoot":"","sources":["../../../src/communityRepository/api/getTrendingCommunities.ts"],"names":[],"mappings":"AAOA;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,sBAAsB,WACzB,MAAM,SAAS,KACtB,QAAQ,MAAM,MAAM,CAAC,MAAM,SAAS,EAAE,CAAC,CAuBzC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"paging.d.ts","sourceRoot":"","sources":["../../../src/core/query/paging.ts"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AACH,eAAO,MAAM,MAAM,SAAU,OAAO,MAAM,EAAE,OAAO,CAAC,sCACf,CAAC;AAEtC;;;;;;;GAOG;AACH,eAAO,MAAM,aAAa,SAAU,OAAO,MAAM,EAAE,OAAO,CAAC,wCACe,CAAC;AAE3E;;;;;;;GAOG;AACH,eAAO,MAAM,gBAAgB,SACrB,OAAO,MAAM,EAAE,OAAO,CAAC,0BAC6B,CAAC;AAE7D;;;;;;;GAOG;AACH,eAAO,MAAM,OAAO,+BAAgC,GAAG,mCAMtD,CAAC;AAEF;;;;;;;;GAQG;AACH,eAAO,MAAM,OAAO,WACV,MAAM,IAAI,GAAG,MAAM,OAAO,GAAG,SAAS,SACvC,MAAM,gBAAgB,KAC5B,MAAM,KAAK,GAAG,
|
|
1
|
+
{"version":3,"file":"paging.d.ts","sourceRoot":"","sources":["../../../src/core/query/paging.ts"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AACH,eAAO,MAAM,MAAM,SAAU,OAAO,MAAM,EAAE,OAAO,CAAC,sCACf,CAAC;AAEtC;;;;;;;GAOG;AACH,eAAO,MAAM,aAAa,SAAU,OAAO,MAAM,EAAE,OAAO,CAAC,wCACe,CAAC;AAE3E;;;;;;;GAOG;AACH,eAAO,MAAM,gBAAgB,SACrB,OAAO,MAAM,EAAE,OAAO,CAAC,0BAC6B,CAAC;AAE7D;;;;;;;GAOG;AACH,eAAO,MAAM,OAAO,+BAAgC,GAAG,mCAMtD,CAAC;AAEF;;;;;;;;GAQG;AACH,eAAO,MAAM,OAAO,WACV,MAAM,IAAI,GAAG,MAAM,OAAO,GAAG,SAAS,SACvC,MAAM,gBAAgB,KAC5B,MAAM,KAAK,GAAG,SA6ChB,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,MAAM,WAAY,MAAM,KAAK,KAAG,MAAM,IAAI,GAAG,SA6BzD,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,SAAS,WAAY,MAAM,KAAK,KAAG,MAAM,OAAO,GAAG,SAW/D,CAAC"}
|
package/dist/index.cjs.js
CHANGED
|
@@ -96,8 +96,8 @@ const PostContentType = Object.freeze({
|
|
|
96
96
|
|
|
97
97
|
function getVersion() {
|
|
98
98
|
try {
|
|
99
|
-
// the string ''v6.
|
|
100
|
-
return 'v6.
|
|
99
|
+
// the string ''v6.7.0-cjs'' should be replaced by actual value by @rollup/plugin-replace
|
|
100
|
+
return 'v6.7.0-cjs';
|
|
101
101
|
}
|
|
102
102
|
catch (error) {
|
|
103
103
|
return '__dev__';
|
|
@@ -256,22 +256,14 @@ const toToken = (paging, style) => {
|
|
|
256
256
|
"before" or "after" value. if that would change,
|
|
257
257
|
we'd need to move toward a more simple: `!paging.before`
|
|
258
258
|
*/
|
|
259
|
-
if (
|
|
260
|
-
payload = {
|
|
261
|
-
before: paging.before,
|
|
262
|
-
last: paging.limit,
|
|
263
|
-
};
|
|
259
|
+
if (paging === null || paging === void 0 ? void 0 : paging.before) {
|
|
260
|
+
payload = Object.assign(Object.assign({}, payload), { before: paging.before });
|
|
264
261
|
}
|
|
265
|
-
|
|
266
|
-
payload = {
|
|
267
|
-
after: paging.after,
|
|
268
|
-
first: paging.limit,
|
|
269
|
-
};
|
|
262
|
+
if (paging === null || paging === void 0 ? void 0 : paging.after) {
|
|
263
|
+
payload = Object.assign(Object.assign({}, payload), { after: paging.after });
|
|
270
264
|
}
|
|
271
|
-
|
|
272
|
-
payload = {
|
|
273
|
-
last: paging.limit,
|
|
274
|
-
};
|
|
265
|
+
if (!Number.isNaN(Number(paging === null || paging === void 0 ? void 0 : paging.limit))) {
|
|
266
|
+
payload = Object.assign(Object.assign({}, payload), { limit: paging.limit });
|
|
275
267
|
}
|
|
276
268
|
}
|
|
277
269
|
else if (style === 'afterbeforeraw') {
|
|
@@ -21161,7 +21153,7 @@ const getUserMarker = async () => {
|
|
|
21161
21153
|
* @param message payload from http request without myReactions
|
|
21162
21154
|
* add myReactions to http response if the event was a reaction event
|
|
21163
21155
|
*/
|
|
21164
|
-
const prepareMessagePayloadForCache = (payload) => {
|
|
21156
|
+
const prepareMessagePayloadForCache = (payload, reactors, event) => {
|
|
21165
21157
|
const client = getActiveClient();
|
|
21166
21158
|
const cached = pullFromCache(['message', 'get', payload.messageId]);
|
|
21167
21159
|
// '[]' in cases where the new reaction is the first one
|
|
@@ -21169,19 +21161,19 @@ const prepareMessagePayloadForCache = (payload) => {
|
|
|
21169
21161
|
// add myReactions to the payload
|
|
21170
21162
|
Object.assign(payload, { myReactions });
|
|
21171
21163
|
// check if there are any updates to the reactions
|
|
21172
|
-
const latestReaction =
|
|
21164
|
+
const latestReaction = reactors[0];
|
|
21173
21165
|
const isLatestReactionMine = latestReaction && latestReaction.userId === client.userId;
|
|
21174
21166
|
if (!isLatestReactionMine) {
|
|
21175
21167
|
return;
|
|
21176
21168
|
}
|
|
21177
21169
|
// new reaction added
|
|
21178
|
-
if (
|
|
21170
|
+
if (event === 'message.reactionAdded' && !myReactions.includes(latestReaction.reactionName)) {
|
|
21179
21171
|
Object.assign(payload, {
|
|
21180
21172
|
myReactions: [...myReactions, latestReaction.reactionName],
|
|
21181
21173
|
});
|
|
21182
21174
|
}
|
|
21183
21175
|
// existing reaction removed
|
|
21184
|
-
if (
|
|
21176
|
+
if (event === 'message.reactionRemoved' && myReactions.includes(latestReaction.reactionName)) {
|
|
21185
21177
|
Object.assign(payload, {
|
|
21186
21178
|
myReactions: myReactions.filter(x => x !== latestReaction.reactionName),
|
|
21187
21179
|
});
|
|
@@ -21225,7 +21217,7 @@ const getMessageReadCount = (message, marker) => {
|
|
|
21225
21217
|
getCachedMarker(message)) !== null && _a !== void 0 ? _a : { readCount: 0, deliveredCount: 0 };
|
|
21226
21218
|
}; // and if not found in cache use default value `0`
|
|
21227
21219
|
|
|
21228
|
-
function convertFromRaw$1(message) {
|
|
21220
|
+
function convertFromRaw$1(message, reactors, event) {
|
|
21229
21221
|
const { channelPublicId, childCount, creatorPublicId, mentionedUsers, messageFeedId, myReactions, reactionCount, reactions, referenceId, segment, messageId } = message, rest = __rest(message, ["channelPublicId", "childCount", "creatorPublicId", "mentionedUsers", "messageFeedId", "myReactions", "reactionCount", "reactions", "referenceId", "segment", "messageId"]);
|
|
21230
21222
|
let cache;
|
|
21231
21223
|
if (referenceId) {
|
|
@@ -21239,7 +21231,15 @@ function convertFromRaw$1(message) {
|
|
|
21239
21231
|
},
|
|
21240
21232
|
get deliveredCount() {
|
|
21241
21233
|
return getMessageReadCount(message).deliveredCount;
|
|
21242
|
-
} }, rest), { messageId, channelId: channelPublicId, channelSegment: segment, childrenNumber: childCount, creatorId: creatorPublicId, reactions: reactions !== null && reactions !== void 0 ? reactions : {},
|
|
21234
|
+
} }, rest), { messageId, channelId: channelPublicId, channelSegment: segment, childrenNumber: childCount, creatorId: creatorPublicId, reactions: reactions !== null && reactions !== void 0 ? reactions : {},
|
|
21235
|
+
/*
|
|
21236
|
+
* Previously, myReactions were added only if it was part of the payload.
|
|
21237
|
+
* So empty myReactions were not present. So I've edited the payload to add
|
|
21238
|
+
* a default for those cases.
|
|
21239
|
+
*
|
|
21240
|
+
* Check git blame for previous iteration
|
|
21241
|
+
*/
|
|
21242
|
+
myReactions: myReactions !== null && myReactions !== void 0 ? myReactions : [], reactionsCount: reactionCount, subChannelId: messageFeedId, uniqueId: cache ? cache.data.uniqueId : messageId, referenceId });
|
|
21243
21243
|
if (mentionedUsers) {
|
|
21244
21244
|
out.mentionees = mentionedUsers.map(mention => {
|
|
21245
21245
|
if (mention.type === 'channel') {
|
|
@@ -21248,20 +21248,18 @@ function convertFromRaw$1(message) {
|
|
|
21248
21248
|
return { type: 'user', userIds: mention.userPublicIds };
|
|
21249
21249
|
});
|
|
21250
21250
|
}
|
|
21251
|
-
if (
|
|
21252
|
-
// http response
|
|
21253
|
-
out.myReactions = myReactions;
|
|
21254
|
-
}
|
|
21255
|
-
else {
|
|
21251
|
+
if (reactors && reactors.length && event) {
|
|
21256
21252
|
// mqtt event
|
|
21257
|
-
prepareMessagePayloadForCache(out);
|
|
21253
|
+
prepareMessagePayloadForCache(out, reactors, event);
|
|
21258
21254
|
}
|
|
21259
21255
|
return out;
|
|
21260
21256
|
}
|
|
21261
21257
|
const preUpdateMessageCache = (rawPayload) => {
|
|
21262
|
-
ingestInCache({
|
|
21258
|
+
ingestInCache({
|
|
21259
|
+
messages: rawPayload.messages.map(message => convertFromRaw$1(message, rawPayload.reactions)),
|
|
21260
|
+
});
|
|
21263
21261
|
};
|
|
21264
|
-
const prepareMessagePayload = async (payload) => {
|
|
21262
|
+
const prepareMessagePayload = async (payload, event) => {
|
|
21265
21263
|
const markerIds = payload.messages.map(({ messageId }) => messageId);
|
|
21266
21264
|
if (markerIds.length > 0) {
|
|
21267
21265
|
// since the get markers method requires a channel cache to function with the reducer.
|
|
@@ -21273,7 +21271,7 @@ const prepareMessagePayload = async (payload) => {
|
|
|
21273
21271
|
// empty block (from the spec, allow marker fetch to fail without having to do anything)
|
|
21274
21272
|
}
|
|
21275
21273
|
}
|
|
21276
|
-
return Object.assign(Object.assign({}, payload), { messages: payload.messages.map(convertFromRaw$1) });
|
|
21274
|
+
return Object.assign(Object.assign({}, payload), { messages: payload.messages.map(m => convertFromRaw$1(m, payload.reactions, event)) });
|
|
21277
21275
|
};
|
|
21278
21276
|
function convertParams(_a) {
|
|
21279
21277
|
var { subChannelId, mentionees } = _a, rest = __rest(_a, ["subChannelId", "mentionees"]);
|
|
@@ -21347,7 +21345,7 @@ const prepareSubChannelPayload = async (rawPayload) => {
|
|
|
21347
21345
|
}
|
|
21348
21346
|
// attach marker to sub channel
|
|
21349
21347
|
const messageFeeds = rawPayload.messageFeeds.map(convertFromRaw);
|
|
21350
|
-
const messages = rawPayload.messages.map(convertFromRaw$1);
|
|
21348
|
+
const messages = rawPayload.messages.map(m => convertFromRaw$1(m));
|
|
21351
21349
|
return Object.assign(Object.assign({}, rawPayload), { messageFeeds,
|
|
21352
21350
|
messages });
|
|
21353
21351
|
};
|
|
@@ -24015,7 +24013,13 @@ const onMessageCreated = (callback, local = true) => {
|
|
|
24015
24013
|
const filter = async (rawPayload) => {
|
|
24016
24014
|
const payload = await prepareMessagePayload(rawPayload);
|
|
24017
24015
|
const message = payload.messages[0];
|
|
24016
|
+
// Update in cache
|
|
24018
24017
|
ingestInCache(payload);
|
|
24018
|
+
// Update lastActivity for Channel and SubChannel
|
|
24019
|
+
payload.messages.forEach(({ channelId, subChannelId, createdAt }) => {
|
|
24020
|
+
upsertInCache(['channel', 'get', channelId], { lastActivity: createdAt });
|
|
24021
|
+
upsertInCache(['subChannel', 'get', channelId], { lastActivity: createdAt });
|
|
24022
|
+
});
|
|
24019
24023
|
callback(message);
|
|
24020
24024
|
};
|
|
24021
24025
|
const disposers = [
|
|
@@ -24185,7 +24189,7 @@ const onMessageFlagCleared = (callback) => {
|
|
|
24185
24189
|
const onMessageReactionAdded = (callback) => {
|
|
24186
24190
|
const client = getActiveClient();
|
|
24187
24191
|
const filter = async (rawPayload) => {
|
|
24188
|
-
const payload = await prepareMessagePayload(rawPayload);
|
|
24192
|
+
const payload = await prepareMessagePayload(rawPayload, 'message.reactionAdded');
|
|
24189
24193
|
ingestInCache(payload);
|
|
24190
24194
|
callback(payload.messages[0]);
|
|
24191
24195
|
};
|
|
@@ -24211,7 +24215,7 @@ const onMessageReactionAdded = (callback) => {
|
|
|
24211
24215
|
const onMessageReactionRemoved = (callback) => {
|
|
24212
24216
|
const client = getActiveClient();
|
|
24213
24217
|
const filter = async (rawPayload) => {
|
|
24214
|
-
const payload = await prepareMessagePayload(rawPayload);
|
|
24218
|
+
const payload = await prepareMessagePayload(rawPayload, 'message.reactionRemoved');
|
|
24215
24219
|
ingestInCache(payload);
|
|
24216
24220
|
callback(payload.messages[0]);
|
|
24217
24221
|
};
|
|
@@ -27070,18 +27074,18 @@ const prepareReactionPayloadFormEvent = (event, payload) => {
|
|
|
27070
27074
|
const eventPrefix = event.split('.')[0]; // 'post' | 'comment'
|
|
27071
27075
|
const eventSuffix = event.split('.')[1]; // 'addReaction' | 'removeReaction'
|
|
27072
27076
|
let myReactions = getMyReactionsInCache(payload, eventPrefix);
|
|
27073
|
-
if (
|
|
27074
|
-
if (
|
|
27075
|
-
myReactions.
|
|
27077
|
+
if (getActiveClient().userId === payload.reactor.userId) {
|
|
27078
|
+
if (eventSuffix === 'addReaction') {
|
|
27079
|
+
if (!myReactions.includes(payload.reactor.reactionName)) {
|
|
27080
|
+
myReactions.push(payload.reactor.reactionName);
|
|
27081
|
+
}
|
|
27076
27082
|
}
|
|
27077
|
-
|
|
27078
|
-
else if (eventSuffix === 'removeReaction') {
|
|
27079
|
-
if (getActiveClient().userId === payload.reactor.userId) {
|
|
27083
|
+
else if (eventSuffix === 'removeReaction') {
|
|
27080
27084
|
myReactions = myReactions.filter(reaction => reaction !== payload.reactor.reactionName);
|
|
27081
27085
|
}
|
|
27082
|
-
|
|
27083
|
-
|
|
27084
|
-
|
|
27086
|
+
else {
|
|
27087
|
+
throw new Error(`Unknown event type: ${eventSuffix}`);
|
|
27088
|
+
}
|
|
27085
27089
|
}
|
|
27086
27090
|
return rebuildPayload(payload, `${eventPrefix}s`, myReactions);
|
|
27087
27091
|
};
|
|
@@ -27801,16 +27805,10 @@ const onReactorAdded = (referenceType, referenceId, callback) => {
|
|
|
27801
27805
|
if (referenceType === 'message') {
|
|
27802
27806
|
const filter = async (rawPayload) => {
|
|
27803
27807
|
const payload = await prepareMessagePayload(rawPayload);
|
|
27804
|
-
if (!payload.
|
|
27805
|
-
return;
|
|
27806
|
-
const _a = payload.messages[0].latestReaction, { eventName, referenceId, referenceType, userDisplayName } = _a, reactor = __rest(_a, ["eventName", "referenceId", "referenceType", "userDisplayName"]);
|
|
27807
|
-
if (eventName !== 'add')
|
|
27808
|
+
if (!payload.reactions[0])
|
|
27808
27809
|
return;
|
|
27809
27810
|
ingestInCache(payload);
|
|
27810
|
-
|
|
27811
|
-
// @ts-ignore
|
|
27812
|
-
ingestInCache({ reactions: [reactor] });
|
|
27813
|
-
callbackWrapper('message', payload.messages[0].messageId, reactor);
|
|
27811
|
+
callbackWrapper('message', payload.messages[0].messageId, payload.reactions[0]);
|
|
27814
27812
|
};
|
|
27815
27813
|
return createEventSubscriber(client, 'reaction/onReactorAdded', 'message.updated', filter);
|
|
27816
27814
|
}
|
|
@@ -27863,16 +27861,10 @@ const onReactorRemoved = (referenceType, referenceId, callback) => {
|
|
|
27863
27861
|
if (referenceType === 'message') {
|
|
27864
27862
|
const filter = async (rawPayload) => {
|
|
27865
27863
|
const payload = await prepareMessagePayload(rawPayload);
|
|
27866
|
-
if (!payload.
|
|
27867
|
-
return;
|
|
27868
|
-
const _a = payload.messages[0].latestReaction, { eventName, referenceId, referenceType } = _a, reactor = __rest(_a, ["eventName", "referenceId", "referenceType"]);
|
|
27869
|
-
if (eventName !== 'remove')
|
|
27864
|
+
if (!payload.reactions[0])
|
|
27870
27865
|
return;
|
|
27871
27866
|
ingestInCache(payload);
|
|
27872
|
-
|
|
27873
|
-
// @ts-ignore
|
|
27874
|
-
ingestInCache({ reactions: [reactor] });
|
|
27875
|
-
callbackWrapper('message', payload.messages[0].messageId, reactor);
|
|
27867
|
+
callbackWrapper('message', payload.messages[0].messageId, payload.reactions[0]);
|
|
27876
27868
|
};
|
|
27877
27869
|
return createEventSubscriber(client, 'reaction/onReactorRemoved', 'message.updated', filter);
|
|
27878
27870
|
}
|
|
@@ -29035,7 +29027,9 @@ const getMessages = (params, callback, config) => {
|
|
|
29035
29027
|
const collection = (_a = pullFromCache(cacheKey)) === null || _a === void 0 ? void 0 : _a.data;
|
|
29036
29028
|
if (params.subChannelId !== (message === null || message === void 0 ? void 0 : message.subChannelId) || !collection)
|
|
29037
29029
|
return;
|
|
29038
|
-
collection.data
|
|
29030
|
+
if (!collection.data.includes(message.messageId)) {
|
|
29031
|
+
collection.data = [...new Set([message.messageId, ...collection.data])];
|
|
29032
|
+
}
|
|
29039
29033
|
pushToCache(cacheKey, collection);
|
|
29040
29034
|
responder(collection);
|
|
29041
29035
|
};
|
|
@@ -29479,7 +29473,7 @@ const querySubChannels = async (query) => {
|
|
|
29479
29473
|
const _a = convertQueryParams(query), { page = { limit: 10 }, channelId, includeDeleted } = _a, params = __rest(_a, ["page", "channelId", "includeDeleted"]);
|
|
29480
29474
|
const response = await client.http.get(`/api/v5/message-feeds/channel/${channelId}`, {
|
|
29481
29475
|
params: Object.assign(Object.assign({}, params), { isDeleted: inferIsDeleted(includeDeleted), options: {
|
|
29482
|
-
token: toToken(page, '
|
|
29476
|
+
token: toToken(page, 'afterbefore'),
|
|
29483
29477
|
} }),
|
|
29484
29478
|
});
|
|
29485
29479
|
const _b = response.data, { paging } = _b, payload = __rest(_b, ["paging"]);
|
|
@@ -29603,12 +29597,11 @@ const getSubChannels = (params, callback, config) => {
|
|
|
29603
29597
|
responder(snapshot);
|
|
29604
29598
|
};
|
|
29605
29599
|
const onFetch = () => {
|
|
29606
|
-
var _a;
|
|
29607
29600
|
const subChannels = snapshot ? snapshot.data : [];
|
|
29608
29601
|
if (subChannels.length > 0 && !(snapshot === null || snapshot === void 0 ? void 0 : snapshot.params.page)) {
|
|
29609
29602
|
return;
|
|
29610
29603
|
}
|
|
29611
|
-
const query = createQuery(querySubChannels, Object.assign(Object.assign({}, queryParams), { page: (
|
|
29604
|
+
const query = createQuery(querySubChannels, Object.assign(Object.assign({}, queryParams), { page: (snapshot === null || snapshot === void 0 ? void 0 : snapshot.params.page) ? Object.assign(Object.assign({}, snapshot === null || snapshot === void 0 ? void 0 : snapshot.params.page), { limit }) : { limit } }));
|
|
29612
29605
|
runQuery(query, ({ data: result, error, loading, nextPage: page }) => {
|
|
29613
29606
|
snapshot = {
|
|
29614
29607
|
loading,
|
package/dist/index.esm.js
CHANGED
|
@@ -82,8 +82,8 @@ const PostContentType = Object.freeze({
|
|
|
82
82
|
|
|
83
83
|
function getVersion() {
|
|
84
84
|
try {
|
|
85
|
-
// the string ''v6.
|
|
86
|
-
return 'v6.
|
|
85
|
+
// the string ''v6.7.0-esm'' should be replaced by actual value by @rollup/plugin-replace
|
|
86
|
+
return 'v6.7.0-esm';
|
|
87
87
|
}
|
|
88
88
|
catch (error) {
|
|
89
89
|
return '__dev__';
|
|
@@ -242,22 +242,14 @@ const toToken = (paging, style) => {
|
|
|
242
242
|
"before" or "after" value. if that would change,
|
|
243
243
|
we'd need to move toward a more simple: `!paging.before`
|
|
244
244
|
*/
|
|
245
|
-
if (
|
|
246
|
-
payload = {
|
|
247
|
-
before: paging.before,
|
|
248
|
-
last: paging.limit,
|
|
249
|
-
};
|
|
245
|
+
if (paging === null || paging === void 0 ? void 0 : paging.before) {
|
|
246
|
+
payload = Object.assign(Object.assign({}, payload), { before: paging.before });
|
|
250
247
|
}
|
|
251
|
-
|
|
252
|
-
payload = {
|
|
253
|
-
after: paging.after,
|
|
254
|
-
first: paging.limit,
|
|
255
|
-
};
|
|
248
|
+
if (paging === null || paging === void 0 ? void 0 : paging.after) {
|
|
249
|
+
payload = Object.assign(Object.assign({}, payload), { after: paging.after });
|
|
256
250
|
}
|
|
257
|
-
|
|
258
|
-
payload = {
|
|
259
|
-
last: paging.limit,
|
|
260
|
-
};
|
|
251
|
+
if (!Number.isNaN(Number(paging === null || paging === void 0 ? void 0 : paging.limit))) {
|
|
252
|
+
payload = Object.assign(Object.assign({}, payload), { limit: paging.limit });
|
|
261
253
|
}
|
|
262
254
|
}
|
|
263
255
|
else if (style === 'afterbeforeraw') {
|
|
@@ -21147,7 +21139,7 @@ const getUserMarker = async () => {
|
|
|
21147
21139
|
* @param message payload from http request without myReactions
|
|
21148
21140
|
* add myReactions to http response if the event was a reaction event
|
|
21149
21141
|
*/
|
|
21150
|
-
const prepareMessagePayloadForCache = (payload) => {
|
|
21142
|
+
const prepareMessagePayloadForCache = (payload, reactors, event) => {
|
|
21151
21143
|
const client = getActiveClient();
|
|
21152
21144
|
const cached = pullFromCache(['message', 'get', payload.messageId]);
|
|
21153
21145
|
// '[]' in cases where the new reaction is the first one
|
|
@@ -21155,19 +21147,19 @@ const prepareMessagePayloadForCache = (payload) => {
|
|
|
21155
21147
|
// add myReactions to the payload
|
|
21156
21148
|
Object.assign(payload, { myReactions });
|
|
21157
21149
|
// check if there are any updates to the reactions
|
|
21158
|
-
const latestReaction =
|
|
21150
|
+
const latestReaction = reactors[0];
|
|
21159
21151
|
const isLatestReactionMine = latestReaction && latestReaction.userId === client.userId;
|
|
21160
21152
|
if (!isLatestReactionMine) {
|
|
21161
21153
|
return;
|
|
21162
21154
|
}
|
|
21163
21155
|
// new reaction added
|
|
21164
|
-
if (
|
|
21156
|
+
if (event === 'message.reactionAdded' && !myReactions.includes(latestReaction.reactionName)) {
|
|
21165
21157
|
Object.assign(payload, {
|
|
21166
21158
|
myReactions: [...myReactions, latestReaction.reactionName],
|
|
21167
21159
|
});
|
|
21168
21160
|
}
|
|
21169
21161
|
// existing reaction removed
|
|
21170
|
-
if (
|
|
21162
|
+
if (event === 'message.reactionRemoved' && myReactions.includes(latestReaction.reactionName)) {
|
|
21171
21163
|
Object.assign(payload, {
|
|
21172
21164
|
myReactions: myReactions.filter(x => x !== latestReaction.reactionName),
|
|
21173
21165
|
});
|
|
@@ -21211,7 +21203,7 @@ const getMessageReadCount = (message, marker) => {
|
|
|
21211
21203
|
getCachedMarker(message)) !== null && _a !== void 0 ? _a : { readCount: 0, deliveredCount: 0 };
|
|
21212
21204
|
}; // and if not found in cache use default value `0`
|
|
21213
21205
|
|
|
21214
|
-
function convertFromRaw$1(message) {
|
|
21206
|
+
function convertFromRaw$1(message, reactors, event) {
|
|
21215
21207
|
const { channelPublicId, childCount, creatorPublicId, mentionedUsers, messageFeedId, myReactions, reactionCount, reactions, referenceId, segment, messageId } = message, rest = __rest(message, ["channelPublicId", "childCount", "creatorPublicId", "mentionedUsers", "messageFeedId", "myReactions", "reactionCount", "reactions", "referenceId", "segment", "messageId"]);
|
|
21216
21208
|
let cache;
|
|
21217
21209
|
if (referenceId) {
|
|
@@ -21225,7 +21217,15 @@ function convertFromRaw$1(message) {
|
|
|
21225
21217
|
},
|
|
21226
21218
|
get deliveredCount() {
|
|
21227
21219
|
return getMessageReadCount(message).deliveredCount;
|
|
21228
|
-
} }, rest), { messageId, channelId: channelPublicId, channelSegment: segment, childrenNumber: childCount, creatorId: creatorPublicId, reactions: reactions !== null && reactions !== void 0 ? reactions : {},
|
|
21220
|
+
} }, rest), { messageId, channelId: channelPublicId, channelSegment: segment, childrenNumber: childCount, creatorId: creatorPublicId, reactions: reactions !== null && reactions !== void 0 ? reactions : {},
|
|
21221
|
+
/*
|
|
21222
|
+
* Previously, myReactions were added only if it was part of the payload.
|
|
21223
|
+
* So empty myReactions were not present. So I've edited the payload to add
|
|
21224
|
+
* a default for those cases.
|
|
21225
|
+
*
|
|
21226
|
+
* Check git blame for previous iteration
|
|
21227
|
+
*/
|
|
21228
|
+
myReactions: myReactions !== null && myReactions !== void 0 ? myReactions : [], reactionsCount: reactionCount, subChannelId: messageFeedId, uniqueId: cache ? cache.data.uniqueId : messageId, referenceId });
|
|
21229
21229
|
if (mentionedUsers) {
|
|
21230
21230
|
out.mentionees = mentionedUsers.map(mention => {
|
|
21231
21231
|
if (mention.type === 'channel') {
|
|
@@ -21234,20 +21234,18 @@ function convertFromRaw$1(message) {
|
|
|
21234
21234
|
return { type: 'user', userIds: mention.userPublicIds };
|
|
21235
21235
|
});
|
|
21236
21236
|
}
|
|
21237
|
-
if (
|
|
21238
|
-
// http response
|
|
21239
|
-
out.myReactions = myReactions;
|
|
21240
|
-
}
|
|
21241
|
-
else {
|
|
21237
|
+
if (reactors && reactors.length && event) {
|
|
21242
21238
|
// mqtt event
|
|
21243
|
-
prepareMessagePayloadForCache(out);
|
|
21239
|
+
prepareMessagePayloadForCache(out, reactors, event);
|
|
21244
21240
|
}
|
|
21245
21241
|
return out;
|
|
21246
21242
|
}
|
|
21247
21243
|
const preUpdateMessageCache = (rawPayload) => {
|
|
21248
|
-
ingestInCache({
|
|
21244
|
+
ingestInCache({
|
|
21245
|
+
messages: rawPayload.messages.map(message => convertFromRaw$1(message, rawPayload.reactions)),
|
|
21246
|
+
});
|
|
21249
21247
|
};
|
|
21250
|
-
const prepareMessagePayload = async (payload) => {
|
|
21248
|
+
const prepareMessagePayload = async (payload, event) => {
|
|
21251
21249
|
const markerIds = payload.messages.map(({ messageId }) => messageId);
|
|
21252
21250
|
if (markerIds.length > 0) {
|
|
21253
21251
|
// since the get markers method requires a channel cache to function with the reducer.
|
|
@@ -21259,7 +21257,7 @@ const prepareMessagePayload = async (payload) => {
|
|
|
21259
21257
|
// empty block (from the spec, allow marker fetch to fail without having to do anything)
|
|
21260
21258
|
}
|
|
21261
21259
|
}
|
|
21262
|
-
return Object.assign(Object.assign({}, payload), { messages: payload.messages.map(convertFromRaw$1) });
|
|
21260
|
+
return Object.assign(Object.assign({}, payload), { messages: payload.messages.map(m => convertFromRaw$1(m, payload.reactions, event)) });
|
|
21263
21261
|
};
|
|
21264
21262
|
function convertParams(_a) {
|
|
21265
21263
|
var { subChannelId, mentionees } = _a, rest = __rest(_a, ["subChannelId", "mentionees"]);
|
|
@@ -21333,7 +21331,7 @@ const prepareSubChannelPayload = async (rawPayload) => {
|
|
|
21333
21331
|
}
|
|
21334
21332
|
// attach marker to sub channel
|
|
21335
21333
|
const messageFeeds = rawPayload.messageFeeds.map(convertFromRaw);
|
|
21336
|
-
const messages = rawPayload.messages.map(convertFromRaw$1);
|
|
21334
|
+
const messages = rawPayload.messages.map(m => convertFromRaw$1(m));
|
|
21337
21335
|
return Object.assign(Object.assign({}, rawPayload), { messageFeeds,
|
|
21338
21336
|
messages });
|
|
21339
21337
|
};
|
|
@@ -24001,7 +23999,13 @@ const onMessageCreated = (callback, local = true) => {
|
|
|
24001
23999
|
const filter = async (rawPayload) => {
|
|
24002
24000
|
const payload = await prepareMessagePayload(rawPayload);
|
|
24003
24001
|
const message = payload.messages[0];
|
|
24002
|
+
// Update in cache
|
|
24004
24003
|
ingestInCache(payload);
|
|
24004
|
+
// Update lastActivity for Channel and SubChannel
|
|
24005
|
+
payload.messages.forEach(({ channelId, subChannelId, createdAt }) => {
|
|
24006
|
+
upsertInCache(['channel', 'get', channelId], { lastActivity: createdAt });
|
|
24007
|
+
upsertInCache(['subChannel', 'get', channelId], { lastActivity: createdAt });
|
|
24008
|
+
});
|
|
24005
24009
|
callback(message);
|
|
24006
24010
|
};
|
|
24007
24011
|
const disposers = [
|
|
@@ -24171,7 +24175,7 @@ const onMessageFlagCleared = (callback) => {
|
|
|
24171
24175
|
const onMessageReactionAdded = (callback) => {
|
|
24172
24176
|
const client = getActiveClient();
|
|
24173
24177
|
const filter = async (rawPayload) => {
|
|
24174
|
-
const payload = await prepareMessagePayload(rawPayload);
|
|
24178
|
+
const payload = await prepareMessagePayload(rawPayload, 'message.reactionAdded');
|
|
24175
24179
|
ingestInCache(payload);
|
|
24176
24180
|
callback(payload.messages[0]);
|
|
24177
24181
|
};
|
|
@@ -24197,7 +24201,7 @@ const onMessageReactionAdded = (callback) => {
|
|
|
24197
24201
|
const onMessageReactionRemoved = (callback) => {
|
|
24198
24202
|
const client = getActiveClient();
|
|
24199
24203
|
const filter = async (rawPayload) => {
|
|
24200
|
-
const payload = await prepareMessagePayload(rawPayload);
|
|
24204
|
+
const payload = await prepareMessagePayload(rawPayload, 'message.reactionRemoved');
|
|
24201
24205
|
ingestInCache(payload);
|
|
24202
24206
|
callback(payload.messages[0]);
|
|
24203
24207
|
};
|
|
@@ -27056,18 +27060,18 @@ const prepareReactionPayloadFormEvent = (event, payload) => {
|
|
|
27056
27060
|
const eventPrefix = event.split('.')[0]; // 'post' | 'comment'
|
|
27057
27061
|
const eventSuffix = event.split('.')[1]; // 'addReaction' | 'removeReaction'
|
|
27058
27062
|
let myReactions = getMyReactionsInCache(payload, eventPrefix);
|
|
27059
|
-
if (
|
|
27060
|
-
if (
|
|
27061
|
-
myReactions.
|
|
27063
|
+
if (getActiveClient().userId === payload.reactor.userId) {
|
|
27064
|
+
if (eventSuffix === 'addReaction') {
|
|
27065
|
+
if (!myReactions.includes(payload.reactor.reactionName)) {
|
|
27066
|
+
myReactions.push(payload.reactor.reactionName);
|
|
27067
|
+
}
|
|
27062
27068
|
}
|
|
27063
|
-
|
|
27064
|
-
else if (eventSuffix === 'removeReaction') {
|
|
27065
|
-
if (getActiveClient().userId === payload.reactor.userId) {
|
|
27069
|
+
else if (eventSuffix === 'removeReaction') {
|
|
27066
27070
|
myReactions = myReactions.filter(reaction => reaction !== payload.reactor.reactionName);
|
|
27067
27071
|
}
|
|
27068
|
-
|
|
27069
|
-
|
|
27070
|
-
|
|
27072
|
+
else {
|
|
27073
|
+
throw new Error(`Unknown event type: ${eventSuffix}`);
|
|
27074
|
+
}
|
|
27071
27075
|
}
|
|
27072
27076
|
return rebuildPayload(payload, `${eventPrefix}s`, myReactions);
|
|
27073
27077
|
};
|
|
@@ -27787,16 +27791,10 @@ const onReactorAdded = (referenceType, referenceId, callback) => {
|
|
|
27787
27791
|
if (referenceType === 'message') {
|
|
27788
27792
|
const filter = async (rawPayload) => {
|
|
27789
27793
|
const payload = await prepareMessagePayload(rawPayload);
|
|
27790
|
-
if (!payload.
|
|
27791
|
-
return;
|
|
27792
|
-
const _a = payload.messages[0].latestReaction, { eventName, referenceId, referenceType, userDisplayName } = _a, reactor = __rest(_a, ["eventName", "referenceId", "referenceType", "userDisplayName"]);
|
|
27793
|
-
if (eventName !== 'add')
|
|
27794
|
+
if (!payload.reactions[0])
|
|
27794
27795
|
return;
|
|
27795
27796
|
ingestInCache(payload);
|
|
27796
|
-
|
|
27797
|
-
// @ts-ignore
|
|
27798
|
-
ingestInCache({ reactions: [reactor] });
|
|
27799
|
-
callbackWrapper('message', payload.messages[0].messageId, reactor);
|
|
27797
|
+
callbackWrapper('message', payload.messages[0].messageId, payload.reactions[0]);
|
|
27800
27798
|
};
|
|
27801
27799
|
return createEventSubscriber(client, 'reaction/onReactorAdded', 'message.updated', filter);
|
|
27802
27800
|
}
|
|
@@ -27849,16 +27847,10 @@ const onReactorRemoved = (referenceType, referenceId, callback) => {
|
|
|
27849
27847
|
if (referenceType === 'message') {
|
|
27850
27848
|
const filter = async (rawPayload) => {
|
|
27851
27849
|
const payload = await prepareMessagePayload(rawPayload);
|
|
27852
|
-
if (!payload.
|
|
27853
|
-
return;
|
|
27854
|
-
const _a = payload.messages[0].latestReaction, { eventName, referenceId, referenceType } = _a, reactor = __rest(_a, ["eventName", "referenceId", "referenceType"]);
|
|
27855
|
-
if (eventName !== 'remove')
|
|
27850
|
+
if (!payload.reactions[0])
|
|
27856
27851
|
return;
|
|
27857
27852
|
ingestInCache(payload);
|
|
27858
|
-
|
|
27859
|
-
// @ts-ignore
|
|
27860
|
-
ingestInCache({ reactions: [reactor] });
|
|
27861
|
-
callbackWrapper('message', payload.messages[0].messageId, reactor);
|
|
27853
|
+
callbackWrapper('message', payload.messages[0].messageId, payload.reactions[0]);
|
|
27862
27854
|
};
|
|
27863
27855
|
return createEventSubscriber(client, 'reaction/onReactorRemoved', 'message.updated', filter);
|
|
27864
27856
|
}
|
|
@@ -29021,7 +29013,9 @@ const getMessages = (params, callback, config) => {
|
|
|
29021
29013
|
const collection = (_a = pullFromCache(cacheKey)) === null || _a === void 0 ? void 0 : _a.data;
|
|
29022
29014
|
if (params.subChannelId !== (message === null || message === void 0 ? void 0 : message.subChannelId) || !collection)
|
|
29023
29015
|
return;
|
|
29024
|
-
collection.data
|
|
29016
|
+
if (!collection.data.includes(message.messageId)) {
|
|
29017
|
+
collection.data = [...new Set([message.messageId, ...collection.data])];
|
|
29018
|
+
}
|
|
29025
29019
|
pushToCache(cacheKey, collection);
|
|
29026
29020
|
responder(collection);
|
|
29027
29021
|
};
|
|
@@ -29465,7 +29459,7 @@ const querySubChannels = async (query) => {
|
|
|
29465
29459
|
const _a = convertQueryParams(query), { page = { limit: 10 }, channelId, includeDeleted } = _a, params = __rest(_a, ["page", "channelId", "includeDeleted"]);
|
|
29466
29460
|
const response = await client.http.get(`/api/v5/message-feeds/channel/${channelId}`, {
|
|
29467
29461
|
params: Object.assign(Object.assign({}, params), { isDeleted: inferIsDeleted(includeDeleted), options: {
|
|
29468
|
-
token: toToken(page, '
|
|
29462
|
+
token: toToken(page, 'afterbefore'),
|
|
29469
29463
|
} }),
|
|
29470
29464
|
});
|
|
29471
29465
|
const _b = response.data, { paging } = _b, payload = __rest(_b, ["paging"]);
|
|
@@ -29589,12 +29583,11 @@ const getSubChannels = (params, callback, config) => {
|
|
|
29589
29583
|
responder(snapshot);
|
|
29590
29584
|
};
|
|
29591
29585
|
const onFetch = () => {
|
|
29592
|
-
var _a;
|
|
29593
29586
|
const subChannels = snapshot ? snapshot.data : [];
|
|
29594
29587
|
if (subChannels.length > 0 && !(snapshot === null || snapshot === void 0 ? void 0 : snapshot.params.page)) {
|
|
29595
29588
|
return;
|
|
29596
29589
|
}
|
|
29597
|
-
const query = createQuery(querySubChannels, Object.assign(Object.assign({}, queryParams), { page: (
|
|
29590
|
+
const query = createQuery(querySubChannels, Object.assign(Object.assign({}, queryParams), { page: (snapshot === null || snapshot === void 0 ? void 0 : snapshot.params.page) ? Object.assign(Object.assign({}, snapshot === null || snapshot === void 0 ? void 0 : snapshot.params.page), { limit }) : { limit } }));
|
|
29598
29591
|
runQuery(query, ({ data: result, error, loading, nextPage: page }) => {
|
|
29599
29592
|
snapshot = {
|
|
29600
29593
|
loading,
|