@insforge/sdk 1.0.1-refresh.3 → 1.0.1-refresh.5

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/index.d.mts CHANGED
@@ -146,8 +146,9 @@ interface SessionStorageStrategy {
146
146
  * Secure Session Storage Strategy
147
147
  *
148
148
  * Stores access token in memory only (cleared on page refresh).
149
- * Refresh token is stored in httpOnly cookie by the backend.
150
- * Uses an 'isAuthenticated' flag cookie to detect if refresh should be attempted.
149
+ * Refresh token is stored in httpOnly cookie by the backend (on backend domain).
150
+ * The `isAuthenticated` cookie is set by the SDK on the frontend domain to signal
151
+ * that a secure session exists and token refresh should be attempted on page reload.
151
152
  *
152
153
  * Security benefits:
153
154
  * - Access token not accessible to XSS attacks (in memory only)
@@ -165,7 +166,6 @@ declare class SecureSessionStorage implements SessionStorageStrategy {
165
166
  setUser(user: UserSchema): void;
166
167
  clearSession(): void;
167
168
  shouldAttemptRefresh(): boolean;
168
- private setAuthFlag;
169
169
  private hasAuthFlag;
170
170
  }
171
171
  /**
@@ -191,64 +191,6 @@ declare class LocalSessionStorage implements SessionStorageStrategy {
191
191
  shouldAttemptRefresh(): boolean;
192
192
  }
193
193
 
194
- /**
195
- * Backend Configuration for InsForge SDK
196
- *
197
- * Fetches backend configuration via the /api/health endpoint
198
- * and creates appropriate storage strategies based on that configuration.
199
- */
200
-
201
- /**
202
- * Backend configuration returned from /api/health
203
- */
204
- interface BackendConfig {
205
- /** Whether backend supports secure httpOnly cookie storage for refresh tokens */
206
- secureSessionStorage: boolean;
207
- /** Whether backend supports token refresh endpoint */
208
- refreshTokens: boolean;
209
- }
210
- /**
211
- * Fetch backend configuration from the /api/health endpoint
212
- *
213
- * This is the primary method for determining which features the backend supports.
214
- * The SDK uses this information to select appropriate storage strategies.
215
- *
216
- * @param baseUrl - The backend base URL
217
- * @param fetchImpl - Optional custom fetch implementation
218
- * @returns Backend configuration object
219
- *
220
- * @example
221
- * ```typescript
222
- * const config = await discoverBackendConfig('https://api.example.com');
223
- * if (config.secureSessionStorage) {
224
- * // Use secure storage strategy
225
- * }
226
- * ```
227
- */
228
- declare function discoverBackendConfig(baseUrl: string, fetchImpl?: typeof fetch): Promise<BackendConfig>;
229
- /**
230
- * Create the appropriate session storage strategy based on backend configuration
231
- *
232
- * This is the factory function that implements the Strategy Pattern.
233
- * It selects the storage implementation based on what the backend supports.
234
- *
235
- * @param config - Backend configuration from discoverBackendConfig()
236
- * @param storage - Optional custom storage adapter (for LocalSessionStorage)
237
- * @returns Appropriate SessionStorageStrategy implementation
238
- *
239
- * @example
240
- * ```typescript
241
- * const config = await discoverBackendConfig(baseUrl);
242
- * const storage = createSessionStorage(config);
243
- * storage.saveSession({ accessToken: '...', user: {...} });
244
- * ```
245
- */
246
- declare function createSessionStorage(config: BackendConfig, storage?: TokenStorage): SessionStorageStrategy;
247
- /**
248
- * Get default backend configuration (useful for testing or manual override)
249
- */
250
- declare function getDefaultBackendConfig(): BackendConfig;
251
-
252
194
  /**
253
195
  * Token Manager for InsForge SDK
254
196
  *
@@ -334,66 +276,43 @@ type ProfileData = Record<string, any> & {
334
276
  * Supports any fields that exist in the profile table
335
277
  */
336
278
  type UpdateProfileData = Partial<Record<string, any>>;
337
- /**
338
- * Auth state change event types
339
- * Following Supabase pattern for consistency
340
- */
341
- type AuthStateChangeEvent = 'INITIAL_SESSION' | 'SIGNED_IN' | 'SIGNED_OUT' | 'TOKEN_REFRESHED';
342
- /**
343
- * Auth state change callback type
344
- */
345
- type AuthStateChangeCallback = (event: AuthStateChangeEvent, session: AuthSession | null) => void;
346
279
  declare class Auth {
347
280
  private http;
348
281
  private tokenManager;
349
282
  private database;
350
- private authStateListeners;
351
- private initializePromise;
352
- constructor(http: HttpClient, tokenManager: TokenManager, initializePromise?: Promise<void>);
283
+ constructor(http: HttpClient, tokenManager: TokenManager);
353
284
  /**
354
- * Subscribe to auth state changes
355
- *
356
- * New subscribers will receive an INITIAL_SESSION event after initialization completes.
357
- * This ensures no race condition where subscribers miss the initial state.
358
- *
359
- * @param callback - Function called when auth state changes
360
- * @returns Unsubscribe function
361
- *
362
- * @example
363
- * ```typescript
364
- * const { data: { subscription } } = client.auth.onAuthStateChange((event, session) => {
365
- * if (event === 'SIGNED_IN') {
366
- * console.log('User signed in:', session?.user.email);
367
- * } else if (event === 'SIGNED_OUT') {
368
- * console.log('User signed out');
369
- * }
370
- * });
371
- *
372
- * // Later: unsubscribe
373
- * subscription.unsubscribe();
374
- * ```
285
+ * Set the isAuthenticated cookie flag on the frontend domain
286
+ * This is managed by SDK, not backend, to work in cross-origin scenarios
375
287
  */
376
- onAuthStateChange(callback: AuthStateChangeCallback): {
377
- data: {
378
- subscription: {
379
- unsubscribe: () => void;
380
- };
381
- };
382
- };
288
+ private setAuthenticatedCookie;
289
+ /**
290
+ * Clear the isAuthenticated cookie flag from the frontend domain
291
+ */
292
+ private clearAuthenticatedCookie;
383
293
  /**
384
- * Emit auth state change to all listeners
294
+ * Switch to SecureSessionStorage (cookie-based auth)
295
+ * Called when backend returns sessionMode: 'secure'
385
296
  * @internal
386
297
  */
387
- _emitAuthStateChange(event: AuthStateChangeEvent, session: AuthSession | null): void;
298
+ _switchToSecureStorage(): void;
388
299
  /**
389
- * Check if an error represents an authentication failure
390
- * Used to determine appropriate HTTP status code (401 vs 500)
300
+ * Switch to LocalSessionStorage (localStorage-based auth)
301
+ * Called when cookie-based auth fails (fallback)
302
+ * @internal
391
303
  */
392
- private isAuthenticationError;
304
+ _switchToLocalStorage(): void;
393
305
  /**
394
- * Detect and handle OAuth callback parameters in the URL.
395
- * Called by client after initialization.
306
+ * Detect storage strategy based on backend response
307
+ * @param sessionMode - The sessionMode returned by backend ('secure' or undefined)
308
+ * @internal
396
309
  */
310
+ private _detectStorageFromResponse;
311
+ /**
312
+ * Automatically detect and handle OAuth callback parameters in the URL
313
+ * This runs on initialization to seamlessly complete the OAuth flow
314
+ * Matches the backend's OAuth callback response (backend/src/api/routes/auth.ts:540-544)
315
+ */
397
316
  detectAuthCallback(): void;
398
317
  /**
399
318
  * Sign up a new user
@@ -460,6 +379,9 @@ declare class Auth {
460
379
  /**
461
380
  * Get the current user with full profile information
462
381
  * Returns both auth info (id, email, role) and profile data (dynamic fields from users table)
382
+ *
383
+ * In secure session mode (httpOnly cookie), this method will automatically attempt
384
+ * to refresh the session if no access token is available (e.g., after page reload).
463
385
  */
464
386
  getCurrentUser(): Promise<{
465
387
  data: {
@@ -856,98 +778,65 @@ declare class Functions {
856
778
  /**
857
779
  * Main InsForge SDK Client
858
780
  *
859
- * The client automatically initializes in the background and emits auth state changes.
860
- * Subscribe to `auth.onAuthStateChange` to be notified when initialization completes.
861
- *
862
781
  * @example
863
782
  * ```typescript
864
783
  * import { InsForgeClient } from '@insforge/sdk';
865
784
  *
866
- * // Create client - synchronous, immediately usable
867
785
  * const client = new InsForgeClient({
868
786
  * baseUrl: 'http://localhost:7130'
869
787
  * });
870
788
  *
871
- * // Subscribe to auth state changes
872
- * client.auth.onAuthStateChange((event, session) => {
873
- * console.log('Auth event:', event);
874
- * if (session) {
875
- * console.log('User:', session.user.email);
876
- * }
789
+ * // Authentication
790
+ * const { data, error } = await client.auth.signUp({
791
+ * email: 'user@example.com',
792
+ * password: 'password123',
793
+ * name: 'John Doe'
877
794
  * });
878
795
  *
879
- * // Client is immediately usable for auth operations
880
- * const { data, error } = await client.auth.signInWithPassword({
881
- * email: 'user@example.com',
882
- * password: 'password123'
796
+ * // Database operations
797
+ * const { data, error } = await client.database
798
+ * .from('posts')
799
+ * .select('*')
800
+ * .eq('user_id', session.user.id)
801
+ * .order('created_at', { ascending: false })
802
+ * .limit(10);
803
+ *
804
+ * // Insert data
805
+ * const { data: newPost } = await client.database
806
+ * .from('posts')
807
+ * .insert({ title: 'Hello', content: 'World' })
808
+ * .single();
809
+ *
810
+ * // Invoke edge functions
811
+ * const { data, error } = await client.functions.invoke('my-function', {
812
+ * body: { message: 'Hello from SDK' }
883
813
  * });
884
814
  * ```
885
815
  */
886
816
  declare class InsForgeClient {
887
817
  private http;
888
818
  private tokenManager;
889
- private backendConfig;
890
- /**
891
- * Promise that resolves when initialization is complete.
892
- * Use this to ensure operations wait for the client to be ready.
893
- */
894
- private initializePromise;
895
- private initializeResolve;
896
819
  readonly auth: Auth;
897
820
  readonly database: Database;
898
821
  readonly storage: Storage;
899
822
  readonly ai: AI;
900
823
  readonly functions: Functions;
901
824
  constructor(config?: InsForgeConfig);
902
- /**
903
- * Internal async initialization - discovers backend config and recovers session.
904
- * Emits INITIAL_SESSION event when complete.
905
- * @internal
906
- */
907
- private _initializeAsync;
908
- /**
909
- * Wait for client initialization to complete
910
- * @returns Promise that resolves when initialization is done
911
- */
912
- waitForInitialization(): Promise<void>;
913
825
  /**
914
826
  * Get the underlying HTTP client for custom requests
827
+ *
828
+ * @example
829
+ * ```typescript
830
+ * const httpClient = client.getHttpClient();
831
+ * const customData = await httpClient.get('/api/custom-endpoint');
832
+ * ```
915
833
  */
916
834
  getHttpClient(): HttpClient;
917
- /**
918
- * Get the discovered backend configuration
919
- */
920
- getBackendConfig(): BackendConfig | null;
921
835
  /**
922
836
  * Get the current storage strategy identifier
923
837
  */
924
838
  getStorageStrategy(): string;
925
839
  }
926
- /**
927
- * Create an InsForge client.
928
- * This is a convenience alias for `new InsForgeClient(config)`.
929
- *
930
- * Note: The client initializes asynchronously in the background.
931
- * Subscribe to `auth.onAuthStateChange` to be notified when ready.
932
- *
933
- * @example
934
- * ```typescript
935
- * import { createClient } from '@insforge/sdk';
936
- *
937
- * const client = createClient({
938
- * baseUrl: 'http://localhost:7130'
939
- * });
940
- *
941
- * // Subscribe to auth state changes
942
- * client.auth.onAuthStateChange((event, session) => {
943
- * if (event === 'INITIAL_SESSION') {
944
- * // Initialization complete
945
- * console.log('Ready!', session ? 'Logged in' : 'Not logged in');
946
- * }
947
- * });
948
- * ```
949
- */
950
- declare function createClient(config?: InsForgeConfig): InsForgeClient;
951
840
 
952
841
  /**
953
842
  * @insforge/sdk - TypeScript SDK for InsForge Backend-as-a-Service
@@ -955,4 +844,6 @@ declare function createClient(config?: InsForgeConfig): InsForgeClient;
955
844
  * @packageDocumentation
956
845
  */
957
846
 
958
- export { AI, type ApiError, Auth, type AuthSession, type AuthStateChangeCallback, type AuthStateChangeEvent, type BackendConfig, type InsForgeConfig as ClientOptions, Database, type FunctionInvokeOptions, Functions, HttpClient, InsForgeClient, type InsForgeConfig, InsForgeError, LocalSessionStorage, type ProfileData, SecureSessionStorage, type SessionStorageStrategy, Storage, StorageBucket, type StorageResponse, TokenManager, type TokenStorage, type UpdateProfileData, createClient, createSessionStorage, InsForgeClient as default, discoverBackendConfig, getDefaultBackendConfig };
847
+ declare function createClient(config: InsForgeConfig): InsForgeClient;
848
+
849
+ export { AI, type ApiError, Auth, type AuthSession, type InsForgeConfig as ClientOptions, Database, type FunctionInvokeOptions, Functions, HttpClient, InsForgeClient, type InsForgeConfig, InsForgeError, LocalSessionStorage, type ProfileData, SecureSessionStorage, type SessionStorageStrategy, Storage, StorageBucket, type StorageResponse, TokenManager, type TokenStorage, type UpdateProfileData, createClient, InsForgeClient as default };
package/dist/index.d.ts CHANGED
@@ -146,8 +146,9 @@ interface SessionStorageStrategy {
146
146
  * Secure Session Storage Strategy
147
147
  *
148
148
  * Stores access token in memory only (cleared on page refresh).
149
- * Refresh token is stored in httpOnly cookie by the backend.
150
- * Uses an 'isAuthenticated' flag cookie to detect if refresh should be attempted.
149
+ * Refresh token is stored in httpOnly cookie by the backend (on backend domain).
150
+ * The `isAuthenticated` cookie is set by the SDK on the frontend domain to signal
151
+ * that a secure session exists and token refresh should be attempted on page reload.
151
152
  *
152
153
  * Security benefits:
153
154
  * - Access token not accessible to XSS attacks (in memory only)
@@ -165,7 +166,6 @@ declare class SecureSessionStorage implements SessionStorageStrategy {
165
166
  setUser(user: UserSchema): void;
166
167
  clearSession(): void;
167
168
  shouldAttemptRefresh(): boolean;
168
- private setAuthFlag;
169
169
  private hasAuthFlag;
170
170
  }
171
171
  /**
@@ -191,64 +191,6 @@ declare class LocalSessionStorage implements SessionStorageStrategy {
191
191
  shouldAttemptRefresh(): boolean;
192
192
  }
193
193
 
194
- /**
195
- * Backend Configuration for InsForge SDK
196
- *
197
- * Fetches backend configuration via the /api/health endpoint
198
- * and creates appropriate storage strategies based on that configuration.
199
- */
200
-
201
- /**
202
- * Backend configuration returned from /api/health
203
- */
204
- interface BackendConfig {
205
- /** Whether backend supports secure httpOnly cookie storage for refresh tokens */
206
- secureSessionStorage: boolean;
207
- /** Whether backend supports token refresh endpoint */
208
- refreshTokens: boolean;
209
- }
210
- /**
211
- * Fetch backend configuration from the /api/health endpoint
212
- *
213
- * This is the primary method for determining which features the backend supports.
214
- * The SDK uses this information to select appropriate storage strategies.
215
- *
216
- * @param baseUrl - The backend base URL
217
- * @param fetchImpl - Optional custom fetch implementation
218
- * @returns Backend configuration object
219
- *
220
- * @example
221
- * ```typescript
222
- * const config = await discoverBackendConfig('https://api.example.com');
223
- * if (config.secureSessionStorage) {
224
- * // Use secure storage strategy
225
- * }
226
- * ```
227
- */
228
- declare function discoverBackendConfig(baseUrl: string, fetchImpl?: typeof fetch): Promise<BackendConfig>;
229
- /**
230
- * Create the appropriate session storage strategy based on backend configuration
231
- *
232
- * This is the factory function that implements the Strategy Pattern.
233
- * It selects the storage implementation based on what the backend supports.
234
- *
235
- * @param config - Backend configuration from discoverBackendConfig()
236
- * @param storage - Optional custom storage adapter (for LocalSessionStorage)
237
- * @returns Appropriate SessionStorageStrategy implementation
238
- *
239
- * @example
240
- * ```typescript
241
- * const config = await discoverBackendConfig(baseUrl);
242
- * const storage = createSessionStorage(config);
243
- * storage.saveSession({ accessToken: '...', user: {...} });
244
- * ```
245
- */
246
- declare function createSessionStorage(config: BackendConfig, storage?: TokenStorage): SessionStorageStrategy;
247
- /**
248
- * Get default backend configuration (useful for testing or manual override)
249
- */
250
- declare function getDefaultBackendConfig(): BackendConfig;
251
-
252
194
  /**
253
195
  * Token Manager for InsForge SDK
254
196
  *
@@ -334,66 +276,43 @@ type ProfileData = Record<string, any> & {
334
276
  * Supports any fields that exist in the profile table
335
277
  */
336
278
  type UpdateProfileData = Partial<Record<string, any>>;
337
- /**
338
- * Auth state change event types
339
- * Following Supabase pattern for consistency
340
- */
341
- type AuthStateChangeEvent = 'INITIAL_SESSION' | 'SIGNED_IN' | 'SIGNED_OUT' | 'TOKEN_REFRESHED';
342
- /**
343
- * Auth state change callback type
344
- */
345
- type AuthStateChangeCallback = (event: AuthStateChangeEvent, session: AuthSession | null) => void;
346
279
  declare class Auth {
347
280
  private http;
348
281
  private tokenManager;
349
282
  private database;
350
- private authStateListeners;
351
- private initializePromise;
352
- constructor(http: HttpClient, tokenManager: TokenManager, initializePromise?: Promise<void>);
283
+ constructor(http: HttpClient, tokenManager: TokenManager);
353
284
  /**
354
- * Subscribe to auth state changes
355
- *
356
- * New subscribers will receive an INITIAL_SESSION event after initialization completes.
357
- * This ensures no race condition where subscribers miss the initial state.
358
- *
359
- * @param callback - Function called when auth state changes
360
- * @returns Unsubscribe function
361
- *
362
- * @example
363
- * ```typescript
364
- * const { data: { subscription } } = client.auth.onAuthStateChange((event, session) => {
365
- * if (event === 'SIGNED_IN') {
366
- * console.log('User signed in:', session?.user.email);
367
- * } else if (event === 'SIGNED_OUT') {
368
- * console.log('User signed out');
369
- * }
370
- * });
371
- *
372
- * // Later: unsubscribe
373
- * subscription.unsubscribe();
374
- * ```
285
+ * Set the isAuthenticated cookie flag on the frontend domain
286
+ * This is managed by SDK, not backend, to work in cross-origin scenarios
375
287
  */
376
- onAuthStateChange(callback: AuthStateChangeCallback): {
377
- data: {
378
- subscription: {
379
- unsubscribe: () => void;
380
- };
381
- };
382
- };
288
+ private setAuthenticatedCookie;
289
+ /**
290
+ * Clear the isAuthenticated cookie flag from the frontend domain
291
+ */
292
+ private clearAuthenticatedCookie;
383
293
  /**
384
- * Emit auth state change to all listeners
294
+ * Switch to SecureSessionStorage (cookie-based auth)
295
+ * Called when backend returns sessionMode: 'secure'
385
296
  * @internal
386
297
  */
387
- _emitAuthStateChange(event: AuthStateChangeEvent, session: AuthSession | null): void;
298
+ _switchToSecureStorage(): void;
388
299
  /**
389
- * Check if an error represents an authentication failure
390
- * Used to determine appropriate HTTP status code (401 vs 500)
300
+ * Switch to LocalSessionStorage (localStorage-based auth)
301
+ * Called when cookie-based auth fails (fallback)
302
+ * @internal
391
303
  */
392
- private isAuthenticationError;
304
+ _switchToLocalStorage(): void;
393
305
  /**
394
- * Detect and handle OAuth callback parameters in the URL.
395
- * Called by client after initialization.
306
+ * Detect storage strategy based on backend response
307
+ * @param sessionMode - The sessionMode returned by backend ('secure' or undefined)
308
+ * @internal
396
309
  */
310
+ private _detectStorageFromResponse;
311
+ /**
312
+ * Automatically detect and handle OAuth callback parameters in the URL
313
+ * This runs on initialization to seamlessly complete the OAuth flow
314
+ * Matches the backend's OAuth callback response (backend/src/api/routes/auth.ts:540-544)
315
+ */
397
316
  detectAuthCallback(): void;
398
317
  /**
399
318
  * Sign up a new user
@@ -460,6 +379,9 @@ declare class Auth {
460
379
  /**
461
380
  * Get the current user with full profile information
462
381
  * Returns both auth info (id, email, role) and profile data (dynamic fields from users table)
382
+ *
383
+ * In secure session mode (httpOnly cookie), this method will automatically attempt
384
+ * to refresh the session if no access token is available (e.g., after page reload).
463
385
  */
464
386
  getCurrentUser(): Promise<{
465
387
  data: {
@@ -856,98 +778,65 @@ declare class Functions {
856
778
  /**
857
779
  * Main InsForge SDK Client
858
780
  *
859
- * The client automatically initializes in the background and emits auth state changes.
860
- * Subscribe to `auth.onAuthStateChange` to be notified when initialization completes.
861
- *
862
781
  * @example
863
782
  * ```typescript
864
783
  * import { InsForgeClient } from '@insforge/sdk';
865
784
  *
866
- * // Create client - synchronous, immediately usable
867
785
  * const client = new InsForgeClient({
868
786
  * baseUrl: 'http://localhost:7130'
869
787
  * });
870
788
  *
871
- * // Subscribe to auth state changes
872
- * client.auth.onAuthStateChange((event, session) => {
873
- * console.log('Auth event:', event);
874
- * if (session) {
875
- * console.log('User:', session.user.email);
876
- * }
789
+ * // Authentication
790
+ * const { data, error } = await client.auth.signUp({
791
+ * email: 'user@example.com',
792
+ * password: 'password123',
793
+ * name: 'John Doe'
877
794
  * });
878
795
  *
879
- * // Client is immediately usable for auth operations
880
- * const { data, error } = await client.auth.signInWithPassword({
881
- * email: 'user@example.com',
882
- * password: 'password123'
796
+ * // Database operations
797
+ * const { data, error } = await client.database
798
+ * .from('posts')
799
+ * .select('*')
800
+ * .eq('user_id', session.user.id)
801
+ * .order('created_at', { ascending: false })
802
+ * .limit(10);
803
+ *
804
+ * // Insert data
805
+ * const { data: newPost } = await client.database
806
+ * .from('posts')
807
+ * .insert({ title: 'Hello', content: 'World' })
808
+ * .single();
809
+ *
810
+ * // Invoke edge functions
811
+ * const { data, error } = await client.functions.invoke('my-function', {
812
+ * body: { message: 'Hello from SDK' }
883
813
  * });
884
814
  * ```
885
815
  */
886
816
  declare class InsForgeClient {
887
817
  private http;
888
818
  private tokenManager;
889
- private backendConfig;
890
- /**
891
- * Promise that resolves when initialization is complete.
892
- * Use this to ensure operations wait for the client to be ready.
893
- */
894
- private initializePromise;
895
- private initializeResolve;
896
819
  readonly auth: Auth;
897
820
  readonly database: Database;
898
821
  readonly storage: Storage;
899
822
  readonly ai: AI;
900
823
  readonly functions: Functions;
901
824
  constructor(config?: InsForgeConfig);
902
- /**
903
- * Internal async initialization - discovers backend config and recovers session.
904
- * Emits INITIAL_SESSION event when complete.
905
- * @internal
906
- */
907
- private _initializeAsync;
908
- /**
909
- * Wait for client initialization to complete
910
- * @returns Promise that resolves when initialization is done
911
- */
912
- waitForInitialization(): Promise<void>;
913
825
  /**
914
826
  * Get the underlying HTTP client for custom requests
827
+ *
828
+ * @example
829
+ * ```typescript
830
+ * const httpClient = client.getHttpClient();
831
+ * const customData = await httpClient.get('/api/custom-endpoint');
832
+ * ```
915
833
  */
916
834
  getHttpClient(): HttpClient;
917
- /**
918
- * Get the discovered backend configuration
919
- */
920
- getBackendConfig(): BackendConfig | null;
921
835
  /**
922
836
  * Get the current storage strategy identifier
923
837
  */
924
838
  getStorageStrategy(): string;
925
839
  }
926
- /**
927
- * Create an InsForge client.
928
- * This is a convenience alias for `new InsForgeClient(config)`.
929
- *
930
- * Note: The client initializes asynchronously in the background.
931
- * Subscribe to `auth.onAuthStateChange` to be notified when ready.
932
- *
933
- * @example
934
- * ```typescript
935
- * import { createClient } from '@insforge/sdk';
936
- *
937
- * const client = createClient({
938
- * baseUrl: 'http://localhost:7130'
939
- * });
940
- *
941
- * // Subscribe to auth state changes
942
- * client.auth.onAuthStateChange((event, session) => {
943
- * if (event === 'INITIAL_SESSION') {
944
- * // Initialization complete
945
- * console.log('Ready!', session ? 'Logged in' : 'Not logged in');
946
- * }
947
- * });
948
- * ```
949
- */
950
- declare function createClient(config?: InsForgeConfig): InsForgeClient;
951
840
 
952
841
  /**
953
842
  * @insforge/sdk - TypeScript SDK for InsForge Backend-as-a-Service
@@ -955,4 +844,6 @@ declare function createClient(config?: InsForgeConfig): InsForgeClient;
955
844
  * @packageDocumentation
956
845
  */
957
846
 
958
- export { AI, type ApiError, Auth, type AuthSession, type AuthStateChangeCallback, type AuthStateChangeEvent, type BackendConfig, type InsForgeConfig as ClientOptions, Database, type FunctionInvokeOptions, Functions, HttpClient, InsForgeClient, type InsForgeConfig, InsForgeError, LocalSessionStorage, type ProfileData, SecureSessionStorage, type SessionStorageStrategy, Storage, StorageBucket, type StorageResponse, TokenManager, type TokenStorage, type UpdateProfileData, createClient, createSessionStorage, InsForgeClient as default, discoverBackendConfig, getDefaultBackendConfig };
847
+ declare function createClient(config: InsForgeConfig): InsForgeClient;
848
+
849
+ export { AI, type ApiError, Auth, type AuthSession, type InsForgeConfig as ClientOptions, Database, type FunctionInvokeOptions, Functions, HttpClient, InsForgeClient, type InsForgeConfig, InsForgeError, LocalSessionStorage, type ProfileData, SecureSessionStorage, type SessionStorageStrategy, Storage, StorageBucket, type StorageResponse, TokenManager, type TokenStorage, type UpdateProfileData, createClient, InsForgeClient as default };