@nexushub/client 0.0.4 → 0.0.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/chunk-2JRYABGG.cjs +117 -0
- package/dist/chunk-BPQMAYT3.js +110 -0
- package/dist/{tools/cli.js → cli.cjs} +14 -8
- package/dist/content/local-cache-client.cjs +56 -0
- package/dist/content/local-cache-client.d.cts +48 -0
- package/dist/content/local-cache-client.d.ts +48 -0
- package/dist/content/local-cache-client.js +54 -0
- package/dist/content/local-cache-server.cjs +10 -0
- package/dist/content/local-cache-server.d.cts +38 -0
- package/dist/content/local-cache-server.d.ts +38 -0
- package/dist/content/local-cache-server.js +1 -0
- package/dist/index.cjs +2008 -0
- package/dist/{src/index.d.mts → index.d.cts} +32 -28
- package/dist/{src/index.d.ts → index.d.ts} +32 -28
- package/dist/index.js +1984 -0
- package/package.json +18 -5
- package/dist/src/index.js +0 -7259
- package/dist/src/index.mjs +0 -7238
- package/dist/tools/cli.d.mts +0 -1
- package/dist/tools/cli.d.ts +0 -1
- package/dist/tools/cli.mjs +0 -639
|
@@ -1,18 +1,22 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import React from 'react';
|
|
3
|
+
export { LocalCache } from './content/local-cache-server.cjs';
|
|
3
4
|
|
|
4
5
|
interface MinimalNexusConfig {
|
|
5
6
|
apiUrl?: string;
|
|
7
|
+
analyticsUrl?: string;
|
|
6
8
|
apiKey?: string;
|
|
7
9
|
projectId?: string;
|
|
8
10
|
}
|
|
9
|
-
declare const DEFAULT_API_URL = "
|
|
10
|
-
declare const
|
|
11
|
+
declare const DEFAULT_API_URL = "http://localhost:3001";
|
|
12
|
+
declare const DEFAULT_ANALYTICS_URL = "http://localhost:3002";
|
|
13
|
+
declare const LOCAL_NEST_URL = "http://localhost:3001";
|
|
14
|
+
declare const LOCAL_RUST_URL = "http://localhost:3002";
|
|
11
15
|
declare const getEnvConfig: () => MinimalNexusConfig;
|
|
16
|
+
/**
|
|
17
|
+
* Merges base environment config with manual overrides from the constructor
|
|
18
|
+
*/
|
|
12
19
|
declare const mergeConfigs: (base: MinimalNexusConfig, override: Partial<MinimalNexusConfig>) => MinimalNexusConfig;
|
|
13
|
-
declare const hasRequiredConfig: (config: MinimalNexusConfig) => config is MinimalNexusConfig & {
|
|
14
|
-
projectId: string;
|
|
15
|
-
};
|
|
16
20
|
declare const getFullConfig: (partialConfig?: Partial<MinimalNexusConfig>) => MinimalNexusConfig;
|
|
17
21
|
declare const validateConfig: (config: MinimalNexusConfig) => string[];
|
|
18
22
|
|
|
@@ -258,10 +262,27 @@ declare class NexusClient {
|
|
|
258
262
|
declare const nexus: NexusClient;
|
|
259
263
|
declare const createNexusClient: (config: Partial<NexusConfig>) => NexusClient;
|
|
260
264
|
|
|
261
|
-
|
|
265
|
+
interface NexusProviderProps {
|
|
262
266
|
children: React.ReactNode;
|
|
267
|
+
/**
|
|
268
|
+
* Optional project ID override.
|
|
269
|
+
* If provided, this will override the environment variable NEXT_PUBLIC_NEXUS_ID.
|
|
270
|
+
*/
|
|
263
271
|
projectId?: string;
|
|
264
|
-
|
|
272
|
+
/**
|
|
273
|
+
* Optional configuration to disable analytics tracking (e.g., for GDPR compliance).
|
|
274
|
+
*/
|
|
275
|
+
disableAnalytics?: boolean;
|
|
276
|
+
}
|
|
277
|
+
/**
|
|
278
|
+
* The God-Tier NexusHub Provider.
|
|
279
|
+
*
|
|
280
|
+
* 1. Orchestrates the Authentication state.
|
|
281
|
+
* 2. Manages the Analytics lifecycle.
|
|
282
|
+
* 3. Automates Page View tracking on route changes.
|
|
283
|
+
* 4. Provides the NexusClient singleton via Context.
|
|
284
|
+
*/
|
|
285
|
+
declare const NexusProvider: ({ children, projectId, disableAnalytics, }: NexusProviderProps) => react_jsx_runtime.JSX.Element;
|
|
265
286
|
|
|
266
287
|
interface SiteUser {
|
|
267
288
|
id: string;
|
|
@@ -314,14 +335,10 @@ declare const AuthProvider: ({ children, config }: {
|
|
|
314
335
|
declare const useNexusAuth: () => AuthContextType;
|
|
315
336
|
|
|
316
337
|
/**
|
|
317
|
-
* NexusHub
|
|
338
|
+
* NexusHub Shared Cache Implementations
|
|
318
339
|
*
|
|
319
|
-
*
|
|
320
|
-
*
|
|
321
|
-
* 2. Cache tagging for precise invalidation
|
|
322
|
-
* 3. LRU eviction policy
|
|
323
|
-
* 4. Cache statistics and monitoring
|
|
324
|
-
* 5. Development mode with filesystem cache
|
|
340
|
+
* Contains MemoryCache (LRU) and BrowserCache (LocalStorage)
|
|
341
|
+
* which are safe for universal usage.
|
|
325
342
|
*/
|
|
326
343
|
interface CacheOptions {
|
|
327
344
|
maxSize?: number;
|
|
@@ -364,19 +381,6 @@ declare class MemoryCache {
|
|
|
364
381
|
private calculateSize;
|
|
365
382
|
private updateHitRate;
|
|
366
383
|
}
|
|
367
|
-
declare class LocalCache {
|
|
368
|
-
private data;
|
|
369
|
-
private hasLoaded;
|
|
370
|
-
private cachePath;
|
|
371
|
-
constructor(customPath?: string);
|
|
372
|
-
isLoaded(): boolean;
|
|
373
|
-
private load;
|
|
374
|
-
getPage(slug: string): any;
|
|
375
|
-
getCollection(collectionId: string): any[] | null;
|
|
376
|
-
getGlobals(): any;
|
|
377
|
-
getAllData(): any;
|
|
378
|
-
private shouldWarnAboutMissingCache;
|
|
379
|
-
}
|
|
380
384
|
declare class BrowserCache {
|
|
381
385
|
private projectId;
|
|
382
386
|
private prefix;
|
|
@@ -395,4 +399,4 @@ declare class BrowserCache {
|
|
|
395
399
|
|
|
396
400
|
declare const VERSION = "0.0.1";
|
|
397
401
|
|
|
398
|
-
export { AnalyticsEngine, type AuthContextType, type AuthError, AuthProvider, type AuthState, BrowserCache, type CacheEntry, type CacheMetadata, CacheTags, type CollectionQuery, type CollectionResponse, ContentEngine, type ContentResponse,
|
|
402
|
+
export { AnalyticsEngine, type AuthContextType, type AuthError, AuthProvider, type AuthState, BrowserCache, type CacheEntry, type CacheMetadata, CacheTags, type CollectionQuery, type CollectionResponse, ContentEngine, type ContentResponse, DEFAULT_ANALYTICS_URL, DEFAULT_API_URL, type ErrorResponse, LOCAL_NEST_URL, LOCAL_RUST_URL, type LoginCredentials, MemoryCache, type MinimalNexusConfig, NexusClient, type NexusConfig, NexusProvider, type RegisterCredentials, type SiteUser, VERSION, createNexusClient, getEnvConfig, getFullConfig, mergeConfigs, nexus, useNexusAuth, validateConfig };
|
|
@@ -1,18 +1,22 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import React from 'react';
|
|
3
|
+
export { LocalCache } from './content/local-cache-server.js';
|
|
3
4
|
|
|
4
5
|
interface MinimalNexusConfig {
|
|
5
6
|
apiUrl?: string;
|
|
7
|
+
analyticsUrl?: string;
|
|
6
8
|
apiKey?: string;
|
|
7
9
|
projectId?: string;
|
|
8
10
|
}
|
|
9
|
-
declare const DEFAULT_API_URL = "
|
|
10
|
-
declare const
|
|
11
|
+
declare const DEFAULT_API_URL = "http://localhost:3001";
|
|
12
|
+
declare const DEFAULT_ANALYTICS_URL = "http://localhost:3002";
|
|
13
|
+
declare const LOCAL_NEST_URL = "http://localhost:3001";
|
|
14
|
+
declare const LOCAL_RUST_URL = "http://localhost:3002";
|
|
11
15
|
declare const getEnvConfig: () => MinimalNexusConfig;
|
|
16
|
+
/**
|
|
17
|
+
* Merges base environment config with manual overrides from the constructor
|
|
18
|
+
*/
|
|
12
19
|
declare const mergeConfigs: (base: MinimalNexusConfig, override: Partial<MinimalNexusConfig>) => MinimalNexusConfig;
|
|
13
|
-
declare const hasRequiredConfig: (config: MinimalNexusConfig) => config is MinimalNexusConfig & {
|
|
14
|
-
projectId: string;
|
|
15
|
-
};
|
|
16
20
|
declare const getFullConfig: (partialConfig?: Partial<MinimalNexusConfig>) => MinimalNexusConfig;
|
|
17
21
|
declare const validateConfig: (config: MinimalNexusConfig) => string[];
|
|
18
22
|
|
|
@@ -258,10 +262,27 @@ declare class NexusClient {
|
|
|
258
262
|
declare const nexus: NexusClient;
|
|
259
263
|
declare const createNexusClient: (config: Partial<NexusConfig>) => NexusClient;
|
|
260
264
|
|
|
261
|
-
|
|
265
|
+
interface NexusProviderProps {
|
|
262
266
|
children: React.ReactNode;
|
|
267
|
+
/**
|
|
268
|
+
* Optional project ID override.
|
|
269
|
+
* If provided, this will override the environment variable NEXT_PUBLIC_NEXUS_ID.
|
|
270
|
+
*/
|
|
263
271
|
projectId?: string;
|
|
264
|
-
|
|
272
|
+
/**
|
|
273
|
+
* Optional configuration to disable analytics tracking (e.g., for GDPR compliance).
|
|
274
|
+
*/
|
|
275
|
+
disableAnalytics?: boolean;
|
|
276
|
+
}
|
|
277
|
+
/**
|
|
278
|
+
* The God-Tier NexusHub Provider.
|
|
279
|
+
*
|
|
280
|
+
* 1. Orchestrates the Authentication state.
|
|
281
|
+
* 2. Manages the Analytics lifecycle.
|
|
282
|
+
* 3. Automates Page View tracking on route changes.
|
|
283
|
+
* 4. Provides the NexusClient singleton via Context.
|
|
284
|
+
*/
|
|
285
|
+
declare const NexusProvider: ({ children, projectId, disableAnalytics, }: NexusProviderProps) => react_jsx_runtime.JSX.Element;
|
|
265
286
|
|
|
266
287
|
interface SiteUser {
|
|
267
288
|
id: string;
|
|
@@ -314,14 +335,10 @@ declare const AuthProvider: ({ children, config }: {
|
|
|
314
335
|
declare const useNexusAuth: () => AuthContextType;
|
|
315
336
|
|
|
316
337
|
/**
|
|
317
|
-
* NexusHub
|
|
338
|
+
* NexusHub Shared Cache Implementations
|
|
318
339
|
*
|
|
319
|
-
*
|
|
320
|
-
*
|
|
321
|
-
* 2. Cache tagging for precise invalidation
|
|
322
|
-
* 3. LRU eviction policy
|
|
323
|
-
* 4. Cache statistics and monitoring
|
|
324
|
-
* 5. Development mode with filesystem cache
|
|
340
|
+
* Contains MemoryCache (LRU) and BrowserCache (LocalStorage)
|
|
341
|
+
* which are safe for universal usage.
|
|
325
342
|
*/
|
|
326
343
|
interface CacheOptions {
|
|
327
344
|
maxSize?: number;
|
|
@@ -364,19 +381,6 @@ declare class MemoryCache {
|
|
|
364
381
|
private calculateSize;
|
|
365
382
|
private updateHitRate;
|
|
366
383
|
}
|
|
367
|
-
declare class LocalCache {
|
|
368
|
-
private data;
|
|
369
|
-
private hasLoaded;
|
|
370
|
-
private cachePath;
|
|
371
|
-
constructor(customPath?: string);
|
|
372
|
-
isLoaded(): boolean;
|
|
373
|
-
private load;
|
|
374
|
-
getPage(slug: string): any;
|
|
375
|
-
getCollection(collectionId: string): any[] | null;
|
|
376
|
-
getGlobals(): any;
|
|
377
|
-
getAllData(): any;
|
|
378
|
-
private shouldWarnAboutMissingCache;
|
|
379
|
-
}
|
|
380
384
|
declare class BrowserCache {
|
|
381
385
|
private projectId;
|
|
382
386
|
private prefix;
|
|
@@ -395,4 +399,4 @@ declare class BrowserCache {
|
|
|
395
399
|
|
|
396
400
|
declare const VERSION = "0.0.1";
|
|
397
401
|
|
|
398
|
-
export { AnalyticsEngine, type AuthContextType, type AuthError, AuthProvider, type AuthState, BrowserCache, type CacheEntry, type CacheMetadata, CacheTags, type CollectionQuery, type CollectionResponse, ContentEngine, type ContentResponse,
|
|
402
|
+
export { AnalyticsEngine, type AuthContextType, type AuthError, AuthProvider, type AuthState, BrowserCache, type CacheEntry, type CacheMetadata, CacheTags, type CollectionQuery, type CollectionResponse, ContentEngine, type ContentResponse, DEFAULT_ANALYTICS_URL, DEFAULT_API_URL, type ErrorResponse, LOCAL_NEST_URL, LOCAL_RUST_URL, type LoginCredentials, MemoryCache, type MinimalNexusConfig, NexusClient, type NexusConfig, NexusProvider, type RegisterCredentials, type SiteUser, VERSION, createNexusClient, getEnvConfig, getFullConfig, mergeConfigs, nexus, useNexusAuth, validateConfig };
|