@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.esm.js
CHANGED
|
@@ -81,8 +81,8 @@ const PostContentType = Object.freeze({
|
|
|
81
81
|
|
|
82
82
|
function getVersion() {
|
|
83
83
|
try {
|
|
84
|
-
// the string ''v0.0.1-beta.
|
|
85
|
-
return 'v0.0.1-beta.
|
|
84
|
+
// the string ''v0.0.1-beta.45.0-esm'' should be replaced by actual value by @rollup/plugin-replace
|
|
85
|
+
return 'v0.0.1-beta.45.0-esm';
|
|
86
86
|
}
|
|
87
87
|
catch (error) {
|
|
88
88
|
return '__dev__';
|
|
@@ -22915,13 +22915,13 @@ const liveUsers = (params, callback, config) => {
|
|
|
22915
22915
|
pushToCache(cacheKey, collection);
|
|
22916
22916
|
responder(collection);
|
|
22917
22917
|
};
|
|
22918
|
-
const onFetch = () => {
|
|
22918
|
+
const onFetch = (initial = false) => {
|
|
22919
22919
|
var _a, _b, _c;
|
|
22920
22920
|
const collection = (_a = pullFromCache(cacheKey)) === null || _a === void 0 ? void 0 : _a.data;
|
|
22921
22921
|
const users = (_b = collection === null || collection === void 0 ? void 0 : collection.data) !== null && _b !== void 0 ? _b : [];
|
|
22922
|
-
if (users.length > 0 && !(collection === null || collection === void 0 ? void 0 : collection.params.page))
|
|
22922
|
+
if (!initial && users.length > 0 && !(collection === null || collection === void 0 ? void 0 : collection.params.page))
|
|
22923
22923
|
return;
|
|
22924
|
-
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 } }));
|
|
22924
|
+
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 } }));
|
|
22925
22925
|
runQuery(query, ({ data: result, error, loading, nextPage: page }) => {
|
|
22926
22926
|
const data = {
|
|
22927
22927
|
loading,
|
|
@@ -22937,7 +22937,7 @@ const liveUsers = (params, callback, config) => {
|
|
|
22937
22937
|
}, queryOptions(policy));
|
|
22938
22938
|
};
|
|
22939
22939
|
disposers.push(onUserUpdated(realtimeRouter()), onUserDeleted(realtimeRouter()), onUserFlagged(realtimeRouter()), onUserUnflagged(realtimeRouter()), onUserFlagCleared(realtimeRouter()));
|
|
22940
|
-
onFetch();
|
|
22940
|
+
onFetch(true);
|
|
22941
22941
|
return () => {
|
|
22942
22942
|
log(`liveUsers(tmpid: ${timestamp}) > dispose`);
|
|
22943
22943
|
disposers.forEach(fn => fn());
|
|
@@ -26388,13 +26388,13 @@ const liveReactions = (params, callback, config) => {
|
|
|
26388
26388
|
pushToCache(cacheKey, collection);
|
|
26389
26389
|
responder(collection);
|
|
26390
26390
|
};
|
|
26391
|
-
const onFetch = () => {
|
|
26392
|
-
var _a, _b, _c, _d
|
|
26391
|
+
const onFetch = (initial = false) => {
|
|
26392
|
+
var _a, _b, _c, _d;
|
|
26393
26393
|
const collection = (_a = pullFromCache(cacheKey)) === null || _a === void 0 ? void 0 : _a.data;
|
|
26394
26394
|
const reactions = (_b = collection === null || collection === void 0 ? void 0 : collection.data) !== null && _b !== void 0 ? _b : [];
|
|
26395
|
-
if (reactions.length > 0 && !((_c = collection === null || collection === void 0 ? void 0 : collection.params) === null || _c === void 0 ? void 0 : _c.page))
|
|
26395
|
+
if (!initial && reactions.length > 0 && !((_c = collection === null || collection === void 0 ? void 0 : collection.params) === null || _c === void 0 ? void 0 : _c.page))
|
|
26396
26396
|
return;
|
|
26397
|
-
const query = createQuery(queryReactions, Object.assign(Object.assign({}, queryParams), { page: (
|
|
26397
|
+
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 } }));
|
|
26398
26398
|
runQuery(query, ({ data: result, error, loading, nextPage: page }) => {
|
|
26399
26399
|
const data = {
|
|
26400
26400
|
loading,
|
|
@@ -26412,7 +26412,7 @@ const liveReactions = (params, callback, config) => {
|
|
|
26412
26412
|
}, queryOptions(policy));
|
|
26413
26413
|
};
|
|
26414
26414
|
disposers.push(onReactorAdded(queryParams.referenceType, queryParams.referenceId, realtimeRouter('onAdded')), onReactorRemoved(queryParams.referenceType, queryParams.referenceId, realtimeRouter('onRemoved')));
|
|
26415
|
-
onFetch();
|
|
26415
|
+
onFetch(true);
|
|
26416
26416
|
return () => {
|
|
26417
26417
|
log(`liveReactions(tmpid: ${timestamp}) > dispose`);
|
|
26418
26418
|
disposers.forEach(fn => fn());
|
|
@@ -27773,13 +27773,13 @@ const liveChannels = (params, callback, config) => {
|
|
|
27773
27773
|
pushToCache(cacheKey, collection);
|
|
27774
27774
|
responder(collection);
|
|
27775
27775
|
};
|
|
27776
|
-
const onFetch = () => {
|
|
27776
|
+
const onFetch = (initial = false) => {
|
|
27777
27777
|
var _a, _b, _c;
|
|
27778
27778
|
const collection = (_a = pullFromCache(cacheKey)) === null || _a === void 0 ? void 0 : _a.data;
|
|
27779
27779
|
const channels = (_b = collection === null || collection === void 0 ? void 0 : collection.data) !== null && _b !== void 0 ? _b : [];
|
|
27780
|
-
if (channels.length > 0 && !(collection === null || collection === void 0 ? void 0 : collection.params.page))
|
|
27780
|
+
if (!initial && channels.length > 0 && !(collection === null || collection === void 0 ? void 0 : collection.params.page))
|
|
27781
27781
|
return;
|
|
27782
|
-
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 } }));
|
|
27782
|
+
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 } }));
|
|
27783
27783
|
runQuery(query, ({ data: result, error, loading, nextPage: page }) => {
|
|
27784
27784
|
const data = {
|
|
27785
27785
|
loading,
|
|
@@ -27795,7 +27795,7 @@ const liveChannels = (params, callback, config) => {
|
|
|
27795
27795
|
}, queryOptions(policy, CACHE_SHORTEN_LIFESPAN));
|
|
27796
27796
|
};
|
|
27797
27797
|
disposers.push(onChannelCreated(realtimeRouter()), onChannelDeleted(realtimeRouter()), onChannelUpdated(realtimeRouter()), onChannelMuted(realtimeRouter()), onChannelJoined(realtimeRouter()), onChannelLeft(realtimeRouter()), onChannelMemberAdded(realtimeRouter()), onChannelMemberRemoved(realtimeRouter()), onMessageCreated(() => null));
|
|
27798
|
-
onFetch();
|
|
27798
|
+
onFetch(true);
|
|
27799
27799
|
return () => {
|
|
27800
27800
|
log(`liveChannels(tmpid: ${timestamp}) > dispose`);
|
|
27801
27801
|
disposers.forEach(fn => fn());
|
|
@@ -27892,13 +27892,13 @@ const liveChannelMembers = (params, callback, config) => {
|
|
|
27892
27892
|
pushToCache(cacheKey, collection);
|
|
27893
27893
|
responder(collection);
|
|
27894
27894
|
};
|
|
27895
|
-
const onFetch = () => {
|
|
27895
|
+
const onFetch = (initial = false) => {
|
|
27896
27896
|
var _a, _b, _c;
|
|
27897
27897
|
const collection = (_a = pullFromCache(cacheKey)) === null || _a === void 0 ? void 0 : _a.data;
|
|
27898
27898
|
const channelMembers = (_b = collection === null || collection === void 0 ? void 0 : collection.data) !== null && _b !== void 0 ? _b : [];
|
|
27899
|
-
if (channelMembers.length > 0 && !(collection === null || collection === void 0 ? void 0 : collection.params.page))
|
|
27899
|
+
if (!initial && channelMembers.length > 0 && !(collection === null || collection === void 0 ? void 0 : collection.params.page))
|
|
27900
27900
|
return;
|
|
27901
|
-
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 } }));
|
|
27901
|
+
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 } }));
|
|
27902
27902
|
runQuery(query, ({ data: result, error, loading, nextPage: page }) => {
|
|
27903
27903
|
const data = {
|
|
27904
27904
|
loading,
|
|
@@ -27914,7 +27914,7 @@ const liveChannelMembers = (params, callback, config) => {
|
|
|
27914
27914
|
}, queryOptions(policy));
|
|
27915
27915
|
};
|
|
27916
27916
|
disposers.push(onChannelJoined(realtimeRouter()), onChannelLeft(realtimeRouter()), onChannelMemberAdded(realtimeRouter()), onChannelMemberRemoved(realtimeRouter()), onChannelMemberBanned(realtimeRouter()), onChannelMemberUnbanned(realtimeRouter()));
|
|
27917
|
-
onFetch();
|
|
27917
|
+
onFetch(true);
|
|
27918
27918
|
return () => {
|
|
27919
27919
|
log(`liveChannelMembers(tmpid: ${timestamp}) > dispose`);
|
|
27920
27920
|
disposers.forEach(fn => fn());
|
|
@@ -28468,16 +28468,15 @@ const liveMessages = (params, callback, config) => {
|
|
|
28468
28468
|
return;
|
|
28469
28469
|
collection.data = [...new Set([message.messageId, ...collection.data])];
|
|
28470
28470
|
pushToCache(cacheKey, collection);
|
|
28471
|
-
disposers.push(() => dropFromCache(cacheKey));
|
|
28472
28471
|
responder(collection);
|
|
28473
28472
|
};
|
|
28474
|
-
const onFetch = () => {
|
|
28475
|
-
var _a, _b, _c, _d
|
|
28473
|
+
const onFetch = (initial = false) => {
|
|
28474
|
+
var _a, _b, _c, _d;
|
|
28476
28475
|
const collection = (_a = pullFromCache(cacheKey)) === null || _a === void 0 ? void 0 : _a.data;
|
|
28477
28476
|
const messages = (_b = collection === null || collection === void 0 ? void 0 : collection.data) !== null && _b !== void 0 ? _b : [];
|
|
28478
|
-
if (messages.length > 0 && !((_c = collection === null || collection === void 0 ? void 0 : collection.params) === null || _c === void 0 ? void 0 : _c.page))
|
|
28477
|
+
if (!initial && messages.length > 0 && !((_c = collection === null || collection === void 0 ? void 0 : collection.params) === null || _c === void 0 ? void 0 : _c.page))
|
|
28479
28478
|
return;
|
|
28480
|
-
const query = createQuery(queryMessages, Object.assign(Object.assign({}, queryParams), { page: (
|
|
28479
|
+
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 } }));
|
|
28481
28480
|
runQuery(query, ({ data: result, error, loading, nextPage: page }) => {
|
|
28482
28481
|
const data = {
|
|
28483
28482
|
loading,
|
|
@@ -28493,7 +28492,8 @@ const liveMessages = (params, callback, config) => {
|
|
|
28493
28492
|
}, queryOptions(policy, CACHE_SHORTEN_LIFESPAN));
|
|
28494
28493
|
};
|
|
28495
28494
|
disposers.push(onMessageFetched(realtimeRouter()), onMessageCreated(realtimeRouter()), onMessageUpdated(realtimeRouter()), onMessageDeleted(realtimeRouter()), onMessageFlagged(realtimeRouter()), onMessageUnflagged(realtimeRouter()), onMessageFlagCleared(realtimeRouter()), onMessageReactionAdded(realtimeRouter()), onMessageReactionRemoved(realtimeRouter()));
|
|
28496
|
-
onFetch();
|
|
28495
|
+
onFetch(true);
|
|
28496
|
+
disposers.push(() => dropFromCache(cacheKey));
|
|
28497
28497
|
return () => {
|
|
28498
28498
|
log(`liveMessages(tmpid: ${timestamp}) > dispose`);
|
|
28499
28499
|
disposers.forEach(fn => fn());
|
|
@@ -29022,13 +29022,13 @@ const liveCommunities = (params, callback, config) => {
|
|
|
29022
29022
|
pushToCache(cacheKey, collection);
|
|
29023
29023
|
responder(collection);
|
|
29024
29024
|
};
|
|
29025
|
-
const onFetch = () => {
|
|
29025
|
+
const onFetch = (initial = false) => {
|
|
29026
29026
|
var _a, _b, _c;
|
|
29027
29027
|
const collection = (_a = pullFromCache(cacheKey)) === null || _a === void 0 ? void 0 : _a.data;
|
|
29028
29028
|
const communities = (_b = collection === null || collection === void 0 ? void 0 : collection.data) !== null && _b !== void 0 ? _b : [];
|
|
29029
|
-
if (communities.length > 0 && !(collection === null || collection === void 0 ? void 0 : collection.params.page))
|
|
29029
|
+
if (!initial && communities.length > 0 && !(collection === null || collection === void 0 ? void 0 : collection.params.page))
|
|
29030
29030
|
return;
|
|
29031
|
-
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 } }));
|
|
29031
|
+
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 } }));
|
|
29032
29032
|
runQuery(query, ({ data: result, error, loading, nextPage: page }) => {
|
|
29033
29033
|
const data = {
|
|
29034
29034
|
loading,
|
|
@@ -29044,7 +29044,7 @@ const liveCommunities = (params, callback, config) => {
|
|
|
29044
29044
|
}, queryOptions(policy, CACHE_SHORTEN_LIFESPAN));
|
|
29045
29045
|
};
|
|
29046
29046
|
disposers.push(onCommunityCreated(realtimeRouter()), onCommunityDeleted(realtimeRouter()), onCommunityUpdated(realtimeRouter()), onCommunityJoined(realtimeRouter()), onCommunityLeft(realtimeRouter()), onCommunityUserChanged(realtimeRouter()));
|
|
29047
|
-
onFetch();
|
|
29047
|
+
onFetch(true);
|
|
29048
29048
|
return () => {
|
|
29049
29049
|
log(`liveCommunities(tmpid: ${timestamp}) > dispose`);
|
|
29050
29050
|
disposers.forEach(fn => fn());
|
|
@@ -29164,13 +29164,13 @@ const liveCommunityMembers = (params, callback, config) => {
|
|
|
29164
29164
|
pushToCache(cacheKey, collection);
|
|
29165
29165
|
responder(collection);
|
|
29166
29166
|
};
|
|
29167
|
-
const onFetch = () => {
|
|
29167
|
+
const onFetch = (initial = false) => {
|
|
29168
29168
|
var _a, _b, _c;
|
|
29169
29169
|
const collection = (_a = pullFromCache(cacheKey)) === null || _a === void 0 ? void 0 : _a.data;
|
|
29170
29170
|
const communityMembers = (_b = collection === null || collection === void 0 ? void 0 : collection.data) !== null && _b !== void 0 ? _b : [];
|
|
29171
|
-
if (communityMembers.length > 0 && !(collection === null || collection === void 0 ? void 0 : collection.params.page))
|
|
29171
|
+
if (!initial && communityMembers.length > 0 && !(collection === null || collection === void 0 ? void 0 : collection.params.page))
|
|
29172
29172
|
return;
|
|
29173
|
-
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 } }));
|
|
29173
|
+
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 } }));
|
|
29174
29174
|
runQuery(query, ({ data: result, error, loading, nextPage: page }) => {
|
|
29175
29175
|
const data = {
|
|
29176
29176
|
loading,
|
|
@@ -29188,7 +29188,7 @@ const liveCommunityMembers = (params, callback, config) => {
|
|
|
29188
29188
|
}, queryOptions(policy));
|
|
29189
29189
|
};
|
|
29190
29190
|
disposers.push(onCommunityLeft(realtimeRouter()), onCommunityJoined(realtimeRouter()), onCommunityUserBanned(realtimeRouter()), onCommunityUserUnbanned(realtimeRouter()), onCommunityUserChanged(realtimeRouter()), onCommunityUserRoleAdded(realtimeRouter()), onCommunityUserRoleRemoved(realtimeRouter()));
|
|
29191
|
-
onFetch();
|
|
29191
|
+
onFetch(true);
|
|
29192
29192
|
return () => {
|
|
29193
29193
|
log(`liveCommunityMembers(tmpid: ${timestamp}) > dispose`);
|
|
29194
29194
|
disposers.forEach(fn => fn());
|
|
@@ -29387,13 +29387,13 @@ const liveCategories = (params, callback, config) => {
|
|
|
29387
29387
|
* observers
|
|
29388
29388
|
*};
|
|
29389
29389
|
*/
|
|
29390
|
-
const onFetch = () => {
|
|
29390
|
+
const onFetch = (initial = false) => {
|
|
29391
29391
|
var _a, _b, _c;
|
|
29392
29392
|
const collection = (_a = pullFromCache(cacheKey)) === null || _a === void 0 ? void 0 : _a.data;
|
|
29393
29393
|
const categories = (_b = collection === null || collection === void 0 ? void 0 : collection.data) !== null && _b !== void 0 ? _b : [];
|
|
29394
|
-
if (categories.length > 0 && !(collection === null || collection === void 0 ? void 0 : collection.params.page))
|
|
29394
|
+
if (!initial && categories.length > 0 && !(collection === null || collection === void 0 ? void 0 : collection.params.page))
|
|
29395
29395
|
return;
|
|
29396
|
-
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 } }));
|
|
29396
|
+
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 } }));
|
|
29397
29397
|
runQuery(query, ({ data: result, error, loading, nextPage: page }) => {
|
|
29398
29398
|
const data = {
|
|
29399
29399
|
loading,
|
|
@@ -29411,7 +29411,7 @@ const liveCategories = (params, callback, config) => {
|
|
|
29411
29411
|
disposers.push(() => {
|
|
29412
29412
|
// @TODO -> update once observers added
|
|
29413
29413
|
});
|
|
29414
|
-
onFetch();
|
|
29414
|
+
onFetch(true);
|
|
29415
29415
|
return () => {
|
|
29416
29416
|
log(`liveCategories(tmpid: ${timestamp}) > dispose`);
|
|
29417
29417
|
disposers.forEach(fn => fn());
|
|
@@ -30168,13 +30168,13 @@ const liveFollowers = (params, callback, config) => {
|
|
|
30168
30168
|
pushToCache(cacheKey, collection);
|
|
30169
30169
|
responder(collection);
|
|
30170
30170
|
};
|
|
30171
|
-
const onFetch = () => {
|
|
30172
|
-
var _a, _b, _c, _d
|
|
30171
|
+
const onFetch = (initial = false) => {
|
|
30172
|
+
var _a, _b, _c, _d;
|
|
30173
30173
|
const collection = (_a = pullFromCache(cacheKey)) === null || _a === void 0 ? void 0 : _a.data;
|
|
30174
30174
|
const followers = (_b = collection === null || collection === void 0 ? void 0 : collection.data) !== null && _b !== void 0 ? _b : [];
|
|
30175
|
-
if (followers.length > 0 && !((_c = collection === null || collection === void 0 ? void 0 : collection.params) === null || _c === void 0 ? void 0 : _c.page))
|
|
30175
|
+
if (!initial && followers.length > 0 && !((_c = collection === null || collection === void 0 ? void 0 : collection.params) === null || _c === void 0 ? void 0 : _c.page))
|
|
30176
30176
|
return;
|
|
30177
|
-
const query = createQuery(queryFollowers, Object.assign(Object.assign({}, queryParams), { page: (
|
|
30177
|
+
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 } }));
|
|
30178
30178
|
runQuery(query, ({ data: result, error, loading, nextPage: page }) => {
|
|
30179
30179
|
const data = {
|
|
30180
30180
|
loading,
|
|
@@ -30190,7 +30190,7 @@ const liveFollowers = (params, callback, config) => {
|
|
|
30190
30190
|
}, queryOptions(policy));
|
|
30191
30191
|
};
|
|
30192
30192
|
disposers.push(onFollowerRequested(realtimeRouter('onRequested')), onFollowRequestAccepted(realtimeRouter('onAccepted')), onFollowRequestDeclined(realtimeRouter('onDeclined')), onFollowRequestCanceled(realtimeRouter('onCanceled')), onUserFollowed(realtimeRouter('onFollowed')), onUserUnfollowed(realtimeRouter('onUnfollowed')), onFollowerDeleted(realtimeRouter('onDeleted')));
|
|
30193
|
-
onFetch();
|
|
30193
|
+
onFetch(true);
|
|
30194
30194
|
return () => {
|
|
30195
30195
|
log(`liveFollowers(tmpid: ${timestamp}) > dispose`);
|
|
30196
30196
|
disposers.forEach(fn => fn());
|
|
@@ -30258,13 +30258,13 @@ const liveFollowings = (params, callback, config) => {
|
|
|
30258
30258
|
pushToCache(cacheKey, collection);
|
|
30259
30259
|
responder(collection);
|
|
30260
30260
|
};
|
|
30261
|
-
const onFetch = () => {
|
|
30262
|
-
var _a, _b, _c, _d
|
|
30261
|
+
const onFetch = (initial = false) => {
|
|
30262
|
+
var _a, _b, _c, _d;
|
|
30263
30263
|
const collection = (_a = pullFromCache(cacheKey)) === null || _a === void 0 ? void 0 : _a.data;
|
|
30264
30264
|
const followings = (_b = collection === null || collection === void 0 ? void 0 : collection.data) !== null && _b !== void 0 ? _b : [];
|
|
30265
|
-
if (followings.length > 0 && !((_c = collection === null || collection === void 0 ? void 0 : collection.params) === null || _c === void 0 ? void 0 : _c.page))
|
|
30265
|
+
if (!initial && followings.length > 0 && !((_c = collection === null || collection === void 0 ? void 0 : collection.params) === null || _c === void 0 ? void 0 : _c.page))
|
|
30266
30266
|
return;
|
|
30267
|
-
const query = createQuery(queryFollowings, Object.assign(Object.assign({}, queryParams), { page: (
|
|
30267
|
+
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 } }));
|
|
30268
30268
|
runQuery(query, ({ data: result, error, loading, nextPage: page }) => {
|
|
30269
30269
|
const data = {
|
|
30270
30270
|
loading,
|
|
@@ -30280,7 +30280,7 @@ const liveFollowings = (params, callback, config) => {
|
|
|
30280
30280
|
}, queryOptions(policy));
|
|
30281
30281
|
};
|
|
30282
30282
|
disposers.push(onFollowerRequested(realtimeRouter('onRequested')), onFollowRequestAccepted(realtimeRouter('onAccepted')), onFollowRequestDeclined(realtimeRouter('onDeclined')), onFollowRequestCanceled(realtimeRouter('onCanceled')), onUserFollowed(realtimeRouter('onFollowed')), onUserUnfollowed(realtimeRouter('onUnfollowed')), onFollowerDeleted(realtimeRouter('onDeleted')));
|
|
30283
|
-
onFetch();
|
|
30283
|
+
onFetch(true);
|
|
30284
30284
|
return () => {
|
|
30285
30285
|
log(`liveFollowings(tmpid: ${timestamp}) > dispose`);
|
|
30286
30286
|
disposers.forEach(fn => fn());
|
|
@@ -30510,13 +30510,13 @@ const livePosts = (params, callback, config) => {
|
|
|
30510
30510
|
disposers.push(() => dropFromCache(cacheKey));
|
|
30511
30511
|
responder(collection);
|
|
30512
30512
|
};
|
|
30513
|
-
const onFetch = () => {
|
|
30514
|
-
var _a, _b, _c, _d
|
|
30513
|
+
const onFetch = (initial = false) => {
|
|
30514
|
+
var _a, _b, _c, _d;
|
|
30515
30515
|
const collection = (_a = pullFromCache(cacheKey)) === null || _a === void 0 ? void 0 : _a.data;
|
|
30516
30516
|
const posts = (_b = collection === null || collection === void 0 ? void 0 : collection.data) !== null && _b !== void 0 ? _b : [];
|
|
30517
|
-
if (posts.length > 0 && !((_c = collection === null || collection === void 0 ? void 0 : collection.params) === null || _c === void 0 ? void 0 : _c.page))
|
|
30517
|
+
if (!initial && posts.length > 0 && !((_c = collection === null || collection === void 0 ? void 0 : collection.params) === null || _c === void 0 ? void 0 : _c.page))
|
|
30518
30518
|
return;
|
|
30519
|
-
const query = createQuery(queryPosts, Object.assign(Object.assign({}, queryParams), { page: (
|
|
30519
|
+
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 } }));
|
|
30520
30520
|
runQuery(query, ({ data: result, error, loading, nextPage: page }) => {
|
|
30521
30521
|
const data = {
|
|
30522
30522
|
loading,
|
|
@@ -30532,7 +30532,7 @@ const livePosts = (params, callback, config) => {
|
|
|
30532
30532
|
}, queryOptions(policy, CACHE_SHORTEN_LIFESPAN));
|
|
30533
30533
|
};
|
|
30534
30534
|
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')));
|
|
30535
|
-
onFetch();
|
|
30535
|
+
onFetch(true);
|
|
30536
30536
|
return () => {
|
|
30537
30537
|
log(`livePosts(tmpid: ${timestamp}) > dispose`);
|
|
30538
30538
|
disposers.forEach(fn => fn());
|
|
@@ -30721,13 +30721,13 @@ const liveComments = (params, callback, config) => {
|
|
|
30721
30721
|
pushToCache(cacheKey, collection);
|
|
30722
30722
|
responder(collection);
|
|
30723
30723
|
};
|
|
30724
|
-
const onFetch = () => {
|
|
30725
|
-
var _a, _b, _c, _d
|
|
30724
|
+
const onFetch = (initial = false) => {
|
|
30725
|
+
var _a, _b, _c, _d;
|
|
30726
30726
|
const collection = (_a = pullFromCache(cacheKey)) === null || _a === void 0 ? void 0 : _a.data;
|
|
30727
30727
|
const comments = (_b = collection === null || collection === void 0 ? void 0 : collection.data) !== null && _b !== void 0 ? _b : [];
|
|
30728
|
-
if (comments.length > 0 && !((_c = collection === null || collection === void 0 ? void 0 : collection.params) === null || _c === void 0 ? void 0 : _c.page))
|
|
30728
|
+
if (!initial && comments.length > 0 && !((_c = collection === null || collection === void 0 ? void 0 : collection.params) === null || _c === void 0 ? void 0 : _c.page))
|
|
30729
30729
|
return;
|
|
30730
|
-
const query = createQuery(queryComments, Object.assign(Object.assign({}, queryParams), { page: (
|
|
30730
|
+
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 } }));
|
|
30731
30731
|
runQuery(query, ({ data: result, error, loading, prevPage, nextPage }) => {
|
|
30732
30732
|
// depend on sortBy value we have two different pagination type
|
|
30733
30733
|
const page = queryParams.sortBy ? nextPage : prevPage;
|
|
@@ -30745,7 +30745,7 @@ const liveComments = (params, callback, config) => {
|
|
|
30745
30745
|
}, queryOptions(policy, CACHE_SHORTEN_LIFESPAN));
|
|
30746
30746
|
};
|
|
30747
30747
|
disposers.push(onCommentCreated(realtimeRouter('onCreate')), onCommentUpdated(realtimeRouter('onUpdate')), onCommentDeleted(realtimeRouter('onDelete')), onCommentFlagged(realtimeRouter('onFlagged')), onCommentUnflagged(realtimeRouter('onUnflagged')), onCommentReactionAdded(realtimeRouter('onReactionAdded')), onCommentReactionRemoved(realtimeRouter('onReactionRemoved')));
|
|
30748
|
-
onFetch();
|
|
30748
|
+
onFetch(true);
|
|
30749
30749
|
return () => {
|
|
30750
30750
|
log(`liveComments(tmpid: ${timestamp}) > dispose`);
|
|
30751
30751
|
disposers.forEach(fn => fn());
|