@amityco/ts-sdk 6.2.1-0da254e.0 → 6.2.1-5dc0cb2.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/channelRepsitory/api/markAsRead.d.ts +1 -1
- package/dist/channelRepsitory/api/muteChannel.d.ts.map +1 -1
- package/dist/index.cjs.js +35 -26
- package/dist/index.esm.js +35 -26
- package/dist/index.umd.js +4 -4
- package/dist/messageRepository/api/markAsDelivered.d.ts +2 -2
- package/dist/userRepository/{relationship/block/api → api}/queryBlockedUsers.d.ts +2 -2
- package/dist/userRepository/api/queryBlockedUsers.d.ts.map +1 -0
- package/dist/userRepository/api/tests/queryBlockedUsers.test.d.ts.map +1 -0
- package/dist/userRepository/observers/getBlockedUsers.d.ts +2 -0
- package/dist/userRepository/observers/getBlockedUsers.d.ts.map +1 -0
- package/dist/userRepository/observers/index.d.ts +1 -0
- package/dist/userRepository/observers/index.d.ts.map +1 -1
- package/dist/userRepository/relationship/block/observers/getBlockedUsers.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/categoryRepository/observers/getCategories.ts +3 -3
- package/src/channelRepsitory/api/markAsRead.ts +1 -1
- package/src/channelRepsitory/api/muteChannel.ts +8 -0
- package/src/channelRepsitory/api/tests/muteChannel.test.ts +12 -0
- package/src/channelRepsitory/channelMembership/observers/getMembers.ts +3 -3
- package/src/channelRepsitory/observers/getChannels.ts +3 -3
- package/src/communityRepository/communityMembership/observers/getMembers.ts +3 -3
- package/src/communityRepository/observers/getCommunities.ts +3 -3
- package/src/messageRepository/api/markAsDelivered.ts +2 -2
- package/src/messageRepository/observers/getMessages.ts +1 -1
- package/src/userRepository/{relationship/block/api → api}/queryBlockedUsers.ts +3 -2
- package/src/userRepository/{relationship/block/api → api}/tests/queryBlockedUsers.test.ts +1 -1
- package/src/userRepository/observers/getBlockedUsers.ts +104 -0
- package/src/userRepository/observers/getUsers.ts +3 -3
- package/src/userRepository/observers/index.ts +1 -0
- package/src/userRepository/relationship/block/observers/getBlockedUsers.ts +5 -96
- package/dist/userRepository/relationship/block/api/queryBlockedUsers.d.ts.map +0 -1
- package/dist/userRepository/relationship/block/api/tests/queryBlockedUsers.test.d.ts.map +0 -1
- /package/dist/userRepository/{relationship/block/api → api}/tests/queryBlockedUsers.test.d.ts +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"muteChannel.d.ts","sourceRoot":"","sources":["../../../src/channelRepsitory/api/muteChannel.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"muteChannel.d.ts","sourceRoot":"","sources":["../../../src/channelRepsitory/api/muteChannel.ts"],"names":[],"mappings":"AAOA;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,WAAW,cACX,MAAM,OAAO,CAAC,WAAW,CAAC,0BAEpC,QAAQ,OAAO,CAmBjB,CAAC"}
|
package/dist/index.cjs.js
CHANGED
|
@@ -23008,8 +23008,8 @@ const unBlockUser = async (userId) => {
|
|
|
23008
23008
|
|
|
23009
23009
|
/**
|
|
23010
23010
|
* ```js
|
|
23011
|
-
* import {
|
|
23012
|
-
* const { data: users, prevPage, nextPage, total } = await queryBlockedUsers({ page: Amity.PageRaw, limit: number })
|
|
23011
|
+
* import { UserRepository } from '@amityco/ts-sdk'
|
|
23012
|
+
* const { data: users, prevPage, nextPage, total } = await UserRepository.queryBlockedUsers({ page: Amity.PageRaw, limit: number })
|
|
23013
23013
|
* ```
|
|
23014
23014
|
*
|
|
23015
23015
|
* @param query The query parameters
|
|
@@ -23084,7 +23084,7 @@ queryBlockedUsers.locally = (query = {}) => {
|
|
|
23084
23084
|
};
|
|
23085
23085
|
|
|
23086
23086
|
/* eslint-disable no-use-before-define */
|
|
23087
|
-
const getBlockedUsers = (params, callback, config) => {
|
|
23087
|
+
const getBlockedUsers$1 = (params, callback, config) => {
|
|
23088
23088
|
const { log, cache } = getActiveClient();
|
|
23089
23089
|
if (!cache) {
|
|
23090
23090
|
console.log(ENABLE_CACHE_MESSAGE);
|
|
@@ -23153,6 +23153,12 @@ const getBlockedUsers = (params, callback, config) => {
|
|
|
23153
23153
|
};
|
|
23154
23154
|
};
|
|
23155
23155
|
|
|
23156
|
+
/* eslint-disable no-use-before-define */
|
|
23157
|
+
const getBlockedUsers = (params, callback, config) => {
|
|
23158
|
+
console.log('Deprecation Notice: UserRepository.Relationship.getBlockedUsers will be deprecated on 9th June 2023, please use UserRepository.getBlockedUsers instead.');
|
|
23159
|
+
return getBlockedUsers$1(params, callback, config);
|
|
23160
|
+
};
|
|
23161
|
+
|
|
23156
23162
|
/* begin_public_function
|
|
23157
23163
|
id: user.relationship.follow
|
|
23158
23164
|
*/
|
|
@@ -24416,11 +24422,11 @@ const getUsers = (params, callback, config) => {
|
|
|
24416
24422
|
pushToCache(cacheKey, collection);
|
|
24417
24423
|
responder(collection);
|
|
24418
24424
|
};
|
|
24419
|
-
const onFetch = () => {
|
|
24425
|
+
const onFetch = (initial = false) => {
|
|
24420
24426
|
var _a, _b, _c;
|
|
24421
24427
|
const collection = (_a = pullFromCache(cacheKey)) === null || _a === void 0 ? void 0 : _a.data;
|
|
24422
24428
|
const users = (_b = collection === null || collection === void 0 ? void 0 : collection.data) !== null && _b !== void 0 ? _b : [];
|
|
24423
|
-
if (users.length > 0 && !(collection === null || collection === void 0 ? void 0 : collection.params.page))
|
|
24429
|
+
if (!initial && users.length > 0 && !(collection === null || collection === void 0 ? void 0 : collection.params.page))
|
|
24424
24430
|
return;
|
|
24425
24431
|
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 } }));
|
|
24426
24432
|
runQuery(query, ({ data: result, error, loading, nextPage: page }) => {
|
|
@@ -24438,7 +24444,7 @@ const getUsers = (params, callback, config) => {
|
|
|
24438
24444
|
}, queryOptions(policy));
|
|
24439
24445
|
};
|
|
24440
24446
|
disposers.push(onUserUpdated(realtimeRouter()), onUserDeleted(realtimeRouter()), onUserFlagged(realtimeRouter()), onUserUnflagged(realtimeRouter()), onUserFlagCleared(realtimeRouter()));
|
|
24441
|
-
onFetch();
|
|
24447
|
+
onFetch(true);
|
|
24442
24448
|
return () => {
|
|
24443
24449
|
log(`liveUsers(tmpid: ${timestamp}) > dispose`);
|
|
24444
24450
|
disposers.forEach(fn => fn());
|
|
@@ -24498,7 +24504,8 @@ var index$g = /*#__PURE__*/Object.freeze({
|
|
|
24498
24504
|
onUserFlagCleared: onUserFlagCleared,
|
|
24499
24505
|
getUser: getUser,
|
|
24500
24506
|
getUsers: getUsers,
|
|
24501
|
-
observeUser: observeUser
|
|
24507
|
+
observeUser: observeUser,
|
|
24508
|
+
getBlockedUsers: getBlockedUsers$1
|
|
24502
24509
|
});
|
|
24503
24510
|
|
|
24504
24511
|
/* begin_public_function
|
|
@@ -26556,6 +26563,8 @@ const MUTE_FOREVER = -1;
|
|
|
26556
26563
|
const muteChannel = async (channelId, mutePeriod = MUTE_FOREVER) => {
|
|
26557
26564
|
const client = getActiveClient();
|
|
26558
26565
|
client.log('channel/muteChannel', channelId);
|
|
26566
|
+
if (mutePeriod !== MUTE_FOREVER && mutePeriod < 0)
|
|
26567
|
+
throw new ASCError(`Mute Period can only be positive numbers or ${MUTE_FOREVER}(mute forever)`, 800110 /* Amity.ClientError.INVALID_PARAMETERS */, "error" /* Amity.ErrorLevel.ERROR */);
|
|
26559
26568
|
const { data } = await client.http.put(`/api/v2/channel/${encodeURIComponent(channelId)}/mute`, { mutePeriod });
|
|
26560
26569
|
const { success } = data;
|
|
26561
26570
|
return success;
|
|
@@ -26595,7 +26604,7 @@ const unmuteChannel = async (channelId) => {
|
|
|
26595
26604
|
|
|
26596
26605
|
/**
|
|
26597
26606
|
* ```js
|
|
26598
|
-
* import {
|
|
26607
|
+
* import { ChannelRepository } from '@amityco/ts-sdk'
|
|
26599
26608
|
* const success = await ChannelRepository.markAsRead('channelId')
|
|
26600
26609
|
* ```
|
|
26601
26610
|
*
|
|
@@ -27115,11 +27124,11 @@ const getChannels = (params, callback, config) => {
|
|
|
27115
27124
|
pushToCache(cacheKey, collection);
|
|
27116
27125
|
responder(collection);
|
|
27117
27126
|
};
|
|
27118
|
-
const onFetch = () => {
|
|
27127
|
+
const onFetch = (initial = false) => {
|
|
27119
27128
|
var _a, _b, _c;
|
|
27120
27129
|
const collection = (_a = pullFromCache(cacheKey)) === null || _a === void 0 ? void 0 : _a.data;
|
|
27121
27130
|
const channels = (_b = collection === null || collection === void 0 ? void 0 : collection.data) !== null && _b !== void 0 ? _b : [];
|
|
27122
|
-
if (channels.length > 0 && !(collection === null || collection === void 0 ? void 0 : collection.params.page))
|
|
27131
|
+
if (!initial && channels.length > 0 && !(collection === null || collection === void 0 ? void 0 : collection.params.page))
|
|
27123
27132
|
return;
|
|
27124
27133
|
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 } }));
|
|
27125
27134
|
runQuery(query, ({ data: result, error, loading, nextPage: page }) => {
|
|
@@ -27137,7 +27146,7 @@ const getChannels = (params, callback, config) => {
|
|
|
27137
27146
|
}, queryOptions(policy, CACHE_SHORTEN_LIFESPAN));
|
|
27138
27147
|
};
|
|
27139
27148
|
disposers.push(onChannelCreated(realtimeRouter()), onChannelDeleted(realtimeRouter()), onChannelUpdated(realtimeRouter()), onChannelMuted(realtimeRouter()), onChannelJoined(realtimeRouter()), onChannelLeft(realtimeRouter()), onChannelMemberAdded(realtimeRouter()), onChannelMemberRemoved(realtimeRouter()), onMessageCreated(() => null));
|
|
27140
|
-
onFetch();
|
|
27149
|
+
onFetch(true);
|
|
27141
27150
|
return () => {
|
|
27142
27151
|
log(`getChannels(tmpid: ${timestamp}) > dispose`);
|
|
27143
27152
|
disposers.forEach(fn => fn());
|
|
@@ -27393,11 +27402,11 @@ const getMembers$1 = (params, callback, config) => {
|
|
|
27393
27402
|
pushToCache(cacheKey, collection);
|
|
27394
27403
|
responder(collection);
|
|
27395
27404
|
};
|
|
27396
|
-
const onFetch = () => {
|
|
27405
|
+
const onFetch = (initial = false) => {
|
|
27397
27406
|
var _a, _b, _c;
|
|
27398
27407
|
const collection = (_a = pullFromCache(cacheKey)) === null || _a === void 0 ? void 0 : _a.data;
|
|
27399
27408
|
const channelMembers = (_b = collection === null || collection === void 0 ? void 0 : collection.data) !== null && _b !== void 0 ? _b : [];
|
|
27400
|
-
if (channelMembers.length > 0 && !(collection === null || collection === void 0 ? void 0 : collection.params.page))
|
|
27409
|
+
if (!initial && channelMembers.length > 0 && !(collection === null || collection === void 0 ? void 0 : collection.params.page))
|
|
27401
27410
|
return;
|
|
27402
27411
|
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 } }));
|
|
27403
27412
|
runQuery(query, ({ data: result, error, loading, nextPage: page }) => {
|
|
@@ -27415,7 +27424,7 @@ const getMembers$1 = (params, callback, config) => {
|
|
|
27415
27424
|
}, queryOptions(policy));
|
|
27416
27425
|
};
|
|
27417
27426
|
disposers.push(onChannelJoined(realtimeRouter()), onChannelLeft(realtimeRouter()), onChannelMemberAdded(realtimeRouter()), onChannelMemberRemoved(realtimeRouter()), onChannelMemberBanned(realtimeRouter()), onChannelMemberUnbanned(realtimeRouter()));
|
|
27418
|
-
onFetch();
|
|
27427
|
+
onFetch(true);
|
|
27419
27428
|
return () => {
|
|
27420
27429
|
log(`getMembers(tmpid: ${timestamp}) > dispose`);
|
|
27421
27430
|
disposers.forEach(fn => fn());
|
|
@@ -27899,8 +27908,8 @@ deleteMessage.optimistically = (messageId) => {
|
|
|
27899
27908
|
|
|
27900
27909
|
/**
|
|
27901
27910
|
* ```js
|
|
27902
|
-
* import {
|
|
27903
|
-
* const success = await markAsDelivered('subChannelId', 'messageId')
|
|
27911
|
+
* import { MessageRepository } from '@amityco/ts-sdk'
|
|
27912
|
+
* const success = await MessageRepository.markAsDelivered('subChannelId', 'messageId')
|
|
27904
27913
|
* ```
|
|
27905
27914
|
*
|
|
27906
27915
|
* Update `deliveredToSegment` in {@link Amity.SubChannelMarker}
|
|
@@ -28229,7 +28238,6 @@ const getMessages = (params, callback, config) => {
|
|
|
28229
28238
|
return;
|
|
28230
28239
|
collection.data = [...new Set([message.messageId, ...collection.data])];
|
|
28231
28240
|
pushToCache(cacheKey, collection);
|
|
28232
|
-
disposers.push(() => dropFromCache(cacheKey));
|
|
28233
28241
|
responder(collection);
|
|
28234
28242
|
};
|
|
28235
28243
|
const onFetch = () => {
|
|
@@ -28255,6 +28263,7 @@ const getMessages = (params, callback, config) => {
|
|
|
28255
28263
|
};
|
|
28256
28264
|
disposers.push(onMessageFetched(realtimeRouter()), onMessageCreated(realtimeRouter()), onMessageUpdated(realtimeRouter()), onMessageDeleted(realtimeRouter()), onMessageFlagged(realtimeRouter()), onMessageUnflagged(realtimeRouter()), onMessageFlagCleared(realtimeRouter()), onMessageReactionAdded(realtimeRouter()), onMessageReactionRemoved(realtimeRouter()));
|
|
28257
28265
|
onFetch();
|
|
28266
|
+
disposers.push(() => dropFromCache(cacheKey));
|
|
28258
28267
|
return () => {
|
|
28259
28268
|
log(`getMessages(tmpid: ${timestamp}) > dispose`);
|
|
28260
28269
|
disposers.forEach(fn => fn());
|
|
@@ -29735,11 +29744,11 @@ const getCommunities = (params, callback, config) => {
|
|
|
29735
29744
|
pushToCache(cacheKey, collection);
|
|
29736
29745
|
responder(collection);
|
|
29737
29746
|
};
|
|
29738
|
-
const onFetch = () => {
|
|
29747
|
+
const onFetch = (initial = false) => {
|
|
29739
29748
|
var _a, _b, _c;
|
|
29740
29749
|
const collection = (_a = pullFromCache(cacheKey)) === null || _a === void 0 ? void 0 : _a.data;
|
|
29741
29750
|
const communities = (_b = collection === null || collection === void 0 ? void 0 : collection.data) !== null && _b !== void 0 ? _b : [];
|
|
29742
|
-
if (communities.length > 0 && !(collection === null || collection === void 0 ? void 0 : collection.params.page))
|
|
29751
|
+
if (!initial && communities.length > 0 && !(collection === null || collection === void 0 ? void 0 : collection.params.page))
|
|
29743
29752
|
return;
|
|
29744
29753
|
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 } }));
|
|
29745
29754
|
runQuery(query, ({ data: result, error, loading, nextPage: page }) => {
|
|
@@ -29757,7 +29766,7 @@ const getCommunities = (params, callback, config) => {
|
|
|
29757
29766
|
}, queryOptions(policy, CACHE_SHORTEN_LIFESPAN));
|
|
29758
29767
|
};
|
|
29759
29768
|
disposers.push(onCommunityCreated(realtimeRouter()), onCommunityDeleted(realtimeRouter()), onCommunityUpdated(realtimeRouter()), onCommunityJoined(realtimeRouter()), onCommunityLeft(realtimeRouter()), onCommunityUserChanged(realtimeRouter()));
|
|
29760
|
-
onFetch();
|
|
29769
|
+
onFetch(true);
|
|
29761
29770
|
return () => {
|
|
29762
29771
|
log(`getCommunities(tmpid: ${timestamp}) > dispose`);
|
|
29763
29772
|
disposers.forEach(fn => fn());
|
|
@@ -30092,11 +30101,11 @@ const getMembers = (params, callback, config) => {
|
|
|
30092
30101
|
pushToCache(cacheKey, collection);
|
|
30093
30102
|
responder(collection);
|
|
30094
30103
|
};
|
|
30095
|
-
const onFetch = () => {
|
|
30104
|
+
const onFetch = (initial = false) => {
|
|
30096
30105
|
var _a, _b, _c;
|
|
30097
30106
|
const collection = (_a = pullFromCache(cacheKey)) === null || _a === void 0 ? void 0 : _a.data;
|
|
30098
30107
|
const communityMembers = (_b = collection === null || collection === void 0 ? void 0 : collection.data) !== null && _b !== void 0 ? _b : [];
|
|
30099
|
-
if (communityMembers.length > 0 && !(collection === null || collection === void 0 ? void 0 : collection.params.page))
|
|
30108
|
+
if (!initial && communityMembers.length > 0 && !(collection === null || collection === void 0 ? void 0 : collection.params.page))
|
|
30100
30109
|
return;
|
|
30101
30110
|
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 } }));
|
|
30102
30111
|
runQuery(query, ({ data: result, error, loading, nextPage: page }) => {
|
|
@@ -30116,7 +30125,7 @@ const getMembers = (params, callback, config) => {
|
|
|
30116
30125
|
}, queryOptions(policy));
|
|
30117
30126
|
};
|
|
30118
30127
|
disposers.push(onCommunityLeft(realtimeRouter()), onCommunityJoined(realtimeRouter()), onCommunityUserBanned(realtimeRouter()), onCommunityUserUnbanned(realtimeRouter()), onCommunityUserChanged(realtimeRouter()), onCommunityUserRoleAdded(realtimeRouter()), onCommunityUserRoleRemoved(realtimeRouter()));
|
|
30119
|
-
onFetch();
|
|
30128
|
+
onFetch(true);
|
|
30120
30129
|
return () => {
|
|
30121
30130
|
log(`getMembers(tmpid: ${timestamp}) > dispose`);
|
|
30122
30131
|
disposers.forEach(fn => fn());
|
|
@@ -30350,11 +30359,11 @@ const getCategories = (params, callback, config) => {
|
|
|
30350
30359
|
* observers
|
|
30351
30360
|
*};
|
|
30352
30361
|
*/
|
|
30353
|
-
const onFetch = () => {
|
|
30362
|
+
const onFetch = (initial = false) => {
|
|
30354
30363
|
var _a, _b, _c;
|
|
30355
30364
|
const collection = (_a = pullFromCache(cacheKey)) === null || _a === void 0 ? void 0 : _a.data;
|
|
30356
30365
|
const categories = (_b = collection === null || collection === void 0 ? void 0 : collection.data) !== null && _b !== void 0 ? _b : [];
|
|
30357
|
-
if (categories.length > 0 && !(collection === null || collection === void 0 ? void 0 : collection.params.page))
|
|
30366
|
+
if (!initial && categories.length > 0 && !(collection === null || collection === void 0 ? void 0 : collection.params.page))
|
|
30358
30367
|
return;
|
|
30359
30368
|
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 } }));
|
|
30360
30369
|
runQuery(query, ({ data: result, error, loading, nextPage: page }) => {
|
|
@@ -30374,7 +30383,7 @@ const getCategories = (params, callback, config) => {
|
|
|
30374
30383
|
disposers.push(() => {
|
|
30375
30384
|
// @TODO -> update once observers added
|
|
30376
30385
|
});
|
|
30377
|
-
onFetch();
|
|
30386
|
+
onFetch(true);
|
|
30378
30387
|
return () => {
|
|
30379
30388
|
log(`getCategories(tmpid: ${timestamp}) > dispose`);
|
|
30380
30389
|
disposers.forEach(fn => fn());
|
package/dist/index.esm.js
CHANGED
|
@@ -22994,8 +22994,8 @@ const unBlockUser = async (userId) => {
|
|
|
22994
22994
|
|
|
22995
22995
|
/**
|
|
22996
22996
|
* ```js
|
|
22997
|
-
* import {
|
|
22998
|
-
* const { data: users, prevPage, nextPage, total } = await queryBlockedUsers({ page: Amity.PageRaw, limit: number })
|
|
22997
|
+
* import { UserRepository } from '@amityco/ts-sdk'
|
|
22998
|
+
* const { data: users, prevPage, nextPage, total } = await UserRepository.queryBlockedUsers({ page: Amity.PageRaw, limit: number })
|
|
22999
22999
|
* ```
|
|
23000
23000
|
*
|
|
23001
23001
|
* @param query The query parameters
|
|
@@ -23070,7 +23070,7 @@ queryBlockedUsers.locally = (query = {}) => {
|
|
|
23070
23070
|
};
|
|
23071
23071
|
|
|
23072
23072
|
/* eslint-disable no-use-before-define */
|
|
23073
|
-
const getBlockedUsers = (params, callback, config) => {
|
|
23073
|
+
const getBlockedUsers$1 = (params, callback, config) => {
|
|
23074
23074
|
const { log, cache } = getActiveClient();
|
|
23075
23075
|
if (!cache) {
|
|
23076
23076
|
console.log(ENABLE_CACHE_MESSAGE);
|
|
@@ -23139,6 +23139,12 @@ const getBlockedUsers = (params, callback, config) => {
|
|
|
23139
23139
|
};
|
|
23140
23140
|
};
|
|
23141
23141
|
|
|
23142
|
+
/* eslint-disable no-use-before-define */
|
|
23143
|
+
const getBlockedUsers = (params, callback, config) => {
|
|
23144
|
+
console.log('Deprecation Notice: UserRepository.Relationship.getBlockedUsers will be deprecated on 9th June 2023, please use UserRepository.getBlockedUsers instead.');
|
|
23145
|
+
return getBlockedUsers$1(params, callback, config);
|
|
23146
|
+
};
|
|
23147
|
+
|
|
23142
23148
|
/* begin_public_function
|
|
23143
23149
|
id: user.relationship.follow
|
|
23144
23150
|
*/
|
|
@@ -24402,11 +24408,11 @@ const getUsers = (params, callback, config) => {
|
|
|
24402
24408
|
pushToCache(cacheKey, collection);
|
|
24403
24409
|
responder(collection);
|
|
24404
24410
|
};
|
|
24405
|
-
const onFetch = () => {
|
|
24411
|
+
const onFetch = (initial = false) => {
|
|
24406
24412
|
var _a, _b, _c;
|
|
24407
24413
|
const collection = (_a = pullFromCache(cacheKey)) === null || _a === void 0 ? void 0 : _a.data;
|
|
24408
24414
|
const users = (_b = collection === null || collection === void 0 ? void 0 : collection.data) !== null && _b !== void 0 ? _b : [];
|
|
24409
|
-
if (users.length > 0 && !(collection === null || collection === void 0 ? void 0 : collection.params.page))
|
|
24415
|
+
if (!initial && users.length > 0 && !(collection === null || collection === void 0 ? void 0 : collection.params.page))
|
|
24410
24416
|
return;
|
|
24411
24417
|
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 } }));
|
|
24412
24418
|
runQuery(query, ({ data: result, error, loading, nextPage: page }) => {
|
|
@@ -24424,7 +24430,7 @@ const getUsers = (params, callback, config) => {
|
|
|
24424
24430
|
}, queryOptions(policy));
|
|
24425
24431
|
};
|
|
24426
24432
|
disposers.push(onUserUpdated(realtimeRouter()), onUserDeleted(realtimeRouter()), onUserFlagged(realtimeRouter()), onUserUnflagged(realtimeRouter()), onUserFlagCleared(realtimeRouter()));
|
|
24427
|
-
onFetch();
|
|
24433
|
+
onFetch(true);
|
|
24428
24434
|
return () => {
|
|
24429
24435
|
log(`liveUsers(tmpid: ${timestamp}) > dispose`);
|
|
24430
24436
|
disposers.forEach(fn => fn());
|
|
@@ -24484,7 +24490,8 @@ var index$g = /*#__PURE__*/Object.freeze({
|
|
|
24484
24490
|
onUserFlagCleared: onUserFlagCleared,
|
|
24485
24491
|
getUser: getUser,
|
|
24486
24492
|
getUsers: getUsers,
|
|
24487
|
-
observeUser: observeUser
|
|
24493
|
+
observeUser: observeUser,
|
|
24494
|
+
getBlockedUsers: getBlockedUsers$1
|
|
24488
24495
|
});
|
|
24489
24496
|
|
|
24490
24497
|
/* begin_public_function
|
|
@@ -26542,6 +26549,8 @@ const MUTE_FOREVER = -1;
|
|
|
26542
26549
|
const muteChannel = async (channelId, mutePeriod = MUTE_FOREVER) => {
|
|
26543
26550
|
const client = getActiveClient();
|
|
26544
26551
|
client.log('channel/muteChannel', channelId);
|
|
26552
|
+
if (mutePeriod !== MUTE_FOREVER && mutePeriod < 0)
|
|
26553
|
+
throw new ASCError(`Mute Period can only be positive numbers or ${MUTE_FOREVER}(mute forever)`, 800110 /* Amity.ClientError.INVALID_PARAMETERS */, "error" /* Amity.ErrorLevel.ERROR */);
|
|
26545
26554
|
const { data } = await client.http.put(`/api/v2/channel/${encodeURIComponent(channelId)}/mute`, { mutePeriod });
|
|
26546
26555
|
const { success } = data;
|
|
26547
26556
|
return success;
|
|
@@ -26581,7 +26590,7 @@ const unmuteChannel = async (channelId) => {
|
|
|
26581
26590
|
|
|
26582
26591
|
/**
|
|
26583
26592
|
* ```js
|
|
26584
|
-
* import {
|
|
26593
|
+
* import { ChannelRepository } from '@amityco/ts-sdk'
|
|
26585
26594
|
* const success = await ChannelRepository.markAsRead('channelId')
|
|
26586
26595
|
* ```
|
|
26587
26596
|
*
|
|
@@ -27101,11 +27110,11 @@ const getChannels = (params, callback, config) => {
|
|
|
27101
27110
|
pushToCache(cacheKey, collection);
|
|
27102
27111
|
responder(collection);
|
|
27103
27112
|
};
|
|
27104
|
-
const onFetch = () => {
|
|
27113
|
+
const onFetch = (initial = false) => {
|
|
27105
27114
|
var _a, _b, _c;
|
|
27106
27115
|
const collection = (_a = pullFromCache(cacheKey)) === null || _a === void 0 ? void 0 : _a.data;
|
|
27107
27116
|
const channels = (_b = collection === null || collection === void 0 ? void 0 : collection.data) !== null && _b !== void 0 ? _b : [];
|
|
27108
|
-
if (channels.length > 0 && !(collection === null || collection === void 0 ? void 0 : collection.params.page))
|
|
27117
|
+
if (!initial && channels.length > 0 && !(collection === null || collection === void 0 ? void 0 : collection.params.page))
|
|
27109
27118
|
return;
|
|
27110
27119
|
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 } }));
|
|
27111
27120
|
runQuery(query, ({ data: result, error, loading, nextPage: page }) => {
|
|
@@ -27123,7 +27132,7 @@ const getChannels = (params, callback, config) => {
|
|
|
27123
27132
|
}, queryOptions(policy, CACHE_SHORTEN_LIFESPAN));
|
|
27124
27133
|
};
|
|
27125
27134
|
disposers.push(onChannelCreated(realtimeRouter()), onChannelDeleted(realtimeRouter()), onChannelUpdated(realtimeRouter()), onChannelMuted(realtimeRouter()), onChannelJoined(realtimeRouter()), onChannelLeft(realtimeRouter()), onChannelMemberAdded(realtimeRouter()), onChannelMemberRemoved(realtimeRouter()), onMessageCreated(() => null));
|
|
27126
|
-
onFetch();
|
|
27135
|
+
onFetch(true);
|
|
27127
27136
|
return () => {
|
|
27128
27137
|
log(`getChannels(tmpid: ${timestamp}) > dispose`);
|
|
27129
27138
|
disposers.forEach(fn => fn());
|
|
@@ -27379,11 +27388,11 @@ const getMembers$1 = (params, callback, config) => {
|
|
|
27379
27388
|
pushToCache(cacheKey, collection);
|
|
27380
27389
|
responder(collection);
|
|
27381
27390
|
};
|
|
27382
|
-
const onFetch = () => {
|
|
27391
|
+
const onFetch = (initial = false) => {
|
|
27383
27392
|
var _a, _b, _c;
|
|
27384
27393
|
const collection = (_a = pullFromCache(cacheKey)) === null || _a === void 0 ? void 0 : _a.data;
|
|
27385
27394
|
const channelMembers = (_b = collection === null || collection === void 0 ? void 0 : collection.data) !== null && _b !== void 0 ? _b : [];
|
|
27386
|
-
if (channelMembers.length > 0 && !(collection === null || collection === void 0 ? void 0 : collection.params.page))
|
|
27395
|
+
if (!initial && channelMembers.length > 0 && !(collection === null || collection === void 0 ? void 0 : collection.params.page))
|
|
27387
27396
|
return;
|
|
27388
27397
|
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 } }));
|
|
27389
27398
|
runQuery(query, ({ data: result, error, loading, nextPage: page }) => {
|
|
@@ -27401,7 +27410,7 @@ const getMembers$1 = (params, callback, config) => {
|
|
|
27401
27410
|
}, queryOptions(policy));
|
|
27402
27411
|
};
|
|
27403
27412
|
disposers.push(onChannelJoined(realtimeRouter()), onChannelLeft(realtimeRouter()), onChannelMemberAdded(realtimeRouter()), onChannelMemberRemoved(realtimeRouter()), onChannelMemberBanned(realtimeRouter()), onChannelMemberUnbanned(realtimeRouter()));
|
|
27404
|
-
onFetch();
|
|
27413
|
+
onFetch(true);
|
|
27405
27414
|
return () => {
|
|
27406
27415
|
log(`getMembers(tmpid: ${timestamp}) > dispose`);
|
|
27407
27416
|
disposers.forEach(fn => fn());
|
|
@@ -27885,8 +27894,8 @@ deleteMessage.optimistically = (messageId) => {
|
|
|
27885
27894
|
|
|
27886
27895
|
/**
|
|
27887
27896
|
* ```js
|
|
27888
|
-
* import {
|
|
27889
|
-
* const success = await markAsDelivered('subChannelId', 'messageId')
|
|
27897
|
+
* import { MessageRepository } from '@amityco/ts-sdk'
|
|
27898
|
+
* const success = await MessageRepository.markAsDelivered('subChannelId', 'messageId')
|
|
27890
27899
|
* ```
|
|
27891
27900
|
*
|
|
27892
27901
|
* Update `deliveredToSegment` in {@link Amity.SubChannelMarker}
|
|
@@ -28215,7 +28224,6 @@ const getMessages = (params, callback, config) => {
|
|
|
28215
28224
|
return;
|
|
28216
28225
|
collection.data = [...new Set([message.messageId, ...collection.data])];
|
|
28217
28226
|
pushToCache(cacheKey, collection);
|
|
28218
|
-
disposers.push(() => dropFromCache(cacheKey));
|
|
28219
28227
|
responder(collection);
|
|
28220
28228
|
};
|
|
28221
28229
|
const onFetch = () => {
|
|
@@ -28241,6 +28249,7 @@ const getMessages = (params, callback, config) => {
|
|
|
28241
28249
|
};
|
|
28242
28250
|
disposers.push(onMessageFetched(realtimeRouter()), onMessageCreated(realtimeRouter()), onMessageUpdated(realtimeRouter()), onMessageDeleted(realtimeRouter()), onMessageFlagged(realtimeRouter()), onMessageUnflagged(realtimeRouter()), onMessageFlagCleared(realtimeRouter()), onMessageReactionAdded(realtimeRouter()), onMessageReactionRemoved(realtimeRouter()));
|
|
28243
28251
|
onFetch();
|
|
28252
|
+
disposers.push(() => dropFromCache(cacheKey));
|
|
28244
28253
|
return () => {
|
|
28245
28254
|
log(`getMessages(tmpid: ${timestamp}) > dispose`);
|
|
28246
28255
|
disposers.forEach(fn => fn());
|
|
@@ -29721,11 +29730,11 @@ const getCommunities = (params, callback, config) => {
|
|
|
29721
29730
|
pushToCache(cacheKey, collection);
|
|
29722
29731
|
responder(collection);
|
|
29723
29732
|
};
|
|
29724
|
-
const onFetch = () => {
|
|
29733
|
+
const onFetch = (initial = false) => {
|
|
29725
29734
|
var _a, _b, _c;
|
|
29726
29735
|
const collection = (_a = pullFromCache(cacheKey)) === null || _a === void 0 ? void 0 : _a.data;
|
|
29727
29736
|
const communities = (_b = collection === null || collection === void 0 ? void 0 : collection.data) !== null && _b !== void 0 ? _b : [];
|
|
29728
|
-
if (communities.length > 0 && !(collection === null || collection === void 0 ? void 0 : collection.params.page))
|
|
29737
|
+
if (!initial && communities.length > 0 && !(collection === null || collection === void 0 ? void 0 : collection.params.page))
|
|
29729
29738
|
return;
|
|
29730
29739
|
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 } }));
|
|
29731
29740
|
runQuery(query, ({ data: result, error, loading, nextPage: page }) => {
|
|
@@ -29743,7 +29752,7 @@ const getCommunities = (params, callback, config) => {
|
|
|
29743
29752
|
}, queryOptions(policy, CACHE_SHORTEN_LIFESPAN));
|
|
29744
29753
|
};
|
|
29745
29754
|
disposers.push(onCommunityCreated(realtimeRouter()), onCommunityDeleted(realtimeRouter()), onCommunityUpdated(realtimeRouter()), onCommunityJoined(realtimeRouter()), onCommunityLeft(realtimeRouter()), onCommunityUserChanged(realtimeRouter()));
|
|
29746
|
-
onFetch();
|
|
29755
|
+
onFetch(true);
|
|
29747
29756
|
return () => {
|
|
29748
29757
|
log(`getCommunities(tmpid: ${timestamp}) > dispose`);
|
|
29749
29758
|
disposers.forEach(fn => fn());
|
|
@@ -30078,11 +30087,11 @@ const getMembers = (params, callback, config) => {
|
|
|
30078
30087
|
pushToCache(cacheKey, collection);
|
|
30079
30088
|
responder(collection);
|
|
30080
30089
|
};
|
|
30081
|
-
const onFetch = () => {
|
|
30090
|
+
const onFetch = (initial = false) => {
|
|
30082
30091
|
var _a, _b, _c;
|
|
30083
30092
|
const collection = (_a = pullFromCache(cacheKey)) === null || _a === void 0 ? void 0 : _a.data;
|
|
30084
30093
|
const communityMembers = (_b = collection === null || collection === void 0 ? void 0 : collection.data) !== null && _b !== void 0 ? _b : [];
|
|
30085
|
-
if (communityMembers.length > 0 && !(collection === null || collection === void 0 ? void 0 : collection.params.page))
|
|
30094
|
+
if (!initial && communityMembers.length > 0 && !(collection === null || collection === void 0 ? void 0 : collection.params.page))
|
|
30086
30095
|
return;
|
|
30087
30096
|
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 } }));
|
|
30088
30097
|
runQuery(query, ({ data: result, error, loading, nextPage: page }) => {
|
|
@@ -30102,7 +30111,7 @@ const getMembers = (params, callback, config) => {
|
|
|
30102
30111
|
}, queryOptions(policy));
|
|
30103
30112
|
};
|
|
30104
30113
|
disposers.push(onCommunityLeft(realtimeRouter()), onCommunityJoined(realtimeRouter()), onCommunityUserBanned(realtimeRouter()), onCommunityUserUnbanned(realtimeRouter()), onCommunityUserChanged(realtimeRouter()), onCommunityUserRoleAdded(realtimeRouter()), onCommunityUserRoleRemoved(realtimeRouter()));
|
|
30105
|
-
onFetch();
|
|
30114
|
+
onFetch(true);
|
|
30106
30115
|
return () => {
|
|
30107
30116
|
log(`getMembers(tmpid: ${timestamp}) > dispose`);
|
|
30108
30117
|
disposers.forEach(fn => fn());
|
|
@@ -30336,11 +30345,11 @@ const getCategories = (params, callback, config) => {
|
|
|
30336
30345
|
* observers
|
|
30337
30346
|
*};
|
|
30338
30347
|
*/
|
|
30339
|
-
const onFetch = () => {
|
|
30348
|
+
const onFetch = (initial = false) => {
|
|
30340
30349
|
var _a, _b, _c;
|
|
30341
30350
|
const collection = (_a = pullFromCache(cacheKey)) === null || _a === void 0 ? void 0 : _a.data;
|
|
30342
30351
|
const categories = (_b = collection === null || collection === void 0 ? void 0 : collection.data) !== null && _b !== void 0 ? _b : [];
|
|
30343
|
-
if (categories.length > 0 && !(collection === null || collection === void 0 ? void 0 : collection.params.page))
|
|
30352
|
+
if (!initial && categories.length > 0 && !(collection === null || collection === void 0 ? void 0 : collection.params.page))
|
|
30344
30353
|
return;
|
|
30345
30354
|
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 } }));
|
|
30346
30355
|
runQuery(query, ({ data: result, error, loading, nextPage: page }) => {
|
|
@@ -30360,7 +30369,7 @@ const getCategories = (params, callback, config) => {
|
|
|
30360
30369
|
disposers.push(() => {
|
|
30361
30370
|
// @TODO -> update once observers added
|
|
30362
30371
|
});
|
|
30363
|
-
onFetch();
|
|
30372
|
+
onFetch(true);
|
|
30364
30373
|
return () => {
|
|
30365
30374
|
log(`getCategories(tmpid: ${timestamp}) > dispose`);
|
|
30366
30375
|
disposers.forEach(fn => fn());
|