@amityco/ts-sdk 0.0.1-beta.44.0 → 0.0.1-beta.45.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/index.cjs.js +57 -57
- package/dist/index.esm.js +57 -57
- package/dist/index.umd.js +2 -2
- package/package.json +1 -1
- package/src/category/observers/liveCategories.ts +4 -4
- package/src/channel/observers/liveChannelMembers.ts +4 -4
- package/src/channel/observers/liveChannels.ts +4 -4
- package/src/channel/observers/tests/liveChannels.test.ts +3 -9
- package/src/comment/observers/liveComments.ts +4 -4
- package/src/community/observers/liveCommunities.ts +4 -4
- package/src/community/observers/liveCommunityMembers.ts +4 -4
- package/src/follow/observers/liveFollowers.ts +4 -4
- package/src/follow/observers/liveFollowings.ts +4 -4
- package/src/message/observers/liveMessages.ts +6 -6
- package/src/post/observers/livePosts.ts +4 -4
- package/src/reaction/observers/liveReactions.ts +4 -4
- package/src/user/observers/liveUsers.ts +4 -4
- package/src/user/observers/tests/liveUsers.test.ts +3 -9
package/dist/index.cjs.js
CHANGED
|
@@ -95,8 +95,8 @@ const PostContentType = Object.freeze({
|
|
|
95
95
|
|
|
96
96
|
function getVersion() {
|
|
97
97
|
try {
|
|
98
|
-
// the string ''v0.0.1-beta.
|
|
99
|
-
return 'v0.0.1-beta.
|
|
98
|
+
// the string ''v0.0.1-beta.45.0-cjs'' should be replaced by actual value by @rollup/plugin-replace
|
|
99
|
+
return 'v0.0.1-beta.45.0-cjs';
|
|
100
100
|
}
|
|
101
101
|
catch (error) {
|
|
102
102
|
return '__dev__';
|
|
@@ -22929,13 +22929,13 @@ const liveUsers = (params, callback, config) => {
|
|
|
22929
22929
|
pushToCache(cacheKey, collection);
|
|
22930
22930
|
responder(collection);
|
|
22931
22931
|
};
|
|
22932
|
-
const onFetch = () => {
|
|
22932
|
+
const onFetch = (initial = false) => {
|
|
22933
22933
|
var _a, _b, _c;
|
|
22934
22934
|
const collection = (_a = pullFromCache(cacheKey)) === null || _a === void 0 ? void 0 : _a.data;
|
|
22935
22935
|
const users = (_b = collection === null || collection === void 0 ? void 0 : collection.data) !== null && _b !== void 0 ? _b : [];
|
|
22936
|
-
if (users.length > 0 && !(collection === null || collection === void 0 ? void 0 : collection.params.page))
|
|
22936
|
+
if (!initial && users.length > 0 && !(collection === null || collection === void 0 ? void 0 : collection.params.page))
|
|
22937
22937
|
return;
|
|
22938
|
-
const query = createQuery(queryUsers, Object.assign(Object.assign({}, queryParams), { page: (_c = collection === null || collection === void 0 ? void 0 : collection.params.page) !== null && _c !== void 0 ? _c : { limit } }));
|
|
22938
|
+
const query = createQuery(queryUsers, Object.assign(Object.assign({}, queryParams), { page: (_c = (!initial ? collection === null || collection === void 0 ? void 0 : collection.params.page : undefined)) !== null && _c !== void 0 ? _c : { limit } }));
|
|
22939
22939
|
runQuery(query, ({ data: result, error, loading, nextPage: page }) => {
|
|
22940
22940
|
const data = {
|
|
22941
22941
|
loading,
|
|
@@ -22951,7 +22951,7 @@ const liveUsers = (params, callback, config) => {
|
|
|
22951
22951
|
}, queryOptions(policy));
|
|
22952
22952
|
};
|
|
22953
22953
|
disposers.push(onUserUpdated(realtimeRouter()), onUserDeleted(realtimeRouter()), onUserFlagged(realtimeRouter()), onUserUnflagged(realtimeRouter()), onUserFlagCleared(realtimeRouter()));
|
|
22954
|
-
onFetch();
|
|
22954
|
+
onFetch(true);
|
|
22955
22955
|
return () => {
|
|
22956
22956
|
log(`liveUsers(tmpid: ${timestamp}) > dispose`);
|
|
22957
22957
|
disposers.forEach(fn => fn());
|
|
@@ -26402,13 +26402,13 @@ const liveReactions = (params, callback, config) => {
|
|
|
26402
26402
|
pushToCache(cacheKey, collection);
|
|
26403
26403
|
responder(collection);
|
|
26404
26404
|
};
|
|
26405
|
-
const onFetch = () => {
|
|
26406
|
-
var _a, _b, _c, _d
|
|
26405
|
+
const onFetch = (initial = false) => {
|
|
26406
|
+
var _a, _b, _c, _d;
|
|
26407
26407
|
const collection = (_a = pullFromCache(cacheKey)) === null || _a === void 0 ? void 0 : _a.data;
|
|
26408
26408
|
const reactions = (_b = collection === null || collection === void 0 ? void 0 : collection.data) !== null && _b !== void 0 ? _b : [];
|
|
26409
|
-
if (reactions.length > 0 && !((_c = collection === null || collection === void 0 ? void 0 : collection.params) === null || _c === void 0 ? void 0 : _c.page))
|
|
26409
|
+
if (!initial && reactions.length > 0 && !((_c = collection === null || collection === void 0 ? void 0 : collection.params) === null || _c === void 0 ? void 0 : _c.page))
|
|
26410
26410
|
return;
|
|
26411
|
-
const query = createQuery(queryReactions, Object.assign(Object.assign({}, queryParams), { page: (
|
|
26411
|
+
const query = createQuery(queryReactions, Object.assign(Object.assign({}, queryParams), { page: (_d = (!initial ? collection === null || collection === void 0 ? void 0 : collection.params.page : undefined)) !== null && _d !== void 0 ? _d : { limit } }));
|
|
26412
26412
|
runQuery(query, ({ data: result, error, loading, nextPage: page }) => {
|
|
26413
26413
|
const data = {
|
|
26414
26414
|
loading,
|
|
@@ -26426,7 +26426,7 @@ const liveReactions = (params, callback, config) => {
|
|
|
26426
26426
|
}, queryOptions(policy));
|
|
26427
26427
|
};
|
|
26428
26428
|
disposers.push(onReactorAdded(queryParams.referenceType, queryParams.referenceId, realtimeRouter('onAdded')), onReactorRemoved(queryParams.referenceType, queryParams.referenceId, realtimeRouter('onRemoved')));
|
|
26429
|
-
onFetch();
|
|
26429
|
+
onFetch(true);
|
|
26430
26430
|
return () => {
|
|
26431
26431
|
log(`liveReactions(tmpid: ${timestamp}) > dispose`);
|
|
26432
26432
|
disposers.forEach(fn => fn());
|
|
@@ -27787,13 +27787,13 @@ const liveChannels = (params, callback, config) => {
|
|
|
27787
27787
|
pushToCache(cacheKey, collection);
|
|
27788
27788
|
responder(collection);
|
|
27789
27789
|
};
|
|
27790
|
-
const onFetch = () => {
|
|
27790
|
+
const onFetch = (initial = false) => {
|
|
27791
27791
|
var _a, _b, _c;
|
|
27792
27792
|
const collection = (_a = pullFromCache(cacheKey)) === null || _a === void 0 ? void 0 : _a.data;
|
|
27793
27793
|
const channels = (_b = collection === null || collection === void 0 ? void 0 : collection.data) !== null && _b !== void 0 ? _b : [];
|
|
27794
|
-
if (channels.length > 0 && !(collection === null || collection === void 0 ? void 0 : collection.params.page))
|
|
27794
|
+
if (!initial && channels.length > 0 && !(collection === null || collection === void 0 ? void 0 : collection.params.page))
|
|
27795
27795
|
return;
|
|
27796
|
-
const query = createQuery(queryChannels, Object.assign(Object.assign({}, queryParams), { page: (_c = collection === null || collection === void 0 ? void 0 : collection.params.page) !== null && _c !== void 0 ? _c : { limit } }));
|
|
27796
|
+
const query = createQuery(queryChannels, Object.assign(Object.assign({}, queryParams), { page: (_c = (!initial ? collection === null || collection === void 0 ? void 0 : collection.params.page : undefined)) !== null && _c !== void 0 ? _c : { limit } }));
|
|
27797
27797
|
runQuery(query, ({ data: result, error, loading, nextPage: page }) => {
|
|
27798
27798
|
const data = {
|
|
27799
27799
|
loading,
|
|
@@ -27809,7 +27809,7 @@ const liveChannels = (params, callback, config) => {
|
|
|
27809
27809
|
}, queryOptions(policy, CACHE_SHORTEN_LIFESPAN));
|
|
27810
27810
|
};
|
|
27811
27811
|
disposers.push(onChannelCreated(realtimeRouter()), onChannelDeleted(realtimeRouter()), onChannelUpdated(realtimeRouter()), onChannelMuted(realtimeRouter()), onChannelJoined(realtimeRouter()), onChannelLeft(realtimeRouter()), onChannelMemberAdded(realtimeRouter()), onChannelMemberRemoved(realtimeRouter()), onMessageCreated(() => null));
|
|
27812
|
-
onFetch();
|
|
27812
|
+
onFetch(true);
|
|
27813
27813
|
return () => {
|
|
27814
27814
|
log(`liveChannels(tmpid: ${timestamp}) > dispose`);
|
|
27815
27815
|
disposers.forEach(fn => fn());
|
|
@@ -27906,13 +27906,13 @@ const liveChannelMembers = (params, callback, config) => {
|
|
|
27906
27906
|
pushToCache(cacheKey, collection);
|
|
27907
27907
|
responder(collection);
|
|
27908
27908
|
};
|
|
27909
|
-
const onFetch = () => {
|
|
27909
|
+
const onFetch = (initial = false) => {
|
|
27910
27910
|
var _a, _b, _c;
|
|
27911
27911
|
const collection = (_a = pullFromCache(cacheKey)) === null || _a === void 0 ? void 0 : _a.data;
|
|
27912
27912
|
const channelMembers = (_b = collection === null || collection === void 0 ? void 0 : collection.data) !== null && _b !== void 0 ? _b : [];
|
|
27913
|
-
if (channelMembers.length > 0 && !(collection === null || collection === void 0 ? void 0 : collection.params.page))
|
|
27913
|
+
if (!initial && channelMembers.length > 0 && !(collection === null || collection === void 0 ? void 0 : collection.params.page))
|
|
27914
27914
|
return;
|
|
27915
|
-
const query = createQuery(queryChannelMembers, Object.assign(Object.assign({}, queryParams), { page: (_c = collection === null || collection === void 0 ? void 0 : collection.params.page) !== null && _c !== void 0 ? _c : { limit } }));
|
|
27915
|
+
const query = createQuery(queryChannelMembers, Object.assign(Object.assign({}, queryParams), { page: (_c = (!initial ? collection === null || collection === void 0 ? void 0 : collection.params.page : undefined)) !== null && _c !== void 0 ? _c : { limit } }));
|
|
27916
27916
|
runQuery(query, ({ data: result, error, loading, nextPage: page }) => {
|
|
27917
27917
|
const data = {
|
|
27918
27918
|
loading,
|
|
@@ -27928,7 +27928,7 @@ const liveChannelMembers = (params, callback, config) => {
|
|
|
27928
27928
|
}, queryOptions(policy));
|
|
27929
27929
|
};
|
|
27930
27930
|
disposers.push(onChannelJoined(realtimeRouter()), onChannelLeft(realtimeRouter()), onChannelMemberAdded(realtimeRouter()), onChannelMemberRemoved(realtimeRouter()), onChannelMemberBanned(realtimeRouter()), onChannelMemberUnbanned(realtimeRouter()));
|
|
27931
|
-
onFetch();
|
|
27931
|
+
onFetch(true);
|
|
27932
27932
|
return () => {
|
|
27933
27933
|
log(`liveChannelMembers(tmpid: ${timestamp}) > dispose`);
|
|
27934
27934
|
disposers.forEach(fn => fn());
|
|
@@ -28482,16 +28482,15 @@ const liveMessages = (params, callback, config) => {
|
|
|
28482
28482
|
return;
|
|
28483
28483
|
collection.data = [...new Set([message.messageId, ...collection.data])];
|
|
28484
28484
|
pushToCache(cacheKey, collection);
|
|
28485
|
-
disposers.push(() => dropFromCache(cacheKey));
|
|
28486
28485
|
responder(collection);
|
|
28487
28486
|
};
|
|
28488
|
-
const onFetch = () => {
|
|
28489
|
-
var _a, _b, _c, _d
|
|
28487
|
+
const onFetch = (initial = false) => {
|
|
28488
|
+
var _a, _b, _c, _d;
|
|
28490
28489
|
const collection = (_a = pullFromCache(cacheKey)) === null || _a === void 0 ? void 0 : _a.data;
|
|
28491
28490
|
const messages = (_b = collection === null || collection === void 0 ? void 0 : collection.data) !== null && _b !== void 0 ? _b : [];
|
|
28492
|
-
if (messages.length > 0 && !((_c = collection === null || collection === void 0 ? void 0 : collection.params) === null || _c === void 0 ? void 0 : _c.page))
|
|
28491
|
+
if (!initial && messages.length > 0 && !((_c = collection === null || collection === void 0 ? void 0 : collection.params) === null || _c === void 0 ? void 0 : _c.page))
|
|
28493
28492
|
return;
|
|
28494
|
-
const query = createQuery(queryMessages, Object.assign(Object.assign({}, queryParams), { page: (
|
|
28493
|
+
const query = createQuery(queryMessages, Object.assign(Object.assign({}, queryParams), { page: (_d = (!initial ? collection === null || collection === void 0 ? void 0 : collection.params.page : undefined)) !== null && _d !== void 0 ? _d : { limit } }));
|
|
28495
28494
|
runQuery(query, ({ data: result, error, loading, nextPage: page }) => {
|
|
28496
28495
|
const data = {
|
|
28497
28496
|
loading,
|
|
@@ -28507,7 +28506,8 @@ const liveMessages = (params, callback, config) => {
|
|
|
28507
28506
|
}, queryOptions(policy, CACHE_SHORTEN_LIFESPAN));
|
|
28508
28507
|
};
|
|
28509
28508
|
disposers.push(onMessageFetched(realtimeRouter()), onMessageCreated(realtimeRouter()), onMessageUpdated(realtimeRouter()), onMessageDeleted(realtimeRouter()), onMessageFlagged(realtimeRouter()), onMessageUnflagged(realtimeRouter()), onMessageFlagCleared(realtimeRouter()), onMessageReactionAdded(realtimeRouter()), onMessageReactionRemoved(realtimeRouter()));
|
|
28510
|
-
onFetch();
|
|
28509
|
+
onFetch(true);
|
|
28510
|
+
disposers.push(() => dropFromCache(cacheKey));
|
|
28511
28511
|
return () => {
|
|
28512
28512
|
log(`liveMessages(tmpid: ${timestamp}) > dispose`);
|
|
28513
28513
|
disposers.forEach(fn => fn());
|
|
@@ -29036,13 +29036,13 @@ const liveCommunities = (params, callback, config) => {
|
|
|
29036
29036
|
pushToCache(cacheKey, collection);
|
|
29037
29037
|
responder(collection);
|
|
29038
29038
|
};
|
|
29039
|
-
const onFetch = () => {
|
|
29039
|
+
const onFetch = (initial = false) => {
|
|
29040
29040
|
var _a, _b, _c;
|
|
29041
29041
|
const collection = (_a = pullFromCache(cacheKey)) === null || _a === void 0 ? void 0 : _a.data;
|
|
29042
29042
|
const communities = (_b = collection === null || collection === void 0 ? void 0 : collection.data) !== null && _b !== void 0 ? _b : [];
|
|
29043
|
-
if (communities.length > 0 && !(collection === null || collection === void 0 ? void 0 : collection.params.page))
|
|
29043
|
+
if (!initial && communities.length > 0 && !(collection === null || collection === void 0 ? void 0 : collection.params.page))
|
|
29044
29044
|
return;
|
|
29045
|
-
const query = createQuery(queryCommunities, Object.assign(Object.assign({}, queryParams), { page: (_c = collection === null || collection === void 0 ? void 0 : collection.params.page) !== null && _c !== void 0 ? _c : { limit } }));
|
|
29045
|
+
const query = createQuery(queryCommunities, Object.assign(Object.assign({}, queryParams), { page: (_c = (!initial ? collection === null || collection === void 0 ? void 0 : collection.params.page : undefined)) !== null && _c !== void 0 ? _c : { limit } }));
|
|
29046
29046
|
runQuery(query, ({ data: result, error, loading, nextPage: page }) => {
|
|
29047
29047
|
const data = {
|
|
29048
29048
|
loading,
|
|
@@ -29058,7 +29058,7 @@ const liveCommunities = (params, callback, config) => {
|
|
|
29058
29058
|
}, queryOptions(policy, CACHE_SHORTEN_LIFESPAN));
|
|
29059
29059
|
};
|
|
29060
29060
|
disposers.push(onCommunityCreated(realtimeRouter()), onCommunityDeleted(realtimeRouter()), onCommunityUpdated(realtimeRouter()), onCommunityJoined(realtimeRouter()), onCommunityLeft(realtimeRouter()), onCommunityUserChanged(realtimeRouter()));
|
|
29061
|
-
onFetch();
|
|
29061
|
+
onFetch(true);
|
|
29062
29062
|
return () => {
|
|
29063
29063
|
log(`liveCommunities(tmpid: ${timestamp}) > dispose`);
|
|
29064
29064
|
disposers.forEach(fn => fn());
|
|
@@ -29178,13 +29178,13 @@ const liveCommunityMembers = (params, callback, config) => {
|
|
|
29178
29178
|
pushToCache(cacheKey, collection);
|
|
29179
29179
|
responder(collection);
|
|
29180
29180
|
};
|
|
29181
|
-
const onFetch = () => {
|
|
29181
|
+
const onFetch = (initial = false) => {
|
|
29182
29182
|
var _a, _b, _c;
|
|
29183
29183
|
const collection = (_a = pullFromCache(cacheKey)) === null || _a === void 0 ? void 0 : _a.data;
|
|
29184
29184
|
const communityMembers = (_b = collection === null || collection === void 0 ? void 0 : collection.data) !== null && _b !== void 0 ? _b : [];
|
|
29185
|
-
if (communityMembers.length > 0 && !(collection === null || collection === void 0 ? void 0 : collection.params.page))
|
|
29185
|
+
if (!initial && communityMembers.length > 0 && !(collection === null || collection === void 0 ? void 0 : collection.params.page))
|
|
29186
29186
|
return;
|
|
29187
|
-
const query = createQuery(queryCommunityMembers, Object.assign(Object.assign({}, queryParams), { page: (_c = collection === null || collection === void 0 ? void 0 : collection.params.page) !== null && _c !== void 0 ? _c : { limit } }));
|
|
29187
|
+
const query = createQuery(queryCommunityMembers, Object.assign(Object.assign({}, queryParams), { page: (_c = (!initial ? collection === null || collection === void 0 ? void 0 : collection.params.page : undefined)) !== null && _c !== void 0 ? _c : { limit } }));
|
|
29188
29188
|
runQuery(query, ({ data: result, error, loading, nextPage: page }) => {
|
|
29189
29189
|
const data = {
|
|
29190
29190
|
loading,
|
|
@@ -29202,7 +29202,7 @@ const liveCommunityMembers = (params, callback, config) => {
|
|
|
29202
29202
|
}, queryOptions(policy));
|
|
29203
29203
|
};
|
|
29204
29204
|
disposers.push(onCommunityLeft(realtimeRouter()), onCommunityJoined(realtimeRouter()), onCommunityUserBanned(realtimeRouter()), onCommunityUserUnbanned(realtimeRouter()), onCommunityUserChanged(realtimeRouter()), onCommunityUserRoleAdded(realtimeRouter()), onCommunityUserRoleRemoved(realtimeRouter()));
|
|
29205
|
-
onFetch();
|
|
29205
|
+
onFetch(true);
|
|
29206
29206
|
return () => {
|
|
29207
29207
|
log(`liveCommunityMembers(tmpid: ${timestamp}) > dispose`);
|
|
29208
29208
|
disposers.forEach(fn => fn());
|
|
@@ -29401,13 +29401,13 @@ const liveCategories = (params, callback, config) => {
|
|
|
29401
29401
|
* observers
|
|
29402
29402
|
*};
|
|
29403
29403
|
*/
|
|
29404
|
-
const onFetch = () => {
|
|
29404
|
+
const onFetch = (initial = false) => {
|
|
29405
29405
|
var _a, _b, _c;
|
|
29406
29406
|
const collection = (_a = pullFromCache(cacheKey)) === null || _a === void 0 ? void 0 : _a.data;
|
|
29407
29407
|
const categories = (_b = collection === null || collection === void 0 ? void 0 : collection.data) !== null && _b !== void 0 ? _b : [];
|
|
29408
|
-
if (categories.length > 0 && !(collection === null || collection === void 0 ? void 0 : collection.params.page))
|
|
29408
|
+
if (!initial && categories.length > 0 && !(collection === null || collection === void 0 ? void 0 : collection.params.page))
|
|
29409
29409
|
return;
|
|
29410
|
-
const query = createQuery(queryCategories, Object.assign(Object.assign({}, queryParams), { page: (_c = collection === null || collection === void 0 ? void 0 : collection.params.page) !== null && _c !== void 0 ? _c : { limit } }));
|
|
29410
|
+
const query = createQuery(queryCategories, Object.assign(Object.assign({}, queryParams), { page: (_c = (!initial ? collection === null || collection === void 0 ? void 0 : collection.params.page : undefined)) !== null && _c !== void 0 ? _c : { limit } }));
|
|
29411
29411
|
runQuery(query, ({ data: result, error, loading, nextPage: page }) => {
|
|
29412
29412
|
const data = {
|
|
29413
29413
|
loading,
|
|
@@ -29425,7 +29425,7 @@ const liveCategories = (params, callback, config) => {
|
|
|
29425
29425
|
disposers.push(() => {
|
|
29426
29426
|
// @TODO -> update once observers added
|
|
29427
29427
|
});
|
|
29428
|
-
onFetch();
|
|
29428
|
+
onFetch(true);
|
|
29429
29429
|
return () => {
|
|
29430
29430
|
log(`liveCategories(tmpid: ${timestamp}) > dispose`);
|
|
29431
29431
|
disposers.forEach(fn => fn());
|
|
@@ -30182,13 +30182,13 @@ const liveFollowers = (params, callback, config) => {
|
|
|
30182
30182
|
pushToCache(cacheKey, collection);
|
|
30183
30183
|
responder(collection);
|
|
30184
30184
|
};
|
|
30185
|
-
const onFetch = () => {
|
|
30186
|
-
var _a, _b, _c, _d
|
|
30185
|
+
const onFetch = (initial = false) => {
|
|
30186
|
+
var _a, _b, _c, _d;
|
|
30187
30187
|
const collection = (_a = pullFromCache(cacheKey)) === null || _a === void 0 ? void 0 : _a.data;
|
|
30188
30188
|
const followers = (_b = collection === null || collection === void 0 ? void 0 : collection.data) !== null && _b !== void 0 ? _b : [];
|
|
30189
|
-
if (followers.length > 0 && !((_c = collection === null || collection === void 0 ? void 0 : collection.params) === null || _c === void 0 ? void 0 : _c.page))
|
|
30189
|
+
if (!initial && followers.length > 0 && !((_c = collection === null || collection === void 0 ? void 0 : collection.params) === null || _c === void 0 ? void 0 : _c.page))
|
|
30190
30190
|
return;
|
|
30191
|
-
const query = createQuery(queryFollowers, Object.assign(Object.assign({}, queryParams), { page: (
|
|
30191
|
+
const query = createQuery(queryFollowers, Object.assign(Object.assign({}, queryParams), { page: (_d = (!initial ? collection === null || collection === void 0 ? void 0 : collection.params.page : undefined)) !== null && _d !== void 0 ? _d : { limit } }));
|
|
30192
30192
|
runQuery(query, ({ data: result, error, loading, nextPage: page }) => {
|
|
30193
30193
|
const data = {
|
|
30194
30194
|
loading,
|
|
@@ -30204,7 +30204,7 @@ const liveFollowers = (params, callback, config) => {
|
|
|
30204
30204
|
}, queryOptions(policy));
|
|
30205
30205
|
};
|
|
30206
30206
|
disposers.push(onFollowerRequested(realtimeRouter('onRequested')), onFollowRequestAccepted(realtimeRouter('onAccepted')), onFollowRequestDeclined(realtimeRouter('onDeclined')), onFollowRequestCanceled(realtimeRouter('onCanceled')), onUserFollowed(realtimeRouter('onFollowed')), onUserUnfollowed(realtimeRouter('onUnfollowed')), onFollowerDeleted(realtimeRouter('onDeleted')));
|
|
30207
|
-
onFetch();
|
|
30207
|
+
onFetch(true);
|
|
30208
30208
|
return () => {
|
|
30209
30209
|
log(`liveFollowers(tmpid: ${timestamp}) > dispose`);
|
|
30210
30210
|
disposers.forEach(fn => fn());
|
|
@@ -30272,13 +30272,13 @@ const liveFollowings = (params, callback, config) => {
|
|
|
30272
30272
|
pushToCache(cacheKey, collection);
|
|
30273
30273
|
responder(collection);
|
|
30274
30274
|
};
|
|
30275
|
-
const onFetch = () => {
|
|
30276
|
-
var _a, _b, _c, _d
|
|
30275
|
+
const onFetch = (initial = false) => {
|
|
30276
|
+
var _a, _b, _c, _d;
|
|
30277
30277
|
const collection = (_a = pullFromCache(cacheKey)) === null || _a === void 0 ? void 0 : _a.data;
|
|
30278
30278
|
const followings = (_b = collection === null || collection === void 0 ? void 0 : collection.data) !== null && _b !== void 0 ? _b : [];
|
|
30279
|
-
if (followings.length > 0 && !((_c = collection === null || collection === void 0 ? void 0 : collection.params) === null || _c === void 0 ? void 0 : _c.page))
|
|
30279
|
+
if (!initial && followings.length > 0 && !((_c = collection === null || collection === void 0 ? void 0 : collection.params) === null || _c === void 0 ? void 0 : _c.page))
|
|
30280
30280
|
return;
|
|
30281
|
-
const query = createQuery(queryFollowings, Object.assign(Object.assign({}, queryParams), { page: (
|
|
30281
|
+
const query = createQuery(queryFollowings, Object.assign(Object.assign({}, queryParams), { page: (_d = (!initial ? collection === null || collection === void 0 ? void 0 : collection.params.page : undefined)) !== null && _d !== void 0 ? _d : { limit } }));
|
|
30282
30282
|
runQuery(query, ({ data: result, error, loading, nextPage: page }) => {
|
|
30283
30283
|
const data = {
|
|
30284
30284
|
loading,
|
|
@@ -30294,7 +30294,7 @@ const liveFollowings = (params, callback, config) => {
|
|
|
30294
30294
|
}, queryOptions(policy));
|
|
30295
30295
|
};
|
|
30296
30296
|
disposers.push(onFollowerRequested(realtimeRouter('onRequested')), onFollowRequestAccepted(realtimeRouter('onAccepted')), onFollowRequestDeclined(realtimeRouter('onDeclined')), onFollowRequestCanceled(realtimeRouter('onCanceled')), onUserFollowed(realtimeRouter('onFollowed')), onUserUnfollowed(realtimeRouter('onUnfollowed')), onFollowerDeleted(realtimeRouter('onDeleted')));
|
|
30297
|
-
onFetch();
|
|
30297
|
+
onFetch(true);
|
|
30298
30298
|
return () => {
|
|
30299
30299
|
log(`liveFollowings(tmpid: ${timestamp}) > dispose`);
|
|
30300
30300
|
disposers.forEach(fn => fn());
|
|
@@ -30524,13 +30524,13 @@ const livePosts = (params, callback, config) => {
|
|
|
30524
30524
|
disposers.push(() => dropFromCache(cacheKey));
|
|
30525
30525
|
responder(collection);
|
|
30526
30526
|
};
|
|
30527
|
-
const onFetch = () => {
|
|
30528
|
-
var _a, _b, _c, _d
|
|
30527
|
+
const onFetch = (initial = false) => {
|
|
30528
|
+
var _a, _b, _c, _d;
|
|
30529
30529
|
const collection = (_a = pullFromCache(cacheKey)) === null || _a === void 0 ? void 0 : _a.data;
|
|
30530
30530
|
const posts = (_b = collection === null || collection === void 0 ? void 0 : collection.data) !== null && _b !== void 0 ? _b : [];
|
|
30531
|
-
if (posts.length > 0 && !((_c = collection === null || collection === void 0 ? void 0 : collection.params) === null || _c === void 0 ? void 0 : _c.page))
|
|
30531
|
+
if (!initial && posts.length > 0 && !((_c = collection === null || collection === void 0 ? void 0 : collection.params) === null || _c === void 0 ? void 0 : _c.page))
|
|
30532
30532
|
return;
|
|
30533
|
-
const query = createQuery(queryPosts, Object.assign(Object.assign({}, queryParams), { page: (
|
|
30533
|
+
const query = createQuery(queryPosts, Object.assign(Object.assign({}, queryParams), { page: (_d = (!initial ? collection === null || collection === void 0 ? void 0 : collection.params.page : undefined)) !== null && _d !== void 0 ? _d : { limit } }));
|
|
30534
30534
|
runQuery(query, ({ data: result, error, loading, nextPage: page }) => {
|
|
30535
30535
|
const data = {
|
|
30536
30536
|
loading,
|
|
@@ -30546,7 +30546,7 @@ const livePosts = (params, callback, config) => {
|
|
|
30546
30546
|
}, queryOptions(policy, CACHE_SHORTEN_LIFESPAN));
|
|
30547
30547
|
};
|
|
30548
30548
|
disposers.push(onPostCreated(realtimeRouter('onCreate')), onPostApproved(realtimeRouter('onApproved')), onPostDeclined(realtimeRouter('onDeclined')), onPostDeleted(realtimeRouter('onDelete')), onPostUpdated(realtimeRouter('onUpdate')), onPostFlagged(realtimeRouter('onFlagged')), onPostUnflagged(realtimeRouter('onUnflagged')), onPostReactionAdded(realtimeRouter('onReactionAdded')), onPostReactionRemoved(realtimeRouter('onReactionRemoved')));
|
|
30549
|
-
onFetch();
|
|
30549
|
+
onFetch(true);
|
|
30550
30550
|
return () => {
|
|
30551
30551
|
log(`livePosts(tmpid: ${timestamp}) > dispose`);
|
|
30552
30552
|
disposers.forEach(fn => fn());
|
|
@@ -30735,13 +30735,13 @@ const liveComments = (params, callback, config) => {
|
|
|
30735
30735
|
pushToCache(cacheKey, collection);
|
|
30736
30736
|
responder(collection);
|
|
30737
30737
|
};
|
|
30738
|
-
const onFetch = () => {
|
|
30739
|
-
var _a, _b, _c, _d
|
|
30738
|
+
const onFetch = (initial = false) => {
|
|
30739
|
+
var _a, _b, _c, _d;
|
|
30740
30740
|
const collection = (_a = pullFromCache(cacheKey)) === null || _a === void 0 ? void 0 : _a.data;
|
|
30741
30741
|
const comments = (_b = collection === null || collection === void 0 ? void 0 : collection.data) !== null && _b !== void 0 ? _b : [];
|
|
30742
|
-
if (comments.length > 0 && !((_c = collection === null || collection === void 0 ? void 0 : collection.params) === null || _c === void 0 ? void 0 : _c.page))
|
|
30742
|
+
if (!initial && comments.length > 0 && !((_c = collection === null || collection === void 0 ? void 0 : collection.params) === null || _c === void 0 ? void 0 : _c.page))
|
|
30743
30743
|
return;
|
|
30744
|
-
const query = createQuery(queryComments, Object.assign(Object.assign({}, queryParams), { page: (
|
|
30744
|
+
const query = createQuery(queryComments, Object.assign(Object.assign({}, queryParams), { page: (_d = (!initial ? collection === null || collection === void 0 ? void 0 : collection.params.page : undefined)) !== null && _d !== void 0 ? _d : { limit } }));
|
|
30745
30745
|
runQuery(query, ({ data: result, error, loading, prevPage, nextPage }) => {
|
|
30746
30746
|
// depend on sortBy value we have two different pagination type
|
|
30747
30747
|
const page = queryParams.sortBy ? nextPage : prevPage;
|
|
@@ -30759,7 +30759,7 @@ const liveComments = (params, callback, config) => {
|
|
|
30759
30759
|
}, queryOptions(policy, CACHE_SHORTEN_LIFESPAN));
|
|
30760
30760
|
};
|
|
30761
30761
|
disposers.push(onCommentCreated(realtimeRouter('onCreate')), onCommentUpdated(realtimeRouter('onUpdate')), onCommentDeleted(realtimeRouter('onDelete')), onCommentFlagged(realtimeRouter('onFlagged')), onCommentUnflagged(realtimeRouter('onUnflagged')), onCommentReactionAdded(realtimeRouter('onReactionAdded')), onCommentReactionRemoved(realtimeRouter('onReactionRemoved')));
|
|
30762
|
-
onFetch();
|
|
30762
|
+
onFetch(true);
|
|
30763
30763
|
return () => {
|
|
30764
30764
|
log(`liveComments(tmpid: ${timestamp}) > dispose`);
|
|
30765
30765
|
disposers.forEach(fn => fn());
|