@ecency/sdk 1.3.9 → 1.4.1

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.
@@ -263,6 +263,11 @@ function getBoundFetch() {
263
263
  return cachedFetch;
264
264
  }
265
265
 
266
+ // src/modules/core/utils/is-community.ts
267
+ function isCommunity(value) {
268
+ return typeof value === "string" ? /^hive-\d+$/.test(value) : false;
269
+ }
270
+
266
271
  // src/modules/core/storage.ts
267
272
  var getUser = (username) => {
268
273
  try {
@@ -1245,6 +1250,18 @@ function getTrendingTagsQueryOptions(limit = 20) {
1245
1250
  refetchOnMount: true
1246
1251
  });
1247
1252
  }
1253
+ function getTrendingTagsWithStatsQueryOptions(limit = 250) {
1254
+ return reactQuery.infiniteQueryOptions({
1255
+ queryKey: ["posts", "trending-tags", "stats", limit],
1256
+ queryFn: async ({ pageParam: { afterTag } }) => CONFIG.hiveClient.database.call("get_trending_tags", [afterTag, limit]).then(
1257
+ (tags) => tags.filter((tag) => tag.name !== "").filter((tag) => !isCommunity(tag.name))
1258
+ ),
1259
+ initialPageParam: { afterTag: "" },
1260
+ getNextPageParam: (lastPage) => lastPage?.length ? { afterTag: lastPage[lastPage.length - 1].name } : void 0,
1261
+ staleTime: Infinity,
1262
+ refetchOnMount: true
1263
+ });
1264
+ }
1248
1265
  function getFragmentsQueryOptions(username) {
1249
1266
  return reactQuery.queryOptions({
1250
1267
  queryKey: ["posts", "fragments", username],
@@ -3693,7 +3710,7 @@ function buildQuery(entry, retry = 3) {
3693
3710
  q += ` -dporn type:post`;
3694
3711
  let tags;
3695
3712
  if (json_metadata && json_metadata.tags && Array.isArray(json_metadata.tags)) {
3696
- tags = json_metadata.tags.filter((tag) => tag && tag !== "").filter((tag) => !tag.startsWith("hive-")).filter((_tag, ind) => ind < +retry).join(",");
3713
+ tags = json_metadata.tags.filter((tag) => tag && tag !== "" && typeof tag === "string").filter((tag) => !tag.startsWith("hive-")).filter((_tag, ind) => ind < +retry).join(",");
3697
3714
  }
3698
3715
  if (tags && tags.length > 0) {
3699
3716
  q += ` tag:${tags}`;
@@ -4010,6 +4027,7 @@ exports.getSimilarEntriesQueryOptions = getSimilarEntriesQueryOptions;
4010
4027
  exports.getStatsQueryOptions = getStatsQueryOptions;
4011
4028
  exports.getTransactionsInfiniteQueryOptions = getTransactionsInfiniteQueryOptions;
4012
4029
  exports.getTrendingTagsQueryOptions = getTrendingTagsQueryOptions;
4030
+ exports.getTrendingTagsWithStatsQueryOptions = getTrendingTagsWithStatsQueryOptions;
4013
4031
  exports.getUser = getUser;
4014
4032
  exports.getUserProposalVotesQueryOptions = getUserProposalVotesQueryOptions;
4015
4033
  exports.getVestingDelegationsQueryOptions = getVestingDelegationsQueryOptions;
@@ -4020,6 +4038,7 @@ exports.getWavesFollowingQueryOptions = getWavesFollowingQueryOptions;
4020
4038
  exports.getWavesTrendingTagsQueryOptions = getWavesTrendingTagsQueryOptions;
4021
4039
  exports.getWithdrawRoutesQueryOptions = getWithdrawRoutesQueryOptions;
4022
4040
  exports.getWitnessesInfiniteQueryOptions = getWitnessesInfiniteQueryOptions;
4041
+ exports.isCommunity = isCommunity;
4023
4042
  exports.lookupAccountsQueryOptions = lookupAccountsQueryOptions;
4024
4043
  exports.makeQueryClient = makeQueryClient;
4025
4044
  exports.mapThreadItemsToWaveEntries = mapThreadItemsToWaveEntries;