@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.
@@ -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 = "https://api.nexushub.com/v1";
10
- declare const DEFAULT_CDN_URL = "https://cdn.nexushub.com";
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
- declare const NexusProvider: ({ children, projectId }: {
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
- }) => react_jsx_runtime.JSX.Element;
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 Advanced Caching System
338
+ * NexusHub Shared Cache Implementations
318
339
  *
319
- * Features:
320
- * 1. Multi-layer caching (Memory > Local > Remote)
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, DEFAULT_API_URL, DEFAULT_CDN_URL, type ErrorResponse, LocalCache, type LoginCredentials, MemoryCache, type MinimalNexusConfig, NexusClient, type NexusConfig, NexusProvider, type RegisterCredentials, type SiteUser, VERSION, createNexusClient, getEnvConfig, getFullConfig, hasRequiredConfig, mergeConfigs, nexus, useNexusAuth, validateConfig };
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 = "https://api.nexushub.com/v1";
10
- declare const DEFAULT_CDN_URL = "https://cdn.nexushub.com";
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
- declare const NexusProvider: ({ children, projectId }: {
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
- }) => react_jsx_runtime.JSX.Element;
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 Advanced Caching System
338
+ * NexusHub Shared Cache Implementations
318
339
  *
319
- * Features:
320
- * 1. Multi-layer caching (Memory > Local > Remote)
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, DEFAULT_API_URL, DEFAULT_CDN_URL, type ErrorResponse, LocalCache, type LoginCredentials, MemoryCache, type MinimalNexusConfig, NexusClient, type NexusConfig, NexusProvider, type RegisterCredentials, type SiteUser, VERSION, createNexusClient, getEnvConfig, getFullConfig, hasRequiredConfig, mergeConfigs, nexus, useNexusAuth, validateConfig };
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 };