@amityco/ts-sdk 7.25.0 → 7.25.1-0854aaee.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.
Files changed (43) hide show
  1. package/dist/@types/core/payload.d.ts +1 -0
  2. package/dist/@types/core/payload.d.ts.map +1 -1
  3. package/dist/@types/domains/client.d.ts +1 -0
  4. package/dist/@types/domains/client.d.ts.map +1 -1
  5. package/dist/@types/domains/content.d.ts +6 -1
  6. package/dist/@types/domains/content.d.ts.map +1 -1
  7. package/dist/@types/domains/liveViewerCount.d.ts +22 -0
  8. package/dist/@types/domains/liveViewerCount.d.ts.map +1 -0
  9. package/dist/@types/domains/post.d.ts +3 -0
  10. package/dist/@types/domains/post.d.ts.map +1 -1
  11. package/dist/@types/index.d.ts +1 -0
  12. package/dist/@types/index.d.ts.map +1 -1
  13. package/dist/client/api/createClient.d.ts.map +1 -1
  14. package/dist/client/api/getLiveViewerCountConfig.d.ts +24 -0
  15. package/dist/client/api/getLiveViewerCountConfig.d.ts.map +1 -0
  16. package/dist/client/api/index.d.ts +1 -0
  17. package/dist/client/api/index.d.ts.map +1 -1
  18. package/dist/index.cjs.js +206 -1
  19. package/dist/index.esm.js +207 -2
  20. package/dist/index.umd.js +2 -2
  21. package/dist/messagePreview/utils/getSubChannelMessagePreviewWithUser.d.ts +1 -1
  22. package/dist/postRepository/api/createEventPost.d.ts +36 -0
  23. package/dist/postRepository/api/createEventPost.d.ts.map +1 -0
  24. package/dist/postRepository/api/index.d.ts +1 -0
  25. package/dist/postRepository/api/index.d.ts.map +1 -1
  26. package/dist/postRepository/api/tests/integration/setup.d.ts +1 -0
  27. package/dist/postRepository/api/tests/integration/setup.d.ts.map +1 -1
  28. package/dist/userRepository/observers/index.d.ts +1 -0
  29. package/dist/userRepository/observers/index.d.ts.map +1 -1
  30. package/dist/userRepository/observers/searchUserByDisplayName.d.ts +2 -0
  31. package/dist/userRepository/observers/searchUserByDisplayName.d.ts.map +1 -1
  32. package/dist/userRepository/observers/searchUsers.d.ts +26 -0
  33. package/dist/userRepository/observers/searchUsers.d.ts.map +1 -0
  34. package/dist/userRepository/observers/tests/integrations/searchUsers.integration.test.d.ts +2 -0
  35. package/dist/userRepository/observers/tests/integrations/searchUsers.integration.test.d.ts.map +1 -0
  36. package/dist/userRepository/observers/tests/searchUsers.test.d.ts +2 -0
  37. package/dist/userRepository/observers/tests/searchUsers.test.d.ts.map +1 -0
  38. package/dist/utils/linkedObject/postLinkedObject.d.ts.map +1 -1
  39. package/dist/utils/postTypePredicate.d.ts +1 -0
  40. package/dist/utils/postTypePredicate.d.ts.map +1 -1
  41. package/dist/utils/tests/dummy/comment.d.ts +1 -1
  42. package/dist/utils/tests/dummy/post.d.ts.map +1 -1
  43. package/package.json +1 -1
package/dist/index.esm.js CHANGED
@@ -146,6 +146,7 @@ const PostContentType = Object.freeze({
146
146
  CLIP: 'clip',
147
147
  AUDIO: 'audio',
148
148
  ROOM: 'room',
149
+ EVENT: 'event',
149
150
  });
150
151
  const PostStructureType = Object.freeze({
151
152
  TEXT: 'text',
@@ -154,6 +155,7 @@ const PostStructureType = Object.freeze({
154
155
  FILE: 'file',
155
156
  AUDIO: 'audio',
156
157
  MIXED: 'mixed',
158
+ EVENT: 'event',
157
159
  });
158
160
 
159
161
  var InvitationTypeEnum;
@@ -304,6 +306,13 @@ var NotificationRolesFilterTypeEnum;
304
306
  NotificationRolesFilterTypeEnum["ONLY"] = "only";
305
307
  })(NotificationRolesFilterTypeEnum || (NotificationRolesFilterTypeEnum = {}));
306
308
 
309
+ var AmityLiveViewerCountMode;
310
+ (function (AmityLiveViewerCountMode) {
311
+ AmityLiveViewerCountMode["ALWAYS_SHOW"] = "always";
312
+ AmityLiveViewerCountMode["HIDE_ENTIRELY"] = "hidden";
313
+ AmityLiveViewerCountMode["SHOW_ABOVE_MINIMUM"] = "above-minimum";
314
+ })(AmityLiveViewerCountMode || (AmityLiveViewerCountMode = {}));
315
+
307
316
  function getVersion() {
308
317
  try {
309
318
  // the string ''v7.25.0-esm'' should be replaced by actual value by @rollup/plugin-replace
@@ -5019,6 +5028,51 @@ const getCoreUserSettings = async () => {
5019
5028
  return data;
5020
5029
  };
5021
5030
 
5031
+ const DEFAULT_CONFIG = {
5032
+ mode: AmityLiveViewerCountMode.ALWAYS_SHOW,
5033
+ threshold: 50,
5034
+ };
5035
+ const isValidMode = (value) => value === AmityLiveViewerCountMode.ALWAYS_SHOW ||
5036
+ value === AmityLiveViewerCountMode.HIDE_ENTIRELY ||
5037
+ value === AmityLiveViewerCountMode.SHOW_ABOVE_MINIMUM;
5038
+ const isValidThreshold = (value) => typeof value === 'number' && Number.isInteger(value) && value >= 1 && value <= 1000;
5039
+ /**
5040
+ * ```js
5041
+ * import { getLiveViewerCountConfig } from '@amityco/ts-sdk'
5042
+ * const config = await getLiveViewerCountConfig()
5043
+ * ```
5044
+ *
5045
+ * Fetches the network-level {@link Amity.LiveViewerCountConfig} governing
5046
+ * how the live viewer count is displayed to viewers on a livestream.
5047
+ *
5048
+ * Cold-read — no observable, no cache. Call once per livestream mount /
5049
+ * rejoin. Admin-driven config changes take effect on the next join, not
5050
+ * mid-stream.
5051
+ *
5052
+ * On a malformed payload (unknown mode, out-of-range or missing threshold)
5053
+ * the SDK falls open to `{ mode: ALWAYS_SHOW, threshold: 50 }` and logs a
5054
+ * warning. Network errors reject.
5055
+ *
5056
+ * @returns A Promise of {@link Amity.LiveViewerCountConfig}
5057
+ *
5058
+ * @category Client API
5059
+ * @async
5060
+ */
5061
+ /* begin_public_function id: client.getLiveViewerCountConfig */
5062
+ const getLiveViewerCountConfig = async () => {
5063
+ var _a, _b;
5064
+ const client = getActiveClient();
5065
+ const { data } = await client.http.get('/api/v3/network-settings/video-streaming');
5066
+ const mode = (_a = data === null || data === void 0 ? void 0 : data.videoStreaming) === null || _a === void 0 ? void 0 : _a.viewerCountDisplayMode;
5067
+ const threshold = (_b = data === null || data === void 0 ? void 0 : data.videoStreaming) === null || _b === void 0 ? void 0 : _b.viewerCountDisplayMinimum;
5068
+ if (!isValidMode(mode) || !isValidThreshold(threshold)) {
5069
+ client.log('client/getLiveViewerCountConfig', 'malformed videoStreaming settings, falling back to default', { mode, threshold });
5070
+ return DEFAULT_CONFIG;
5071
+ }
5072
+ return { mode, threshold };
5073
+ };
5074
+ /* end_public_function */
5075
+
5022
5076
  /* begin_public_function
5023
5077
  id: client.getProductCatalogueSetting
5024
5078
  */
@@ -8468,6 +8522,7 @@ const createClient = (apiKey, apiRegion = API_REGIONS.SG, { debugSession = DEFAU
8468
8522
  getCoreUserSettings,
8469
8523
  getSocialSettings,
8470
8524
  getChatSettings,
8525
+ getLiveViewerCountConfig,
8471
8526
  getVisitorDeviceId: getDeviceId,
8472
8527
  getMessagePreviewSetting: getMessagePreviewSetting$1,
8473
8528
  use: () => setActiveClient(client),
@@ -9559,6 +9614,7 @@ var index$s = /*#__PURE__*/Object.freeze({
9559
9614
  setCurrentUserType: setCurrentUserType,
9560
9615
  setAccessTokenHandler: setAccessTokenHandler,
9561
9616
  getChatSettings: getChatSettings,
9617
+ getLiveViewerCountConfig: getLiveViewerCountConfig,
9562
9618
  getCoreUserSettings: getCoreUserSettings,
9563
9619
  notifications: notifications,
9564
9620
  enableAutoSubscriptions: enableAutoSubscriptions,
@@ -12361,6 +12417,9 @@ function isAmityRoomPost(post) {
12361
12417
  'roomId' in post.data &&
12362
12418
  post.dataType === 'room');
12363
12419
  }
12420
+ function isAmityEventPost(post) {
12421
+ return post.dataType === 'event' || post.structureType === 'event';
12422
+ }
12364
12423
 
12365
12424
  /**
12366
12425
  * ```js
@@ -12472,7 +12531,7 @@ const getWatchSessionStorage = () => {
12472
12531
  return storageInstance;
12473
12532
  };
12474
12533
 
12475
- const privateKey = "-----BEGIN PRIVATE KEY-----\nMIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQDHo80SecH7FuF2\nhFYnb+l26/VN8UMLXAQFLnxciNTEwkGVFMpdezlH8rU2H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478
12537
  */
@@ -13019,6 +13078,57 @@ const postLinkedObject = (post) => {
13019
13078
  const room = (_b = pullFromCache(['room', 'get', (_a = post === null || post === void 0 ? void 0 : post.data) === null || _a === void 0 ? void 0 : _a.roomId])) === null || _b === void 0 ? void 0 : _b.data;
13020
13079
  return room ? roomLinkedObject(room) : undefined;
13021
13080
  },
13081
+ getEventInfo() {
13082
+ var _a, _b;
13083
+ if (!isAmityEventPost(post))
13084
+ return;
13085
+ const readEventId = (data) => {
13086
+ if (data && typeof data === 'object' && 'eventId' in data) {
13087
+ const value = data.eventId;
13088
+ return typeof value === 'string' ? value : undefined;
13089
+ }
13090
+ return undefined;
13091
+ };
13092
+ const parentEventId = readEventId(post.data);
13093
+ const eventId = parentEventId !== null && parentEventId !== void 0 ? parentEventId : (_a = post.children) === null || _a === void 0 ? void 0 : _a.map(childId => { var _a; return (_a = pullFromCache(['post', 'get', childId])) === null || _a === void 0 ? void 0 : _a.data; }).map(child => readEventId(child === null || child === void 0 ? void 0 : child.data)).find(Boolean);
13094
+ if (!eventId)
13095
+ return;
13096
+ const event = (_b = pullFromCache(['event', 'get', eventId])) === null || _b === void 0 ? void 0 : _b.data;
13097
+ if (!event)
13098
+ return;
13099
+ // Inlined event linked-object construction. Calling eventLinkedObject()
13100
+ // here would create a static import cycle (eventLinkObject already
13101
+ // imports postLinkedObject for its `event.post` getter). Snapshot
13102
+ // consumers get the raw event fields plus the getters they need for the
13103
+ // in-post event card (creator, targetCommunity, coverImage, room). The
13104
+ // full linked-object surface — including RSVP methods and `event.post` —
13105
+ // is available via EventRepository.getEvent(eventId).
13106
+ return Object.assign(Object.assign({}, event), { get creator() {
13107
+ const cacheData = pullFromCache(['user', 'get', event.userId]);
13108
+ if (!(cacheData === null || cacheData === void 0 ? void 0 : cacheData.data))
13109
+ return undefined;
13110
+ return userLinkedObject(cacheData.data);
13111
+ },
13112
+ get targetCommunity() {
13113
+ var _a;
13114
+ if (!event.originId)
13115
+ return undefined;
13116
+ const cacheData = (_a = pullFromCache([
13117
+ 'community',
13118
+ 'get',
13119
+ event.originId,
13120
+ ])) === null || _a === void 0 ? void 0 : _a.data;
13121
+ if (!cacheData)
13122
+ return undefined;
13123
+ return communityLinkedObject(cacheData);
13124
+ },
13125
+ get coverImage() {
13126
+ var _a;
13127
+ if (!event.coverImageFileId)
13128
+ return undefined;
13129
+ return (_a = pullFromCache(['file', 'get', event.coverImageFileId])) === null || _a === void 0 ? void 0 : _a.data;
13130
+ } });
13131
+ },
13022
13132
  });
13023
13133
  };
13024
13134
 
@@ -15072,10 +15182,58 @@ class SearchUserLiveCollectionController extends LiveCollectionController {
15072
15182
  }
15073
15183
  }
15074
15184
 
15185
+ /* begin_public_function
15186
+ id: user.searchUsers
15187
+ */
15188
+ /**
15189
+ * ```js
15190
+ * import { UserRepository } from '@amityco/ts-sdk'
15191
+ *
15192
+ * let users = []
15193
+ * const unsub = UserRepository.searchUsers(
15194
+ * { displayName: 'jack', searchBy: [SearchUsersByEnum.DISPLAY_NAME] },
15195
+ * response => merge(users, response.data),
15196
+ * )
15197
+ * ```
15198
+ *
15199
+ * Observe all mutations on a list of {@link Amity.InternalUser}s.
15200
+ *
15201
+ * Pass `searchBy` in `params` to restrict which user fields are matched
15202
+ * (e.g. `[SearchUsersByEnum.DISPLAY_NAME]`). When omitted, the backend
15203
+ * default (both `displayName` and `userId`) applies.
15204
+ *
15205
+ * @param params for searching users
15206
+ * @param callback the function to call when new data are available
15207
+ * @param config the configuration for the live collection
15208
+ * @returns An {@link Amity.Unsubscriber} function to run when willing to stop observing the users
15209
+ *
15210
+ * @category Category Live Collection
15211
+ */
15212
+ const searchUsers = (params, callback, config) => {
15213
+ const { log, cache } = getActiveClient();
15214
+ if (!cache) {
15215
+ // eslint-disable-next-line no-console
15216
+ console.log(ENABLE_CACHE_MESSAGE);
15217
+ }
15218
+ const timestamp = Date.now();
15219
+ log(`liveSearchUsers(tmpid: ${timestamp}) > listen`);
15220
+ const searchUsersLiveCollection = new SearchUserLiveCollectionController(params, callback);
15221
+ const disposers = searchUsersLiveCollection.startSubscription();
15222
+ const cacheKey = searchUsersLiveCollection.getCacheKey();
15223
+ disposers.push(() => dropFromCache(cacheKey));
15224
+ return () => {
15225
+ log(`liveSearchUsers(tmpid: ${timestamp}) > dispose`);
15226
+ disposers.forEach(fn => fn());
15227
+ };
15228
+ };
15229
+ /* end_public_function */
15230
+
15075
15231
  /* begin_public_function
15076
15232
  id: user.search
15077
15233
  */
15078
15234
  /**
15235
+ * @deprecated Use {@link searchUsers} instead. `searchUserByDisplayName` will be removed in a future major version.
15236
+ *
15079
15237
  * ```js
15080
15238
  * import { UserRepository } from '@amityco/ts-sdk'
15081
15239
  *
@@ -15224,6 +15382,7 @@ var index$q = /*#__PURE__*/Object.freeze({
15224
15382
  getUsers: getUsers,
15225
15383
  getBlockedUsers: getBlockedUsers,
15226
15384
  getBlockingUsers: getBlockingUsers,
15385
+ searchUsers: searchUsers,
15227
15386
  searchUserByDisplayName: searchUserByDisplayName,
15228
15387
  getReachedUsers: getReachedUsers,
15229
15388
  get AmityUserSearchMatchType () { return AmityUserSearchMatchType; }
@@ -28331,6 +28490,51 @@ const createRoomPost = async (bundle) => {
28331
28490
  };
28332
28491
  /* end_public_function */
28333
28492
 
28493
+ /* begin_public_function
28494
+ id: post.create.event_post
28495
+ */
28496
+ /**
28497
+ * ```js
28498
+ * import { PostRepository } from '@amityco/ts-sdk'
28499
+ * const created = await PostRepository.createEventPost({
28500
+ * targetType: 'community',
28501
+ * targetId: 'communityId',
28502
+ * data: { eventId: 'eventId123', title: 'Summer Meetup', text: 'Come say hi' }
28503
+ * })
28504
+ * ```
28505
+ *
28506
+ * Creates an event {@link Amity.Post} — a post whose content is an event.
28507
+ * The parent post carries the author's caption; the referenced event is
28508
+ * resolved via `post.getEventInfo()`.
28509
+ *
28510
+ * `data.eventId` is REQUIRED; `title` and `text` are OPTIONAL — both blank is
28511
+ * valid and yields a bare event card.
28512
+ *
28513
+ * Media attachments and product tags are rejected by the backend with 400.
28514
+ *
28515
+ * @param bundle The data necessary to create a new event {@link Amity.Post}
28516
+ * @returns The newly created {@link Amity.Post}
28517
+ *
28518
+ * @category Post API
28519
+ * @async
28520
+ */
28521
+ const createEventPost = async (bundle) => {
28522
+ const client = getActiveClient();
28523
+ client.log('post/createEventPost', bundle);
28524
+ const { data: payload } = await client.http.post('/api/v4/posts', Object.assign(Object.assign({}, bundle), { dataType: 'event' }));
28525
+ fireEvent('post.created', payload);
28526
+ const data = preparePostPayload(payload);
28527
+ const cachedAt = client.cache && Date.now();
28528
+ if (client.cache)
28529
+ ingestInCache(data, { cachedAt });
28530
+ const { posts } = data;
28531
+ return {
28532
+ data: LinkedObject.post(posts[0]),
28533
+ cachedAt,
28534
+ };
28535
+ };
28536
+ /* end_public_function */
28537
+
28334
28538
  /* begin_public_function
28335
28539
  id: post.pin_product
28336
28540
  */
@@ -31062,6 +31266,7 @@ var index$b = /*#__PURE__*/Object.freeze({
31062
31266
  createAudioPost: createAudioPost,
31063
31267
  createMixedMediaPost: createMixedMediaPost,
31064
31268
  createRoomPost: createRoomPost,
31269
+ createEventPost: createEventPost,
31065
31270
  pinProduct: pinProduct,
31066
31271
  unpinProduct: unpinProduct,
31067
31272
  updateProductTags: updateProductTags,
@@ -35392,4 +35597,4 @@ class AmityAttachmentProductTags {
35392
35597
  }
35393
35598
  }
35394
35599
 
35395
- export { API_REGIONS, index$5 as AdRepository, AmityAttachmentProductTags, AmityAutoSubscription, AmityChannelNotificationModeEnum, AmityCommunityType, AmityEventOrderOption, AmityEventOriginType, AmityEventResponseStatus, AmityEventSortOption, AmityEventStatus, AmityEventType, AmitySharableContentType, AnalyticsSourceTypeEnum, index$f as CategoryRepository, index$j as ChannelRepository, index$s as Client, index$e as CommentRepository, CommunityNotificationEventNameEnum, CommunityPostSettingMaps, CommunityPostSettings, index$g as CommunityRepository, ContentFeedType, ContentFlagReasonEnum, DefaultCommunityPostSetting, index$1 as EventRepository, FeedDataTypeEnum, index$d as FeedRepository, FeedSortByEnum, FeedSourceEnum, FeedTypeEnum, FileAccessTypeEnum, index$p as FileRepository, FileType, GET_WATCHER_URLS, index$3 as InvitationRepository, InvitationSortByEnum, InvitationStatusEnum, InvitationTargetTypeEnum, InvitationTypeEnum, JoinRequestStatusEnum, JoinResultStatusEnum, index$2 as LiveReactionRepository, index$7 as LiveStreamPlayer, MembershipAcceptanceTypeEnum, MessageContentType, index$n as MessageRepository, NotificationRolesFilterTypeEnum, NotificationSettingsLevelEnum, index$8 as PollRepository, PostContentType, index$b as PostRepository, PostStructureType, index as ProductRepository, index$o as ReactionRepository, index$9 as RoomPresenceRepository, index$c as RoomRepository, SearchUsersByEnum, index$6 as StoryRepository, index$a as StreamRepository, index$m as SubChannelRepository, SubscriptionLevels, UserNotificationModuleNameEnum, UserReportTypeEnum, index$q as UserRepository, UserTypeEnum, VERSION, VideoResolution, VideoSize, VideoTranscodingStatus, backupCache, createQuery, createReport, createUserToken, deleteReport, disableCache, dropFromCache, enableCache, exceedsUntilAtBoundary, filterByChannelMembership, filterByCommunityMembership, filterByFeedType, filterByPostDataTypes, filterByPropEquality, filterByPropInclusion, filterByPropIntersection, filterBySearchTerm, filterByStringComparePartially, filterByUntilAt, filterCommentsByBlockUsers, filterPostsByBlockUsers, getBlockUsersId, getChannelTopic, getCommentTopic, getCommunityStoriesTopic, getCommunityTopic, getLiveReactionTopic, getLiveStreamTopic, getMarkedMessageTopic, getMarkerUserFeedTopic, getMessageTopic, getMyFollowersTopic, getMyFollowingsTopic, getNetworkId, getNetworkTopic, getPostTopic, getRole, getRoomStreamerTopic, getRoomWatcherTopic, getSmartFeedChannelTopic, getSmartFeedMessageTopic, getSmartFeedSubChannelTopic, getStoryTopic, getSubChannelTopic, getUserTopic, isAfterBefore, isAfterBeforeRaw, isCachable, isFetcher, isFresh, isLocal, isMutator, isOffline, isPaged, isReportedByMe, isSkip, mergeInCache, index$4 as notificationTray, onChannelMarkerFetched, onFeedMarkerFetched, onFeedMarkerUpdated, onMessageMarked, onMessageMarkerFetched, onSubChannelMarkerFetched, onSubChannelMarkerUpdated, onUserMarkerFetched, onUserMarkerFetchedLegacy, pullFromCache, pushToCache, queryCache, queryOptions, queryRoles, restoreCache, runQuery, sortByChannelSegment, sortByDisplayName, sortByFirstCreated, sortByFirstUpdated, sortByLastActivity, sortByLastCreated, sortByLastUpdated, sortByLocalSortingDate, sortByName, sortBySegmentNumber, subscribeTopic, toPage, toPageRaw, toToken, upsertInCache, validateUntilAt, wipeCache };
35600
+ export { API_REGIONS, index$5 as AdRepository, AmityAttachmentProductTags, AmityAutoSubscription, AmityChannelNotificationModeEnum, AmityCommunityType, AmityEventOrderOption, AmityEventOriginType, AmityEventResponseStatus, AmityEventSortOption, AmityEventStatus, AmityEventType, AmityLiveViewerCountMode, AmitySharableContentType, AnalyticsSourceTypeEnum, index$f as CategoryRepository, index$j as ChannelRepository, index$s as Client, index$e as CommentRepository, CommunityNotificationEventNameEnum, CommunityPostSettingMaps, CommunityPostSettings, index$g as CommunityRepository, ContentFeedType, ContentFlagReasonEnum, DefaultCommunityPostSetting, index$1 as EventRepository, FeedDataTypeEnum, index$d as FeedRepository, FeedSortByEnum, FeedSourceEnum, FeedTypeEnum, FileAccessTypeEnum, index$p as FileRepository, FileType, GET_WATCHER_URLS, index$3 as InvitationRepository, InvitationSortByEnum, InvitationStatusEnum, InvitationTargetTypeEnum, InvitationTypeEnum, JoinRequestStatusEnum, JoinResultStatusEnum, index$2 as LiveReactionRepository, index$7 as LiveStreamPlayer, MembershipAcceptanceTypeEnum, MessageContentType, index$n as MessageRepository, NotificationRolesFilterTypeEnum, NotificationSettingsLevelEnum, index$8 as PollRepository, PostContentType, index$b as PostRepository, PostStructureType, index as ProductRepository, index$o as ReactionRepository, index$9 as RoomPresenceRepository, index$c as RoomRepository, SearchUsersByEnum, index$6 as StoryRepository, index$a as StreamRepository, index$m as SubChannelRepository, SubscriptionLevels, UserNotificationModuleNameEnum, UserReportTypeEnum, index$q as UserRepository, UserTypeEnum, VERSION, VideoResolution, VideoSize, VideoTranscodingStatus, backupCache, createQuery, createReport, createUserToken, deleteReport, disableCache, dropFromCache, enableCache, exceedsUntilAtBoundary, filterByChannelMembership, filterByCommunityMembership, filterByFeedType, filterByPostDataTypes, filterByPropEquality, filterByPropInclusion, filterByPropIntersection, filterBySearchTerm, filterByStringComparePartially, filterByUntilAt, filterCommentsByBlockUsers, filterPostsByBlockUsers, getBlockUsersId, getChannelTopic, getCommentTopic, getCommunityStoriesTopic, getCommunityTopic, getLiveReactionTopic, getLiveStreamTopic, getMarkedMessageTopic, getMarkerUserFeedTopic, getMessageTopic, getMyFollowersTopic, getMyFollowingsTopic, getNetworkId, getNetworkTopic, getPostTopic, getRole, getRoomStreamerTopic, getRoomWatcherTopic, getSmartFeedChannelTopic, getSmartFeedMessageTopic, getSmartFeedSubChannelTopic, getStoryTopic, getSubChannelTopic, getUserTopic, isAfterBefore, isAfterBeforeRaw, isCachable, isFetcher, isFresh, isLocal, isMutator, isOffline, isPaged, isReportedByMe, isSkip, mergeInCache, index$4 as notificationTray, onChannelMarkerFetched, onFeedMarkerFetched, onFeedMarkerUpdated, onMessageMarked, onMessageMarkerFetched, onSubChannelMarkerFetched, onSubChannelMarkerUpdated, onUserMarkerFetched, onUserMarkerFetchedLegacy, pullFromCache, pushToCache, queryCache, queryOptions, queryRoles, restoreCache, runQuery, sortByChannelSegment, sortByDisplayName, sortByFirstCreated, sortByFirstUpdated, sortByLastActivity, sortByLastCreated, sortByLastUpdated, sortByLocalSortingDate, sortByName, sortBySegmentNumber, subscribeTopic, toPage, toPageRaw, toToken, upsertInCache, validateUntilAt, wipeCache };