@ecency/sdk 2.4.16 → 2.4.18
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/browser/{chunk-F7W5CKAC.js → chunk-2ANYOCYN.js} +2 -2
- package/dist/browser/{chunk-F7W5CKAC.js.map → chunk-2ANYOCYN.js.map} +1 -1
- package/dist/browser/chunk-36AOY64H.js +2 -0
- package/dist/browser/chunk-36AOY64H.js.map +1 -0
- package/dist/browser/{chunk-IS3RG6IP.js → chunk-3OUVABTI.js} +2 -2
- package/dist/browser/{chunk-IS3RG6IP.js.map → chunk-3OUVABTI.js.map} +1 -1
- package/dist/browser/chunk-73J64EEQ.js +2 -0
- package/dist/browser/{chunk-FOHLJPTH.js.map → chunk-73J64EEQ.js.map} +1 -1
- package/dist/browser/chunk-7B2TRW3Y.js +2 -0
- package/dist/browser/chunk-7B2TRW3Y.js.map +1 -0
- package/dist/browser/chunk-BY3CXHIK.js +2 -0
- package/dist/browser/{chunk-KZ7ESL64.js.map → chunk-BY3CXHIK.js.map} +1 -1
- package/dist/browser/{chunk-JVYBP7BH.js → chunk-EHTCN4X5.js} +2 -2
- package/dist/browser/{chunk-JVYBP7BH.js.map → chunk-EHTCN4X5.js.map} +1 -1
- package/dist/browser/{chunk-L66OOKXI.js → chunk-EO6TGAAL.js} +2 -2
- package/dist/browser/{chunk-L66OOKXI.js.map → chunk-EO6TGAAL.js.map} +1 -1
- package/dist/browser/chunk-EOQ6ZEQ6.js +2 -0
- package/dist/browser/chunk-EOQ6ZEQ6.js.map +1 -0
- package/dist/browser/{chunk-ZLI2P5QI.js → chunk-G7UK7OAA.js} +2 -2
- package/dist/browser/{chunk-ZLI2P5QI.js.map → chunk-G7UK7OAA.js.map} +1 -1
- package/dist/browser/{chunk-3FR56QMW.js → chunk-H34MRPJG.js} +2 -2
- package/dist/browser/{chunk-3FR56QMW.js.map → chunk-H34MRPJG.js.map} +1 -1
- package/dist/browser/{chunk-7BFIUZCF.js → chunk-HS2D6O7J.js} +2 -2
- package/dist/browser/{chunk-7BFIUZCF.js.map → chunk-HS2D6O7J.js.map} +1 -1
- package/dist/browser/{chunk-6UYPRFW2.js → chunk-ISYWZWG7.js} +2 -2
- package/dist/browser/{chunk-6UYPRFW2.js.map → chunk-ISYWZWG7.js.map} +1 -1
- package/dist/browser/{chunk-SVWEBXN3.js → chunk-IWGTII7L.js} +2 -2
- package/dist/browser/{chunk-SVWEBXN3.js.map → chunk-IWGTII7L.js.map} +1 -1
- package/dist/browser/chunk-JLH3XJNT.js +2 -0
- package/dist/browser/{chunk-WZIYV3BG.js.map → chunk-JLH3XJNT.js.map} +1 -1
- package/dist/browser/{chunk-4WACFTD7.js → chunk-K27EKN2G.js} +2 -2
- package/dist/browser/{chunk-4WACFTD7.js.map → chunk-K27EKN2G.js.map} +1 -1
- package/dist/browser/{chunk-ETEMHLPK.js → chunk-K6ZAPF3O.js} +2 -2
- package/dist/browser/{chunk-ETEMHLPK.js.map → chunk-K6ZAPF3O.js.map} +1 -1
- package/dist/browser/{chunk-WIAN2AEG.js → chunk-LQMNAGAQ.js} +2 -2
- package/dist/browser/{chunk-WIAN2AEG.js.map → chunk-LQMNAGAQ.js.map} +1 -1
- package/dist/browser/chunk-NJV3ON3L.js +2 -0
- package/dist/browser/chunk-NJV3ON3L.js.map +1 -0
- package/dist/browser/{chunk-BHWDUBPI.js → chunk-OO7TNSDO.js} +2 -2
- package/dist/browser/{chunk-BHWDUBPI.js.map → chunk-OO7TNSDO.js.map} +1 -1
- package/dist/browser/chunk-PAE3HIPT.js +2 -0
- package/dist/browser/{chunk-QO2TFHO2.js.map → chunk-PAE3HIPT.js.map} +1 -1
- package/dist/browser/chunk-QDXJMILO.js +2 -0
- package/dist/browser/chunk-QDXJMILO.js.map +1 -0
- package/dist/browser/{chunk-BRMWBBBX.js → chunk-R6ITDRKU.js} +2 -2
- package/dist/browser/{chunk-BRMWBBBX.js.map → chunk-R6ITDRKU.js.map} +1 -1
- package/dist/browser/chunk-RYNXUPBF.js +2 -0
- package/dist/browser/chunk-RYNXUPBF.js.map +1 -0
- package/dist/browser/{chunk-SVROBXWO.js → chunk-UGOUX6UI.js} +2 -2
- package/dist/browser/{chunk-SVROBXWO.js.map → chunk-UGOUX6UI.js.map} +1 -1
- package/dist/browser/chunk-W6H2FORU.js +2 -0
- package/dist/browser/{chunk-7QYBZV6Y.js.map → chunk-W6H2FORU.js.map} +1 -1
- package/dist/browser/chunk-WV4Y4D4E.js +2 -0
- package/dist/browser/chunk-WV4Y4D4E.js.map +1 -0
- package/dist/browser/{chunk-NMCYCY5I.js → chunk-XIL25HFC.js} +2 -2
- package/dist/browser/{chunk-NMCYCY5I.js.map → chunk-XIL25HFC.js.map} +1 -1
- package/dist/browser/chunk-ZJEINVJL.js +2 -0
- package/dist/browser/{chunk-LZ7UKF5Q.js.map → chunk-ZJEINVJL.js.map} +1 -1
- package/dist/browser/index.js +1 -1
- package/dist/browser/modules/accounts/index.js +1 -1
- package/dist/browser/modules/accounts/mutations/bookmarks/index.js +1 -1
- package/dist/browser/modules/accounts/mutations/bookmarks/use-account-bookmark-add.js +1 -1
- package/dist/browser/modules/accounts/mutations/bookmarks/use-account-bookmark-delete.js +1 -1
- package/dist/browser/modules/accounts/mutations/favorite-tags/index.js +1 -1
- package/dist/browser/modules/accounts/mutations/favorite-tags/requests.js +1 -1
- package/dist/browser/modules/accounts/mutations/favorite-tags/use-favorite-tag-add.js +1 -1
- package/dist/browser/modules/accounts/mutations/favorite-tags/use-favorite-tag-delete.js +1 -1
- package/dist/browser/modules/accounts/mutations/favorites/index.js +1 -1
- package/dist/browser/modules/accounts/mutations/favorites/use-account-favorite-add.js +1 -1
- package/dist/browser/modules/accounts/mutations/favorites/use-account-favorite-delete.js +1 -1
- package/dist/browser/modules/accounts/mutations/index.js +1 -1
- package/dist/browser/modules/accounts/mutations/use-account-relations-update.js +1 -1
- package/dist/browser/modules/accounts/mutations/use-account-revoke-key.js +1 -1
- package/dist/browser/modules/accounts/mutations/use-account-revoke-posting.js +1 -1
- package/dist/browser/modules/accounts/mutations/use-account-update-key-auths.js +1 -1
- package/dist/browser/modules/accounts/mutations/use-account-update-password.js +1 -1
- package/dist/browser/modules/accounts/mutations/use-account-update-recovery.js +1 -1
- package/dist/browser/modules/accounts/mutations/use-account-update.js +1 -1
- package/dist/browser/modules/accounts/mutations/use-claim-account.js +1 -1
- package/dist/browser/modules/accounts/mutations/use-create-account.js +1 -1
- package/dist/browser/modules/accounts/mutations/use-follow.js +1 -1
- package/dist/browser/modules/accounts/mutations/use-grant-posting-permission.js +1 -1
- package/dist/browser/modules/accounts/mutations/use-unfollow.js +1 -1
- package/dist/browser/modules/accounts/queries/check-favorite-query-options.js +1 -1
- package/dist/browser/modules/accounts/queries/check-username-wallets-pending-query-options.js +1 -1
- package/dist/browser/modules/accounts/queries/get-account-full-query-options.js +1 -1
- package/dist/browser/modules/accounts/queries/get-account-pending-recovery-query-options.js +1 -1
- package/dist/browser/modules/accounts/queries/get-account-recoveries-query-options.js +1 -1
- package/dist/browser/modules/accounts/queries/get-account-reputations-query-options.js +1 -1
- package/dist/browser/modules/accounts/queries/get-account-subscriptions-query-options.js +1 -1
- package/dist/browser/modules/accounts/queries/get-account-vote-history-infinite-query-options.js +1 -1
- package/dist/browser/modules/accounts/queries/get-accounts-query-options.js +1 -1
- package/dist/browser/modules/accounts/queries/get-aggregated-balance-query-options.js +1 -1
- package/dist/browser/modules/accounts/queries/get-balance-history-query-options.js +1 -1
- package/dist/browser/modules/accounts/queries/get-bookmarks-query-options.js +1 -1
- package/dist/browser/modules/accounts/queries/get-bots-query-options.js +1 -1
- package/dist/browser/modules/accounts/queries/get-favorite-tag-check-query-options.js +1 -1
- package/dist/browser/modules/accounts/queries/get-favorite-tags-query-options.js +1 -1
- package/dist/browser/modules/accounts/queries/get-favorites-query-options.js +1 -1
- package/dist/browser/modules/accounts/queries/get-follow-count-query-options.js +1 -1
- package/dist/browser/modules/accounts/queries/get-followers-query-options.js +1 -1
- package/dist/browser/modules/accounts/queries/get-following-query-options.js +1 -1
- package/dist/browser/modules/accounts/queries/get-friends-infinite-query-options.js +1 -1
- package/dist/browser/modules/accounts/queries/get-muted-users-query-options.js +1 -1
- package/dist/browser/modules/accounts/queries/get-pro-members-query-options.js +1 -1
- package/dist/browser/modules/accounts/queries/get-profiles-query-options.js +1 -1
- package/dist/browser/modules/accounts/queries/get-referrals-infinite-query-options.js +1 -1
- package/dist/browser/modules/accounts/queries/get-referrals-stats-query-options.js +1 -1
- package/dist/browser/modules/accounts/queries/get-relationship-between-accounts-query-options.js +1 -1
- package/dist/browser/modules/accounts/queries/get-search-friends-query-options.js +1 -1
- package/dist/browser/modules/accounts/queries/get-transactions-infinite-query-options.js +1 -1
- package/dist/browser/modules/accounts/queries/index.js +1 -1
- package/dist/browser/modules/accounts/queries/lookup-accounts-query-options.js +1 -1
- package/dist/browser/modules/accounts/queries/search-accounts-by-username-query-options.js +1 -1
- package/dist/browser/modules/accounts/types/index.js +1 -1
- package/dist/browser/modules/accounts/utils/account-power.js +1 -1
- package/dist/browser/modules/accounts/utils/index.js +1 -1
- package/dist/browser/modules/ai/index.js +1 -1
- package/dist/browser/modules/ai/mutations/index.js +1 -1
- package/dist/browser/modules/ai/mutations/use-ai-assist.js +1 -1
- package/dist/browser/modules/ai/mutations/use-ai-transcribe.js +1 -1
- package/dist/browser/modules/ai/mutations/use-generate-image.js +1 -1
- package/dist/browser/modules/ai/queries/get-ai-assist-price-query-options.js +1 -1
- package/dist/browser/modules/ai/queries/get-ai-generate-price-query-options.js +1 -1
- package/dist/browser/modules/ai/queries/get-ai-images-query-options.js +1 -1
- package/dist/browser/modules/ai/queries/get-ai-transcribe-price-query-options.js +1 -1
- package/dist/browser/modules/ai/queries/index.js +1 -1
- package/dist/browser/modules/analytics/index.js +1 -1
- package/dist/browser/modules/analytics/mutations/index.js +1 -1
- package/dist/browser/modules/analytics/mutations/use-record-activity.js +1 -1
- package/dist/browser/modules/analytics/queries/get-discover-curation-query-options.js +1 -1
- package/dist/browser/modules/analytics/queries/get-discover-leaderboard-query-options.js +1 -1
- package/dist/browser/modules/analytics/queries/get-page-stats-query-options.js +1 -1
- package/dist/browser/modules/analytics/queries/index.js +1 -1
- package/dist/browser/modules/auth/index.js +1 -1
- package/dist/browser/modules/auth/requests.js +1 -1
- package/dist/browser/modules/bad-actors/index.js +1 -1
- package/dist/browser/modules/bad-actors/queries/get-bad-actors-query-options.js +1 -1
- package/dist/browser/modules/bad-actors/queries/index.js +1 -1
- package/dist/browser/modules/bridge/index.js +1 -1
- package/dist/browser/modules/bridge/requests.js +1 -1
- package/dist/browser/modules/communities/index.js +1 -1
- package/dist/browser/modules/communities/mutations/index.js +1 -1
- package/dist/browser/modules/communities/mutations/use-mute-post.js +1 -1
- package/dist/browser/modules/communities/mutations/use-pin-post.js +1 -1
- package/dist/browser/modules/communities/mutations/use-register-community-rewards.js +1 -1
- package/dist/browser/modules/communities/mutations/use-set-community-role.js +1 -1
- package/dist/browser/modules/communities/mutations/use-subscribe-community.js +1 -1
- package/dist/browser/modules/communities/mutations/use-unsubscribe-community.js +1 -1
- package/dist/browser/modules/communities/mutations/use-update-community.js +1 -1
- package/dist/browser/modules/communities/queries/get-account-notifications-infinite-query-options.js +1 -1
- package/dist/browser/modules/communities/queries/get-communities-query-options.js +1 -1
- package/dist/browser/modules/communities/queries/get-community-context-query-options.js +1 -1
- package/dist/browser/modules/communities/queries/get-community-query-options.js +1 -1
- package/dist/browser/modules/communities/queries/get-community-subscribers-query-options.js +1 -1
- package/dist/browser/modules/communities/queries/get-rewarded-communities-query-options.js +1 -1
- package/dist/browser/modules/communities/queries/index.js +1 -1
- package/dist/browser/modules/core/index.js +1 -1
- package/dist/browser/modules/core/queries/get-chain-properties-query-options.js +1 -1
- package/dist/browser/modules/core/queries/get-dynamic-props-query-options.js +1 -1
- package/dist/browser/modules/core/queries/get-reward-fund-query-options.js +1 -1
- package/dist/browser/modules/core/queries/index.js +1 -1
- package/dist/browser/modules/core/utils/index.js +1 -1
- package/dist/browser/modules/curation/dmca.js +1 -1
- package/dist/browser/modules/curation/index.js +1 -1
- package/dist/browser/modules/curation/mutations/index.js +1 -1
- package/dist/browser/modules/curation/mutations/use-curation-recommend.js +1 -1
- package/dist/browser/modules/curation/queries/get-curation-application-query-options.js +1 -1
- package/dist/browser/modules/curation/queries/get-curation-applications-query-options.js +1 -1
- package/dist/browser/modules/curation/queries/get-curation-feed-infinite-query-options.js +1 -1
- package/dist/browser/modules/curation/queries/get-curation-post-query-options.js +1 -1
- package/dist/browser/modules/curation/queries/get-curation-recommendations-infinite-query-options.js +1 -1
- package/dist/browser/modules/curation/queries/get-curation-recommender-query-options.js +1 -1
- package/dist/browser/modules/curation/queries/get-curation-roster-admin-query-options.js +1 -1
- package/dist/browser/modules/curation/queries/get-curation-roster-query-options.js +1 -1
- package/dist/browser/modules/curation/queries/get-curation-status-query-options.js +1 -1
- package/dist/browser/modules/curation/queries/index.js +1 -1
- package/dist/browser/modules/curation/requests.js +1 -1
- package/dist/browser/modules/games/index.js +1 -1
- package/dist/browser/modules/games/mutations/game-claim.js +1 -1
- package/dist/browser/modules/games/mutations/index.js +1 -1
- package/dist/browser/modules/games/queries/game-status-check-query-options.js +1 -1
- package/dist/browser/modules/games/queries/index.js +1 -1
- package/dist/browser/modules/games/types/index.js +1 -1
- package/dist/browser/modules/hive-engine/index.js +1 -1
- package/dist/browser/modules/hive-engine/queries/get-all-hive-engine-tokens-query-options.js +1 -1
- package/dist/browser/modules/hive-engine/queries/get-hive-engine-balances-with-usd-query-options.js +1 -1
- package/dist/browser/modules/hive-engine/queries/get-hive-engine-token-general-info-query-options.js +1 -1
- package/dist/browser/modules/hive-engine/queries/get-hive-engine-token-metrics-query-options.js +1 -1
- package/dist/browser/modules/hive-engine/queries/get-hive-engine-token-transactions-query-options.js +1 -1
- package/dist/browser/modules/hive-engine/queries/get-hive-engine-tokens-balances-query-options.js +1 -1
- package/dist/browser/modules/hive-engine/queries/get-hive-engine-tokens-market-query-options.js +1 -1
- package/dist/browser/modules/hive-engine/queries/get-hive-engine-tokens-metadata-query-options.js +1 -1
- package/dist/browser/modules/hive-engine/queries/get-hive-engine-unclaimed-rewards-query-options.js +1 -1
- package/dist/browser/modules/hive-engine/queries/index.js +1 -1
- package/dist/browser/modules/hive-engine/requests.js +1 -1
- package/dist/browser/modules/hive-engine/types/index.js +1 -1
- package/dist/browser/modules/integrations/3speak/index.js +1 -1
- package/dist/browser/modules/integrations/3speak/queries/get-account-token-query-options.js +1 -1
- package/dist/browser/modules/integrations/3speak/queries/get-account-videos-query-options.js +1 -1
- package/dist/browser/modules/integrations/3speak/queries/index.js +1 -1
- package/dist/browser/modules/integrations/hiveposh/index.js +1 -1
- package/dist/browser/modules/integrations/hiveposh/queries/get-hiveposh-links-query-options.js +1 -1
- package/dist/browser/modules/integrations/hiveposh/queries/index.js +1 -1
- package/dist/browser/modules/integrations/index.js +1 -1
- package/dist/browser/modules/integrations/plausible/index.js +1 -1
- package/dist/browser/modules/integrations/plausible/queries/get-stats-query-options.js +1 -1
- package/dist/browser/modules/integrations/plausible/queries/index.js +1 -1
- package/dist/browser/modules/market/index.js +1 -1
- package/dist/browser/modules/market/mutations/index.js +1 -1
- package/dist/browser/modules/market/mutations/use-limit-order-cancel.js +1 -1
- package/dist/browser/modules/market/mutations/use-limit-order-create.js +1 -1
- package/dist/browser/modules/market/queries/get-market-data-query-options.js +1 -1
- package/dist/browser/modules/market/queries/index.js +1 -1
- package/dist/browser/modules/market/requests.js +1 -1
- package/dist/browser/modules/market/types/index.js +1 -1
- package/dist/browser/modules/newsletter/api.js +1 -1
- package/dist/browser/modules/newsletter/index.js +1 -1
- package/dist/browser/modules/newsletter/mutations/index.js +1 -1
- package/dist/browser/modules/newsletter/mutations/use-leave-digest.js +1 -1
- package/dist/browser/modules/newsletter/mutations/use-send-newsletter-issue.js +1 -1
- package/dist/browser/modules/newsletter/mutations/use-subscribe-digest.js +1 -1
- package/dist/browser/modules/newsletter/mutations/use-unsubscribe-all-digests.js +1 -1
- package/dist/browser/modules/newsletter/queries/get-digest-subscriptions-query-options.js +1 -1
- package/dist/browser/modules/newsletter/queries/get-newsletter-issues-query-options.js +1 -1
- package/dist/browser/modules/newsletter/queries/get-newsletter-posts-query-options.js +1 -1
- package/dist/browser/modules/newsletter/queries/get-newsletter-sender-query-options.js +1 -1
- package/dist/browser/modules/newsletter/queries/index.js +1 -1
- package/dist/browser/modules/notifications/enums/index.js +1 -1
- package/dist/browser/modules/notifications/index.js +1 -1
- package/dist/browser/modules/notifications/mutations/index.js +1 -1
- package/dist/browser/modules/notifications/mutations/use-mark-notifications-read.js +1 -1
- package/dist/browser/modules/notifications/mutations/use-set-last-read.js +1 -1
- package/dist/browser/modules/notifications/queries/get-announcements-query-options.js +1 -1
- package/dist/browser/modules/notifications/queries/get-notifications-infinite-query-options.js +1 -1
- package/dist/browser/modules/notifications/queries/get-notifications-settings-query-options.js +1 -1
- package/dist/browser/modules/notifications/queries/get-notifications-unread-count-query-options.js +1 -1
- package/dist/browser/modules/notifications/queries/get-spotlights-query-options.js +1 -1
- package/dist/browser/modules/notifications/queries/index.js +1 -1
- package/dist/browser/modules/operations/builders/index.js +1 -1
- package/dist/browser/modules/operations/index.js +1 -1
- package/dist/browser/modules/points/index.js +1 -1
- package/dist/browser/modules/points/mutations/index.js +1 -1
- package/dist/browser/modules/points/mutations/use-claim-points.js +1 -1
- package/dist/browser/modules/points/queries/get-points-asset-general-info-query-options.js +1 -1
- package/dist/browser/modules/points/queries/get-points-query-options.js +1 -1
- package/dist/browser/modules/points/queries/index.js +1 -1
- package/dist/browser/modules/polls/index.js +1 -1
- package/dist/browser/modules/polls/mutations/index.js +1 -1
- package/dist/browser/modules/polls/mutations/use-poll-vote.js +1 -1
- package/dist/browser/modules/polls/queries/get-poll-query-options.js +1 -1
- package/dist/browser/modules/polls/queries/index.js +1 -1
- package/dist/browser/modules/posts/cache/discussions-cache-utils.js +1 -1
- package/dist/browser/modules/posts/cache/entries-cache-management.js +1 -1
- package/dist/browser/modules/posts/cache/index.js +1 -1
- package/dist/browser/modules/posts/index.js +1 -1
- package/dist/browser/modules/posts/mutations/add-fragment.js +1 -1
- package/dist/browser/modules/posts/mutations/edit-fragment.js +1 -1
- package/dist/browser/modules/posts/mutations/index.js +1 -1
- package/dist/browser/modules/posts/mutations/remove-fragment.js +1 -1
- package/dist/browser/modules/posts/mutations/use-add-draft.js +1 -1
- package/dist/browser/modules/posts/mutations/use-add-image.js +1 -1
- package/dist/browser/modules/posts/mutations/use-add-schedule.js +1 -1
- package/dist/browser/modules/posts/mutations/use-comment.js +1 -1
- package/dist/browser/modules/posts/mutations/use-cross-post.js +1 -1
- package/dist/browser/modules/posts/mutations/use-delete-comment.js +1 -1
- package/dist/browser/modules/posts/mutations/use-delete-draft.js +1 -1
- package/dist/browser/modules/posts/mutations/use-delete-image.js +1 -1
- package/dist/browser/modules/posts/mutations/use-delete-schedule.js +1 -1
- package/dist/browser/modules/posts/mutations/use-move-schedule.js +1 -1
- package/dist/browser/modules/posts/mutations/use-promote.js +1 -1
- package/dist/browser/modules/posts/mutations/use-reblog.js +1 -1
- package/dist/browser/modules/posts/mutations/use-update-draft.js +1 -1
- package/dist/browser/modules/posts/mutations/use-update-reply.js +1 -1
- package/dist/browser/modules/posts/mutations/use-upload-image.js +1 -1
- package/dist/browser/modules/posts/mutations/use-vote.js +1 -1
- package/dist/browser/modules/posts/queries/get-account-posts-query-options.js +1 -1
- package/dist/browser/modules/posts/queries/get-comment-history-query-options.js +1 -1
- package/dist/browser/modules/posts/queries/get-content-query-options.js +1 -1
- package/dist/browser/modules/posts/queries/get-content-replies-query-options.js +1 -1
- package/dist/browser/modules/posts/queries/get-deleted-entry-query-options.js +1 -1
- package/dist/browser/modules/posts/queries/get-discussions-query-options.js +1 -1
- package/dist/browser/modules/posts/queries/get-drafts-query-options.js +1 -1
- package/dist/browser/modules/posts/queries/get-entry-active-votes-query-options.js +1 -1
- package/dist/browser/modules/posts/queries/get-fragments-query-options.js +1 -1
- package/dist/browser/modules/posts/queries/get-images-query-options.js +1 -1
- package/dist/browser/modules/posts/queries/get-normalize-post-query-options.js +1 -1
- package/dist/browser/modules/posts/queries/get-post-header-query-options.js +1 -1
- package/dist/browser/modules/posts/queries/get-post-query-options.js +1 -1
- package/dist/browser/modules/posts/queries/get-post-tips-query-options.js +1 -1
- package/dist/browser/modules/posts/queries/get-posts-ranked-query-options.js +1 -1
- package/dist/browser/modules/posts/queries/get-promoted-posts-query-options.js +1 -1
- package/dist/browser/modules/posts/queries/get-reblogged-by-query-options.js +1 -1
- package/dist/browser/modules/posts/queries/get-reblogs-query-options.js +1 -1
- package/dist/browser/modules/posts/queries/get-schedules-query-options.js +1 -1
- package/dist/browser/modules/posts/queries/get-shorts-feed-query-options.js +1 -1
- package/dist/browser/modules/posts/queries/get-trending-tags-query-options.js +1 -1
- package/dist/browser/modules/posts/queries/get-trending-tags-with-stats-query-options.js +1 -1
- package/dist/browser/modules/posts/queries/get-user-post-vote-query-options.js +1 -1
- package/dist/browser/modules/posts/queries/get-waves-by-account-query-options.js +1 -1
- package/dist/browser/modules/posts/queries/get-waves-by-host-query-options.js +1 -1
- package/dist/browser/modules/posts/queries/get-waves-by-tag-query-options.js +1 -1
- package/dist/browser/modules/posts/queries/get-waves-feed-query-options.js +1 -1
- package/dist/browser/modules/posts/queries/get-waves-following-query-options.js +1 -1
- package/dist/browser/modules/posts/queries/get-waves-trending-authors-query-options.js +1 -1
- package/dist/browser/modules/posts/queries/get-waves-trending-tags-query-options.js +1 -1
- package/dist/browser/modules/posts/queries/index.js +1 -1
- package/dist/browser/modules/posts/types/index.js +1 -1
- package/dist/browser/modules/posts/utils/filter-dmca-entries.js +1 -1
- package/dist/browser/modules/posts/utils/waves-helpers.js +1 -1
- package/dist/browser/modules/private-api/index.js +1 -1
- package/dist/browser/modules/private-api/requests.js +1 -1
- package/dist/browser/modules/promotions/index.js +1 -1
- package/dist/browser/modules/promotions/mutations/index.js +1 -1
- package/dist/browser/modules/promotions/mutations/use-boost-plus.js +1 -1
- package/dist/browser/modules/promotions/mutations/use-rc-delegation.js +1 -1
- package/dist/browser/modules/promotions/queries/get-boost-plus-account-prices-query-options.js +1 -1
- package/dist/browser/modules/promotions/queries/get-boost-plus-prices-query-options.js +1 -1
- package/dist/browser/modules/promotions/queries/get-promote-price-query-options.js +1 -1
- package/dist/browser/modules/promotions/queries/get-rc-delegation-active-query-options.js +1 -1
- package/dist/browser/modules/promotions/queries/get-rc-delegation-prices-query-options.js +1 -1
- package/dist/browser/modules/promotions/queries/index.js +1 -1
- package/dist/browser/modules/proposals/index.js +1 -1
- package/dist/browser/modules/proposals/mutations/index.js +1 -1
- package/dist/browser/modules/proposals/mutations/use-proposal-create.js +1 -1
- package/dist/browser/modules/proposals/mutations/use-proposal-vote.js +1 -1
- package/dist/browser/modules/proposals/queries/get-proposal-votes-query-options.js +1 -1
- package/dist/browser/modules/proposals/queries/index.js +1 -1
- package/dist/browser/modules/quests/index.js +1 -1
- package/dist/browser/modules/quests/mutations/buy-streak-freeze.js +1 -1
- package/dist/browser/modules/quests/mutations/index.js +1 -1
- package/dist/browser/modules/quests/queries/get-quests-query-options.js +1 -1
- package/dist/browser/modules/quests/queries/index.js +1 -1
- package/dist/browser/modules/resource-credits/index.js +1 -1
- package/dist/browser/modules/resource-credits/queries/get-rc-resource-params-query-options.js +1 -1
- package/dist/browser/modules/resource-credits/queries/index.js +1 -1
- package/dist/browser/modules/resource-credits/utils/estimate-rc-precheck.js +1 -1
- package/dist/browser/modules/resource-credits/utils/index.js +1 -1
- package/dist/browser/modules/search/dmca.js +2 -0
- package/dist/browser/modules/search/dmca.js.map +1 -0
- package/dist/browser/modules/search/index.js +1 -1
- package/dist/browser/modules/search/parse-json-response.js +1 -1
- package/dist/browser/modules/search/queries/get-search-account-query-options.js +1 -1
- package/dist/browser/modules/search/queries/get-search-api-infinite-query-options.js +1 -1
- package/dist/browser/modules/search/queries/get-search-path-query-options.js +1 -1
- package/dist/browser/modules/search/queries/get-search-query-options.js +1 -1
- package/dist/browser/modules/search/queries/get-search-topics-query-options.js +1 -1
- package/dist/browser/modules/search/queries/get-similar-entries-query-options.js +1 -1
- package/dist/browser/modules/search/queries/index.js +1 -1
- package/dist/browser/modules/search/requests.js +1 -1
- package/dist/browser/modules/support/index.js +1 -1
- package/dist/browser/modules/support/mutations/index.js +1 -1
- package/dist/browser/modules/support/mutations/update-support-settings.js +1 -1
- package/dist/browser/modules/support/queries/get-support-settings-query-options.js +1 -1
- package/dist/browser/modules/support/queries/index.js +1 -1
- package/dist/browser/modules/wallet/index.js +1 -1
- package/dist/browser/modules/wallet/mutations/index.js +1 -1
- package/dist/browser/modules/wallet/mutations/use-claim-engine-rewards.js +1 -1
- package/dist/browser/modules/wallet/mutations/use-claim-interest.js +1 -1
- package/dist/browser/modules/wallet/mutations/use-claim-rewards.js +1 -1
- package/dist/browser/modules/wallet/mutations/use-convert.js +1 -1
- package/dist/browser/modules/wallet/mutations/use-delegate-engine-token.js +1 -1
- package/dist/browser/modules/wallet/mutations/use-delegate-rc.js +1 -1
- package/dist/browser/modules/wallet/mutations/use-delegate-vesting-shares.js +1 -1
- package/dist/browser/modules/wallet/mutations/use-engine-market-order.js +1 -1
- package/dist/browser/modules/wallet/mutations/use-set-withdraw-vesting-route.js +1 -1
- package/dist/browser/modules/wallet/mutations/use-stake-engine-token.js +1 -1
- package/dist/browser/modules/wallet/mutations/use-transfer-engine-token.js +1 -1
- package/dist/browser/modules/wallet/mutations/use-transfer-from-savings.js +1 -1
- package/dist/browser/modules/wallet/mutations/use-transfer-point.js +1 -1
- package/dist/browser/modules/wallet/mutations/use-transfer-to-savings.js +1 -1
- package/dist/browser/modules/wallet/mutations/use-transfer-to-vesting.js +1 -1
- package/dist/browser/modules/wallet/mutations/use-transfer.js +1 -1
- package/dist/browser/modules/wallet/mutations/use-undelegate-engine-token.js +1 -1
- package/dist/browser/modules/wallet/mutations/use-unstake-engine-token.js +1 -1
- package/dist/browser/modules/wallet/mutations/use-wallet-operation.js +1 -1
- package/dist/browser/modules/wallet/mutations/use-withdraw-vesting.js +1 -1
- package/dist/browser/modules/wallet/queries/get-account-wallet-asset-info-query-options.js +1 -1
- package/dist/browser/modules/wallet/queries/get-hbd-asset-general-info-query-options.js +1 -1
- package/dist/browser/modules/wallet/queries/get-hbd-asset-transactions-query-options.js +1 -1
- package/dist/browser/modules/wallet/queries/get-hive-asset-general-info-query-options.js +1 -1
- package/dist/browser/modules/wallet/queries/get-hive-asset-transactions-query-options.js +1 -1
- package/dist/browser/modules/wallet/queries/get-hive-power-asset-general-info-query-options.js +1 -1
- package/dist/browser/modules/wallet/queries/get-hive-power-asset-transactions-query-options.js +1 -1
- package/dist/browser/modules/wallet/queries/get-hive-power-delegatings-query-options.js +1 -1
- package/dist/browser/modules/wallet/queries/get-incoming-rc-query-options.js +1 -1
- package/dist/browser/modules/wallet/queries/get-portfolio-query-options.js +1 -1
- package/dist/browser/modules/wallet/queries/get-received-vesting-shares-query-options.js +1 -1
- package/dist/browser/modules/wallet/queries/index.js +1 -1
- package/dist/browser/modules/wallet/types/index.js +1 -1
- package/dist/browser/modules/witnesses/index.js +1 -1
- package/dist/browser/modules/witnesses/mutations/index.js +1 -1
- package/dist/browser/modules/witnesses/mutations/use-witness-proxy.js +1 -1
- package/dist/browser/modules/witnesses/mutations/use-witness-vote.js +1 -1
- package/dist/browser/modules/witnesses/queries/get-witnesses-query-options.js +1 -1
- package/dist/browser/modules/witnesses/queries/index.js +1 -1
- package/dist/node/index.cjs +3 -3
- package/dist/node/index.cjs.map +1 -1
- package/dist/node/index.mjs +3 -3
- package/dist/node/index.mjs.map +1 -1
- package/package.json +1 -1
- package/dist/browser/chunk-7B5CJV66.js +0 -2
- package/dist/browser/chunk-7B5CJV66.js.map +0 -1
- package/dist/browser/chunk-7QYBZV6Y.js +0 -2
- package/dist/browser/chunk-A2ZUZQJW.js +0 -2
- package/dist/browser/chunk-A2ZUZQJW.js.map +0 -1
- package/dist/browser/chunk-FOHLJPTH.js +0 -2
- package/dist/browser/chunk-KZ7ESL64.js +0 -2
- package/dist/browser/chunk-LZ7UKF5Q.js +0 -2
- package/dist/browser/chunk-QO2TFHO2.js +0 -2
- package/dist/browser/chunk-RXGIT5EC.js +0 -2
- package/dist/browser/chunk-RXGIT5EC.js.map +0 -1
- package/dist/browser/chunk-UWERF3NL.js +0 -2
- package/dist/browser/chunk-UWERF3NL.js.map +0 -1
- package/dist/browser/chunk-WTTXOAV3.js +0 -2
- package/dist/browser/chunk-WTTXOAV3.js.map +0 -1
- package/dist/browser/chunk-WZIYV3BG.js +0 -2
- package/dist/browser/chunk-ZPE5HNBG.js +0 -2
- package/dist/browser/chunk-ZPE5HNBG.js.map +0 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {a as a$1}from'./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import {a as a$1}from'./chunk-EO6TGAAL.js';import {d}from'./chunk-Q567KEFE.js';import {a}from'./chunk-HEILHNSR.js';import {infiniteQueryOptions,queryOptions}from'@tanstack/react-query';var w=20;function F(e){return {containers:e.containers??[],tag:e.tag?.trim()||void 0,following:e.following?.trim().toLowerCase()||void 0,author:e.author?.trim().toLowerCase()||void 0,observer:e.observer?.trim().toLowerCase()||void 0,limit:e.limit??w}}async function h({containers:e,tag:n,following:s,author:i,observer:o,limit:m},d$1,u){let t=d.getValidatedBaseUrl(),r=new URL("/private-api/waves/feed",t);r.searchParams.set("limit",String(m)),d$1&&r.searchParams.set("cursor",d$1),e.forEach(a=>r.searchParams.append("container",a)),n&&r.searchParams.set("tag",n),s&&r.searchParams.set("following",s),i&&r.searchParams.set("author",i),o&&r.searchParams.set("observer",o);let l=await fetch(r.toString(),{method:"GET",signal:u});if(!l.ok)throw new Error(`Failed to fetch waves feed: ${l.status}`);let f=await l.json();return !Array.isArray(f)||f.length===0?[]:f.map(a=>{let g=a$1(a,a.host??"");return g?{...g,_cursor:a._cursor}:null}).filter(a=>!!a)}function _(e={}){let n=F(e),{containers:s,tag:i,following:o,author:m,observer:d,limit:u}=n;return infiniteQueryOptions({queryKey:a.posts.wavesFeed({containers:s,tag:i,following:o,author:m,observer:d,limit:u}),initialPageParam:void 0,queryFn:({pageParam:t,signal:r})=>h(n,t,r),getNextPageParam:t=>{if(!(t.length<u))return t[t.length-1]?._cursor}})}function z(e={}){let n=F(e),{containers:s,tag:i,following:o,author:m,observer:d,limit:u}=n;return queryOptions({queryKey:[...a.posts.wavesFeed({containers:s,tag:i,following:o,author:m,observer:d,limit:u}),"latest"],staleTime:0,queryFn:({signal:t})=>h(n,void 0,t)})}export{_ as a,z as b};//# sourceMappingURL=chunk-K27EKN2G.js.map
|
|
2
|
+
//# sourceMappingURL=chunk-K27EKN2G.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/modules/posts/queries/get-waves-feed-query-options.ts"],"names":["DEFAULT_FEED_LIMIT","normalizeParams","params","fetchWavesFeedPage","containers","tag","following","author","observer","limit","cursor","signal","baseUrl","ConfigManager","url","container","response","data","row","entry","normalizeWaveEntryFromApi","getWavesFeedQueryOptions","normalized","infiniteQueryOptions","QueryKeys","pageParam","lastPage","getWavesLatestFeedQueryOptions","queryOptions"],"mappings":"yLAKA,IAAMA,EAAqB,EAAA,CA2C3B,SAASC,CAAAA,CAAgBC,CAAAA,CAA+C,CACtE,OAAO,CACL,WAAYA,CAAAA,CAAO,UAAA,EAAc,EAAC,CAClC,GAAA,CAAKA,CAAAA,CAAO,GAAA,EAAK,MAAK,EAAK,MAAA,CAC3B,UAAWA,CAAAA,CAAO,SAAA,EAAW,MAAK,CAAE,WAAA,IAAiB,MAAA,CACrD,MAAA,CAAQA,EAAO,MAAA,EAAQ,IAAA,GAAO,WAAA,EAAY,EAAK,OAC/C,QAAA,CAAUA,CAAAA,CAAO,QAAA,EAAU,IAAA,GAAO,WAAA,EAAY,EAAK,OACnD,KAAA,CAAOA,CAAAA,CAAO,OAASF,C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C,CAAAA,CAAK,UAAAC,CAAAA,CAAW,MAAA,CAAAC,EAAQ,QAAA,CAAAC,CAAAA,CAAU,KAAA,CAAAC,CAAM,EAAIa,CAAAA,CAEhE,OAAOM,aAAa,CAClB,QAAA,CAAU,CACR,GAAGJ,CAAAA,CAAU,MAAM,SAAA,CAAU,CAAE,WAAApB,CAAAA,CAAY,GAAA,CAAAC,EAAK,SAAA,CAAAC,CAAAA,CAAW,OAAAC,CAAAA,CAAQ,QAAA,CAAAC,CAAAA,CAAU,KAAA,CAAAC,CAAM,CAAC,CAAA,CACpF,QACF,CAAA,CACA,SAAA,CAAW,EACX,OAAA,CAAS,CAAC,CAAE,MAAA,CAAAE,CAAO,IAAMR,CAAAA,CAAmBmB,CAAAA,CAAY,OAAWX,CAAM,CAC3E,CAAC,CACH","file":"chunk-
|
|
1
|
+
{"version":3,"sources":["../../src/modules/posts/queries/get-waves-feed-query-options.ts"],"names":["DEFAULT_FEED_LIMIT","normalizeParams","params","fetchWavesFeedPage","containers","tag","following","author","observer","limit","cursor","signal","baseUrl","ConfigManager","url","container","response","data","row","entry","normalizeWaveEntryFromApi","getWavesFeedQueryOptions","normalized","infiniteQueryOptions","QueryKeys","pageParam","lastPage","getWavesLatestFeedQueryOptions","queryOptions"],"mappings":"yLAKA,IAAMA,EAAqB,EAAA,CA2C3B,SAASC,CAAAA,CAAgBC,CAAAA,CAA+C,CACtE,OAAO,CACL,WAAYA,CAAAA,CAAO,UAAA,EAAc,EAAC,CAClC,GAAA,CAAKA,CAAAA,CAAO,GAAA,EAAK,MAAK,EAAK,MAAA,CAC3B,UAAWA,CAAAA,CAAO,SAAA,EAAW,MAAK,CAAE,WAAA,IAAiB,MAAA,CACrD,MAAA,CAAQA,EAAO,MAAA,EAAQ,IAAA,GAAO,WAAA,EAAY,EAAK,OAC/C,QAAA,CAAUA,CAAAA,CAAO,QAAA,EAAU,IAAA,GAAO,WAAA,EAAY,EAAK,OACnD,KAAA,CAAOA,CAAAA,CAAO,OAAS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AAAC,CAAAA,CAAK,UAAAC,CAAAA,CAAW,MAAA,CAAAC,EAAQ,QAAA,CAAAC,CAAAA,CAAU,KAAA,CAAAC,CAAM,EAAIa,CAAAA,CAEhE,OAAOM,aAAa,CAClB,QAAA,CAAU,CACR,GAAGJ,CAAAA,CAAU,MAAM,SAAA,CAAU,CAAE,WAAApB,CAAAA,CAAY,GAAA,CAAAC,EAAK,SAAA,CAAAC,CAAAA,CAAW,OAAAC,CAAAA,CAAQ,QAAA,CAAAC,CAAAA,CAAU,KAAA,CAAAC,CAAM,CAAC,CAAA,CACpF,QACF,CAAA,CACA,SAAA,CAAW,EACX,OAAA,CAAS,CAAC,CAAE,MAAA,CAAAE,CAAO,IAAMR,CAAAA,CAAmBmB,CAAAA,CAAY,OAAWX,CAAM,CAC3E,CAAC,CACH","file":"chunk-K27EKN2G.js","sourcesContent":["import { infiniteQueryOptions, queryOptions } from \"@tanstack/react-query\";\nimport { ConfigManager, QueryKeys } from \"@/modules/core\";\nimport { Entry, WaveEntry } from \"../types\";\nimport { normalizeWaveEntryFromApi } from \"../utils/waves-helpers\";\n\nconst DEFAULT_FEED_LIMIT = 20;\n\ntype WavesFeedRow = Entry & {\n post_id: number;\n // The wave's container account (e.g. ecency.waves, leothreads), so a mixed\n // cross-container feed can be rendered and acted on per item.\n host?: string;\n // Opaque keyset cursor pointing just past this row.\n _cursor?: string;\n container?: (Entry & { post_id: number }) | null;\n parent?: (Entry & { post_id: number }) | null;\n};\n\nexport type WavesFeedEntry = WaveEntry & { _cursor?: string };\n\nexport interface WavesFeedParams {\n /** Scope to one or more container accounts; omit for the full combined feed. */\n containers?: string[];\n /** Only waves carrying this tag (across all containers). */\n tag?: string;\n /** Only waves from accounts this user follows (across all containers). */\n following?: string;\n /** Only this author's waves (across all containers); the per-author feed. */\n author?: string;\n /**\n * The viewing user; exclude authors they currently mute. Ecency's own\n * moderation mutes are applied by esync regardless of this value, so leaving\n * it unset drops the viewer's personal mutes, not the platform ones.\n */\n observer?: string;\n /** Page size (default 20). */\n limit?: number;\n}\n\ninterface NormalizedFeedParams {\n containers: string[];\n tag?: string;\n following?: string;\n author?: string;\n observer?: string;\n limit: number;\n}\n\nfunction normalizeParams(params: WavesFeedParams): NormalizedFeedParams {\n return {\n containers: params.containers ?? [],\n tag: params.tag?.trim() || undefined,\n following: params.following?.trim().toLowerCase() || undefined,\n author: params.author?.trim().toLowerCase() || undefined,\n observer: params.observer?.trim().toLowerCase() || undefined,\n limit: params.limit ?? DEFAULT_FEED_LIMIT\n };\n}\n\nasync function fetchWavesFeedPage(\n { containers, tag, following, author, observer, limit }: NormalizedFeedParams,\n cursor: string | undefined,\n signal?: AbortSignal\n): Promise<WavesFeedEntry[]> {\n const baseUrl = ConfigManager.getValidatedBaseUrl();\n const url = new URL(\"/private-api/waves/feed\", baseUrl);\n url.searchParams.set(\"limit\", String(limit));\n if (cursor) {\n url.searchParams.set(\"cursor\", cursor);\n }\n containers.forEach((container) => url.searchParams.append(\"container\", container));\n if (tag) {\n url.searchParams.set(\"tag\", tag);\n }\n if (following) {\n url.searchParams.set(\"following\", following);\n }\n if (author) {\n url.searchParams.set(\"author\", author);\n }\n if (observer) {\n url.searchParams.set(\"observer\", observer);\n }\n\n const response = await fetch(url.toString(), {\n method: \"GET\",\n signal\n });\n\n if (!response.ok) {\n throw new Error(`Failed to fetch waves feed: ${response.status}`);\n }\n\n const data = (await response.json()) as WavesFeedRow[];\n\n if (!Array.isArray(data) || data.length === 0) {\n return [];\n }\n\n return data\n .map((row) => {\n const entry = normalizeWaveEntryFromApi(row, row.host ?? \"\");\n if (!entry) {\n return null;\n }\n return { ...entry, _cursor: row._cursor } as WavesFeedEntry;\n })\n .filter((entry): entry is WavesFeedEntry => Boolean(entry));\n}\n\n/**\n * Combined cross-container waves feed (the chronological \"For You\" stream, and\n * the Following / Tag feeds via filters).\n *\n * A single esync-backed call returns the newest waves across every indexed\n * container, already merged and time-ordered, with keyset (cursor) pagination,\n * replacing the per-container chain-RPC scan. The optional `tag` / `following`\n * filters narrow the same stream without changing the cursor.\n */\nexport function getWavesFeedQueryOptions(params: WavesFeedParams = {}) {\n const normalized = normalizeParams(params);\n const { containers, tag, following, author, observer, limit } = normalized;\n\n return infiniteQueryOptions({\n queryKey: QueryKeys.posts.wavesFeed({ containers, tag, following, author, observer, limit }),\n initialPageParam: undefined as string | undefined,\n\n queryFn: ({ pageParam, signal }) => fetchWavesFeedPage(normalized, pageParam, signal),\n\n // Keyset pagination. A short page (fewer than `limit` rows) is the\n // end-of-feed signal; on a full page the server always returns the next\n // cursor on the last row. Stopping (rather than looping) is the safe\n // fallback if that cursor were ever absent.\n getNextPageParam: (lastPage: WavesFeedEntry[]) => {\n if (lastPage.length < limit) {\n return undefined;\n }\n return lastPage[lastPage.length - 1]?._cursor;\n }\n });\n}\n\n/**\n * Page-one of the combined feed as a plain (non-infinite) query under a distinct\n * key, for the \"new waves\" poll. Separate from {@link getWavesFeedQueryOptions}\n * so refreshing it never truncates the infinite feed's loaded pages.\n */\nexport function getWavesLatestFeedQueryOptions(params: WavesFeedParams = {}) {\n const normalized = normalizeParams(params);\n const { containers, tag, following, author, observer, limit } = normalized;\n\n return queryOptions({\n queryKey: [\n ...QueryKeys.posts.wavesFeed({ containers, tag, following, author, observer, limit }),\n \"latest\"\n ],\n staleTime: 0,\n queryFn: ({ signal }) => fetchWavesFeedPage(normalized, undefined, signal)\n });\n}\n"]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import {d,e}from'./chunk-DX3UNW47.js';import {a}from'./chunk-KMM5LEOT.js';import {c,b}from'./chunk-UNI2VKFW.js';import {f}from'./chunk-4TJ4KSFV.js';var C={ready:false,currentMana:0,maxMana:0,avgCost:0,cost:0,transactionBytes:0,estimatedCost:0,willLikelyFail:false,deficit:0,remaining:0};function V({rcAccount:t,rcStats:e,rcParams:r,operation:a,payload:n,fallback:l="minimal",buffer:u=1.2}){if(!t||!e?.ops)return C;let{current_mana:o,max_mana:m}=f(t),i=P(a,n,l,r,e);if(!i)return {...C,currentMana:o,maxMana:m};let{cost:c,transactionBytes:k}=i,f$1=Number.isFinite(u)&&u>0?u:1.2,s=c*f$1,p=o<s;return {ready:true,currentMana:o,maxMana:m,avgCost:c,cost:c,transactionBytes:k,estimatedCost:s,willLikelyFail:p,deficit:p?Math.ceil(s-o):0,remaining:Math.floor(o/c)}}function P(t,e$1,r,a$1,n){let l=v(n,t);if(!(t==="comment_operation"||t==="vote_operation")||!e$1&&r==="average")return l;if(!a$1?.resource_params||!a$1.size_info||!n.pool||!n.share)return null;let o={pool:n.pool,regen:n.regen,share:n.share};if(t==="vote_operation"){let f=e$1?.kind==="vote"?e$1.op:M,s=d(f),p=e({transactionBytes:s},a$1.size_info);return {cost:a(p,a$1,o).cost,transactionBytes:s}}let m=e$1?.kind==="comment"?e$1.op:L,i=e$1?.kind==="comment"?e$1.options:void 0,c$1=c({op:m,options:i}),k=b({transactionBytes:c$1,permlinkLength:m.permlink.length,beneficiaries:i?.beneficiaries?.length??0,hasCommentOptions:!!i},a$1.size_info);return {cost:a(k,a$1,o).cost,transactionBytes:c$1}}function v(t,e){let r=t.ops[e]?.avg_cost;return typeof r=="number"&&r>0?{cost:r,transactionBytes:0}:null}var L={author:"aaaaaaaaaa",permlink:"aaaaaaaaaaaaaaaaaaaa",parent_author:"",parent_permlink:"hive-100000",title:"",body:"",json_metadata:"{}"},M={voter:"aaaaaaaaaa",author:"aaaaaaaaaa",permlink:"aaaaaaaaaaaaaaaaaaaa"};export{V as a};//# sourceMappingURL=chunk-K6ZAPF3O.js.map
|
|
2
|
+
//# sourceMappingURL=chunk-K6ZAPF3O.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/modules/resource-credits/utils/estimate-rc-precheck.ts"],"names":["EMPTY","estimateRcPrecheck","rcAccount","rcStats","rcParams","operation","payload","fallback","buffer","currentMana","maxMana","calculateRCMana","priced","priceOperation","cost","transactionBytes","safeBuffer","estimatedCost","willLikelyFail","average","averageCost","stats","op","MINIMAL_VOTE","estimateVoteTransactionBytes","usage","countVoteResourceUsage","priceRcUsage","MINIMAL_COMMENT","options","estimateCommentTransactionBytes","countCommentResourceUsage"],"mappings":"oJA+FA,IAAMA,EAA0B,CAC9B,KAAA,CAAO,KAAA,CACP,WAAA,CAAa,EACb,OAAA,CAAS,CAAA,CACT,OAAA,CAAS,CAAA,CACT,KAAM,CAAA,CACN,gBAAA,CAAkB,EAClB,aAAA,CAAe,CAAA,CACf,eAAgB,KAAA,CAChB,OAAA,CAAS,CAAA,CACT,SAAA,CAAW,CACb,CAAA,CAiBO,SAASC,EAAmB,CACjC,SAAA,CAAAC,EACA,OAAA,CAAAC,CAAAA,CACA,QAAA,CAAAC,CAAAA,CACA,UAAAC,CAAAA,CACA,OAAA,CAAAC,EACA,QAAA,CAAAC,CAAAA,CAAW,UACX,MAAA,CAAAC,CAAAA,CAAS,GACX,CAAA,CAAsC,CACpC,GAAI,CAACN,CAAAA,EAAa,CAACC,GAAS,GAAA,CAC1B,OAAOH,CAAAA,CAGT,GAAM,CAAE,YAAA,CAAcS,CAAAA,CAAa,SAAUC,CAAQ,CAAA,CAAIC,EAAgBT,CAAS,CAAA,CAE5EU,CAAAA,CAASC,CAAAA,CAAeR,EAAWC,CAAAA,CAASC,CAAAA,CAAUH,EAAUD,CAAO,CAAA,CAC7E,GAAI,CAACS,CAAAA,CAGH,OAAO,CAAE,GAAGZ,CAAAA,CAAO,WAAA,CAAAS,EAAa,OAAA,CAAAC,CAAQ,EAG1C,GAAM,CAAE,IAAA,CAAAI,CAAAA,CAAM,iBAAAC,CAAiB,CAAA,CAAIH,CAAAA,CAC7BI,GAAAA,CAAa,OAAO,QAAA,CAASR,CAAM,CAAA,EAAKA,CAAAA,CAAS,EAAIA,CAAAA,CAAS,GAAA,CAC9DS,EAAgBH,CAAAA,CAAOE,GAAAA,CACvBE,EAAiBT,CAAAA,CAAcQ,CA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RCAccount } from \"@/modules/core/hive-tx\";\nimport type { RcStats } from \"../types/stats\";\nimport type { RcResourceParams } from \"../types/resource-params\";\nimport { priceRcUsage } from \"./price-rc-usage\";\nimport {\n countVoteResourceUsage,\n estimateVoteTransactionBytes,\n type VoteLike\n} from \"./count-operation-usage\";\nimport {\n countCommentResourceUsage,\n estimateCommentTransactionBytes,\n type CommentLike,\n type CommentOptionsLike\n} from \"./estimate-comment-rc-cost\";\n\n/**\n * Operations the RC pre-check can estimate. Mirrors the keys exposed by\n * `rc_api.get_rc_stats` (see {@link RcStats}[\"ops\"]).\n */\nexport type RcPrecheckOperation = keyof RcStats[\"ops\"];\n\n/** The operation about to be broadcast, when the caller has it. */\nexport type RcPrecheckPayload =\n | { kind: \"comment\"; op: CommentLike; options?: CommentOptionsLike }\n | { kind: \"vote\"; op: VoteLike };\n\nexport interface RcPrecheckInput {\n /** From `getAccountRcQueryOptions(username)` -> rcAccounts[0]. */\n rcAccount: RCAccount | null | undefined;\n /** From `getRcStatsQueryOptions()`. */\n rcStats: RcStats | null | undefined;\n /** The operation the user is about to broadcast. */\n operation: RcPrecheckOperation;\n /**\n * From `getRcResourceParamsQueryOptions()`. Required for an exact estimate;\n * without it the result is not ready rather than silently approximate.\n */\n rcParams?: RcResourceParams | null;\n /**\n * The actual operation about to be broadcast. Supplying it is what makes the\n * estimate exact, because cost is dominated by the serialized transaction\n * size. Without it a minimal operation of that type is priced instead, which\n * is a lower bound: it can miss a marginal case but never invents one.\n */\n payload?: RcPrecheckPayload;\n /**\n * What to price when no payload is supplied.\n *\n * - `\"minimal\"` (default) prices the smallest operation of that type. It is\n * a lower bound, so a pre-submit warning is never invented for an\n * operation that would have succeeded.\n * - `\"average\"` prices the network average the chain publishes. Right for\n * \"how many of these can I afford\" displays, where there is no specific\n * operation in hand and the smallest conceivable one would flatter the\n * count.\n */\n fallback?: \"minimal\" | \"average\";\n /**\n * Safety multiplier applied to the operation cost when deciding\n * whether the broadcast will \"likely fail\". Actual on-chain cost varies with\n * network load, so we keep headroom. Defaults to 1.2.\n */\n buffer?: number;\n}\n\nexport interface RcPrecheckResult {\n /** Both inputs were available, so the estimate is meaningful. */\n ready: boolean;\n /** Current RC mana of the account. */\n currentMana: number;\n /** Maximum RC mana of the account. */\n maxMana: number;\n /**\n * RC cost of the operation itself.\n *\n * Named `avgCost` for backwards compatibility; it is no longer an average.\n * @deprecated prefer `cost`.\n */\n avgCost: number;\n /** RC cost of the operation, computed the way the chain computes it. */\n cost: number;\n /** Serialized transaction size, the dominant term for a comment. */\n transactionBytes: number;\n /** Average cost padded by `buffer`. */\n estimatedCost: number;\n /** `currentMana` is below the padded estimate -> broadcast likely fails. */\n willLikelyFail: boolean;\n /** RC shortfall vs the padded estimate (0 when not failing). */\n deficit: number;\n /** Roughly how many such operations the account can still afford. */\n remaining: number;\n}\n\nconst EMPTY: RcPrecheckResult = {\n ready: false,\n currentMana: 0,\n maxMana: 0,\n avgCost: 0,\n cost: 0,\n transactionBytes: 0,\n estimatedCost: 0,\n willLikelyFail: false,\n deficit: 0,\n remaining: 0,\n};\n\n/**\n * Pure, client-side estimate of whether an account has enough Resource Credits\n * to broadcast an operation, used to warn the user BEFORE they submit instead\n * of failing afterwards with the chain's \"Please wait to transact\" error.\n *\n * Costs are computed the way the chain computes them, from the actual\n * operation, not from the network-wide average. The average is dominated by\n * short replies and badly misleads on posts: it once told an account holding\n * 21.3B RC that it could afford 17 posts, and the next post it tried needed\n * 23.3B.\n *\n * Still a hint, never a hard gate: the buffer covers pool drift between the\n * estimate and the broadcast, and the publish/comment/vote action must stay\n * non-blocking.\n */\nexport function estimateRcPrecheck({\n rcAccount,\n rcStats,\n rcParams,\n operation,\n payload,\n fallback = \"minimal\",\n buffer = 1.2,\n}: RcPrecheckInput): RcPrecheckResult {\n if (!rcAccount || !rcStats?.ops) {\n return EMPTY;\n }\n\n const { current_mana: currentMana, max_mana: maxMana } = calculateRCMana(rcAccount);\n\n const priced = priceOperation(operation, payload, fallback, rcParams, rcStats);\n if (!priced) {\n // Nothing to price against: reporting \"ready\" here would be a silent\n // all-clear, which is the one answer a pre-check must never invent.\n return { ...EMPTY, currentMana, maxMana };\n }\n\n const { cost, transactionBytes } = priced;\n const safeBuffer = Number.isFinite(buffer) && buffer > 0 ? buffer : 1.2;\n const estimatedCost = cost * safeBuffer;\n const willLikelyFail = currentMana < estimatedCost;\n\n return {\n ready: true,\n currentMana,\n maxMana,\n avgCost: cost,\n cost,\n transactionBytes,\n estimatedCost,\n willLikelyFail,\n deficit: willLikelyFail ? Math.ceil(estimatedCost - currentMana) : 0,\n remaining: Math.floor(currentMana / cost),\n };\n}\n\n/**\n * Prices whichever operation the caller is about to broadcast.\n *\n * Comments and votes are the two operations whose cost swings with what the\n * user wrote, so they are priced from the payload, and pricing them needs the\n * curve parameters. Every other operation the type advertises (transfer,\n * custom_json, ...) is fixed-shape and takes the network average the chain\n * publishes, which needs nothing else.\n *\n * When no payload is supplied a minimal operation is priced. That is\n * deliberately a lower bound: it can miss a marginal case, but it never warns\n * about one that would have succeeded.\n *\n * Returns null when the answer would have to be invented, so the caller\n * reports \"not ready\" rather than a zero-cost all-clear.\n */\nfunction priceOperation(\n operation: RcPrecheckOperation,\n payload: RcPrecheckPayload | undefined,\n fallback: \"minimal\" | \"average\",\n rcParams: RcResourceParams | null | undefined,\n rcStats: RcStats\n): { cost: number; transactionBytes: number } | null {\n const average = averageCost(rcStats, operation);\n const pricedFromPayload =\n operation === \"comment_operation\" || operation === \"vote_operation\";\n\n // The average is a number the node already returned. It needs no curve\n // parameters, so a caller pricing a transfer must not be blocked waiting on\n // them, which is how every operation outside these two is priced.\n if (!pricedFromPayload || (!payload && fallback === \"average\")) {\n return average;\n }\n\n // Asked to price a real comment or vote without the inputs to do it. The\n // honest answer is \"not ready\": falling back to the average here is exactly\n // what told an account holding 21.3B RC it could afford 17 more posts.\n if (!rcParams?.resource_params || !rcParams.size_info || !rcStats.pool || !rcStats.share) {\n return null;\n }\n\n const stats = { pool: rcStats.pool, regen: rcStats.regen, share: rcStats.share };\n\n if (operation === \"vote_operation\") {\n const op: VoteLike = payload?.kind === \"vote\" ? payload.op : MINIMAL_VOTE;\n const transactionBytes = estimateVoteTransactionBytes(op);\n const usage = countVoteResourceUsage({ transactionBytes }, rcParams.size_info);\n return { cost: priceRcUsage(usage, rcParams, stats).cost, transactionBytes };\n }\n\n const op: CommentLike = payload?.kind === \"comment\" ? payload.op : MINIMAL_COMMENT;\n const options = payload?.kind === \"comment\" ? payload.options : undefined;\n const transactionBytes = estimateCommentTransactionBytes({ op, options });\n const usage = countCommentResourceUsage(\n {\n transactionBytes,\n permlinkLength: op.permlink.length,\n beneficiaries: options?.beneficiaries?.length ?? 0,\n hasCommentOptions: !!options\n },\n rcParams.size_info\n );\n return { cost: priceRcUsage(usage, rcParams, stats).cost, transactionBytes };\n}\n\n/** The network average the chain publishes for an operation, when it has one. */\nfunction averageCost(\n rcStats: RcStats,\n operation: RcPrecheckOperation\n): { cost: number; transactionBytes: number } | null {\n const cost = rcStats.ops[operation]?.avg_cost;\n return typeof cost === \"number\" && cost > 0 ? { cost, transactionBytes: 0 } : null;\n}\n\n/** Smallest realistic operations, used only when the caller has no payload yet. */\nconst MINIMAL_COMMENT: CommentLike = {\n author: \"aaaaaaaaaa\",\n permlink: \"aaaaaaaaaaaaaaaaaaaa\",\n parent_author: \"\",\n parent_permlink: \"hive-100000\",\n title: \"\",\n body: \"\",\n json_metadata: \"{}\"\n};\n\nconst MINIMAL_VOTE: VoteLike = {\n voter: \"aaaaaaaaaa\",\n author: \"aaaaaaaaaa\",\n permlink: \"aaaaaaaaaaaaaaaaaaaa\"\n};\n"]}
|
|
1
|
+
{"version":3,"sources":["../../src/modules/resource-credits/utils/estimate-rc-precheck.ts"],"names":["EMPTY","estimateRcPrecheck","rcAccount","rcStats","rcParams","operation","payload","fallback","buffer","currentMana","maxMana","calculateRCMana","priced","priceOperation","cost","transactionBytes","safeBuffer","estimatedCost","willLikelyFail","average","averageCost","stats","op","MINIMAL_VOTE","estimateVoteTransactionBytes","usage","countVoteResourceUsage","priceRcUsage","MINIMAL_COMMENT","options","estimateCommentTransactionBytes","countCommentResourceUsage"],"mappings":"oJA+FA,IAAMA,EAA0B,CAC9B,KAAA,CAAO,KAAA,CACP,WAAA,CAAa,EACb,OAAA,CAAS,CAAA,CACT,OAAA,CAAS,CAAA,CACT,KAAM,CAAA,CACN,gBAAA,CAAkB,EAClB,aAAA,CAAe,CAAA,CACf,eAAgB,KAAA,CAChB,OAAA,CAAS,CAAA,CACT,SAAA,CAAW,CACb,CAAA,CAiBO,SAASC,EAAmB,CACjC,SAAA,CAAAC,EACA,OAAA,CAAAC,CAAAA,CACA,QAAA,CAAAC,CAAAA,CACA,UAAAC,CAAAA,CACA,OAAA,CAAAC,EACA,QAAA,CAAAC,CAAAA,CAAW,UACX,MAAA,CAAAC,CAAAA,CAAS,GACX,CAAA,CAAsC,CACpC,GAAI,CAACN,CAAAA,EAAa,CAACC,GAAS,GAAA,CAC1B,OAAOH,CAAAA,CAGT,GAAM,CAAE,YAAA,CAAcS,CAAAA,CAAa,SAAUC,CAAQ,CAAA,CAAIC,EAAgBT,CAAS,CAAA,CAE5EU,CAAAA,CAASC,CAAAA,CAAeR,EAAWC,CAAAA,CAASC,CAAAA,CAAUH,EAAUD,CAAO,CAAA,CAC7E,GAAI,CAACS,CAAAA,CAGH,OAAO,CAAE,GAAGZ,CAAAA,CAAO,WAAA,CAAAS,EAAa,OAAA,CAAAC,CAAQ,EAG1C,GAAM,CAAE,IAAA,CAAAI,CAAAA,CAAM,iBAAAC,CAAiB,CAAA,CAAIH,CAAAA,CAC7BI,GAAAA,CAAa,OAAO,QAAA,CAASR,CAAM,CAAA,EAAKA,CAAAA,CAAS,EAAIA,CAAAA,CAAS,GAAA,CAC9DS,EAAgBH,CAAAA,CAAOE,GAAAA,CACvBE,EAAiBT,CAAAA,CAAcQ,CAAAA,CAErC,OAAO,CACL,MAAO,IAAA,CACP,WAAA,CAAAR,EACA,O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CAAAA,CAAkBhB,GAAAA,EAAS,IAAA,GAAS,SAAA,CAAYA,IAAQ,EAAA,CAAKsB,CAAAA,CAC7DC,EAAUvB,GAAAA,EAAS,IAAA,GAAS,UAAYA,GAAAA,CAAQ,OAAA,CAAU,MAAA,CAC1DS,GAAAA,CAAmBe,EAAgC,CAAE,EAAA,CAAAR,EAAI,OAAA,CAAAO,CAAQ,CAAC,CAAA,CAClEJ,CAAAA,CAAQM,CAAAA,CACZ,CACE,iBAAAhB,GAAAA,CACA,cAAA,CAAgBO,CAAAA,CAAG,QAAA,CAAS,OAC5B,aAAA,CAAeO,CAAAA,EAAS,aAAA,EAAe,MAAA,EAAU,EACjD,iBAAA,CAAmB,CAAC,CAACA,CACvB,CAAA,CACAzB,IAAS,SACX,CAAA,CACA,OAAO,CAAE,KAAMuB,CAAAA,CAAaF,CAAAA,CAAOrB,IAAUiB,CAAK,CAAA,CAAE,KAAM,gBAAA,CAAAN,GAAiB,CAC7E,CAGA,SAASK,CAAAA,CACPjB,CAAAA,CACAE,EACmD,CACnD,IAAMS,EAAOX,CAAAA,CAAQ,GAAA,CAAIE,CAAS,CAAA,EAAG,SACrC,OAAO,OAAOS,GAAS,QAAA,EAAYA,CAAAA,CAAO,EAAI,CAAE,IAAA,CAAAA,CAAAA,CAAM,gBAAA,CAAkB,CAAE,CAAA,CAAI,IAChF,CAGA,IAAMc,CAAAA,CAA+B,CACnC,MAAA,CAAQ,YAAA,CACR,QAAA,CAAU,sBAAA,CACV,cAAe,EAAA,CACf,eAAA,CAAiB,cACjB,KAAA,CAAO,EAAA,CACP,KAAM,EAAA,CACN,aAAA,CAAe,IACjB,CAAA,CAEML,EAAyB,CAC7B,KAAA,CAAO,aACP,MAAA,CAAQ,YAAA,CACR,SAAU,sBACZ,CAAA","file":"chunk-K6ZAPF3O.js","sourcesContent":["import { calculateRCMana } from \"@/modules/core/hive-tx\";\nimport type { RCAccount } from \"@/modules/core/hive-tx\";\nimport type { RcStats } from \"../types/stats\";\nimport type { RcResourceParams } from \"../types/resource-params\";\nimport { priceRcUsage } from \"./price-rc-usage\";\nimport {\n countVoteResourceUsage,\n estimateVoteTransactionBytes,\n type VoteLike\n} from \"./count-operation-usage\";\nimport {\n countCommentResourceUsage,\n estimateCommentTransactionBytes,\n type CommentLike,\n type CommentOptionsLike\n} from \"./estimate-comment-rc-cost\";\n\n/**\n * Operations the RC pre-check can estimate. Mirrors the keys exposed by\n * `rc_api.get_rc_stats` (see {@link RcStats}[\"ops\"]).\n */\nexport type RcPrecheckOperation = keyof RcStats[\"ops\"];\n\n/** The operation about to be broadcast, when the caller has it. */\nexport type RcPrecheckPayload =\n | { kind: \"comment\"; op: CommentLike; options?: CommentOptionsLike }\n | { kind: \"vote\"; op: VoteLike };\n\nexport interface RcPrecheckInput {\n /** From `getAccountRcQueryOptions(username)` -> rcAccounts[0]. */\n rcAccount: RCAccount | null | undefined;\n /** From `getRcStatsQueryOptions()`. */\n rcStats: RcStats | null | undefined;\n /** The operation the user is about to broadcast. */\n operation: RcPrecheckOperation;\n /**\n * From `getRcResourceParamsQueryOptions()`. Required for an exact estimate;\n * without it the result is not ready rather than silently approximate.\n */\n rcParams?: RcResourceParams | null;\n /**\n * The actual operation about to be broadcast. Supplying it is what makes the\n * estimate exact, because cost is dominated by the serialized transaction\n * size. Without it a minimal operation of that type is priced instead, which\n * is a lower bound: it can miss a marginal case but never invents one.\n */\n payload?: RcPrecheckPayload;\n /**\n * What to price when no payload is supplied.\n *\n * - `\"minimal\"` (default) prices the smallest operation of that type. It is\n * a lower bound, so a pre-submit warning is never invented for an\n * operation that would have succeeded.\n * - `\"average\"` prices the network average the chain publishes. Right for\n * \"how many of these can I afford\" displays, where there is no specific\n * operation in hand and the smallest conceivable one would flatter the\n * count.\n */\n fallback?: \"minimal\" | \"average\";\n /**\n * Safety multiplier applied to the operation cost when deciding\n * whether the broadcast will \"likely fail\". Actual on-chain cost varies with\n * network load, so we keep headroom. Defaults to 1.2.\n */\n buffer?: number;\n}\n\nexport interface RcPrecheckResult {\n /** Both inputs were available, so the estimate is meaningful. */\n ready: boolean;\n /** Current RC mana of the account. */\n currentMana: number;\n /** Maximum RC mana of the account. */\n maxMana: number;\n /**\n * RC cost of the operation itself.\n *\n * Named `avgCost` for backwards compatibility; it is no longer an average.\n * @deprecated prefer `cost`.\n */\n avgCost: number;\n /** RC cost of the operation, computed the way the chain computes it. */\n cost: number;\n /** Serialized transaction size, the dominant term for a comment. */\n transactionBytes: number;\n /** Average cost padded by `buffer`. */\n estimatedCost: number;\n /** `currentMana` is below the padded estimate -> broadcast likely fails. */\n willLikelyFail: boolean;\n /** RC shortfall vs the padded estimate (0 when not failing). */\n deficit: number;\n /** Roughly how many such operations the account can still afford. */\n remaining: number;\n}\n\nconst EMPTY: RcPrecheckResult = {\n ready: false,\n currentMana: 0,\n maxMana: 0,\n avgCost: 0,\n cost: 0,\n transactionBytes: 0,\n estimatedCost: 0,\n willLikelyFail: false,\n deficit: 0,\n remaining: 0,\n};\n\n/**\n * Pure, client-side estimate of whether an account has enough Resource Credits\n * to broadcast an operation, used to warn the user BEFORE they submit instead\n * of failing afterwards with the chain's \"Please wait to transact\" error.\n *\n * Costs are computed the way the chain computes them, from the actual\n * operation, not from the network-wide average. The average is dominated by\n * short replies and badly misleads on posts: it once told an account holding\n * 21.3B RC that it could afford 17 posts, and the next post it tried needed\n * 23.3B.\n *\n * Still a hint, never a hard gate: the buffer covers pool drift between the\n * estimate and the broadcast, and the publish/comment/vote action must stay\n * non-blocking.\n */\nexport function estimateRcPrecheck({\n rcAccount,\n rcStats,\n rcParams,\n operation,\n payload,\n fallback = \"minimal\",\n buffer = 1.2,\n}: RcPrecheckInput): RcPrecheckResult {\n if (!rcAccount || !rcStats?.ops) {\n return EMPTY;\n }\n\n const { current_mana: currentMana, max_mana: maxMana } = calculateRCMana(rcAccount);\n\n const priced = priceOperation(operation, payload, fallback, rcParams, rcStats);\n if (!priced) {\n // Nothing to price against: reporting \"ready\" here would be a silent\n // all-clear, which is the one answer a pre-check must never invent.\n return { ...EMPTY, currentMana, maxMana };\n }\n\n const { cost, transactionBytes } = priced;\n const safeBuffer = Number.isFinite(buffer) && buffer > 0 ? buffer : 1.2;\n const estimatedCost = cost * safeBuffer;\n const willLikelyFail = currentMana < estimatedCost;\n\n return {\n ready: true,\n currentMana,\n maxMana,\n avgCost: cost,\n cost,\n transactionBytes,\n estimatedCost,\n willLikelyFail,\n deficit: willLikelyFail ? Math.ceil(estimatedCost - currentMana) : 0,\n remaining: Math.floor(currentMana / cost),\n };\n}\n\n/**\n * Prices whichever operation the caller is about to broadcast.\n *\n * Comments and votes are the two operations whose cost swings with what the\n * user wrote, so they are priced from the payload, and pricing them needs the\n * curve parameters. Every other operation the type advertises (transfer,\n * custom_json, ...) is fixed-shape and takes the network average the chain\n * publishes, which needs nothing else.\n *\n * When no payload is supplied a minimal operation is priced. That is\n * deliberately a lower bound: it can miss a marginal case, but it never warns\n * about one that would have succeeded.\n *\n * Returns null when the answer would have to be invented, so the caller\n * reports \"not ready\" rather than a zero-cost all-clear.\n */\nfunction priceOperation(\n operation: RcPrecheckOperation,\n payload: RcPrecheckPayload | undefined,\n fallback: \"minimal\" | \"average\",\n rcParams: RcResourceParams | null | undefined,\n rcStats: RcStats\n): { cost: number; transactionBytes: number } | null {\n const average = averageCost(rcStats, operation);\n const pricedFromPayload =\n operation === \"comment_operation\" || operation === \"vote_operation\";\n\n // The average is a number the node already returned. It needs no curve\n // parameters, so a caller pricing a transfer must not be blocked waiting on\n // them, which is how every operation outside these two is priced.\n if (!pricedFromPayload || (!payload && fallback === \"average\")) {\n return average;\n }\n\n // Asked to price a real comment or vote without the inputs to do it. The\n // honest answer is \"not ready\": falling back to the average here is exactly\n // what told an account holding 21.3B RC it could afford 17 more posts.\n if (!rcParams?.resource_params || !rcParams.size_info || !rcStats.pool || !rcStats.share) {\n return null;\n }\n\n const stats = { pool: rcStats.pool, regen: rcStats.regen, share: rcStats.share };\n\n if (operation === \"vote_operation\") {\n const op: VoteLike = payload?.kind === \"vote\" ? payload.op : MINIMAL_VOTE;\n const transactionBytes = estimateVoteTransactionBytes(op);\n const usage = countVoteResourceUsage({ transactionBytes }, rcParams.size_info);\n return { cost: priceRcUsage(usage, rcParams, stats).cost, transactionBytes };\n }\n\n const op: CommentLike = payload?.kind === \"comment\" ? payload.op : MINIMAL_COMMENT;\n const options = payload?.kind === \"comment\" ? payload.options : undefined;\n const transactionBytes = estimateCommentTransactionBytes({ op, options });\n const usage = countCommentResourceUsage(\n {\n transactionBytes,\n permlinkLength: op.permlink.length,\n beneficiaries: options?.beneficiaries?.length ?? 0,\n hasCommentOptions: !!options\n },\n rcParams.size_info\n );\n return { cost: priceRcUsage(usage, rcParams, stats).cost, transactionBytes };\n}\n\n/** The network average the chain publishes for an operation, when it has one. */\nfunction averageCost(\n rcStats: RcStats,\n operation: RcPrecheckOperation\n): { cost: number; transactionBytes: number } | null {\n const cost = rcStats.ops[operation]?.avg_cost;\n return typeof cost === \"number\" && cost > 0 ? { cost, transactionBytes: 0 } : null;\n}\n\n/** Smallest realistic operations, used only when the caller has no payload yet. */\nconst MINIMAL_COMMENT: CommentLike = {\n author: \"aaaaaaaaaa\",\n permlink: \"aaaaaaaaaaaaaaaaaaaa\",\n parent_author: \"\",\n parent_permlink: \"hive-100000\",\n title: \"\",\n body: \"\",\n json_metadata: \"{}\"\n};\n\nconst MINIMAL_VOTE: VoteLike = {\n voter: \"aaaaaaaaaa\",\n author: \"aaaaaaaaaa\",\n permlink: \"aaaaaaaaaaaaaaaaaaaa\"\n};\n"]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {a}from'./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import {a}from'./chunk-73J64EEQ.js';import {c}from'./chunk-Q567KEFE.js';import {a as a$1}from'./chunk-HEILHNSR.js';import {j}from'./chunk-UB5YHSMC.js';import {infiniteQueryOptions}from'@tanstack/react-query';function b(t){return !!t&&typeof t=="object"&&"author"in t&&"permlink"in t&&"active_votes"in t}function l(t){let i=new Date(t);return (new Date().getTime()-i.getTime())/(1e3*60*60*24)}function E(t,i){let{limit:n=20,filters:a$2=[],dayLimit:P=7}=i??{};return infiniteQueryOptions({queryKey:a$1.accounts.voteHistory(t,n),initialPageParam:{start:-1},queryFn:async({pageParam:s})=>{let{start:m}=s,c$1=await j("condenser_api.get_account_history",[t,m,n,...a$2]),V=c$1.map(([e,r])=>({...r.op[1],num:e,timestamp:r.timestamp})).filter(e=>e.voter===t&&e.weight!==0&&l(e.timestamp)<=P),u=[];for(let e of V){let r=await c.queryClient.fetchQuery(a(e.author,e.permlink));b(r)&&u.push(r);}let[o]=c$1;return {lastDate:o?l(o[1].timestamp):0,lastItemFetched:o?o[0]:m,entries:u}},getNextPageParam:s=>({start:s.lastItemFetched})})}export{E as a};//# sourceMappingURL=chunk-LQMNAGAQ.js.map
|
|
2
|
+
//# sourceMappingURL=chunk-LQMNAGAQ.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/modules/accounts/queries/get-account-vote-history-infinite-query-options.ts"],"names":["isEntry","x","getDays","createdDate","past","getAccountVoteHistoryInfiniteQueryOptions","username","options","limit","filters","dayLimit","infiniteQueryOptions","QueryKeys","pageParam","start","response","callRPC","result","num","historyObj","filtered","entries","obj","post","CONFIG","getPostQueryOptions","firstHistory","lastPage"],"mappings":"gNAoCA,SAASA,EAAQC,CAAAA,CAAwB,CACvC,OACE,CAAC,CAACA,GACF,OAAOA,CAAAA,EAAM,UACb,QAAA,GAAYA,CAAAA,EACZ,aAAcA,CAAAA,EACd,cAAA,GAAkBA,CAEtB,CAKA,SAASC,CAAAA,CAAQC,EAA6B,CAC5C,IAAMC,EAAO,IAAI,IAAA,CAAKD,CAAW,CAAA,CAGjC,OAAA,CAFY,IAAI,IAAA,EAAK,CACF,OAAA,GAAYC,CAAAA,CAAK,OAAA,KACnB,GAAA,CAAO,EAAA,CAAK,GAAK,EAAA,CACpC,CAUO,SA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AA,CAEvB,OAAO,CACL,QAAA,CAAUW,CAAAA,CAAexB,CAAAA,CAAQwB,EAAa,CAAC,CAAA,CAAE,SAAS,CAAA,CAAI,CAAA,CAC9D,gBAAiBA,CAAAA,CAAeA,CAAAA,CAAa,CAAC,CAAA,CAAIZ,CAAAA,CAClD,OAAA,CAAAO,CACF,CACF,CAAA,CAEA,iBAAmBM,CAAAA,GAAqD,CACtE,MAAOA,CAAAA,CAAS,eAClB,CAAA,CACF,CAAC,CACH","file":"chunk-
|
|
1
|
+
{"version":3,"sources":["../../src/modules/accounts/queries/get-account-vote-history-infinite-query-options.ts"],"names":["isEntry","x","getDays","createdDate","past","getAccountVoteHistoryInfiniteQueryOptions","username","options","limit","filters","dayLimit","infiniteQueryOptions","QueryKeys","pageParam","start","response","callRPC","result","num","historyObj","filtered","entries","obj","post","CONFIG","getPostQueryOptions","firstHistory","lastPage"],"mappings":"gNAoCA,SAASA,EAAQC,CAAAA,CAAwB,CACvC,OACE,CAAC,CAACA,GACF,OAAOA,CAAAA,EAAM,UACb,QAAA,GAAYA,CAAAA,EACZ,aAAcA,CAAAA,EACd,cAAA,GAAkBA,CAEtB,CAKA,SAASC,CAAAA,CAAQC,EAA6B,CAC5C,IAAMC,EAAO,IAAI,IAAA,CAAKD,CAAW,CAAA,CAGjC,OAAA,CAFY,IAAI,IAAA,EAAK,CACF,OAAA,GAAYC,CAAAA,CAAK,OAAA,KACnB,GAAA,CAAO,EAAA,CAAK,GAAK,EAAA,CACpC,CAUO,SAASC,CAAAA,CACdC,CAAAA,CACAC,CAAAA,CAKA,CACA,GAAM,CAAE,MAAAC,CAAAA,CAAQ,EAAA,CAAI,QAAAC,GAAAA,CAAU,EAAC,CAAG,QAAA,CAAAC,CAAAA,CAAW,CAAI,EAAIH,CAAAA,EAAW,GAEhE,OAAOI,oBAAAA,CAML,CACA,QAAA,CAAUC,GAAAA,CAAU,QAAA,CAAS,WAAA,CAAYN,CAAAA,CAAUE,CAAK,EACxD,gBAAA,CA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CACH","file":"chunk-LQMNAGAQ.js","sourcesContent":["import { InfiniteData, infiniteQueryOptions } from \"@tanstack/react-query\";\nimport { CONFIG } from \"@/modules/core/config\";\nimport { QueryKeys } from \"@/modules/core\";\nimport { Entry } from \"@/modules/posts/types\";\nimport { getPostQueryOptions } from \"@/modules/posts/queries\";\nimport { callRPC } from \"@/modules/core/hive-tx\";\n\ninterface VoteOperationDetails {\n voter: string;\n author: string;\n permlink: string;\n weight: number;\n}\n\ninterface AccountVoteHistoryItem {\n timestamp: string;\n op: [string, VoteOperationDetails];\n}\n\ntype AccountVoteHistoryRecord = [number, AccountVoteHistoryItem];\n\ninterface VoteHistoryResult extends VoteOperationDetails {\n num: number;\n timestamp: string;\n}\n\nexport interface VoteHistoryPageParam {\n start: number;\n}\n\nexport interface VoteHistoryPage {\n lastDate: number;\n lastItemFetched: number;\n entries: Entry[];\n}\n\nfunction isEntry(x: unknown): x is Entry {\n return (\n !!x &&\n typeof x === \"object\" &&\n \"author\" in x &&\n \"permlink\" in x &&\n \"active_votes\" in x\n );\n}\n\n/**\n * Calculate days since a date\n */\nfunction getDays(createdDate: string): number {\n const past = new Date(createdDate);\n const now = new Date();\n const diffMs = now.getTime() - past.getTime();\n return diffMs / (1000 * 60 * 60 * 24);\n}\n\n/**\n * Get account vote history with entries\n *\n * @param username - Account name to get vote history for\n * @param limit - Number of history items per page (default: 20)\n * @param filters - Additional filters to pass to get_account_history\n * @param dayLimit - Only include votes from last N days (default: 7)\n */\nexport function getAccountVoteHistoryInfiniteQueryOptions<F>(\n username: string,\n options?: {\n limit?: number;\n filters?: F[];\n dayLimit?: number;\n }\n) {\n const { limit = 20, filters = [], dayLimit = 7.0 } = options ?? {};\n\n return infiniteQueryOptions<\n VoteHistoryPage,\n Error,\n InfiniteData<VoteHistoryPage, VoteHistoryPageParam>,\n (string | number)[],\n VoteHistoryPageParam\n >({\n queryKey: QueryKeys.accounts.voteHistory(username, limit),\n initialPageParam: { start: -1 },\n\n queryFn: async ({ pageParam }: { pageParam: VoteHistoryPageParam }) => {\n const { start } = pageParam;\n\n const response = (await callRPC(\"condenser_api.get_account_history\", [username, start, limit, ...filters])) as AccountVoteHistoryRecord[];\n\n const mappedResults: VoteHistoryResult[] = response.map(([num, historyObj]) => ({\n ...historyObj.op[1],\n num,\n timestamp: historyObj.timestamp,\n }));\n\n const result = mappedResults.filter(\n (filtered) =>\n filtered.voter === username &&\n filtered.weight !== 0 &&\n getDays(filtered.timestamp) <= dayLimit\n );\n\n const entries: Entry[] = [];\n for (const obj of result) {\n const post = await CONFIG.queryClient.fetchQuery(\n getPostQueryOptions(obj.author, obj.permlink)\n );\n if (isEntry(post)) entries.push(post);\n }\n\n const [firstHistory] = response;\n\n return {\n lastDate: firstHistory ? getDays(firstHistory[1].timestamp) : 0,\n lastItemFetched: firstHistory ? firstHistory[0] : start,\n entries,\n };\n },\n\n getNextPageParam: (lastPage: VoteHistoryPage): VoteHistoryPageParam => ({\n start: lastPage.lastItemFetched,\n }),\n });\n}\n"]}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import {c as c$1}from'./chunk-WV4Y4D4E.js';import {a}from'./chunk-LEYBAREX.js';import {c,a as a$2}from'./chunk-Q567KEFE.js';import {a as a$3}from'./chunk-HEILHNSR.js';import {a as a$1}from'./chunk-JDGZ4DHM.js';import {queryOptions,infiniteQueryOptions}from'@tanstack/react-query';function D(n,i,c$2,t,a$4,e){return queryOptions({queryKey:a$3.search.results(n,i,c$2,t,a$4,e),queryFn:async({signal:r})=>{let s={q:n,sort:i,hide_low:c$2};t&&(s.since=t),a$4&&(s.scroll_id=a$4),e&&(s.votes=e);let d=await fetch(c.privateApiHost+"/search-api/search",{method:"POST",headers:{"Content-Type":"application/json","X-Ecency-Client":c.clientId},body:JSON.stringify(s),signal:a$1(a$2,r)});return c$1(d)},retry:a})}function R(n,i,c$2=true){return infiniteQueryOptions({queryKey:a$3.search.controversialRising(n,i),initialPageParam:{sid:void 0,hasNextPage:true},queryFn:async({pageParam:t,signal:a})=>{if(!t.hasNextPage)return {hits:0,took:0,results:[]};let e,r=new Date;switch(i){case "today":e=new Date(r.getTime()-1440*60*1e3);break;case "week":e=new Date(r.getTime()-10080*60*1e3);break;case "month":e=new Date(r.getTime()-720*60*60*1e3);break;case "year":e=new Date(r.getTime()-365*24*60*60*1e3);break;default:e=void 0;}let s="* type:post",d=n==="rising"?"children":n,m=e?e.toISOString().split(".")[0]:void 0,P="0",f=i==="today"?50:200,g={q:s,sort:d,hide_low:P};m&&(g.since=m),t.sid&&(g.scroll_id=t.sid),(g.votes=f);let S=await fetch(c.privateApiHost+"/search-api/search",{method:"POST",headers:{"Content-Type":"application/json","X-Ecency-Client":c.clientId},body:JSON.stringify(g),signal:a$1(a$2,a)});return c$1(S)},getNextPageParam:t=>({sid:t?.scroll_id,hasNextPage:t.results.length>0}),enabled:c$2,retry:a})}export{D as a,R as b};//# sourceMappingURL=chunk-NJV3ON3L.js.map
|
|
2
|
+
//# sourceMappingURL=chunk-NJV3ON3L.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/modules/search/queries/get-search-query-options.ts"],"names":["searchQueryOptions","q","sort","hideLow","since","scroll_id","votes","queryOptions","QueryKeys","signal","data","response","CONFIG","withTimeoutSignal","INTERNAL_API_TIMEOUT_MS","parseSearchResponse","searchRetryPolicy","getControversialRisingInfiniteQueryOptions","what","tag","enabled","infiniteQueryOptions","pageParam","sinceDate","now","resp"],"mappings":"wRAMO,SAASA,CAAAA,CACdC,CAAAA,CACAC,CAAAA,CACAC,IACAC,CAAAA,CACAC,GAAAA,CACAC,CAAAA,CACA,CACA,OAAOC,YAAAA,CAAa,CAClB,QAAA,CAAUC,GAAAA,CAAU,OAAO,OAAA,CAAQP,CAAAA,CAAGC,CAAAA,CAAMC,GAAAA,CAASC,EAAOC,GAAAA,CAAWC,CAAK,CAAA,CAC5E,OAAA,CAAS,MAAO,CAAE,MAAA,CAAAG,CAAO,CAAA,GAAM,CAC7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AAA,CACA,IAAA,CAAM,IAAA,CAAK,SAAA,CAAUF,CAAI,CAAA,CACzB,MAAA,CAAQG,GAAAA,CAAkBC,GAAAA,CAAyBL,CAAM,CAC3D,CAAC,CAAA,CAID,OAAOM,IAAoBJ,CAAQ,CACrC,CAAA,CAEA,gBAAA,CAAmBc,IACV,CACL,GAAA,CAAKA,CAAAA,EAAM,SAAA,CACX,YAAaA,CAAAA,CAAK,OAAA,CAAQ,MAAA,CAAS,CACrC,GAGF,OAAA,CAAAL,GAAAA,CACA,KAAA,CAAOJ,CACT,CAAC,CACH","file":"chunk-NJV3ON3L.js","sourcesContent":["import { InfiniteData, infiniteQueryOptions, queryOptions } from \"@tanstack/react-query\";\nimport { CONFIG, INTERNAL_API_TIMEOUT_MS, withTimeoutSignal, QueryKeys } from \"@/modules/core\";\nimport { SearchResponse } from \"../types/search-response\";\nimport { parseSearchResponse } from \"../parse-json-response\";\nimport { searchRetryPolicy } from \"../retry-policy\";\n\nexport function searchQueryOptions(\n q: string,\n sort: string,\n hideLow: string,\n since?: string,\n scroll_id?: string,\n votes?: number\n) {\n return queryOptions({\n queryKey: QueryKeys.search.results(q, sort, hideLow, since, scroll_id, votes),\n queryFn: async ({ signal }) => {\n const data: {\n q: string;\n sort: string;\n hide_low: string;\n since?: string;\n scroll_id?: string;\n votes?: number;\n } = { q, sort, hide_low: hideLow };\n\n if (since) data.since = since;\n if (scroll_id) data.scroll_id = scroll_id;\n if (votes) data.votes = votes;\n\n const response = await fetch(CONFIG.privateApiHost + \"/search-api/search\", {\n method: \"POST\",\n headers: {\n \"Content-Type\": \"application/json\",\n \"X-Ecency-Client\": CONFIG.clientId,\n },\n body: JSON.stringify(data),\n signal: withTimeoutSignal(INTERNAL_API_TIMEOUT_MS, signal),\n });\n\n // Keeps the backend's own explanation of a rejected query on the error\n // (status + body) instead of collapsing it to a status code.\n return parseSearchResponse(response);\n },\n retry: searchRetryPolicy,\n });\n}\n\ntype PageParam = {\n sid: string | undefined;\n hasNextPage: boolean;\n};\n\nexport function getControversialRisingInfiniteQueryOptions(\n what: string,\n tag: string,\n enabled = true\n) {\n return infiniteQueryOptions<\n SearchResponse,\n Error,\n InfiniteData<SearchResponse, PageParam>,\n (string | number)[],\n PageParam\n >({\n queryKey: QueryKeys.search.controversialRising(what, tag),\n initialPageParam: { sid: undefined, hasNextPage: true } as PageParam,\n\n queryFn: async ({ pageParam, signal }: { pageParam: PageParam; signal: AbortSignal }) => {\n if (!pageParam.hasNextPage) {\n return {\n hits: 0,\n took: 0,\n results: [],\n };\n }\n\n let sinceDate: Date | undefined;\n const now = new Date();\n\n switch (tag) {\n case \"today\":\n sinceDate = new Date(now.getTime() - 24 * 60 * 60 * 1000);\n break;\n case \"week\":\n sinceDate = new Date(now.getTime() - 7 * 24 * 60 * 60 * 1000);\n break;\n case \"month\":\n sinceDate = new Date(now.getTime() - 30 * 24 * 60 * 60 * 1000);\n break;\n case \"year\":\n sinceDate = new Date(now.getTime() - 365 * 24 * 60 * 60 * 1000);\n break;\n default:\n sinceDate = undefined;\n }\n\n const q = \"* type:post\";\n const sort = what === \"rising\" ? \"children\" : what;\n const since = sinceDate ? sinceDate.toISOString().split(\".\")[0] : undefined;\n const hideLow = \"0\";\n const votes = tag === \"today\" ? 50 : 200;\n\n const data: {\n q: string;\n sort: string;\n hide_low: string;\n since?: string;\n scroll_id?: string;\n votes?: number;\n } = { q, sort, hide_low: hideLow };\n\n if (since) data.since = since;\n if (pageParam.sid) data.scroll_id = pageParam.sid;\n if (votes) data.votes = votes;\n\n const response = await fetch(CONFIG.privateApiHost + \"/search-api/search\", {\n method: \"POST\",\n headers: {\n \"Content-Type\": \"application/json\",\n \"X-Ecency-Client\": CONFIG.clientId,\n },\n body: JSON.stringify(data),\n signal: withTimeoutSignal(INTERNAL_API_TIMEOUT_MS, signal),\n });\n\n // Keeps the backend's own explanation of a rejected query on the error\n // (status + body) instead of collapsing it to a status code.\n return parseSearchResponse(response);\n },\n\n getNextPageParam: (resp: SearchResponse): PageParam => {\n return {\n sid: resp?.scroll_id,\n hasNextPage: resp.results.length > 0,\n };\n },\n\n enabled,\n retry: searchRetryPolicy,\n });\n}\n"]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {a}from'./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import {a}from'./chunk-EO6TGAAL.js';import {d}from'./chunk-Q567KEFE.js';import {a as a$1}from'./chunk-HEILHNSR.js';import {infiniteQueryOptions}from'@tanstack/react-query';function v(t,y){let r=y?.trim().toLowerCase();return infiniteQueryOptions({queryKey:a$1.posts.wavesFollowing(t,r??""),enabled:!!r,initialPageParam:void 0,queryFn:async({signal:u})=>{if(!r)return [];try{let n=d.getValidatedBaseUrl(),a$1=new URL("/private-api/waves/following",n);a$1.searchParams.set("container",t),a$1.searchParams.set("username",r);let o=await fetch(a$1.toString(),{method:"GET",headers:{"Content-Type":"application/json"},signal:u});if(!o.ok)throw new Error(`Failed to fetch waves following feed: ${o.status}`);let i=await o.json();if(!Array.isArray(i)||i.length===0)return [];let s=i.map(e=>a(e,t)).filter(e=>!!e);return s.length===0?[]:s.sort((e,c)=>new Date(c.created).getTime()-new Date(e.created).getTime())}catch(n){return console.error("[SDK] Failed to fetch waves following feed",n),[]}},getNextPageParam:()=>{}})}export{v as a};//# sourceMappingURL=chunk-OO7TNSDO.js.map
|
|
2
|
+
//# sourceMappingURL=chunk-OO7TNSDO.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/modules/posts/queries/get-waves-following-query-options.ts"],"names":["getWavesFollowingQueryOptions","host","username","normalizedUsername","infiniteQueryOptions","QueryKeys","signal","baseUrl","ConfigManager","url","response","data","flattened","entry","normalizeWaveEntryFromApi","a","b","error"],"mappings":"4KAWO,SAASA,CAAAA,CAA8BC,CAAAA,CAAcC,EAAmB,CAC7E,IAAMC,CAAAA,CAAqBD,CAAAA,EAAU,MAAK,CAAE,WAAA,GAE5C,OAAOE,oBAAAA,CA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AAI,IAAI,IAAA,CAAKD,CAAAA,CAAE,OAAO,CAAA,CAAE,SAChE,CACF,OAASE,CAAAA,CAAO,CACd,eAAQ,KAAA,CAAM,4CAAA,CAA8CA,CAAK,CAAA,CAC1D,EACT,CACF,CAAA,CAEA,iBAAkB,IAAG,CAAA,CACvB,CAAC,CACH","file":"chunk-
|
|
1
|
+
{"version":3,"sources":["../../src/modules/posts/queries/get-waves-following-query-options.ts"],"names":["getWavesFollowingQueryOptions","host","username","normalizedUsername","infiniteQueryOptions","QueryKeys","signal","baseUrl","ConfigManager","url","response","data","flattened","entry","normalizeWaveEntryFromApi","a","b","error"],"mappings":"4KAWO,SAASA,CAAAA,CAA8BC,CAAAA,CAAcC,EAAmB,CAC7E,IAAMC,CAAAA,CAAqBD,CAAAA,EAAU,MAAK,CAAE,WAAA,GAE5C,OAAOE,oBAAAA,CAAqB,CAC1B,QAAA,CAAUC,GAAAA,CAAU,KAAA,CAAM,cAAA,CAAeJ,EAAME,CAAAA,EAAsB,EAAE,EACvE,OAAA,CAAS,CAAA,CAAQA,EACjB,gBAAA,CAAkB,MAAA,CAElB,OAAA,CAAS,MAAO,CAAE,MAAA,CAAAG,CAAO,IAAM,CAC7B,GAAI,CAACH,CAAAA,CACH,OAAO,EAAC,CAGV,GAAI,CACF,IAAMI,EAAUC,CAAAA,CAAc,mBAAA,GACxBC,GAAAA,CAAM,IAAI,GAAA,CAAI,8BAAA,CAAgCF,CAAO,CAAA,CAC3DE,GAAAA,CAAI,aAAa,GAAA,CAAI,WAAA,CAAaR,CAAI,CAAA,CACtCQ,GAAAA,CAAI,YAAA,CAAa,GAAA,CAAI,WAAYN,CAAkB,CAAA,CAEnD,IAAMO,CAAAA,CAAW,MAAM,MAAMD,GAAAA,CAAI,QAAA,GAAY,CAC3C,MAAA,CAAQ,MACR,OAAA,CAAS,CACP,eAAgB,kBAClB,CAAA,CACA,OAAAH,CACF,CAAC,CAAA,CAED,GAAI,CAACI,CAAAA,CAAS,EAAA,CACZ,MAAM,IAAI,KAAA,CAAM,yCAAyCA,CAAAA,CAAS,MAAM,CAAA,CAAE,CAAA,CAG5E,IAAMC,CAAAA,CAAO,MAAMD,EAAS,IAAA,EAAK,CAEjC,GAAI,CAAC,KAAA,CAAM,OAAA,CAAQC,CAAI,GAAKA,CAAAA,CAAK,MAAA,GAAW,EAC1C,OAAO,GAGT,IAAMC,CAAAA,CAAYD,EACf,GAAA,CAAKE,CAAAA,EAAUC,EAA0BD,CAAAA,CAAOZ,CAAI,CAAC,CAAA,CACrD,MAAA,CAAQY,GAA8B,CAAA,CAAQA,CAAM,CAAA,CAEvD,OAAID,EAAU,MAAA,GAAW,CAAA,CAChB,EAAC,CAGHA,CAAAA,CAAU,KACf,CAACG,CAAAA,CAAGC,CAAAA,GAAM,IAAI,KAAKA,CAAAA,CAAE,OAAO,EAAE,OAAA,EAAQ,CAAI,IAAI,IAAA,CAAKD,CAAAA,CAAE,OAAO,CAAA,CAAE,SAChE,CACF,OAASE,CAAAA,CAAO,CACd,eAAQ,KAAA,CAAM,4CAAA,CAA8CA,CAAK,CAAA,CAC1D,EACT,CACF,CAAA,CAEA,iBAAkB,IAAG,CAAA,CACvB,CAAC,CACH","file":"chunk-OO7TNSDO.js","sourcesContent":["import { infiniteQueryOptions } from \"@tanstack/react-query\";\nimport { ConfigManager, QueryKeys } from \"@/modules/core\";\nimport { Entry, WaveEntry } from \"../types\";\nimport { normalizeWaveEntryFromApi } from \"../utils/waves-helpers\";\n\ntype WavesFollowingEntry = Entry & {\n post_id: number;\n container?: (Entry & { post_id: number }) | null;\n parent?: (Entry & { post_id: number }) | null;\n};\n\nexport function getWavesFollowingQueryOptions(host: string, username?: string) {\n const normalizedUsername = username?.trim().toLowerCase();\n\n return infiniteQueryOptions({\n queryKey: QueryKeys.posts.wavesFollowing(host, normalizedUsername ?? \"\"),\n enabled: Boolean(normalizedUsername),\n initialPageParam: undefined,\n\n queryFn: async ({ signal }) => {\n if (!normalizedUsername) {\n return [];\n }\n\n try {\n const baseUrl = ConfigManager.getValidatedBaseUrl();\n const url = new URL(\"/private-api/waves/following\", baseUrl);\n url.searchParams.set(\"container\", host);\n url.searchParams.set(\"username\", normalizedUsername);\n\n const response = await fetch(url.toString(), {\n method: \"GET\",\n headers: {\n \"Content-Type\": \"application/json\",\n },\n signal,\n });\n\n if (!response.ok) {\n throw new Error(`Failed to fetch waves following feed: ${response.status}`);\n }\n\n const data = await response.json() as WavesFollowingEntry[];\n\n if (!Array.isArray(data) || data.length === 0) {\n return [];\n }\n\n const flattened = data\n .map((entry) => normalizeWaveEntryFromApi(entry, host))\n .filter((entry): entry is WaveEntry => Boolean(entry));\n\n if (flattened.length === 0) {\n return [];\n }\n\n return flattened.sort(\n (a, b) => new Date(b.created).getTime() - new Date(a.created).getTime()\n );\n } catch (error) {\n console.error(\"[SDK] Failed to fetch waves following feed\", error);\n return [];\n }\n },\n\n getNextPageParam: () => undefined,\n });\n}\n"]}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import {a}from'./chunk-S4YYOQEV.js';import {g as g$1}from'./chunk-2ANYOCYN.js';import {b}from'./chunk-36AOY64H.js';import {c}from'./chunk-Q567KEFE.js';import {a as a$1}from'./chunk-HEILHNSR.js';import {j}from'./chunk-UB5YHSMC.js';import {queryOptions}from'@tanstack/react-query';var O=(n=>(n.trending="trending",n.author_reputation="author_reputation",n.votes="votes",n.created="created",n))(O||{});function g(t){let e=t.match(/^(\d+\.?\d*)\s*([A-Z]+)$/);return e?{amount:parseFloat(e[1]),symbol:e[2]}:{amount:0,symbol:""}}function $(t,e,l){let p=r=>g(r.pending_payout_value).amount+g(r.author_payout_value).amount+g(r.curator_payout_value).amount,n=r=>r.net_rshares<0,i=a(t?.json_metadata)?.pinned_reply,u=r=>i===`${r.author}/${r.permlink}`,d={trending:(r,c)=>{if(n(r))return 1;if(n(c))return -1;let s=p(r),o=p(c);return s!==o?o-s:0},author_reputation:(r,c)=>{let s=r.author_reputation,o=c.author_reputation;return s>o?-1:s<o?1:0},votes:(r,c)=>{let s=r.children,o=c.children;return s>o?-1:s<o?1:0},created:(r,c)=>{if(n(r))return 1;if(n(c))return -1;let s=Date.parse(r.created),o=Date.parse(c.created);return s>o?-1:s<o?1:0}},y=e.sort(d[l]),m=y.findIndex(r=>u(r)),a$1=y[m];return m>=0&&(y.splice(m,1),y.unshift(a$1)),y}function B(t,e="created",l=true,p){let n=p||c.defaultObserver;return queryOptions({queryKey:a$1.posts.discussions(t?.author,t?.permlink,e,n),queryFn:async()=>{if(!t)return [];let i=await j("bridge.get_discussion",{author:t.author,permlink:t.permlink,observer:n}),u=i?Array.from(Object.values(i)):[];return b(u)},enabled:l&&!!t,select:i=>$(t,i,e),structuralSharing:(i,u)=>{if(!i||!u)return u;let d=i.filter(a=>a.is_optimistic===true),y=new Set(u.map(a=>`${a.author}/${a.permlink}`)),m=d.filter(a=>!y.has(`${a.author}/${a.permlink}`));return m.length>0?[...u,...m]:u}})}function I(t,e,l,p=true){let n=l||c.defaultObserver;return queryOptions({queryKey:a$1.posts.discussion(t,e,n),enabled:p&&!!t&&!!e,queryFn:async()=>g$1(t,e,n)})}export{O as a,$ as b,B as c,I as d};//# sourceMappingURL=chunk-PAE3HIPT.js.map
|
|
2
|
+
//# sourceMappingURL=chunk-PAE3HIPT.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/modules/posts/queries/get-discussions-query-options.ts"],"names":["SortOrder","parseAsset","value","match","sortDiscussions","entry","discussion","order","allPayout","c","absNegative","a","pinnedReply","parseJsonMetadata","isPinned","sortOrders","b","_a","_b","keyA","keyB","sorted","pinnedIndex","i","pinned","getDiscussionsQueryOptions","enabled","observer","resolvedObserver","CONFIG","queryOptions","QueryKeys","response","callRPC","results","filterDmcaEntry","data","oldData","newData","optimisticEntries","fetchedPermlinks","e","missingOptimistic","opt","getDiscussionQueryOptions","author","permlink","getDiscussion"],"mappings":"8RAQO,IAAKA,OACVA,CAAAA,CAAA,QAAA,CAAW,U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CAAE,QAAQ,EAAE,CACpE,CAAA,CAEMC,CAAAA,CAAoBH,CAAAA,CAAkB,MAAA,CACzCI,CAAAA,EAAe,CAACH,CAAAA,CAAiB,GAAA,CAAI,CAAA,EAAGG,CAAAA,CAAI,MAAM,CAAA,CAAA,EAAIA,EAAI,QAAQ,CAAA,CAAE,CACvE,CAAA,CAGA,OAAID,CAAAA,CAAkB,OAAS,CAAA,CACtB,CAAC,GAAIJ,CAAAA,CAAqB,GAAGI,CAAiB,CAAA,CAGhDJ,CACT,CACF,CAAC,CACH,CAEO,SAASM,CAAAA,CACdC,CAAAA,CACAC,CAAAA,CACAnB,CAAAA,CACAD,CAAAA,CAAU,IAAA,CACV,CACA,IAAME,CAAAA,CAAmBD,CAAAA,EAAYE,CAAAA,CAAO,eAAA,CAE5C,OAAOC,aAAa,CAClB,QAAA,CAAUC,GAAAA,CAAU,KAAA,CAAM,UAAA,CAAWc,CAAAA,CAAQC,EAAUlB,CAAgB,CAAA,CACvE,OAAA,CAASF,CAAAA,EAAW,CAAC,CAACmB,GAAU,CAAC,CAACC,CAAAA,CAClC,OAAA,CAAS,SACPC,GAAAA,CAAcF,EAAQC,CAAAA,CAAUlB,CAAgB,CAIpD,CAAC,CACH","file":"chunk-QO2TFHO2.js","sourcesContent":["import { CONFIG, QueryKeys } from \"@/modules/core\";\nimport { queryOptions } from \"@tanstack/react-query\";\nimport { Entry } from \"../types\";\nimport { filterDmcaEntry } from \"../utils/filter-dmca-entries\";\nimport { getDiscussion } from \"@/modules/bridge\";\nimport { callRPC } from \"@/modules/core/hive-tx\";\nimport { parseJsonMetadata } from \"../utils/parse-json-metadata\";\n\nexport enum SortOrder {\n trending = \"trending\",\n author_reputation = \"author_reputation\",\n votes = \"votes\",\n created = \"created\",\n}\n\nfunction parseAsset(value: string): { amount: number; symbol: string } {\n const match = value.match(/^(\\d+\\.?\\d*)\\s*([A-Z]+)$/);\n if (!match) return { amount: 0, symbol: \"\" };\n return {\n amount: parseFloat(match[1]),\n symbol: match[2],\n };\n}\n\nexport function sortDiscussions(\n entry: Entry,\n discussion: Entry[],\n order: SortOrder\n) {\n const allPayout = (c: Entry) =>\n parseAsset(c.pending_payout_value).amount +\n parseAsset(c.author_payout_value).amount +\n parseAsset(c.curator_payout_value).amount;\n\n const absNegative = (a: Entry) => a.net_rshares < 0;\n // Parsed rather than read straight off the value: an entry fetched through\n // condenser_api carries json_metadata as a string (the decks columns fetch\n // that way), and `\"…\".pinned_reply` is undefined, so the pinned reply lost\n // its place at the top of the thread. Parsed once here, not per comparison.\n const pinnedReply = parseJsonMetadata(entry?.json_metadata)?.pinned_reply;\n const isPinned = (a: Entry) => pinnedReply === `${a.author}/${a.permlink}`;\n\n const sortOrders = {\n trending: (a: Entry, b: Entry) => {\n if (absNegative(a)) {\n return 1;\n }\n\n if (absNegative(b)) {\n return -1;\n }\n\n const _a = allPayout(a);\n const _b = allPayout(b);\n if (_a !== _b) {\n return _b - _a;\n }\n\n return 0;\n },\n author_reputation: (a: Entry, b: Entry) => {\n const keyA = a.author_reputation;\n const keyB = b.author_reputation;\n\n if (keyA > keyB) return -1;\n if (keyA < keyB) return 1;\n\n return 0;\n },\n votes: (a: Entry, b: Entry) => {\n const keyA = a.children;\n const keyB = b.children;\n\n if (keyA > keyB) return -1;\n if (keyA < keyB) return 1;\n\n return 0;\n },\n created: (a: Entry, b: Entry) => {\n if (absNegative(a)) {\n return 1;\n }\n\n if (absNegative(b)) {\n return -1;\n }\n\n const keyA = Date.parse(a.created);\n const keyB = Date.parse(b.created);\n\n if (keyA > keyB) return -1;\n if (keyA < keyB) return 1;\n\n return 0;\n },\n };\n\n const sorted = discussion.sort(sortOrders[order]);\n const pinnedIndex = sorted.findIndex((i) => isPinned(i));\n const pinned = sorted[pinnedIndex];\n if (pinnedIndex >= 0) {\n sorted.splice(pinnedIndex, 1);\n sorted.unshift(pinned);\n }\n return sorted;\n}\n\nexport function getDiscussionsQueryOptions(\n entry: Entry,\n order: SortOrder = SortOrder.created,\n enabled: boolean = true,\n observer?: string\n) {\n // Anonymous readers fall back to CONFIG.defaultObserver rather than the post\n // author. Author-as-observer only helps the minority of authors who curate a\n // mute list; everyone else's comment section came back unfiltered, so the\n // shared moderation account is the better default for logged-out traffic.\n const resolvedObserver = observer || CONFIG.defaultObserver;\n\n return queryOptions({\n queryKey: QueryKeys.posts.discussions(entry?.author, entry?.permlink, order, resolvedObserver),\n queryFn: async () => {\n if (!entry) {\n return [];\n }\n\n const response = await callRPC(\"bridge.get_discussion\", {\n author: entry.author,\n permlink: entry.permlink,\n observer: resolvedObserver,\n });\n\n const results = response\n ? Array.from(Object.values(response as Record<string, Entry>))\n : [];\n return filterDmcaEntry(results);\n },\n enabled: enabled && !!entry,\n select: (data: Entry[]) => sortDiscussions(entry, data, order),\n // Preserve optimistic entries during refetch by using structural sharing\n // This ensures newly added comments (is_optimistic: true) aren't wiped out\n // when blockchain hasn't indexed them yet\n structuralSharing: (oldData, newData) => {\n if (!oldData || !newData) return newData;\n\n // Find optimistic entries in old data that aren't in new data yet\n const optimisticEntries = (oldData as Entry[]).filter(\n (entry: Entry) => entry.is_optimistic === true\n );\n\n const fetchedPermlinks = new Set(\n (newData as Entry[]).map((e: Entry) => `${e.author}/${e.permlink}`)\n );\n\n const missingOptimistic = optimisticEntries.filter(\n (opt: Entry) => !fetchedPermlinks.has(`${opt.author}/${opt.permlink}`)\n );\n\n // If there are optimistic entries missing from new data, preserve them\n if (missingOptimistic.length > 0) {\n return [...(newData as Entry[]), ...missingOptimistic];\n }\n\n return newData;\n },\n });\n}\n\nexport function getDiscussionQueryOptions(\n author: string,\n permlink: string,\n observer?: string,\n enabled = true\n) {\n const resolvedObserver = observer || CONFIG.defaultObserver;\n\n return queryOptions({\n queryKey: QueryKeys.posts.discussion(author, permlink, resolvedObserver),\n enabled: enabled && !!author && !!permlink,\n queryFn: async () =>\n getDiscussion(author, permlink, resolvedObserver) as Promise<Record<\n string,\n Entry\n > | null>,\n });\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../../src/modules/posts/queries/get-discussions-query-options.ts"],"names":["SortOrder","parseAsset","value","match","sortDiscussions","entry","discussion","order","allPayout","c","absNegative","a","pinnedReply","parseJsonMetadata","isPinned","sortOrders","b","_a","_b","keyA","keyB","sorted","pinnedIndex","i","pinned","getDiscussionsQueryOptions","enabled","observer","resolvedObserver","CONFIG","queryOptions","QueryKeys","response","callRPC","results","filterDmcaEntry","data","oldData","newData","optimisticEntries","fetchedPermlinks","e","missingOptimistic","opt","getDiscussionQueryOptions","author","permlink","getDiscussion"],"mappings":"uRAQO,IAAKA,OACVA,CAAAA,CAAA,QAAA,CAAW,UAAA,CACXA,CAAAA,CAAA,iBAAA,CAAoB,mBAAA,CACpBA,EAAA,KAAA,CAAQ,OAAA,CACRA,CAAAA,CAAA,OAAA,CAAU,SAAA,CAJAA,CAAAA,CAAAA,EAAAA,CAAAA,EAAA,IAOZ,SAASC,CAAAA,CAAWC,CAAAA,CAAmD,CACrE,IAAMC,CAAAA,CAAQD,EAAM,KAAA,CAAM,0BAA0B,EACpD,OAAKC,CAAAA,CACE,CACL,MAAA,CAAQ,UAAA,CAAWA,CAAAA,CAAM,CAAC,CAAC,CAAA,CAC3B,OAAQA,CAAAA,CAAM,CAAC,CACjB,CAAA,CAJmB,CAAE,MAAA,CAAQ,EAAG,MAAA,CAAQ,EAAG,CAK7C,CAEO,SAASC,CAAAA,CACdC,EACAC,CAAAA,CACAC,CAAAA,CACA,CACA,IAAMC,CAAAA,CAAaC,GACjBR,CAAAA,CAAWQ,CAAAA,CAAE,oBAAoB,CAAA,CAAE,MAAA,CACnCR,CAAAA,CAAWQ,EAAE,mBAAmB,CAAA,CAAE,MAAA,CAClCR,CAAAA,CAAWQ,CAAAA,CAAE,oBAAoB,EAAE,MAAA,CAE/BC,CAAAA,CAAeC,CAAAA,EAAaA,CAAAA,CAAE,WAAA,CAAc,CAAA,CAK5CC,EAAcC,CAAAA,CAAkBR,CAAAA,EAAO,aAAa,CAAA,EAAG,YA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from \"@tanstack/react-query\";\nimport { Entry } from \"../types\";\nimport { filterDmcaEntry } from \"../utils/filter-dmca-entries\";\nimport { getDiscussion } from \"@/modules/bridge\";\nimport { callRPC } from \"@/modules/core/hive-tx\";\nimport { parseJsonMetadata } from \"../utils/parse-json-metadata\";\n\nexport enum SortOrder {\n trending = \"trending\",\n author_reputation = \"author_reputation\",\n votes = \"votes\",\n created = \"created\",\n}\n\nfunction parseAsset(value: string): { amount: number; symbol: string } {\n const match = value.match(/^(\\d+\\.?\\d*)\\s*([A-Z]+)$/);\n if (!match) return { amount: 0, symbol: \"\" };\n return {\n amount: parseFloat(match[1]),\n symbol: match[2],\n };\n}\n\nexport function sortDiscussions(\n entry: Entry,\n discussion: Entry[],\n order: SortOrder\n) {\n const allPayout = (c: Entry) =>\n parseAsset(c.pending_payout_value).amount +\n parseAsset(c.author_payout_value).amount +\n parseAsset(c.curator_payout_value).amount;\n\n const absNegative = (a: Entry) => a.net_rshares < 0;\n // Parsed rather than read straight off the value: an entry fetched through\n // condenser_api carries json_metadata as a string (the decks columns fetch\n // that way), and `\"…\".pinned_reply` is undefined, so the pinned reply lost\n // its place at the top of the thread. Parsed once here, not per comparison.\n const pinnedReply = parseJsonMetadata(entry?.json_metadata)?.pinned_reply;\n const isPinned = (a: Entry) => pinnedReply === `${a.author}/${a.permlink}`;\n\n const sortOrders = {\n trending: (a: Entry, b: Entry) => {\n if (absNegative(a)) {\n return 1;\n }\n\n if (absNegative(b)) {\n return -1;\n }\n\n const _a = allPayout(a);\n const _b = allPayout(b);\n if (_a !== _b) {\n return _b - _a;\n }\n\n return 0;\n },\n author_reputation: (a: Entry, b: Entry) => {\n const keyA = a.author_reputation;\n const keyB = b.author_reputation;\n\n if (keyA > keyB) return -1;\n if (keyA < keyB) return 1;\n\n return 0;\n },\n votes: (a: Entry, b: Entry) => {\n const keyA = a.children;\n const keyB = b.children;\n\n if (keyA > keyB) return -1;\n if (keyA < keyB) return 1;\n\n return 0;\n },\n created: (a: Entry, b: Entry) => {\n if (absNegative(a)) {\n return 1;\n }\n\n if (absNegative(b)) {\n return -1;\n }\n\n const keyA = Date.parse(a.created);\n const keyB = Date.parse(b.created);\n\n if (keyA > keyB) return -1;\n if (keyA < keyB) return 1;\n\n return 0;\n },\n };\n\n const sorted = discussion.sort(sortOrders[order]);\n const pinnedIndex = sorted.findIndex((i) => isPinned(i));\n const pinned = sorted[pinnedIndex];\n if (pinnedIndex >= 0) {\n sorted.splice(pinnedIndex, 1);\n sorted.unshift(pinned);\n }\n return sorted;\n}\n\nexport function getDiscussionsQueryOptions(\n entry: Entry,\n order: SortOrder = SortOrder.created,\n enabled: boolean = true,\n observer?: string\n) {\n // Anonymous readers fall back to CONFIG.defaultObserver rather than the post\n // author. Author-as-observer only helps the minority of authors who curate a\n // mute list; everyone else's comment section came back unfiltered, so the\n // shared moderation account is the better default for logged-out traffic.\n const resolvedObserver = observer || CONFIG.defaultObserver;\n\n return queryOptions({\n queryKey: QueryKeys.posts.discussions(entry?.author, entry?.permlink, order, resolvedObserver),\n queryFn: async () => {\n if (!entry) {\n return [];\n }\n\n const response = await callRPC(\"bridge.get_discussion\", {\n author: entry.author,\n permlink: entry.permlink,\n observer: resolvedObserver,\n });\n\n const results = response\n ? Array.from(Object.values(response as Record<string, Entry>))\n : [];\n return filterDmcaEntry(results);\n },\n enabled: enabled && !!entry,\n select: (data: Entry[]) => sortDiscussions(entry, data, order),\n // Preserve optimistic entries during refetch by using structural sharing\n // This ensures newly added comments (is_optimistic: true) aren't wiped out\n // when blockchain hasn't indexed them yet\n structuralSharing: (oldData, newData) => {\n if (!oldData || !newData) return newData;\n\n // Find optimistic entries in old data that aren't in new data yet\n const optimisticEntries = (oldData as Entry[]).filter(\n (entry: Entry) => entry.is_optimistic === true\n );\n\n const fetchedPermlinks = new Set(\n (newData as Entry[]).map((e: Entry) => `${e.author}/${e.permlink}`)\n );\n\n const missingOptimistic = optimisticEntries.filter(\n (opt: Entry) => !fetchedPermlinks.has(`${opt.author}/${opt.permlink}`)\n );\n\n // If there are optimistic entries missing from new data, preserve them\n if (missingOptimistic.length > 0) {\n return [...(newData as Entry[]), ...missingOptimistic];\n }\n\n return newData;\n },\n });\n}\n\nexport function getDiscussionQueryOptions(\n author: string,\n permlink: string,\n observer?: string,\n enabled = true\n) {\n const resolvedObserver = observer || CONFIG.defaultObserver;\n\n return queryOptions({\n queryKey: QueryKeys.posts.discussion(author, permlink, resolvedObserver),\n enabled: enabled && !!author && !!permlink,\n queryFn: async () =>\n getDiscussion(author, permlink, resolvedObserver) as Promise<Record<\n string,\n Entry\n > | null>,\n });\n}\n"]}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import {c as c$1,a as a$3}from'./chunk-WV4Y4D4E.js';import {a as a$1}from'./chunk-SEACJS36.js';import {a,c}from'./chunk-Q567KEFE.js';import {a as a$2}from'./chunk-JDGZ4DHM.js';async function S(n,e,r,s,t,h,d){let o={q:n,sort:e,hide_low:r};s&&(o.since=s),t&&(o.scroll_id=t),h&&(o.votes=h);let m=await a$1()(c.privateApiHost+"/search-api/search",{method:"POST",headers:{"Content-Type":"application/json","X-Ecency-Client":c.clientId},body:JSON.stringify(o),signal:a$2(a,d)});return c$1(m)}async function u(n,e,r=a){let t=await a$1()(c.privateApiHost+"/search-api/similar",{method:"POST",headers:{"Content-Type":"application/json","X-Ecency-Client":c.clientId},body:JSON.stringify(n),signal:a$2(r,e)});return c$1(t)}async function b(n,e){let s=await a$1()(c.privateApiHost+"/search-api/search-path",{method:"POST",headers:{"Content-Type":"application/json","X-Ecency-Client":c.clientId},body:JSON.stringify({q:n}),signal:a$2(a,e)}),t=await a$3(s,Array.isArray);return t?.length>0?t:[n]}export{S as a,u as b,b as c};//# sourceMappingURL=chunk-QDXJMILO.js.map
|
|
2
|
+
//# sourceMappingURL=chunk-QDXJMILO.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/modules/search/requests.ts"],"names":["search","q","sort","hideLow","since","scroll_id","votes","signal","data","response","getBoundFetch","CONFIG","withTimeoutSignal","INTERNAL_API_TIMEOUT_MS","parseSearchResponse","similar","params","timeoutMs","searchPath","parseJsonResponse"],"mappings":"gLAIA,eAAsBA,EACpBC,CAAAA,CACAC,CAAAA,CACAC,CAAAA,CACAC,CAAAA,CACAC,EACAC,CAAAA,CACAC,CAAAA,CACyB,CACzB,IAAMC,EAOF,CAAE,CAAA,CAAAP,CAAAA,CAAG,IAAA,CAAAC,EAAM,QAAA,CAAUC,CAAQ,CAAA,CAE7BC,CAAAA,GACFI,EAAK,KAAA,CAAQJ,CAAAA,CAAAA,CAEXC,CAAAA,GACFG,CAAAA,CAAK,UAAYH,CAAAA,CAAAA,CAEfC,CAAAA,GACFE,CAAAA,CAAK,KAAA,CAAQF,GAIf,IAAMG,CAAAA,CAAW,MADAC,GAAAA,EAAc,CACCC,EAAO,cAAA,CAAiB,oBAAA,CAAsB,CAC5E,MAAA,CAAQ,OACR,OAAA,CAAS,CACP,cAAA,CAAgB,kBAAA,CAChB,kBAAmBA,CAAAA,CAAO,QAC5B,CAAA,CACA,IAAA,CAAM,KAAK,SAAA,CAAUH,CAAI,EACzB,MAAA,CAAQI,GAAAA,CAAkBC,EAAyBN,CAAM,CAC3D,CAAC,CAAA,CAED,OAAOO,GAAAA,CAAoBL,CAAQ,CACrC,CAEA,eAAsBM,CAAAA,CACpBC,CAAAA,CAQAT,CAAAA,CACAU,CAAAA,CAAoBJ,EACK,CAEzB,IAAMJ,EAAW,MADAC,GAAAA,GACeC,CAAAA,CAAO,cAAA,CAAiB,qBAAA,CAAuB,CAC7E,OAAQ,MAAA,CACR,OAAA,CAAS,CACP,cAAA,CAAgB,mBAChB,iBAAA,CAAmBA,CAAAA,CAAO,QAC5B,CAAA,CACA,KAAM,IAAA,CAAK,SAAA,CAAUK,CAAM,CAAA,CAC3B,MAAA,CAAQJ,IAAkBK,CAAAA,CAAWV,CAAM,CAC7C,CAAC,EAED,OAAOO,GAAAA,CAAoBL,CAAQ,CACrC,CAEA,eAAsBS,CAAAA,CAAWjB,CAAAA,CAAWM,CAAAA,CAAyC,CAEnF,IAAME,CAAAA,CAAW,MADAC,GAAAA,EAAc,CACCC,EAAO,cAAA,CAAiB,yBAAA,CAA2B,CACjF,MAAA,CAAQ,OACR,OAAA,CAAS,CACP,cAAA,CAAgB,kBAAA,CAChB,kBAAmBA,CAAAA,CAAO,QAC5B,CAAA,CACA,IAAA,CAAM,KAAK,SAAA,CAAU,CAAE,EAAAV,CAAE,CAAC,EAC1B,MAAA,CAAQW,GAAAA,CAAkBC,CAAAA,CAAyBN,CAAM,CAC3D,CAAC,CAAA,CAEKC,CAAAA,CAAO,MAAMW,IAA4BV,CAAAA,CAAU,KAAA,CAAM,OAAO,CAAA,CACtE,OAAOD,CAAAA,EAAM,MAAA,CAAS,EAAIA,CAAAA,CAAO,CAACP,CAAC,CACrC","file":"chunk-QDXJMILO.js","sourcesContent":["import { CONFIG, INTERNAL_API_TIMEOUT_MS, getBoundFetch, withTimeoutSignal } from \"@/modules/core\";\nimport { SearchResponse } from \"./types/search-response\";\nimport { parseJsonResponse, parseSearchResponse } from \"./parse-json-response\";\n\nexport async function search(\n q: string,\n sort: string,\n hideLow: string,\n since?: string,\n scroll_id?: string,\n votes?: number,\n signal?: AbortSignal\n): Promise<SearchResponse> {\n const data: {\n q: string;\n sort: string;\n hide_low: string;\n since?: string;\n scroll_id?: string;\n votes?: number;\n } = { q, sort, hide_low: hideLow };\n\n if (since) {\n data.since = since;\n }\n if (scroll_id) {\n data.scroll_id = scroll_id;\n }\n if (votes) {\n data.votes = votes;\n }\n\n const fetchApi = getBoundFetch();\n const response = await fetchApi(CONFIG.privateApiHost + \"/search-api/search\", {\n method: \"POST\",\n headers: {\n \"Content-Type\": \"application/json\",\n \"X-Ecency-Client\": CONFIG.clientId,\n },\n body: JSON.stringify(data),\n signal: withTimeoutSignal(INTERNAL_API_TIMEOUT_MS, signal),\n });\n\n return parseSearchResponse(response);\n}\n\nexport async function similar(\n params: {\n author: string;\n permlink: string;\n title?: string;\n body?: string;\n tags?: string[];\n since?: string;\n },\n signal?: AbortSignal,\n timeoutMs: number = INTERNAL_API_TIMEOUT_MS\n): Promise<SearchResponse> {\n const fetchApi = getBoundFetch();\n const response = await fetchApi(CONFIG.privateApiHost + \"/search-api/similar\", {\n method: \"POST\",\n headers: {\n \"Content-Type\": \"application/json\",\n \"X-Ecency-Client\": CONFIG.clientId,\n },\n body: JSON.stringify(params),\n signal: withTimeoutSignal(timeoutMs, signal),\n });\n\n return parseSearchResponse(response);\n}\n\nexport async function searchPath(q: string, signal?: AbortSignal): Promise<string[]> {\n const fetchApi = getBoundFetch();\n const response = await fetchApi(CONFIG.privateApiHost + \"/search-api/search-path\", {\n method: \"POST\",\n headers: {\n \"Content-Type\": \"application/json\",\n \"X-Ecency-Client\": CONFIG.clientId,\n },\n body: JSON.stringify({ q }),\n signal: withTimeoutSignal(INTERNAL_API_TIMEOUT_MS, signal),\n });\n\n const data = await parseJsonResponse<string[]>(response, Array.isArray);\n return data?.length > 0 ? data : [q];\n}\n"]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {c,d}from'./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import {c,d}from'./chunk-EO6TGAAL.js';import {a}from'./chunk-HEILHNSR.js';import {j}from'./chunk-UB5YHSMC.js';import {infiniteQueryOptions}from'@tanstack/react-query';var h=5,W=50;async function _(n,e){let r=e?.author,s=e?.permlink,c$1=0,i=e?.post_id;for(;c$1<W;){let f={sort:"posts",account:n,limit:h,...r?{start_author:r}:{},...s?{start_permlink:s}:{}},a;try{a=await j("bridge.get_account_posts",f);}catch(t){return console.error("[SDK] getThreads get_account_posts error:",t),null}if(!a||a.length===0)return null;let o=a.map(t=>(t.id=t.post_id,t.host=n,t));for(let t of o){if(i&&t.post_id===i){i=void 0;continue}if(c$1+=1,t.stats?.gray){r=t.author,s=t.permlink;continue}let l;try{l=await c(t);}catch(d){console.error("[SDK] getThreads get_discussion error:",d),r=t.author,s=t.permlink;continue}if(l.length===0){r=t.author,s=t.permlink;continue}return {entries:d(l,t,n)}}let u=o[o.length-1];if(!u)return null;r=u.author,s=u.permlink;}return null}function A(n){return infiniteQueryOptions({queryKey:a.posts.wavesByHost(n),initialPageParam:void 0,queryFn:async({pageParam:e})=>{let r=await _(n,e);return r?r.entries:[]},getNextPageParam:e=>e?.[0]?.container})}export{A as a};//# sourceMappingURL=chunk-R6ITDRKU.js.map
|
|
2
|
+
//# sourceMappingURL=chunk-R6ITDRKU.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/modules/posts/queries/get-waves-by-host-query-options.ts"],"names":["THREAD_CONTAINER_BATCH_SIZE","MAX_CONTAINERS_TO_SCAN","getThreads","host","pageParam","startAuthor","startPermlink","scannedContainers","skipContainerId","rpcParams","containers","callRPC","err","normalizedContainers","container","visibleItems","getVisibleFirstLevelThreadItems","mapThreadItemsToWaveEntries","lastContainer","getWavesByHostQueryOptions","infiniteQueryOptions","QueryKeys","result","lastPage"],"mappings":"uKASA,IAAMA,CAAAA,CAA8B,CAAA,CAC9BC,CAAAA,CAAyB,EAAA,CAM/B,eAAeC,CAAAA,CACbC,CAAAA,CACAC,CAAAA,CAC+B,CAC/B,IAAIC,CAAAA,CAAcD,CAAAA,EAAW,MAAA,CACzBE,CAAAA,CAAgBF,CAAAA,EAAW,QAAA,CAC3BG,GAAAA,CAAoB,CAAA,CACpBC,CAAAA,CAAkBJ,CAAAA,EAAW,OAAA,CAEjC,KAAOG,GAAAA,CAAoBN,CAAAA,EAAwB,CASjD,IAAMQ,CAAAA,CAAgC,CACpC,IAAA,CAAM,OAAA,CACN,OAAA,CAASN,CAAAA,CACT,KAAA,CAAOH,CAAAA,CACP,GAAIK,CAAAA,CAAc,CAAE,YAAA,CAAcA,CAAY,EAAI,EAAC,CACnD,GAAIC,CAAAA,CAAgB,CAAE,cAAA,CAAgBA,CAAc,CAAA,CAAI,EA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AA4BF,CAAAA,CAAcD,CAAAA,CAAWX,CAAI,CACpE,CACF,CAEA,IAAMe,CAAAA,CAAgBL,CAAAA,CAAqBA,CAAAA,CAAqB,MAAA,CAAS,CAAC,EAE1E,GAAI,CAACK,CAAAA,CACH,OAAO,IAAA,CAGTb,CAAAA,CAAca,CAAAA,CAAc,MAAA,CAC5BZ,CAAAA,CAAgBY,CAAAA,CAAc,SAChC,CAEA,OAAO,IACT,CAMO,SAASC,CAAAA,CAA2BhB,CAAAA,CAAc,CACvD,OAAOiB,oBAAAA,CAML,CACA,QAAA,CAAUC,CAAAA,CAAU,KAAA,CAAM,WAAA,CAAYlB,CAAI,CAAA,CAC1C,gBAAA,CAAkB,OAElB,OAAA,CAAS,MAAO,CAAE,SAAA,CAAAC,CAAU,CAAA,GAAkC,CAC5D,IAAMkB,CAAAA,CAAS,MAAMpB,CAAAA,CAAWC,CAAAA,CAAMC,CAAS,CAAA,CAC/C,OAAKkB,CAAAA,CAEEA,CAAAA,CAAO,OAAA,CAFM,EAGtB,CAAA,CAEA,gBAAA,CAAmBC,CAAAA,EAAqCA,CAAAA,GAAW,CAAC,CAAA,EAAG,SACzE,CAAC,CACH","file":"chunk-
|
|
1
|
+
{"version":3,"sources":["../../src/modules/posts/queries/get-waves-by-host-query-options.ts"],"names":["THREAD_CONTAINER_BATCH_SIZE","MAX_CONTAINERS_TO_SCAN","getThreads","host","pageParam","startAuthor","startPermlink","scannedContainers","skipContainerId","rpcParams","containers","callRPC","err","normalizedContainers","container","visibleItems","getVisibleFirstLevelThreadItems","mapThreadItemsToWaveEntries","lastContainer","getWavesByHostQueryOptions","infiniteQueryOptions","QueryKeys","result","lastPage"],"mappings":"uKASA,IAAMA,CAAAA,CAA8B,CAAA,CAC9BC,CAAAA,CAAyB,EAAA,CAM/B,eAAeC,CAAAA,CACbC,CAAAA,CACAC,CAAAA,CAC+B,CAC/B,IAAIC,CAAAA,CAAcD,CAAAA,EAAW,MAAA,CACzBE,CAAAA,CAAgBF,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,EAChE,OAASF,CAAAA,CAAK,CAMZ,OAAA,CAAQ,KAAA,CAAM,wCAAA,CAA0CA,CAAG,CAAA,CAC3DP,CAAAA,CAAcS,CAAAA,CAAU,MAAA,CACxBR,CAAAA,CAAgBQ,CAAAA,CAAU,QAAA,CAC1B,QACF,CAEA,GAAIC,CAAAA,CAAa,MAAA,GAAW,CAAA,CAAG,CAC7BV,CAAAA,CAAcS,CAAAA,CAAU,MAAA,CACxBR,CAAAA,CAAgBQ,CAAAA,CAAU,QAAA,CAC1B,QACF,CAEA,OAAO,CACL,OAAA,CAASG,CAAAA,CAA4BF,CAAAA,CAAcD,CAAAA,CAAWX,CAAI,CACpE,CACF,CAEA,IAAMe,CAAAA,CAAgBL,CAAAA,CAAqBA,CAAAA,CAAqB,MAAA,CAAS,CAAC,EAE1E,GAAI,CAACK,CAAAA,CACH,OAAO,IAAA,CAGTb,CAAAA,CAAca,CAAAA,CAAc,MAAA,CAC5BZ,CAAAA,CAAgBY,CAAAA,CAAc,SAChC,CAEA,OAAO,IACT,CAMO,SAASC,CAAAA,CAA2BhB,CAAAA,CAAc,CACvD,OAAOiB,oBAAAA,CAML,CACA,QAAA,CAAUC,CAAAA,CAAU,KAAA,CAAM,WAAA,CAAYlB,CAAI,CAAA,CAC1C,gBAAA,CAAkB,OAElB,OAAA,CAAS,MAAO,CAAE,SAAA,CAAAC,CAAU,CAAA,GAAkC,CAC5D,IAAMkB,CAAAA,CAAS,MAAMpB,CAAAA,CAAWC,CAAAA,CAAMC,CAAS,CAAA,CAC/C,OAAKkB,CAAAA,CAEEA,CAAAA,CAAO,OAAA,CAFM,EAGtB,CAAA,CAEA,gBAAA,CAAmBC,CAAAA,EAAqCA,CAAAA,GAAW,CAAC,CAAA,EAAG,SACzE,CAAC,CACH","file":"chunk-R6ITDRKU.js","sourcesContent":["import { InfiniteData, infiniteQueryOptions } from \"@tanstack/react-query\";\nimport { QueryKeys } from \"@/modules/core\";\nimport { Entry, WaveEntry } from \"../types\";\nimport {\n getVisibleFirstLevelThreadItems,\n mapThreadItemsToWaveEntries\n} from \"../utils/waves-helpers\";\nimport { callRPC } from \"@/modules/core/hive-tx\";\n\nconst THREAD_CONTAINER_BATCH_SIZE = 5;\nconst MAX_CONTAINERS_TO_SCAN = 50;\n\ninterface ThreadsResult {\n entries: WaveEntry[];\n}\n\nasync function getThreads(\n host: string,\n pageParam?: WaveEntry\n): Promise<ThreadsResult | null> {\n let startAuthor = pageParam?.author;\n let startPermlink = pageParam?.permlink;\n let scannedContainers = 0;\n let skipContainerId = pageParam?.post_id;\n\n while (scannedContainers < MAX_CONTAINERS_TO_SCAN) {\n interface AccountPostsParams {\n sort: string;\n account: string;\n limit: number;\n start_author?: string;\n start_permlink?: string;\n }\n\n const rpcParams: AccountPostsParams = {\n sort: \"posts\", // ProfileFilter.posts\n account: host,\n limit: THREAD_CONTAINER_BATCH_SIZE,\n ...(startAuthor ? { start_author: startAuthor } : {}),\n ...(startPermlink ? { start_permlink: startPermlink } : {})\n };\n\n let containers: WaveEntry[];\n try {\n containers = (await callRPC(\"bridge.get_account_posts\", rpcParams)) as WaveEntry[];\n } catch (err) {\n console.error(\"[SDK] getThreads get_account_posts error:\", err);\n return null;\n }\n\n if (!containers || containers.length === 0) {\n return null;\n }\n\n const normalizedContainers = containers.map((container) => {\n container.id = container.post_id;\n container.host = host;\n return container;\n });\n\n for (const container of normalizedContainers) {\n if (skipContainerId && container.post_id === skipContainerId) {\n skipContainerId = undefined;\n continue;\n }\n\n scannedContainers += 1;\n\n if (container.stats?.gray) {\n startAuthor = container.author;\n startPermlink = container.permlink;\n continue;\n }\n\n let visibleItems: Entry[];\n try {\n visibleItems = await getVisibleFirstLevelThreadItems(container);\n } catch (err) {\n // A transient bridge.get_discussion failure (RPC timeout, node error, or\n // an oversized response on a large late-day container) must not collapse\n // the whole feed. Treat this container as temporarily unavailable and scan\n // the next one — mirroring the empty-container handling below and the\n // get_account_posts guard above. The query's refetch interval retries it.\n console.error(\"[SDK] getThreads get_discussion error:\", err);\n startAuthor = container.author;\n startPermlink = container.permlink;\n continue;\n }\n\n if (visibleItems.length === 0) {\n startAuthor = container.author;\n startPermlink = container.permlink;\n continue;\n }\n\n return {\n entries: mapThreadItemsToWaveEntries(visibleItems, container, host)\n };\n }\n\n const lastContainer = normalizedContainers[normalizedContainers.length - 1];\n\n if (!lastContainer) {\n return null;\n }\n\n startAuthor = lastContainer.author;\n startPermlink = lastContainer.permlink;\n }\n\n return null;\n}\n\n// Page = array of WaveEntry; Cursor = WaveEntry (container) or undefined\ntype WavesPage = WaveEntry[];\ntype WavesCursor = WaveEntry | undefined;\n\nexport function getWavesByHostQueryOptions(host: string) {\n return infiniteQueryOptions<\n WavesPage,\n Error,\n InfiniteData<WavesPage, WavesCursor>,\n string[],\n WavesCursor\n >({\n queryKey: QueryKeys.posts.wavesByHost(host),\n initialPageParam: undefined as WavesCursor,\n\n queryFn: async ({ pageParam }: { pageParam: WavesCursor }) => {\n const result = await getThreads(host, pageParam);\n if (!result) return []; // no items to show for this page\n\n return result.entries;\n },\n\n getNextPageParam: (lastPage: WavesPage): WavesCursor => lastPage?.[0]?.container,\n });\n}\n"]}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import {b}from'./chunk-QDXJMILO.js';import {a}from'./chunk-YNRDVQAQ.js';import {a as a$1}from'./chunk-HEILHNSR.js';import {queryOptions}from'@tanstack/react-query';var f=4368*60*60*1e3,E=4,_=3e3,h=2e3,R=4e3,k=2;function T(t,r){return t.replace(/!\[[^\]]*\]\([^)]*\)/g," ").replace(/\[([^\]]*)\]\([^)]*\)/g,"$1").replace(/<[^>]+>/g," ").replace(/https?:\/\/\S+/g," ").replace(/\s+/g," ").trim().slice(0,r)}function M(t){let r=5381;for(let e=0;e<t.length;e++)r=(r<<5)+r+t.charCodeAt(e)|0;return (r>>>0).toString(36)}function w(t){let r=t.title??"",e=t.json_metadata?.tags,s=(Array.isArray(e)?e:[]).filter(i=>typeof i=="string"&&i!==""),a$2=T(t.body??"",_),g=M(`${r}|${s.join(",")}|${a$2}`);return queryOptions({queryKey:a$1.search.similarEntries(t.author,t.permlink,g),queryFn:async({signal:i})=>{let m=new Date(Date.now()-f).toISOString().slice(0,19),I=await b({author:t.author,permlink:t.permlink,title:r,body:a$2,tags:s,since:m},i,typeof window>"u"?h:R),o=[],c=new Set;for(let n of I.results){if(o.length>=E)break;n.permlink!==t.permlink&&(n.tags??[]).indexOf("nsfw")===-1&&(a(n.author,n.permlink)||c.has(n.author)||(c.add(n.author),o.push(n)));}return o},staleTime:300*1e3,retry:false})}export{k as a,w as b};//# sourceMappingURL=chunk-RYNXUPBF.js.map
|
|
2
|
+
//# sourceMappingURL=chunk-RYNXUPBF.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/modules/search/queries/get-similar-entries-query-options.ts"],"names":["SIMILAR_ENTRIES_SINCE_MS","SIMILAR_ENTRIES_TARGET","SIMILAR_ENTRIES_BODY_LIMIT","SIMILAR_ENTRIES_SSR_TIMEOUT_MS","SIMILAR_ENTRIES_CLIENT_TIMEOUT_MS","SIMILAR_ENTRIES_MIN_RENDER","toMltExcerpt","body","limit","fingerprint","s","h","i","getSimilarEntriesQueryOptions","entry","title","rawTags","tags","tag","contentKey","queryOptions","QueryKeys","signal","since","response","similar","collected","seenAuthors","r","isDmcaCurationPath"],"mappings":"oKAUA,IAAMA,CAAAA,CAA2B,IAAA,CAAW,EAAA,CAAK,EAAA,CAAK,GAAA,CAGhDC,CAAAA,CAAyB,CAAA,CAIzBC,CAAAA,CAA6B,GAAA,CAO7BC,CAAAA,CAAiC,GAAA,CASjCC,CAAAA,CAAoC,GAAA,CAI7BC,CAAAA,CAA6B,EAK1C,SAASC,CAAAA,CAAaC,CAAAA,CAAcC,CAAAA,CAAuB,CACzD,OAAOD,CAAAA,CACJ,OAAA,CAAQ,uBAAA,CAAyB,GAAG,CAAA,CACpC,OAAA,CAAQ,wBAAA,CAA0B,IAAI,CAAA,CACtC,O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CAAC,CACH","file":"chunk-RYNXUPBF.js","sourcesContent":["import { queryOptions } from \"@tanstack/react-query\";\nimport { QueryKeys } from \"@/modules/core\";\nimport { similar } from \"../requests\";\nimport { SearchResult } from \"../types/search-response\";\nimport { isDmcaCurationPath } from \"@/modules/curation/dmca\";\n\n// Without a recency window the backend ranks across the entire historical\n// index and surfaces years-old posts. Constrain suggestions to the last\n// ~6 months so related posts stay fresh (it also bounds the backend's\n// more_like_this candidate set, which is what keeps it fast).\nconst SIMILAR_ENTRIES_SINCE_MS = 182 * 24 * 60 * 60 * 1000;\n\n// How many results the suggestions strip renders at most.\nconst SIMILAR_ENTRIES_TARGET = 4;\n\n// more_like_this only extracts a handful of significant terms, so an excerpt is\n// enough signal and keeps the request payload small.\nconst SIMILAR_ENTRIES_BODY_LIMIT = 3000;\n\n// On the server the prefetch sits on the entry-page render path, and the search\n// backend is single-region (EU) — so anything slower than this stalls SSR for a\n// non-essential \"related posts\" strip. Keep the SSR cap short and let the strip\n// fall back to a client fetch (only that render misses the in-HTML strip; it's\n// ISR-cached anyway). Do NOT raise this — 2s is the SSR budget.\nconst SIMILAR_ENTRIES_SSR_TIMEOUT_MS = 2000;\n\n// The client fetch doesn't block paint, so it previously had no cap and fell\n// through to the SDK's generic INTERNAL_API_TIMEOUT_MS (10s; CF's worker further\n// truncates at ~8s). Combined with React Query's default client retry (3×), a\n// /search-api/similar outage turned this best-effort strip into a multi-second\n// post-onload tail (observed as a ~29s \"fully loaded\" in GTmetrix). Cap the\n// client call short and disable retry (below) so a degraded backend just hides\n// the strip quickly instead of churning.\nconst SIMILAR_ENTRIES_CLIENT_TIMEOUT_MS = 4000;\n\n// The strip is hidden below this many results. A lone suggestion looks\n// sparse. Exported so the web component shares one threshold (filter == render).\nexport const SIMILAR_ENTRIES_MIN_RENDER = 2;\n\n// Strip markdown image/link/URL noise before truncating, so more_like_this\n// keys on prose terms instead of image-CDN domains and file hashes (which\n// rarely match the index's sanitized body and just waste the term budget).\nfunction toMltExcerpt(body: string, limit: number): string {\n return body\n .replace(/!\\[[^\\]]*\\]\\([^)]*\\)/g, \" \") // markdown images\n .replace(/\\[([^\\]]*)\\]\\([^)]*\\)/g, \"$1\") // markdown links -> keep link text\n .replace(/<[^>]+>/g, \" \") // html tags\n .replace(/https?:\\/\\/\\S+/g, \" \") // bare URLs\n .replace(/\\s+/g, \" \")\n .trim()\n .slice(0, limit);\n}\n\n// Compact deterministic fingerprint (djb2) of the MLT inputs. Folded into the\n// cache key so an edited post (title/tags/body changed) refetches instead of\n// serving stale recommendations under the same author/permlink. Deterministic\n// so the SSR prefetch and the client compute the same key from the same entry.\nfunction fingerprint(s: string): string {\n let h = 5381;\n for (let i = 0; i < s.length; i++) {\n h = ((h << 5) + h + s.charCodeAt(i)) | 0;\n }\n return (h >>> 0).toString(36);\n}\n\ninterface Entry {\n author: string;\n permlink: string;\n title?: string;\n body?: string;\n json_metadata?: {\n // Hive's json_metadata is user-controlled and untyped on-chain: `tags` is\n // usually a string[] but some posts store it as a bare string (or other\n // junk). Typed as unknown on purpose so callers can't assume an array —\n // it's narrowed with a runtime guard below.\n tags?: unknown;\n };\n}\n\nexport function getSimilarEntriesQueryOptions(entry: Entry) {\n const title = entry.title ?? \"\";\n // `?? []` only guards null/undefined; a non-array tags value (e.g. a bare\n // string from json_metadata) slips through and crashes `.filter` — which\n // took down the entry-page SSR prefetch (Sentry ECENCY-NEXT-1FMA). Guard on\n // Array.isArray so only real arrays reach the filter.\n const rawTags = entry.json_metadata?.tags;\n const tags = (Array.isArray(rawTags) ? rawTags : []).filter(\n (tag): tag is string => typeof tag === \"string\" && tag !== \"\"\n );\n const body = toMltExcerpt(entry.body ?? \"\", SIMILAR_ENTRIES_BODY_LIMIT);\n const contentKey = fingerprint(`${title}|${tags.join(\",\")}|${body}`);\n\n return queryOptions({\n queryKey: QueryKeys.search.similarEntries(entry.author, entry.permlink, contentKey),\n queryFn: async ({ signal }) => {\n // Naive `YYYY-MM-DDTHH:mm:ss` (no `Z`) matches the search-api date\n // contract used elsewhere; a <14h skew on a 182-day boundary is immaterial.\n const since = new Date(Date.now() - SIMILAR_ENTRIES_SINCE_MS).toISOString().slice(0, 19);\n\n // Elasticsearch more_like_this recommendations: content-based \"related\n // posts\" ranked by shared significant terms in title/body/tags, scoped\n // to the recency window. The backend already excludes the source author,\n // spam and nsfw.\n const response = await similar(\n {\n author: entry.author,\n permlink: entry.permlink,\n title,\n body,\n tags,\n since\n },\n signal,\n // Short cap server-side so a slow cross-region call can't stall SSR;\n // a slightly longer (but still bounded) cap client-side so a degraded\n // backend can't hang the request on the SDK's generic 8s timeout.\n typeof window === \"undefined\"\n ? SIMILAR_ENTRIES_SSR_TIMEOUT_MS\n : SIMILAR_ENTRIES_CLIENT_TIMEOUT_MS\n );\n\n // Light client guard mirroring the render contract: never the source\n // post, never nsfw, never a taken-down post (`similar` masks it, but a\n // blank card is no suggestion), one per author, capped at the render\n // target.\n const collected: SearchResult[] = [];\n const seenAuthors = new Set<string>();\n for (const r of response.results) {\n if (collected.length >= SIMILAR_ENTRIES_TARGET) break;\n if (r.permlink === entry.permlink) continue;\n if ((r.tags ?? []).indexOf(\"nsfw\") !== -1) continue;\n if (isDmcaCurationPath(r.author, r.permlink)) continue;\n if (seenAuthors.has(r.author)) continue;\n seenAuthors.add(r.author);\n collected.push(r);\n }\n\n return collected;\n },\n // The entry page server-prefetches this query and dehydrates it. Without a\n // staleTime, React Query treats the hydrated data as stale and refetches on\n // mount — issuing a *redundant* /search-api/similar XHR right after\n // hydration even though SSR already provided the data. That refetch was the\n // long post-onload tail in the waterfall (held open to the client timeout),\n // inflating GTmetrix \"Fully Loaded\" while the visible strip was already\n // populated from SSR. A staleTime makes the hydrated data fresh so the\n // client skips that refetch; if SSR delivered nothing (empty cache), the\n // client still fetches. Recommendations are stable per post (and the cache\n // key is content-fingerprinted), so 5 min matches the page's ISR cadence.\n staleTime: 5 * 60 * 1000,\n // Best-effort suggestions strip — never retry-storm a degraded backend.\n // The web QueryClient only disables retries on the server; the browser\n // client keeps React Query's default retry (3×) — and other SDK consumers\n // (e.g. mobile) may too — so pin retry:false here to cover every caller.\n retry: false\n });\n}\n"]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {a}from'./chunk-JIFT2BF5.js';import {a as a$
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import {a}from'./chunk-JIFT2BF5.js';import {a as a$2}from'./chunk-XKRGZQK2.js';import {a as a$1}from'./chunk-ZOZ6ILWU.js';import {a as a$3}from'./chunk-JTXK75KH.js';import {b}from'./chunk-ZRBTHYIY.js';import {queryOptions}from'@tanstack/react-query';function O(t,e){return queryOptions({queryKey:["assets","hive-engine",e,"general-info",t],enabled:!!e&&!!t,staleTime:6e4,refetchInterval:9e4,queryFn:async()=>{if(!e||!t)throw new Error("[SDK][HiveEngine] \u2013 token or username missed");let n=b(),i=a(t);await n.prefetchQuery(i);let d=n.getQueryData(i.queryKey),k=await n.ensureQueryData(a$1([e])),Q=await n.ensureQueryData(a$2(t)),v=await n.ensureQueryData(a$3(void 0,e)),E=k?.find(a=>a.symbol===e),r=Q?.find(a=>a.symbol===e),s=+(v?.find(a=>a.symbol===e)?.lastPrice??"0"),o=parseFloat(r?.balance??"0"),c=parseFloat(r?.stake??"0"),l=parseFloat(r?.pendingUnstake??"0"),u=[{name:"liquid",balance:o},{name:"staked",balance:c}];return l>0&&u.push({name:"unstaking",balance:l}),{name:e,title:E?.name??"",price:s===0?0:Number(s*(d?.price??0)),accountBalance:o+c,layer:"ENGINE",parts:u}}})}export{O as a};//# sourceMappingURL=chunk-UGOUX6UI.js.map
|
|
2
|
+
//# sourceMappingURL=chunk-UGOUX6UI.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/modules/hive-engine/queries/get-hive-engine-token-general-info-query-options.ts"],"names":["getHiveEngineTokenGeneralInfoQueryOptions","username","symbol","queryOptions","queryClient","getQueryClient","hiveQuery","getHiveAssetGeneralInfoQueryOptions","hiveData","metadataList","getHiveEngineTokensMetadataQueryOptions","balanceList","getHiveEngineTokensBalancesQueryOptions","marketList","getAllHiveEngineTokensQueryOptions","metadata","i","balance","lastPrice","liquidBalance","stakedBalance","unstakingBalance","parts"],"mappings":"0PAQO,SAASA,EACdC,CAAAA,CACAC,CAAAA,CACA,CACA,OAAOC,YAAAA,CAAa,CAClB,QAAA,CAAU,CAAC,SAAU,aAAA,CAAeD,CAAAA,CAAQ,eAAgBD,CAAQ,CAAA,CACpE,QAAS,CAAC,CAACC,GAAU,CAAC,CAACD,EACvB,SAAA,CAAW,GAAA,CACX,gBAAiB,GAAA,CACjB,OAAA,CAAS,SAAY,CACnB,GAAI,CAACC,CAAAA,EAAU,CAACD,EACd,MAAM,IAAI,MACR,mDACF,CAAA,CAEF,IAAMG,CAAAA,CAAcC,CAAAA,GACdC,CAAAA,CAAYC,CAAAA,CAAoCN,CAAQ,CAAA,CAC9D,MAAMG,EAAY,aAAA,CAAcE,CAAS,EACzC,IAAME,CAAAA,CAAWJ,EAAY,YAAA,CAC3BE,CAAAA,CAAU,QACZ,CAAA,CAEMG,CAAAA,CAAe,MAAML,CAAAA,CAAY,eAAA,CACrCM,IAAwC,CAACR,CAAM,CAAC,CAClD,CAAA,CAEMS,EAAc,MAAMP,CAAAA,CAAY,gBACpCQ,GAAAA,CAAwCX,CAAQ,CAClD,CAAA,CAIMY,CAAAA,CAAa,MAAMT,CAAAA,CAAY,eAAA,CACnCU,IAAmC,MAAA,CAAWZ,CAAM,CACtD,CAAA,CAEMa,CAAAA,CAAWN,GAAc,IAAA,CAAMO,CAAAA,EAAMA,EAAE,MAAA,GAAWd,CAAM,EACxDe,CAAAA,CAAUN,CAAAA,EAAa,KAAMK,CAAAA,EAAMA,CAAAA,CAAE,SAAWd,CAAM,CAAA,CAGtDgB,EAAY,EAFHL,CAAAA,EAAY,KAAMG,CAAAA,EAAMA,CAAAA,CAAE,SAAWd,CAAM,CAAA,EAE9B,WAAa,GAAA,CAAA,CAEnCiB,CAAAA,CAAgB,WAAWF,CAAAA,EAAS,OAAA,EAAW,GAAG,CAAA,CAClDG,CAAAA,CAAgB,WAAWH,CAAAA,EAAS,KAAA,EAAS,GAAG,CAAA,CAChDI,CAAAA,CAAmB,WAAWJ,CAAAA,EAAS,cAAA,EAAkB,GAAG,CAAA,CAE5DK,CAAAA,CAAmC,CACvC,CAAE,IAAA,CAAM,SAAU,OAAA,CAASH,CAAc,EACzC,CAAE,IAAA,CAAM,SAAU,OAAA,CAASC,CAAc,CAC3C,CAAA,CAEA,OAAIC,EAAmB,CAAA,EACrBC,CAAAA,CAAM,KAAK,CAAE,IAAA,CAAM,YAAa,OAAA,CAASD,CAAiB,CAAC,CAAA,CAGtD,CACL,KAAMnB,CAAAA,CACN,KAAA,CAAOa,GAAU,IAAA,EAAQ,EAAA,CACzB,MAAOG,CAAAA,GAAc,CAAA,CAAI,EAAI,MAAA,CAAOA,CAAAA,EAAaV,GAAU,KAAA,EAAS,CAAA,CAAE,EACtE,cAAA,CAAgBW,CAAAA,CAAgBC,EAChC,KAAA,CAAO,QAAA,CACP,MAAAE,CACF,CACF,CACF,CAAC,CACH","file":"chunk-
|
|
1
|
+
{"version":3,"sources":["../../src/modules/hive-engine/queries/get-hive-engine-token-general-info-query-options.ts"],"names":["getHiveEngineTokenGeneralInfoQueryOptions","username","symbol","queryOptions","queryClient","getQueryClient","hiveQuery","getHiveAssetGeneralInfoQueryOptions","hiveData","metadataList","getHiveEngineTokensMetadataQueryOptions","balanceList","getHiveEngineTokensBalancesQueryOptions","marketList","getAllHiveEngineTokensQueryOptions","metadata","i","balance","lastPrice","liquidBalance","stakedBalance","unstakingBalance","parts"],"mappings":"0PAQO,SAASA,EACdC,CAAAA,CACAC,CAAAA,CACA,CACA,OAAOC,YAAAA,CAAa,CAClB,QAAA,CAAU,CAAC,SAAU,aAAA,CAAeD,CAAAA,CAAQ,eAAgBD,CAAQ,CAAA,CACpE,QAAS,CAAC,CAACC,GAAU,CAAC,CAACD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,EAAmB,CAAA,EACrBC,CAAAA,CAAM,KAAK,CAAE,IAAA,CAAM,YAAa,OAAA,CAASD,CAAiB,CAAC,CAAA,CAGtD,CACL,KAAMnB,CAAAA,CACN,KAAA,CAAOa,GAAU,IAAA,EAAQ,EAAA,CACzB,MAAOG,CAAAA,GAAc,CAAA,CAAI,EAAI,MAAA,CAAOA,CAAAA,EAAaV,GAAU,KAAA,EAAS,CAAA,CAAE,EACtE,cAAA,CAAgBW,CAAAA,CAAgBC,EAChC,KAAA,CAAO,QAAA,CACP,MAAAE,CACF,CACF,CACF,CAAC,CACH","file":"chunk-UGOUX6UI.js","sourcesContent":["import { queryOptions } from \"@tanstack/react-query\";\nimport { getQueryClient } from \"@/modules/core\";\nimport type { GeneralAssetInfo } from \"@/modules/wallet/types\";\nimport { getHiveEngineTokensMetadataQueryOptions } from \"./get-hive-engine-tokens-metadata-query-options\";\nimport { getHiveEngineTokensBalancesQueryOptions } from \"./get-hive-engine-tokens-balances-query-options\";\nimport { getAllHiveEngineTokensQueryOptions } from \"./get-all-hive-engine-tokens-query-options\";\nimport { getHiveAssetGeneralInfoQueryOptions } from \"@/modules/wallet/queries/get-hive-asset-general-info-query-options\";\n\nexport function getHiveEngineTokenGeneralInfoQueryOptions(\n username?: string,\n symbol?: string\n) {\n return queryOptions({\n queryKey: [\"assets\", \"hive-engine\", symbol, \"general-info\", username],\n enabled: !!symbol && !!username,\n staleTime: 60000,\n refetchInterval: 90000,\n queryFn: async () => {\n if (!symbol || !username) {\n throw new Error(\n \"[SDK][HiveEngine] – token or username missed\"\n );\n }\n const queryClient = getQueryClient();\n const hiveQuery = getHiveAssetGeneralInfoQueryOptions(username);\n await queryClient.prefetchQuery(hiveQuery);\n const hiveData = queryClient.getQueryData<GeneralAssetInfo>(\n hiveQuery.queryKey\n );\n\n const metadataList = await queryClient.ensureQueryData(\n getHiveEngineTokensMetadataQueryOptions([symbol])\n );\n\n const balanceList = await queryClient.ensureQueryData(\n getHiveEngineTokensBalancesQueryOptions(username)\n );\n\n // Scoped to this symbol: the unfiltered metrics call is capped at 1000 rows, so a\n // token outside that page reported no market and rendered a zero price.\n const marketList = await queryClient.ensureQueryData(\n getAllHiveEngineTokensQueryOptions(undefined, symbol)\n );\n\n const metadata = metadataList?.find((i) => i.symbol === symbol);\n const balance = balanceList?.find((i) => i.symbol === symbol);\n const market = marketList?.find((i) => i.symbol === symbol);\n\n const lastPrice = +(market?.lastPrice ?? \"0\");\n\n const liquidBalance = parseFloat(balance?.balance ?? \"0\");\n const stakedBalance = parseFloat(balance?.stake ?? \"0\");\n const unstakingBalance = parseFloat(balance?.pendingUnstake ?? \"0\");\n\n const parts: GeneralAssetInfo[\"parts\"] = [\n { name: \"liquid\", balance: liquidBalance },\n { name: \"staked\", balance: stakedBalance },\n ];\n\n if (unstakingBalance > 0) {\n parts.push({ name: \"unstaking\", balance: unstakingBalance });\n }\n\n return {\n name: symbol,\n title: metadata?.name ?? \"\",\n price: lastPrice === 0 ? 0 : Number(lastPrice * (hiveData?.price ?? 0)),\n accountBalance: liquidBalance + stakedBalance,\n layer: \"ENGINE\",\n parts,\n } satisfies GeneralAssetInfo;\n },\n });\n}\n"]}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import {b}from'./chunk-36AOY64H.js';import {a as a$1}from'./chunk-HEILHNSR.js';import {j}from'./chunk-UB5YHSMC.js';import {queryOptions}from'@tanstack/react-query';function a(t,r){return queryOptions({queryKey:a$1.posts.content(t,r),enabled:!!t&&!!r,queryFn:async()=>{let y=await j("condenser_api.get_content",[t,r]);return b(y)}})}export{a};//# sourceMappingURL=chunk-W6H2FORU.js.map
|
|
2
|
+
//# sourceMappingURL=chunk-W6H2FORU.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/modules/posts/queries/get-content-query-options.ts"],"names":["getContentQueryOptions","author","permlink","queryOptions","QueryKeys","entry","callRPC","filterDmcaEntry"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../src/modules/posts/queries/get-content-query-options.ts"],"names":["getContentQueryOptions","author","permlink","queryOptions","QueryKeys","entry","callRPC","filterDmcaEntry"],"mappings":"oKAMO,SAASA,EAAuBC,CAAAA,CAAgBC,CAAAA,CAAkB,CACvE,OAAOC,YAAAA,CAAa,CAClB,QAAA,CAAUC,GAAAA,CAAU,MAAM,OAAA,CAAQH,CAAAA,CAAQC,CAAQ,CAAA,CAClD,OAAA,CAAS,CAAC,CAACD,CAAAA,EAAU,CAAC,CAACC,CAAAA,CACvB,QAAS,SAA4B,CACnC,IAAMG,CAAAA,CAAS,MAAMC,EAAQ,2BAAA,CAA6B,CACxDL,EACAC,CACF,CAAC,EAOD,OAAOK,CAAAA,CAAgBF,CAAK,CAC9B,CACF,CAAC,CACH","file":"chunk-W6H2FORU.js","sourcesContent":["import { QueryKeys } from \"@/modules/core\";\nimport { queryOptions } from \"@tanstack/react-query\";\nimport { Entry } from \"../types\";\nimport { callRPC } from \"@/modules/core/hive-tx\";\nimport { filterDmcaEntry } from \"../utils/filter-dmca-entries\";\n\nexport function getContentQueryOptions(author: string, permlink: string) {\n return queryOptions({\n queryKey: QueryKeys.posts.content(author, permlink),\n enabled: !!author && !!permlink,\n queryFn: async (): Promise<Entry> => {\n const entry = (await callRPC(\"condenser_api.get_content\", [\n author,\n permlink,\n ])) as Entry;\n\n // A takedown applies wherever a post is served, not only on the path the\n // entry page happens to read. getPostQueryOptions (bridge) has always\n // filtered; this query had not, and it is the one the agent endpoints,\n // the oEmbed provider and the decks columns read, so a listed post came\n // back in full from /@author/permlink.md and .json (#1862).\n return filterDmcaEntry(entry) as Entry;\n },\n });\n}\n"]}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import {b}from'./chunk-7B2TRW3Y.js';async function o(e,t){let n=await(async()=>{let r;try{r=await e.text();}catch{return}if(r!=="")try{return JSON.parse(r)}catch{return e.ok?void 0:r}})();if(!e.ok){let r=new Error(`Request failed with status ${e.status}`);throw r.status=e.status,r.data=n,r}if(n===void 0||t!==void 0&&!t(n))throw new Error("Response body was empty, invalid JSON, or not the expected shape");return n}function a(e){return typeof e=="object"&&e!==null&&Array.isArray(e.results)}async function i(e){return b(await o(e,a))}export{o as a,a as b,i as c};//# sourceMappingURL=chunk-WV4Y4D4E.js.map
|
|
2
|
+
//# sourceMappingURL=chunk-WV4Y4D4E.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/modules/search/parse-json-response.ts"],"names":["parseJsonResponse","response","isValid","data","raw","error","isSearchResponse","parseSearchResponse","maskDmcaSearchResponse"],"mappings":"oCAiBA,eAAsBA,CAAAA,CACpBC,CAAAA,CAQAC,CAAAA,CACY,CA+BZ,IAAMC,EAAO,KAAA,CA9BK,SAA8B,CAK9C,IAAIC,CAAAA,CACJ,GAAI,CACFA,CAAAA,CAAM,MAAMH,CAAAA,CAAS,IAAA,GACvB,CAAA,KAAQ,CACN,MACF,CAEA,GAAIG,CAAAA,GAAQ,EAAA,CAIZ,GAAI,CACF,OAAO,IAAA,CAAK,KAAA,CAAMA,CAAG,CACvB,CAAA,KAAQ,CAQN,OAAOH,CAAAA,CAAS,EAAA,CAAK,MAAA,CAAYG,CACnC,CACF,IAE6B,CAC7B,GAAI,CAACH,CAAAA,CAAS,EAAA,CAAI,CAChB,IAAMI,CAAAA,CAAQ,IAAI,KAAA,CAAM,CAAA,2BAAA,EAA8BJ,CAAAA,CAAS,MAAM,CAAA,CAAE,EACvE,MAAAI,CAAAA,CAAM,MAAA,CAASJ,CAAAA,CAAS,MAAA,CACxBI,CAAAA,CAAM,KAAOF,CAAAA,CACPE,CACR,CAEA,GAAIF,CAAAA,GAAS,MAAA,EAAcD,IAAY,MAAA,EAAa,CAACA,CAAAA,CAAQC,CAAI,CAAA,CAC/D,MAAM,IAAI,KAAA,CAAM,kEAAkE,CAAA,CAGpF,OAAOA,CACT,CAMO,SAASG,CAAAA,CAAiBH,CAAAA,CAAwB,CACvD,OACE,OAAOA,CAAAA,EAAS,UAChBA,CAAAA,GAAS,IAAA,EACT,KAAA,CAAM,OAAA,CAASA,CAAAA,CAA+B,OAAO,CAEzD,CAMA,eAAsBI,CAAAA,CAAoBN,CAAAA,CAA6C,CACrF,OAAOO,CAAAA,CAAuB,MAAMR,CAAAA,CAAkCC,CAAAA,CAAUK,CAAgB,CAAC,CACnG","file":"chunk-WV4Y4D4E.js","sourcesContent":["import { maskDmcaSearchResponse } from \"./dmca\";\nimport type { SearchResponse } from \"./types/search-response\";\n\nexport type RequestError = Error & { status?: number; data?: unknown };\n\n/**\n * Reads a response body and, when the status is not OK, throws an error that\n * keeps both the status and the parsed body.\n *\n * The search backend answers a malformed query with an explanation the user can\n * act on (\"Maximum 5 tags!\", \"Query string too long! ...\", \"Parsed query is\n * empty!\"). Dropping the body leaves callers with a bare status: they can\n * neither tell the user what to change nor tell a deterministic rejection from\n * a transient failure worth retrying.\n *\n * Module-internal on purpose - it is not part of the published SDK surface.\n */\nexport async function parseJsonResponse<T>(\n response: Response,\n /**\n * Shape guard for a SUCCESSFUL body. JSON.parse happily accepts `null`,\n * `\"maintenance\"` and `{\"error\": \"...\"}`, none of which are the payload the\n * caller asked for, and all of which would otherwise be returned as `T` and\n * cached as valid data. Callers that have a known shape pass a guard so an\n * unexpected 200 fails here instead of at the first property access.\n */\n isValid?: (data: unknown) => boolean\n): Promise<T> {\n const parseBody = async (): Promise<unknown> => {\n // Read the body ONCE. Calling json() and then falling back to text() on the\n // same response cannot work: json() consumes the stream, so the fallback\n // always threw and the raw body of a non-JSON failure (an HTML error page\n // from a proxy) was silently lost.\n let raw: string;\n try {\n raw = await response.text();\n } catch {\n return undefined;\n }\n\n if (raw === \"\") {\n return undefined;\n }\n\n try {\n return JSON.parse(raw) as unknown;\n } catch {\n // Raw text is a diagnostic, not a payload. On a failed response it is\n // what the caller shows or logs, but on a 2xx returning it would hand\n // back a string typed as the parsed body: callers reading `.results`\n // would see undefined and report an empty result set, and the\n // controversial/rising pager would throw on `resp.results.length`. An\n // unparseable success is a failure, so let it fall through to the throw\n // below rather than caching a string as a SearchResponse.\n return response.ok ? undefined : raw;\n }\n };\n\n const data = await parseBody();\n if (!response.ok) {\n const error = new Error(`Request failed with status ${response.status}`) as RequestError;\n error.status = response.status;\n error.data = data;\n throw error;\n }\n\n if (data === undefined || (isValid !== undefined && !isValid(data))) {\n throw new Error(\"Response body was empty, invalid JSON, or not the expected shape\");\n }\n\n return data as T;\n}\n\n/**\n * The contract every /search-api consumer relies on: an object carrying a\n * `results` array. Enough to keep a stray 200 from reaching `resp.results.length`.\n */\nexport function isSearchResponse(data: unknown): boolean {\n return (\n typeof data === \"object\" &&\n data !== null &&\n Array.isArray((data as { results?: unknown }).results)\n );\n}\n\n/**\n * Every /search-api endpoint that returns post rows goes through here, so a\n * taken-down post is masked once for all of them (see ./dmca).\n */\nexport async function parseSearchResponse(response: Response): Promise<SearchResponse> {\n return maskDmcaSearchResponse(await parseJsonResponse<SearchResponse>(response, isSearchResponse));\n}\n"]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {n}from'./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import {n}from'./chunk-2ANYOCYN.js';import {a}from'./chunk-HEILHNSR.js';import {j}from'./chunk-UB5YHSMC.js';import {queryOptions}from'@tanstack/react-query';function p(s,e=5){let r=s.trim();return queryOptions({queryKey:a.search.account(r,e),queryFn:async()=>{let o=await j("condenser_api.lookup_accounts",[r,e]);return o.length===0?[]:n(o)},enabled:!!r})}export{p as a};//# sourceMappingURL=chunk-XIL25HFC.js.map
|
|
2
|
+
//# sourceMappingURL=chunk-XIL25HFC.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/modules/search/queries/get-search-account-query-options.ts"],"names":["getSearchAccountQueryOptions","q","limit","normalized","queryOptions","QueryKeys","usernames","callRPC","getProfiles"],"mappings":"6JAMO,SAASA,CAAAA,CAA6BC,EAAWC,CAAAA,CAAQ,CAAA,CAAG,CACjE,IAAMC,CAAAA,CAAaF,CAAAA,CAAE,MAAK,CAE1B,OAAOG,YAAAA,CAAa,CAClB,QAAA,CAAUC,CAAAA,CAAU,OAAO,OAAA,CAAQF,CAAAA,CAAYD,CAAK,CAAA,CACpD,OAAA,CAAS,SAAgC,CACvC,IAAMI,CAAAA,CAAa,MAAMC,CAAAA,CAAQ,+BAAA,CAAiC,CAChEJ,EACAD,CACF,CAAC,CAAA,CAED,OAAII,CAAAA,CAAU,MAAA,GAAW,EAChB,EAAC,CAGHE,CAAAA,CAAYF,CAAS,CAC9B,CAAA,CACA,QAAS,CAAC,CAACH,CACb,CAAC,CACH","file":"chunk-
|
|
1
|
+
{"version":3,"sources":["../../src/modules/search/queries/get-search-account-query-options.ts"],"names":["getSearchAccountQueryOptions","q","limit","normalized","queryOptions","QueryKeys","usernames","callRPC","getProfiles"],"mappings":"6JAMO,SAASA,CAAAA,CAA6BC,EAAWC,CAAAA,CAAQ,CAAA,CAAG,CACjE,IAAMC,CAAAA,CAAaF,CAAAA,CAAE,MAAK,CAE1B,OAAOG,YAAAA,CAAa,CAClB,QAAA,CAAUC,CAAAA,CAAU,OAAO,OAAA,CAAQF,CAAAA,CAAYD,CAAK,CAAA,CACpD,OAAA,CAAS,SAAgC,CACvC,IAAMI,CAAAA,CAAa,MAAMC,CAAAA,CAAQ,+BAAA,CAAiC,CAChEJ,EACAD,CACF,CAAC,CAAA,CAED,OAAII,CAAAA,CAAU,MAAA,GAAW,EAChB,EAAC,CAGHE,CAAAA,CAAYF,CAAS,CAC9B,CAAA,CACA,QAAS,CAAC,CAACH,CACb,CAAC,CACH","file":"chunk-XIL25HFC.js","sourcesContent":["import { queryOptions } from \"@tanstack/react-query\";\nimport { QueryKeys } from \"@/modules/core\";\nimport { getProfiles } from \"@/modules/bridge\";\nimport { Profile } from \"@/modules/accounts/types\";\nimport { callRPC } from \"@/modules/core/hive-tx\";\n\nexport function getSearchAccountQueryOptions(q: string, limit = 5) {\n const normalized = q.trim();\n\n return queryOptions({\n queryKey: QueryKeys.search.account(normalized, limit),\n queryFn: async (): Promise<Profile[]> => {\n const usernames = (await callRPC(\"condenser_api.lookup_accounts\", [\n normalized,\n limit,\n ])) as string[];\n\n if (usernames.length === 0) {\n return [];\n }\n\n return getProfiles(usernames);\n },\n enabled: !!normalized,\n });\n}\n"]}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import {d}from'./chunk-2ANYOCYN.js';import {b}from'./chunk-36AOY64H.js';import {a}from'./chunk-HEILHNSR.js';import {infiniteQueryOptions,queryOptions}from'@tanstack/react-query';function E(t,o="posts",e=20,i="",s=true){return infiniteQueryOptions({queryKey:a.posts.accountPosts(t??"",o,e,i),enabled:!!t&&s,initialPageParam:{author:void 0,permlink:void 0,hasNextPage:true},queryFn:async({pageParam:n,signal:r})=>{if(!n?.hasNextPage||!t)return [];let a=await d(o,t,n.author??"",n.permlink??"",e,i,r);return b(a??[])},getNextPageParam:n=>{let r=n?.[n.length-1],a=(n?.length??0)===e;if(a)return {author:r?.author,permlink:r?.permlink,hasNextPage:a}}})}function l(t,o="posts",e="",i="",s=20,n="",r=true){return queryOptions({queryKey:a.posts.accountPostsPage(t??"",o,e,i,s,n),enabled:!!t&&r,queryFn:async({signal:a}={})=>{if(!t)return [];let y=await d(o,t,e,i,s,n,a);return b(y??[])}})}export{E as a,l as b};//# sourceMappingURL=chunk-ZJEINVJL.js.map
|
|
2
|
+
//# sourceMappingURL=chunk-ZJEINVJL.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/modules/posts/queries/get-account-posts-query-options.ts"],"names":["getAccountPostsInfiniteQueryOptions","username","filter","limit","observer","enabled","infiniteQueryOptions","QueryKeys","pageParam","signal","response","getAccountPosts","filterDmcaEntry","lastPage","last","hasNextPage","getAccountPostsQueryOptions","start_author","start_permlink","queryOptions"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../src/modules/posts/queries/get-account-posts-query-options.ts"],"names":["getAccountPostsInfiniteQueryOptions","username","filter","limit","observer","enabled","infiniteQueryOptions","QueryKeys","pageParam","signal","response","getAccountPosts","filterDmcaEntry","lastPage","last","hasNextPage","getAccountPostsQueryOptions","start_author","start_permlink","queryOptions"],"mappings":"kLAaO,SAASA,CAAAA,CACdC,EACAC,CAAAA,CAAS,OAAA,CACTC,EAAQ,EAAA,CACRC,CAAAA,CAAW,GACXC,CAAAA,CAAU,IAAA,CACV,CACA,OAAOC,oBAAAA,CAML,CACA,QAAA,CAAUC,CAAAA,CAAU,MAAM,YAAA,CAAaN,CAAAA,EAAY,GAAIC,CAAAA,CAAQC,CAAAA,CAAOC,CAAQ,CAAA,CAC9E,OAAA,CAAS,CAAC,CAACH,CAAAA,EAAYI,EACvB,gBAAA,CAAkB,CAChB,OAAQ,MAAA,CACR,QAAA,CAAU,OACV,WAAA,CAAa,IACf,EAEA,OAAA,CAAS,MAAO,CAAE,SAAA,CAAAG,CAAAA,CAAW,OAAAC,CAAO,CAAA,GAAM,CACxC,GAAI,CAACD,GAAW,WAAA,EAAe,CAACP,EAAU,OAAO,GAEjD,IAAMS,CAAAA,CAAW,MAAMC,CAAAA,CACrBT,CAAAA,CACAD,EACAO,CAAAA,CAAU,MAAA,EAAU,GACpBA,CAAAA,CAAU,QAAA,EAAY,GACtBL,CAAAA,CACAC,CAAAA,CACAK,CACF,CAAA,CAEA,OAAOG,EAAgBF,CAAAA,EAAY,EAAE,CACvC,CAAA,CAEA,iBAAmBG,CAAAA,EAA0C,CAC3D,IAAMC,CAAAA,CAAOD,CAAAA,GAAWA,EAAS,MAAA,CAAS,CAAC,EAGrCE,CAAAA,CAAAA,CAAeF,CAAAA,EAAU,QAAU,CAAA,IAAOV,CAAAA,CAEhD,GAAKY,CAAAA,CAIL,OAAO,CACL,MAAA,CAAQD,CAAAA,EAAM,OACd,QAAA,CAAUA,CAAAA,EAAM,SAChB,WAAA,CAAAC,CACF,CACF,CACF,CAAC,CACH,CAEO,SAASC,EACdf,CAAAA,CACAC,CAAAA,CAAS,QACTe,CAAAA,CAAuB,EAAA,CACvBC,EAAyB,EAAA,CACzBf,CAAAA,CAAQ,GACRC,CAAAA,CAAW,EAAA,CACXC,EAAU,IAAA,CACV,CACA,OAAOc,YAAAA,CAAa,CAClB,SAAUZ,CAAAA,CAAU,KAAA,CAAM,iBAAiBN,CAAAA,EAAY,EAAA,CAAIC,EAAQe,CAAAA,CAAcC,CAAAA,CAAgBf,EAAOC,CAAQ,CAAA,CAChH,QAAS,CAAC,CAACH,GAAYI,CAAAA,CACvB,OAAA,CAAS,MAAO,CAAE,MAAA,CAAAI,CAAO,CAAA,CAAI,KAAc,CACzC,GAAI,CAACR,CAAAA,CACH,OAAO,EAAC,CAGV,IAAMS,EAAW,MAAMC,CAAAA,CACrBT,EACAD,CAAAA,CACAgB,CAAAA,CACAC,EACAf,CAAAA,CACAC,CAAAA,CACAK,CACF,CAAA,CAEA,OAAOG,EAAgBF,CAAAA,EAAY,EAAE,CACvC,CACF,CAAC,CACH","file":"chunk-ZJEINVJL.js","sourcesContent":["import { QueryKeys } from \"@/modules/core\";\nimport { InfiniteData, infiniteQueryOptions, queryOptions } from \"@tanstack/react-query\";\nimport { Entry } from \"../types\";\nimport { filterDmcaEntry } from \"../utils/filter-dmca-entries\";\nimport { getAccountPosts } from \"@/modules/bridge\";\n\ntype PageParam = {\n author: string | undefined;\n permlink: string | undefined;\n hasNextPage: boolean;\n};\ntype Page = Entry[];\n\nexport function getAccountPostsInfiniteQueryOptions(\n username: string | undefined,\n filter = \"posts\",\n limit = 20,\n observer = \"\",\n enabled = true\n) {\n return infiniteQueryOptions<\n Page,\n Error,\n InfiniteData<Page, PageParam>,\n (string | number)[],\n PageParam\n >({\n queryKey: QueryKeys.posts.accountPosts(username ?? \"\", filter, limit, observer),\n enabled: !!username && enabled,\n initialPageParam: {\n author: undefined,\n permlink: undefined,\n hasNextPage: true,\n } as PageParam,\n\n queryFn: async ({ pageParam, signal }) => {\n if (!pageParam?.hasNextPage || !username) return [];\n\n const response = await getAccountPosts(\n filter,\n username,\n pageParam.author ?? \"\",\n pageParam.permlink ?? \"\",\n limit,\n observer,\n signal\n );\n\n return filterDmcaEntry(response ?? []) as Entry[];\n },\n\n getNextPageParam: (lastPage: Page): PageParam | undefined => {\n const last = lastPage?.[lastPage.length - 1];\n // Only consider there's a next page if we got a full page of results\n // A partial page means we've reached the end\n const hasNextPage = (lastPage?.length ?? 0) === limit;\n\n if (!hasNextPage) {\n return undefined;\n }\n\n return {\n author: last?.author,\n permlink: last?.permlink,\n hasNextPage,\n };\n },\n });\n}\n\nexport function getAccountPostsQueryOptions(\n username: string | undefined,\n filter = \"posts\",\n start_author: string = \"\",\n start_permlink: string = \"\",\n limit = 20,\n observer = \"\",\n enabled = true\n) {\n return queryOptions({\n queryKey: QueryKeys.posts.accountPostsPage(username ?? \"\", filter, start_author, start_permlink, limit, observer),\n enabled: !!username && enabled,\n queryFn: async ({ signal } = {} as any) => {\n if (!username) {\n return [];\n }\n\n const response = await getAccountPosts(\n filter,\n username,\n start_author,\n start_permlink,\n limit,\n observer,\n signal\n );\n\n return filterDmcaEntry(response ?? []) as Entry[];\n },\n });\n}\n"]}
|