@nexushub/client 1.1.4 → 1.1.7
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/cli.cjs +124 -123
- package/dist/index.cjs +191 -287
- package/dist/index.d.cts +68 -112
- package/dist/index.d.ts +68 -112
- package/dist/index.js +191 -287
- package/dist/react.cjs +206 -302
- package/dist/react.d.cts +12 -48
- package/dist/react.d.ts +12 -48
- package/dist/react.js +191 -287
- package/package.json +1 -1
package/dist/react.d.cts
CHANGED
|
@@ -11,6 +11,14 @@ interface NexusRendererProps {
|
|
|
11
11
|
}
|
|
12
12
|
declare function NexusRenderer({ content, className, onCommentClick, onImageClick, hydrateCharts, enableImageInteraction, documentClassName, }: NexusRendererProps): React.JSX.Element;
|
|
13
13
|
|
|
14
|
+
interface CacheStats {
|
|
15
|
+
size: number;
|
|
16
|
+
hits: number;
|
|
17
|
+
misses: number;
|
|
18
|
+
hitRate: number;
|
|
19
|
+
evictions: number;
|
|
20
|
+
}
|
|
21
|
+
|
|
14
22
|
interface MinimalNexusConfig {
|
|
15
23
|
apiUrl?: string;
|
|
16
24
|
analyticsUrl?: string;
|
|
@@ -77,14 +85,9 @@ declare class ContentEngine {
|
|
|
77
85
|
private circuitBreaker;
|
|
78
86
|
private defaultRevalidate;
|
|
79
87
|
private cacheStrategy;
|
|
80
|
-
private abortController?;
|
|
81
88
|
private isServer;
|
|
82
89
|
constructor(config: NexusConfig);
|
|
83
|
-
/** Update runtime configuration without exposing internal mutation. */
|
|
84
90
|
updateConfig(config: NexusConfig): void;
|
|
85
|
-
/**
|
|
86
|
-
* Fetch a Single Page with full strategy pipeline
|
|
87
|
-
*/
|
|
88
91
|
getPage<T = any>(slug: string, options?: {
|
|
89
92
|
revalidate?: number | false;
|
|
90
93
|
tags?: string[];
|
|
@@ -92,67 +95,41 @@ declare class ContentEngine {
|
|
|
92
95
|
includeMetadata?: boolean;
|
|
93
96
|
}): Promise<T>;
|
|
94
97
|
private _getPage;
|
|
95
|
-
/**
|
|
96
|
-
* Fetch a Collection (Optimized)
|
|
97
|
-
*/
|
|
98
98
|
getCollection<T = any>(collectionId: string, query?: CollectionQuery, options?: {
|
|
99
99
|
revalidate?: number | false;
|
|
100
100
|
tags?: string[];
|
|
101
101
|
forceRefresh?: boolean;
|
|
102
102
|
includeMetadata?: boolean;
|
|
103
103
|
}): Promise<CollectionResponse<T>>;
|
|
104
|
-
private _getCollection;
|
|
105
|
-
/**
|
|
106
|
-
* Fetch Global Settings
|
|
107
|
-
*/
|
|
108
104
|
getGlobals<T = any>(options?: {
|
|
109
105
|
include?: string[];
|
|
110
106
|
revalidate?: number | false;
|
|
111
107
|
forceRefresh?: boolean;
|
|
112
108
|
tags?: string[];
|
|
113
109
|
}): Promise<T>;
|
|
114
|
-
/**
|
|
115
|
-
* Get a single item from a collection (Uses Request Batching)
|
|
116
|
-
*/
|
|
117
110
|
getItem<T = any>(collectionId: string, itemId: string, options?: {
|
|
118
111
|
revalidate?: number | false;
|
|
119
112
|
tags?: string[];
|
|
120
113
|
include?: string[];
|
|
114
|
+
forceRefresh?: boolean;
|
|
121
115
|
}): Promise<T>;
|
|
122
|
-
/**
|
|
123
|
-
* Search across collections
|
|
124
|
-
*/
|
|
125
116
|
search<T = any>(query: string, options?: {
|
|
126
117
|
collections?: string[];
|
|
127
118
|
fields?: string[];
|
|
128
119
|
limit?: number;
|
|
129
120
|
revalidate?: number | false;
|
|
121
|
+
forceRefresh?: boolean;
|
|
130
122
|
}): Promise<{
|
|
131
123
|
results: T[];
|
|
132
124
|
total: number;
|
|
133
125
|
}>;
|
|
134
|
-
/**
|
|
135
|
-
* Prefetch content
|
|
136
|
-
*/
|
|
137
126
|
prefetch(urls: string[]): Promise<void>;
|
|
138
|
-
/**
|
|
139
|
-
* Robust Real-time Subscriptions (SSE) with Auto-Reconnect
|
|
140
|
-
*/
|
|
141
127
|
subscribeToUpdates(callback: (data: any) => void): () => void;
|
|
142
|
-
private checkCaches;
|
|
143
128
|
private writeCache;
|
|
144
129
|
invalidateCache(tags: string[]): void;
|
|
145
130
|
clearCache(): void;
|
|
146
131
|
getCacheStats(): {
|
|
147
|
-
memory:
|
|
148
|
-
size: number;
|
|
149
|
-
hits: number;
|
|
150
|
-
misses: number;
|
|
151
|
-
hitRate: number;
|
|
152
|
-
};
|
|
153
|
-
browser: {
|
|
154
|
-
size: number;
|
|
155
|
-
} | null;
|
|
132
|
+
memory: CacheStats;
|
|
156
133
|
local: {
|
|
157
134
|
loaded: boolean;
|
|
158
135
|
};
|
|
@@ -163,12 +140,7 @@ declare class ContentEngine {
|
|
|
163
140
|
private fetchWithTimeout;
|
|
164
141
|
private getHeaders;
|
|
165
142
|
private isCacheValid;
|
|
166
|
-
/**
|
|
167
|
-
* 🛡️ FIX: Normalizes timeout errors (AbortError, 408, or Timeout messages)
|
|
168
|
-
* into clean, standardized "Request timeout" errors.
|
|
169
|
-
*/
|
|
170
143
|
private normalizeError;
|
|
171
|
-
cancelRequests(): void;
|
|
172
144
|
cleanup(): void;
|
|
173
145
|
}
|
|
174
146
|
|
|
@@ -339,15 +311,7 @@ declare class NexusClient {
|
|
|
339
311
|
*/
|
|
340
312
|
diagnostics(): {
|
|
341
313
|
cache: {
|
|
342
|
-
memory:
|
|
343
|
-
size: number;
|
|
344
|
-
hits: number;
|
|
345
|
-
misses: number;
|
|
346
|
-
hitRate: number;
|
|
347
|
-
};
|
|
348
|
-
browser: {
|
|
349
|
-
size: number;
|
|
350
|
-
} | null;
|
|
314
|
+
memory: CacheStats;
|
|
351
315
|
local: {
|
|
352
316
|
loaded: boolean;
|
|
353
317
|
};
|
package/dist/react.d.ts
CHANGED
|
@@ -11,6 +11,14 @@ interface NexusRendererProps {
|
|
|
11
11
|
}
|
|
12
12
|
declare function NexusRenderer({ content, className, onCommentClick, onImageClick, hydrateCharts, enableImageInteraction, documentClassName, }: NexusRendererProps): React.JSX.Element;
|
|
13
13
|
|
|
14
|
+
interface CacheStats {
|
|
15
|
+
size: number;
|
|
16
|
+
hits: number;
|
|
17
|
+
misses: number;
|
|
18
|
+
hitRate: number;
|
|
19
|
+
evictions: number;
|
|
20
|
+
}
|
|
21
|
+
|
|
14
22
|
interface MinimalNexusConfig {
|
|
15
23
|
apiUrl?: string;
|
|
16
24
|
analyticsUrl?: string;
|
|
@@ -77,14 +85,9 @@ declare class ContentEngine {
|
|
|
77
85
|
private circuitBreaker;
|
|
78
86
|
private defaultRevalidate;
|
|
79
87
|
private cacheStrategy;
|
|
80
|
-
private abortController?;
|
|
81
88
|
private isServer;
|
|
82
89
|
constructor(config: NexusConfig);
|
|
83
|
-
/** Update runtime configuration without exposing internal mutation. */
|
|
84
90
|
updateConfig(config: NexusConfig): void;
|
|
85
|
-
/**
|
|
86
|
-
* Fetch a Single Page with full strategy pipeline
|
|
87
|
-
*/
|
|
88
91
|
getPage<T = any>(slug: string, options?: {
|
|
89
92
|
revalidate?: number | false;
|
|
90
93
|
tags?: string[];
|
|
@@ -92,67 +95,41 @@ declare class ContentEngine {
|
|
|
92
95
|
includeMetadata?: boolean;
|
|
93
96
|
}): Promise<T>;
|
|
94
97
|
private _getPage;
|
|
95
|
-
/**
|
|
96
|
-
* Fetch a Collection (Optimized)
|
|
97
|
-
*/
|
|
98
98
|
getCollection<T = any>(collectionId: string, query?: CollectionQuery, options?: {
|
|
99
99
|
revalidate?: number | false;
|
|
100
100
|
tags?: string[];
|
|
101
101
|
forceRefresh?: boolean;
|
|
102
102
|
includeMetadata?: boolean;
|
|
103
103
|
}): Promise<CollectionResponse<T>>;
|
|
104
|
-
private _getCollection;
|
|
105
|
-
/**
|
|
106
|
-
* Fetch Global Settings
|
|
107
|
-
*/
|
|
108
104
|
getGlobals<T = any>(options?: {
|
|
109
105
|
include?: string[];
|
|
110
106
|
revalidate?: number | false;
|
|
111
107
|
forceRefresh?: boolean;
|
|
112
108
|
tags?: string[];
|
|
113
109
|
}): Promise<T>;
|
|
114
|
-
/**
|
|
115
|
-
* Get a single item from a collection (Uses Request Batching)
|
|
116
|
-
*/
|
|
117
110
|
getItem<T = any>(collectionId: string, itemId: string, options?: {
|
|
118
111
|
revalidate?: number | false;
|
|
119
112
|
tags?: string[];
|
|
120
113
|
include?: string[];
|
|
114
|
+
forceRefresh?: boolean;
|
|
121
115
|
}): Promise<T>;
|
|
122
|
-
/**
|
|
123
|
-
* Search across collections
|
|
124
|
-
*/
|
|
125
116
|
search<T = any>(query: string, options?: {
|
|
126
117
|
collections?: string[];
|
|
127
118
|
fields?: string[];
|
|
128
119
|
limit?: number;
|
|
129
120
|
revalidate?: number | false;
|
|
121
|
+
forceRefresh?: boolean;
|
|
130
122
|
}): Promise<{
|
|
131
123
|
results: T[];
|
|
132
124
|
total: number;
|
|
133
125
|
}>;
|
|
134
|
-
/**
|
|
135
|
-
* Prefetch content
|
|
136
|
-
*/
|
|
137
126
|
prefetch(urls: string[]): Promise<void>;
|
|
138
|
-
/**
|
|
139
|
-
* Robust Real-time Subscriptions (SSE) with Auto-Reconnect
|
|
140
|
-
*/
|
|
141
127
|
subscribeToUpdates(callback: (data: any) => void): () => void;
|
|
142
|
-
private checkCaches;
|
|
143
128
|
private writeCache;
|
|
144
129
|
invalidateCache(tags: string[]): void;
|
|
145
130
|
clearCache(): void;
|
|
146
131
|
getCacheStats(): {
|
|
147
|
-
memory:
|
|
148
|
-
size: number;
|
|
149
|
-
hits: number;
|
|
150
|
-
misses: number;
|
|
151
|
-
hitRate: number;
|
|
152
|
-
};
|
|
153
|
-
browser: {
|
|
154
|
-
size: number;
|
|
155
|
-
} | null;
|
|
132
|
+
memory: CacheStats;
|
|
156
133
|
local: {
|
|
157
134
|
loaded: boolean;
|
|
158
135
|
};
|
|
@@ -163,12 +140,7 @@ declare class ContentEngine {
|
|
|
163
140
|
private fetchWithTimeout;
|
|
164
141
|
private getHeaders;
|
|
165
142
|
private isCacheValid;
|
|
166
|
-
/**
|
|
167
|
-
* 🛡️ FIX: Normalizes timeout errors (AbortError, 408, or Timeout messages)
|
|
168
|
-
* into clean, standardized "Request timeout" errors.
|
|
169
|
-
*/
|
|
170
143
|
private normalizeError;
|
|
171
|
-
cancelRequests(): void;
|
|
172
144
|
cleanup(): void;
|
|
173
145
|
}
|
|
174
146
|
|
|
@@ -339,15 +311,7 @@ declare class NexusClient {
|
|
|
339
311
|
*/
|
|
340
312
|
diagnostics(): {
|
|
341
313
|
cache: {
|
|
342
|
-
memory:
|
|
343
|
-
size: number;
|
|
344
|
-
hits: number;
|
|
345
|
-
misses: number;
|
|
346
|
-
hitRate: number;
|
|
347
|
-
};
|
|
348
|
-
browser: {
|
|
349
|
-
size: number;
|
|
350
|
-
} | null;
|
|
314
|
+
memory: CacheStats;
|
|
351
315
|
local: {
|
|
352
316
|
loaded: boolean;
|
|
353
317
|
};
|