@ecency/sdk 1.5.11 → 1.5.13

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.
@@ -388,6 +388,25 @@ function isCommunity(value) {
388
388
  return typeof value === "string" ? /^hive-\d+$/.test(value) : false;
389
389
  }
390
390
 
391
+ // src/modules/core/utils/pagination-helpers.ts
392
+ function isWrappedResponse(response) {
393
+ return response && typeof response === "object" && "data" in response && "pagination" in response && Array.isArray(response.data);
394
+ }
395
+ function normalizeToWrappedResponse(response, limit) {
396
+ if (isWrappedResponse(response)) {
397
+ return response;
398
+ }
399
+ return {
400
+ data: Array.isArray(response) ? response : [],
401
+ pagination: {
402
+ total: Array.isArray(response) ? response.length : 0,
403
+ limit,
404
+ offset: 0,
405
+ has_next: false
406
+ }
407
+ };
408
+ }
409
+
391
410
  // src/modules/core/queries/get-dynamic-props-query-options.ts
392
411
  function getDynamicPropsQueryOptions() {
393
412
  return queryOptions({
@@ -841,7 +860,7 @@ function getAccountSubscriptionsQueryOptions(username) {
841
860
  }
842
861
  });
843
862
  }
844
- function getActiveAccountBookmarksQueryOptions(activeUsername, code) {
863
+ function getBookmarksQueryOptions(activeUsername, code) {
845
864
  return queryOptions({
846
865
  queryKey: ["accounts", "bookmarks", activeUsername],
847
866
  enabled: !!activeUsername && !!code,
@@ -864,7 +883,7 @@ function getActiveAccountBookmarksQueryOptions(activeUsername, code) {
864
883
  }
865
884
  });
866
885
  }
867
- function getActiveAccountBookmarksInfiniteQueryOptions(activeUsername, code, limit = 10) {
886
+ function getBookmarksInfiniteQueryOptions(activeUsername, code, limit = 10) {
868
887
  return infiniteQueryOptions({
869
888
  queryKey: ["accounts", "bookmarks", "infinite", activeUsername, limit],
870
889
  queryFn: async ({ pageParam = 0 }) => {
@@ -893,7 +912,8 @@ function getActiveAccountBookmarksInfiniteQueryOptions(activeUsername, code, lim
893
912
  if (!response.ok) {
894
913
  throw new Error(`Failed to fetch bookmarks: ${response.status}`);
895
914
  }
896
- return response.json();
915
+ const json = await response.json();
916
+ return normalizeToWrappedResponse(json, limit);
897
917
  },
898
918
  initialPageParam: 0,
899
919
  getNextPageParam: (lastPage) => {
@@ -905,7 +925,7 @@ function getActiveAccountBookmarksInfiniteQueryOptions(activeUsername, code, lim
905
925
  enabled: !!activeUsername && !!code
906
926
  });
907
927
  }
908
- function getActiveAccountFavouritesQueryOptions(activeUsername, code) {
928
+ function getFavouritesQueryOptions(activeUsername, code) {
909
929
  return queryOptions({
910
930
  queryKey: ["accounts", "favourites", activeUsername],
911
931
  enabled: !!activeUsername && !!code,
@@ -928,7 +948,7 @@ function getActiveAccountFavouritesQueryOptions(activeUsername, code) {
928
948
  }
929
949
  });
930
950
  }
931
- function getActiveAccountFavouritesInfiniteQueryOptions(activeUsername, code, limit = 10) {
951
+ function getFavouritesInfiniteQueryOptions(activeUsername, code, limit = 10) {
932
952
  return infiniteQueryOptions({
933
953
  queryKey: ["accounts", "favourites", "infinite", activeUsername, limit],
934
954
  queryFn: async ({ pageParam = 0 }) => {
@@ -957,7 +977,8 @@ function getActiveAccountFavouritesInfiniteQueryOptions(activeUsername, code, li
957
977
  if (!response.ok) {
958
978
  throw new Error(`Failed to fetch favorites: ${response.status}`);
959
979
  }
960
- return response.json();
980
+ const json = await response.json();
981
+ return normalizeToWrappedResponse(json, limit);
961
982
  },
962
983
  initialPageParam: 0,
963
984
  getNextPageParam: (lastPage) => {
@@ -1333,7 +1354,8 @@ function getFragmentsInfiniteQueryOptions(username, code, limit = 10) {
1333
1354
  if (!response.ok) {
1334
1355
  throw new Error(`Failed to fetch fragments: ${response.status}`);
1335
1356
  }
1336
- return response.json();
1357
+ const json = await response.json();
1358
+ return normalizeToWrappedResponse(json, limit);
1337
1359
  },
1338
1360
  initialPageParam: 0,
1339
1361
  getNextPageParam: (lastPage) => {
@@ -1996,7 +2018,8 @@ function getSchedulesInfiniteQueryOptions(activeUsername, code, limit = 10) {
1996
2018
  if (!response.ok) {
1997
2019
  throw new Error(`Failed to fetch schedules: ${response.status}`);
1998
2020
  }
1999
- return response.json();
2021
+ const json = await response.json();
2022
+ return normalizeToWrappedResponse(json, limit);
2000
2023
  },
2001
2024
  initialPageParam: 0,
2002
2025
  getNextPageParam: (lastPage) => {
@@ -2064,7 +2087,8 @@ function getDraftsInfiniteQueryOptions(activeUsername, code, limit = 10) {
2064
2087
  if (!response.ok) {
2065
2088
  throw new Error(`Failed to fetch drafts: ${response.status}`);
2066
2089
  }
2067
- return response.json();
2090
+ const json = await response.json();
2091
+ return normalizeToWrappedResponse(json, limit);
2068
2092
  },
2069
2093
  initialPageParam: 0,
2070
2094
  getNextPageParam: (lastPage) => {
@@ -2147,7 +2171,8 @@ function getImagesInfiniteQueryOptions(username, code, limit = 10) {
2147
2171
  if (!response.ok) {
2148
2172
  throw new Error(`Failed to fetch images: ${response.status}`);
2149
2173
  }
2150
- return response.json();
2174
+ const json = await response.json();
2175
+ return normalizeToWrappedResponse(json, limit);
2151
2176
  },
2152
2177
  initialPageParam: 0,
2153
2178
  getNextPageParam: (lastPage) => {
@@ -2290,8 +2315,8 @@ function toEntryArray(x) {
2290
2315
  return Array.isArray(x) ? x : [];
2291
2316
  }
2292
2317
  async function getVisibleFirstLevelThreadItems(container) {
2293
- const queryOptions86 = getDiscussionsQueryOptions(container, "created" /* created */, true);
2294
- const discussionItemsRaw = await CONFIG.queryClient.fetchQuery(queryOptions86);
2318
+ const queryOptions87 = getDiscussionsQueryOptions(container, "created" /* created */, true);
2319
+ const discussionItemsRaw = await CONFIG.queryClient.fetchQuery(queryOptions87);
2295
2320
  const discussionItems = toEntryArray(discussionItemsRaw);
2296
2321
  if (discussionItems.length <= 1) {
2297
2322
  return [];
@@ -4242,6 +4267,15 @@ function getReceivedVestingSharesQueryOptions(username) {
4242
4267
  }
4243
4268
  });
4244
4269
  }
4270
+ function getRecurrentTransfersQueryOptions(username) {
4271
+ return queryOptions({
4272
+ queryKey: ["wallet", "recurrent-transfers", username],
4273
+ queryFn: () => CONFIG.hiveClient.call("condenser_api", "find_recurrent_transfers", [
4274
+ username
4275
+ ]),
4276
+ enabled: !!username
4277
+ });
4278
+ }
4245
4279
  function getWitnessesInfiniteQueryOptions(limit) {
4246
4280
  return infiniteQueryOptions({
4247
4281
  queryKey: ["witnesses", "list", limit],
@@ -5403,6 +5437,6 @@ async function getSpkMarkets() {
5403
5437
  return await response.json();
5404
5438
  }
5405
5439
 
5406
- export { ACCOUNT_OPERATION_GROUPS, ALL_ACCOUNT_OPERATIONS, ALL_NOTIFY_TYPES, CONFIG, ConfigManager, mutations_exports as EcencyAnalytics, EcencyQueriesManager, HiveSignerIntegration, NaiMap, NotificationFilter, NotificationViewType, NotifyTypes, ROLES, SortOrder, Symbol2 as Symbol, ThreeSpeakIntegration, addDraft, addImage, addSchedule, bridgeApiCall, broadcastJson, buildProfileMetadata, checkUsernameWalletsPendingQueryOptions, decodeObj, dedupeAndSortKeyAuths, deleteDraft, deleteImage, deleteSchedule, downVotingPower, encodeObj, extractAccountProfile, getAccountFullQueryOptions, getAccountNotificationsInfiniteQueryOptions, getAccountPendingRecoveryQueryOptions, getAccountPosts, getAccountPostsInfiniteQueryOptions, getAccountPostsQueryOptions, getAccountRcQueryOptions, getAccountRecoveriesQueryOptions, getAccountReputationsQueryOptions, getAccountSubscriptionsQueryOptions, getAccountVoteHistoryInfiniteQueryOptions, getAccountsQueryOptions, getActiveAccountBookmarksInfiniteQueryOptions, getActiveAccountBookmarksQueryOptions, getActiveAccountFavouritesInfiniteQueryOptions, getActiveAccountFavouritesQueryOptions, getAnnouncementsQueryOptions, getBoostPlusAccountPricesQueryOptions, getBoostPlusPricesQueryOptions, getBotsQueryOptions, getBoundFetch, getChainPropertiesQueryOptions, getCollateralizedConversionRequestsQueryOptions, getCommentHistoryQueryOptions, getCommunities, getCommunitiesQueryOptions, getCommunity, getCommunityContextQueryOptions, getCommunityPermissions, getCommunityQueryOptions, getCommunitySubscribersQueryOptions, getCommunityType, getContentQueryOptions, getContentRepliesQueryOptions, getControversialRisingInfiniteQueryOptions, getConversionRequestsQueryOptions, getCurrencyRate, getCurrencyRates, getCurrencyTokenRate, getDeletedEntryQueryOptions, getDiscoverCurationQueryOptions, getDiscoverLeaderboardQueryOptions, getDiscussion, getDiscussionQueryOptions, getDiscussionsQueryOptions, getDraftsInfiniteQueryOptions, getDraftsQueryOptions, getDynamicPropsQueryOptions, getEntryActiveVotesQueryOptions, getFollowCountQueryOptions, getFollowingQueryOptions, getFragmentsInfiniteQueryOptions, getFragmentsQueryOptions, getFriendsInfiniteQueryOptions, getGalleryImagesQueryOptions, getGameStatusCheckQueryOptions, getHiveEngineMetrics, getHiveEngineOpenOrders, getHiveEngineOrderBook, getHiveEngineTokenMetrics, getHiveEngineTokenTransactions, getHiveEngineTokensBalances, getHiveEngineTokensMarket, getHiveEngineTokensMetadata, getHiveEngineTradeHistory, getHiveEngineUnclaimedRewards, getHiveHbdStatsQueryOptions, getHivePoshLinksQueryOptions, getHivePrice, getImagesInfiniteQueryOptions, getImagesQueryOptions, getIncomingRcQueryOptions, getMarketData, getMarketDataQueryOptions, getMarketHistoryQueryOptions, getMarketStatisticsQueryOptions, getMutedUsersQueryOptions, getNormalizePostQueryOptions, getNotificationSetting, getNotifications, getNotificationsInfiniteQueryOptions, getNotificationsSettingsQueryOptions, getNotificationsUnreadCountQueryOptions, getOpenOrdersQueryOptions, getOrderBookQueryOptions, getOutgoingRcDelegationsInfiniteQueryOptions, getPageStatsQueryOptions, getPointsQueryOptions, getPost, getPostHeader, getPostHeaderQueryOptions, getPostQueryOptions, getPostTipsQueryOptions, getPostsRanked, getPostsRankedInfiniteQueryOptions, getPostsRankedQueryOptions, getProfiles, getProfilesQueryOptions, getPromotePriceQueryOptions, getPromotedPost, getPromotedPostsQuery, getProposalQueryOptions, getProposalVotesInfiniteQueryOptions, getProposalsQueryOptions, getQueryClient, getRcStatsQueryOptions, getReblogsQueryOptions, getReceivedVestingSharesQueryOptions, getReferralsInfiniteQueryOptions, getReferralsStatsQueryOptions, getRelationshipBetweenAccounts, getRelationshipBetweenAccountsQueryOptions, getRewardedCommunitiesQueryOptions, getSavingsWithdrawFromQueryOptions, getSchedulesInfiniteQueryOptions, getSchedulesQueryOptions, getSearchAccountQueryOptions, getSearchAccountsByUsernameQueryOptions, getSearchApiInfiniteQueryOptions, getSearchFriendsQueryOptions, getSearchPathQueryOptions, getSearchTopicsQueryOptions, getSimilarEntriesQueryOptions, getSpkMarkets, getSpkWallet, getStatsQueryOptions, getSubscribers, getSubscriptions, getTradeHistoryQueryOptions, getTransactionsInfiniteQueryOptions, getTrendingTagsQueryOptions, getTrendingTagsWithStatsQueryOptions, getUserProposalVotesQueryOptions, getVestingDelegationsQueryOptions, getVisibleFirstLevelThreadItems, getWavesByHostQueryOptions, getWavesByTagQueryOptions, getWavesFollowingQueryOptions, getWavesTrendingTagsQueryOptions, getWithdrawRoutesQueryOptions, getWitnessesInfiniteQueryOptions, hsTokenRenew, isCommunity, lookupAccountsQueryOptions, makeQueryClient, mapThreadItemsToWaveEntries, markNotifications, moveSchedule, normalizePost, normalizeWaveEntryFromApi, onboardEmail, parseAccounts, parseAsset, parseProfileMetadata, powerRechargeTime, rcPower, resolvePost, roleMap, saveNotificationSetting, search, searchAccount, searchPath, searchQueryOptions, searchTag, signUp, sortDiscussions, subscribeEmail, toEntryArray, updateDraft, uploadImage, useAccountFavouriteAdd, useAccountFavouriteDelete, useAccountRelationsUpdate, useAccountRevokeKey, useAccountRevokePosting, useAccountUpdate, useAccountUpdateKeyAuths, useAccountUpdatePassword, useAccountUpdateRecovery, useAddFragment, useBookmarkAdd, useBookmarkDelete, useBroadcastMutation, useEditFragment, useGameClaim, useRecordActivity, useRemoveFragment, useSignOperationByHivesigner, useSignOperationByKey, useSignOperationByKeychain, usrActivity, validatePostCreating, votingPower, votingValue };
5440
+ export { ACCOUNT_OPERATION_GROUPS, ALL_ACCOUNT_OPERATIONS, ALL_NOTIFY_TYPES, CONFIG, ConfigManager, mutations_exports as EcencyAnalytics, EcencyQueriesManager, HiveSignerIntegration, NaiMap, NotificationFilter, NotificationViewType, NotifyTypes, ROLES, SortOrder, Symbol2 as Symbol, ThreeSpeakIntegration, addDraft, addImage, addSchedule, bridgeApiCall, broadcastJson, buildProfileMetadata, checkUsernameWalletsPendingQueryOptions, decodeObj, dedupeAndSortKeyAuths, deleteDraft, deleteImage, deleteSchedule, downVotingPower, encodeObj, extractAccountProfile, getAccountFullQueryOptions, getAccountNotificationsInfiniteQueryOptions, getAccountPendingRecoveryQueryOptions, getAccountPosts, getAccountPostsInfiniteQueryOptions, getAccountPostsQueryOptions, getAccountRcQueryOptions, getAccountRecoveriesQueryOptions, getAccountReputationsQueryOptions, getAccountSubscriptionsQueryOptions, getAccountVoteHistoryInfiniteQueryOptions, getAccountsQueryOptions, getAnnouncementsQueryOptions, getBookmarksInfiniteQueryOptions, getBookmarksQueryOptions, getBoostPlusAccountPricesQueryOptions, getBoostPlusPricesQueryOptions, getBotsQueryOptions, getBoundFetch, getChainPropertiesQueryOptions, getCollateralizedConversionRequestsQueryOptions, getCommentHistoryQueryOptions, getCommunities, getCommunitiesQueryOptions, getCommunity, getCommunityContextQueryOptions, getCommunityPermissions, getCommunityQueryOptions, getCommunitySubscribersQueryOptions, getCommunityType, getContentQueryOptions, getContentRepliesQueryOptions, getControversialRisingInfiniteQueryOptions, getConversionRequestsQueryOptions, getCurrencyRate, getCurrencyRates, getCurrencyTokenRate, getDeletedEntryQueryOptions, getDiscoverCurationQueryOptions, getDiscoverLeaderboardQueryOptions, getDiscussion, getDiscussionQueryOptions, getDiscussionsQueryOptions, getDraftsInfiniteQueryOptions, getDraftsQueryOptions, getDynamicPropsQueryOptions, getEntryActiveVotesQueryOptions, getFavouritesInfiniteQueryOptions, getFavouritesQueryOptions, getFollowCountQueryOptions, getFollowingQueryOptions, getFragmentsInfiniteQueryOptions, getFragmentsQueryOptions, getFriendsInfiniteQueryOptions, getGalleryImagesQueryOptions, getGameStatusCheckQueryOptions, getHiveEngineMetrics, getHiveEngineOpenOrders, getHiveEngineOrderBook, getHiveEngineTokenMetrics, getHiveEngineTokenTransactions, getHiveEngineTokensBalances, getHiveEngineTokensMarket, getHiveEngineTokensMetadata, getHiveEngineTradeHistory, getHiveEngineUnclaimedRewards, getHiveHbdStatsQueryOptions, getHivePoshLinksQueryOptions, getHivePrice, getImagesInfiniteQueryOptions, getImagesQueryOptions, getIncomingRcQueryOptions, getMarketData, getMarketDataQueryOptions, getMarketHistoryQueryOptions, getMarketStatisticsQueryOptions, getMutedUsersQueryOptions, getNormalizePostQueryOptions, getNotificationSetting, getNotifications, getNotificationsInfiniteQueryOptions, getNotificationsSettingsQueryOptions, getNotificationsUnreadCountQueryOptions, getOpenOrdersQueryOptions, getOrderBookQueryOptions, getOutgoingRcDelegationsInfiniteQueryOptions, getPageStatsQueryOptions, getPointsQueryOptions, getPost, getPostHeader, getPostHeaderQueryOptions, getPostQueryOptions, getPostTipsQueryOptions, getPostsRanked, getPostsRankedInfiniteQueryOptions, getPostsRankedQueryOptions, getProfiles, getProfilesQueryOptions, getPromotePriceQueryOptions, getPromotedPost, getPromotedPostsQuery, getProposalQueryOptions, getProposalVotesInfiniteQueryOptions, getProposalsQueryOptions, getQueryClient, getRcStatsQueryOptions, getReblogsQueryOptions, getReceivedVestingSharesQueryOptions, getRecurrentTransfersQueryOptions, getReferralsInfiniteQueryOptions, getReferralsStatsQueryOptions, getRelationshipBetweenAccounts, getRelationshipBetweenAccountsQueryOptions, getRewardedCommunitiesQueryOptions, getSavingsWithdrawFromQueryOptions, getSchedulesInfiniteQueryOptions, getSchedulesQueryOptions, getSearchAccountQueryOptions, getSearchAccountsByUsernameQueryOptions, getSearchApiInfiniteQueryOptions, getSearchFriendsQueryOptions, getSearchPathQueryOptions, getSearchTopicsQueryOptions, getSimilarEntriesQueryOptions, getSpkMarkets, getSpkWallet, getStatsQueryOptions, getSubscribers, getSubscriptions, getTradeHistoryQueryOptions, getTransactionsInfiniteQueryOptions, getTrendingTagsQueryOptions, getTrendingTagsWithStatsQueryOptions, getUserProposalVotesQueryOptions, getVestingDelegationsQueryOptions, getVisibleFirstLevelThreadItems, getWavesByHostQueryOptions, getWavesByTagQueryOptions, getWavesFollowingQueryOptions, getWavesTrendingTagsQueryOptions, getWithdrawRoutesQueryOptions, getWitnessesInfiniteQueryOptions, hsTokenRenew, isCommunity, isWrappedResponse, lookupAccountsQueryOptions, makeQueryClient, mapThreadItemsToWaveEntries, markNotifications, moveSchedule, normalizePost, normalizeToWrappedResponse, normalizeWaveEntryFromApi, onboardEmail, parseAccounts, parseAsset, parseProfileMetadata, powerRechargeTime, rcPower, resolvePost, roleMap, saveNotificationSetting, search, searchAccount, searchPath, searchQueryOptions, searchTag, signUp, sortDiscussions, subscribeEmail, toEntryArray, updateDraft, uploadImage, useAccountFavouriteAdd, useAccountFavouriteDelete, useAccountRelationsUpdate, useAccountRevokeKey, useAccountRevokePosting, useAccountUpdate, useAccountUpdateKeyAuths, useAccountUpdatePassword, useAccountUpdateRecovery, useAddFragment, useBookmarkAdd, useBookmarkDelete, useBroadcastMutation, useEditFragment, useGameClaim, useRecordActivity, useRemoveFragment, useSignOperationByHivesigner, useSignOperationByKey, useSignOperationByKeychain, usrActivity, validatePostCreating, votingPower, votingValue };
5407
5441
  //# sourceMappingURL=index.mjs.map
5408
5442
  //# sourceMappingURL=index.mjs.map