@ecency/sdk 2.3.62 → 2.3.64
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/index.d.ts
CHANGED
|
@@ -960,6 +960,18 @@ declare function withTimeoutSignal(timeoutMs: number, signal?: AbortSignal): Abo
|
|
|
960
960
|
declare const INTERNAL_API_TIMEOUT_MS = 10000;
|
|
961
961
|
declare const CONFIG: {
|
|
962
962
|
privateApiHost: string;
|
|
963
|
+
/**
|
|
964
|
+
* Observer used for bridge calls when nobody is logged in. The bridge applies
|
|
965
|
+
* this account's mute list to the response, marking muted authors' posts and
|
|
966
|
+
* comments `stats.gray` so clients can dim or collapse them. Anonymous
|
|
967
|
+
* visitors therefore inherit Ecency's moderation instead of seeing an
|
|
968
|
+
* unfiltered firehose. Apps may override via `ConfigManager.setDefaultObserver`,
|
|
969
|
+
* which expects a real account rather than "" (see that setter).
|
|
970
|
+
*
|
|
971
|
+
* Note this only *marks* content: the bridge still returns muted authors'
|
|
972
|
+
* posts, so an observer never shortens a feed.
|
|
973
|
+
*/
|
|
974
|
+
defaultObserver: string;
|
|
963
975
|
/**
|
|
964
976
|
* First-party client identifier sent as the `X-Ecency-Client` header on
|
|
965
977
|
* search/private API requests. Lets the origin distinguish Ecency's own
|
|
@@ -973,6 +985,13 @@ declare const CONFIG: {
|
|
|
973
985
|
/** Current Hive RPC nodes. Reads from the unified hive-tx config. */
|
|
974
986
|
readonly hiveNodes: string[];
|
|
975
987
|
heliusApiKey: string | undefined;
|
|
988
|
+
/**
|
|
989
|
+
* The React Query client all SDK code reads through `getQueryClient()`.
|
|
990
|
+
* Backed by a resolver so an SSR host can scope it per request — see the
|
|
991
|
+
* `queryClientResolver` note above. Assigning replaces the resolver with one
|
|
992
|
+
* that always returns the assigned client, preserving the previous
|
|
993
|
+
* "one client, set once" behaviour for browser and native hosts.
|
|
994
|
+
*/
|
|
976
995
|
queryClient: QueryClient;
|
|
977
996
|
pollsApiHost: string;
|
|
978
997
|
plausibleHost: string;
|
|
@@ -990,6 +1009,25 @@ type DmcaListsInput = {
|
|
|
990
1009
|
};
|
|
991
1010
|
declare namespace ConfigManager {
|
|
992
1011
|
function setQueryClient(client: QueryClient): void;
|
|
1012
|
+
/**
|
|
1013
|
+
* Register how the SDK should obtain its React Query client, for hosts where
|
|
1014
|
+
* a single shared instance is wrong — principally SSR, where one process
|
|
1015
|
+
* serves many requests and a shared cache both leaks memory and risks serving
|
|
1016
|
+
* one request's data to another.
|
|
1017
|
+
*
|
|
1018
|
+
* `resolve` is called on every SDK cache access and should return the client
|
|
1019
|
+
* belonging to the request currently being handled. In a Next.js App Router
|
|
1020
|
+
* host that means wrapping the factory in React's `cache()`, which memoises
|
|
1021
|
+
* per request:
|
|
1022
|
+
*
|
|
1023
|
+
* ```ts
|
|
1024
|
+
* ConfigManager.setQueryClientResolver(() => getQueryClient());
|
|
1025
|
+
* ```
|
|
1026
|
+
*
|
|
1027
|
+
* Registering a resolver supersedes any client previously passed to
|
|
1028
|
+
* `setQueryClient`; assigning a client afterwards supersedes the resolver.
|
|
1029
|
+
*/
|
|
1030
|
+
function setQueryClientResolver(resolve: () => QueryClient): void;
|
|
993
1031
|
/**
|
|
994
1032
|
* Set the private API host
|
|
995
1033
|
* @param host - The private API host URL (e.g., "https://ecency.com" or "" for relative URLs)
|
|
@@ -1003,6 +1041,20 @@ declare namespace ConfigManager {
|
|
|
1003
1041
|
* @param clientId - Short client label
|
|
1004
1042
|
*/
|
|
1005
1043
|
function setClientId(clientId: string): void;
|
|
1044
|
+
/**
|
|
1045
|
+
* Set the observer used for bridge calls made without a logged-in user.
|
|
1046
|
+
* Defaults to "ecency"; a third-party integrator should point this at their
|
|
1047
|
+
* own moderation account.
|
|
1048
|
+
*
|
|
1049
|
+
* Must be a real account. An empty value is rejected rather than treated as
|
|
1050
|
+
* an opt-out: consumers resolve the observer with `||`, and `getDiscussion`
|
|
1051
|
+
* separately falls back to the post author, so "" would not disable mute
|
|
1052
|
+
* marking. It would silently observe as someone else while being cached under
|
|
1053
|
+
* "", leaving the request and its cache key describing different things.
|
|
1054
|
+
* @param observer - Hive account whose mute list applies to anonymous reads
|
|
1055
|
+
* @throws If given an empty or whitespace-only value
|
|
1056
|
+
*/
|
|
1057
|
+
function setDefaultObserver(observer: string): void;
|
|
1006
1058
|
/**
|
|
1007
1059
|
* Get a validated base URL for API requests
|
|
1008
1060
|
* Returns a valid base URL that can be used with new URL(path, baseUrl)
|
|
@@ -1191,6 +1243,11 @@ declare function isInfoError(error: any): boolean;
|
|
|
1191
1243
|
*/
|
|
1192
1244
|
declare function isNetworkError(error: any): boolean;
|
|
1193
1245
|
|
|
1246
|
+
/**
|
|
1247
|
+
* Builds a client with the SDK's defaults. It is only a factory — request
|
|
1248
|
+
* scoping is the host's job, via `ConfigManager.setQueryClientResolver`, since
|
|
1249
|
+
* only the host knows where one request ends and the next begins.
|
|
1250
|
+
*/
|
|
1194
1251
|
declare function makeQueryClient(): QueryClient;
|
|
1195
1252
|
declare const getQueryClient: () => QueryClient;
|
|
1196
1253
|
declare namespace EcencyQueriesManager {
|