@fluxbase/sdk 0.0.1-rc.112 → 0.0.1-rc.114

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.cts CHANGED
@@ -841,7 +841,7 @@ interface ResetUserPasswordResponse {
841
841
  interface DeleteUserResponse {
842
842
  message: string;
843
843
  }
844
- interface APIKey {
844
+ interface ClientKey {
845
845
  id: string;
846
846
  name: string;
847
847
  description?: string;
@@ -855,33 +855,47 @@ interface APIKey {
855
855
  last_used_at?: string;
856
856
  user_id: string;
857
857
  }
858
- interface CreateAPIKeyRequest {
858
+ interface CreateClientKeyRequest {
859
859
  name: string;
860
860
  description?: string;
861
861
  scopes: string[];
862
862
  rate_limit_per_minute: number;
863
863
  expires_at?: string;
864
864
  }
865
- interface CreateAPIKeyResponse {
866
- api_key: APIKey;
865
+ interface CreateClientKeyResponse {
866
+ client_key: ClientKey;
867
867
  key: string;
868
868
  }
869
- interface ListAPIKeysResponse {
870
- api_keys: APIKey[];
869
+ interface ListClientKeysResponse {
870
+ client_keys: ClientKey[];
871
871
  total: number;
872
872
  }
873
- interface UpdateAPIKeyRequest {
873
+ interface UpdateClientKeyRequest {
874
874
  name?: string;
875
875
  description?: string;
876
876
  scopes?: string[];
877
877
  rate_limit_per_minute?: number;
878
878
  }
879
- interface RevokeAPIKeyResponse {
879
+ interface RevokeClientKeyResponse {
880
880
  message: string;
881
881
  }
882
- interface DeleteAPIKeyResponse {
882
+ interface DeleteClientKeyResponse {
883
883
  message: string;
884
884
  }
885
+ /** @deprecated Use ClientKey instead */
886
+ type APIKey = ClientKey;
887
+ /** @deprecated Use CreateClientKeyRequest instead */
888
+ type CreateAPIKeyRequest = CreateClientKeyRequest;
889
+ /** @deprecated Use CreateClientKeyResponse instead */
890
+ type CreateAPIKeyResponse = CreateClientKeyResponse;
891
+ /** @deprecated Use ListClientKeysResponse instead */
892
+ type ListAPIKeysResponse = ListClientKeysResponse;
893
+ /** @deprecated Use UpdateClientKeyRequest instead */
894
+ type UpdateAPIKeyRequest = UpdateClientKeyRequest;
895
+ /** @deprecated Use RevokeClientKeyResponse instead */
896
+ type RevokeAPIKeyResponse = RevokeClientKeyResponse;
897
+ /** @deprecated Use DeleteClientKeyResponse instead */
898
+ type DeleteAPIKeyResponse = DeleteClientKeyResponse;
885
899
  interface Webhook {
886
900
  id: string;
887
901
  url: string;
@@ -1225,7 +1239,7 @@ interface EmailProviderSettings {
1225
1239
  * Request to update email provider settings
1226
1240
  *
1227
1241
  * All fields are optional - only provided fields will be updated.
1228
- * Secret fields (passwords, API keys) are only updated if provided.
1242
+ * Secret fields (passwords, client keys) are only updated if provided.
1229
1243
  */
1230
1244
  interface UpdateEmailProviderSettingsRequest {
1231
1245
  enabled?: boolean;
@@ -2950,6 +2964,134 @@ interface ExecutionLogConfig {
2950
2964
  /** Type of execution (function, job, rpc) */
2951
2965
  type?: ExecutionType;
2952
2966
  }
2967
+ /**
2968
+ * Branch status
2969
+ */
2970
+ type BranchStatus = 'creating' | 'ready' | 'migrating' | 'error' | 'deleting' | 'deleted';
2971
+ /**
2972
+ * Branch type
2973
+ */
2974
+ type BranchType = 'main' | 'preview' | 'persistent';
2975
+ /**
2976
+ * Data clone mode when creating a branch
2977
+ */
2978
+ type DataCloneMode = 'schema_only' | 'full_clone' | 'seed_data';
2979
+ /**
2980
+ * Database branch information
2981
+ */
2982
+ interface Branch {
2983
+ /** Unique branch identifier */
2984
+ id: string;
2985
+ /** Display name of the branch */
2986
+ name: string;
2987
+ /** URL-safe slug for the branch */
2988
+ slug: string;
2989
+ /** Actual database name */
2990
+ database_name: string;
2991
+ /** Current status of the branch */
2992
+ status: BranchStatus;
2993
+ /** Type of branch */
2994
+ type: BranchType;
2995
+ /** Parent branch ID (for feature branches) */
2996
+ parent_branch_id?: string;
2997
+ /** How data was cloned when branch was created */
2998
+ data_clone_mode: DataCloneMode;
2999
+ /** GitHub PR number if this is a preview branch */
3000
+ github_pr_number?: number;
3001
+ /** GitHub PR URL */
3002
+ github_pr_url?: string;
3003
+ /** GitHub repository (owner/repo) */
3004
+ github_repo?: string;
3005
+ /** Error message if status is 'error' */
3006
+ error_message?: string;
3007
+ /** User ID who created the branch */
3008
+ created_by?: string;
3009
+ /** When the branch was created */
3010
+ created_at: string;
3011
+ /** When the branch was last updated */
3012
+ updated_at: string;
3013
+ /** When the branch will automatically expire */
3014
+ expires_at?: string;
3015
+ }
3016
+ /**
3017
+ * Options for creating a new branch
3018
+ */
3019
+ interface CreateBranchOptions {
3020
+ /** Parent branch to clone from (defaults to main) */
3021
+ parentBranchId?: string;
3022
+ /** How to clone data */
3023
+ dataCloneMode?: DataCloneMode;
3024
+ /** Branch type */
3025
+ type?: BranchType;
3026
+ /** GitHub PR number (for preview branches) */
3027
+ githubPRNumber?: number;
3028
+ /** GitHub PR URL */
3029
+ githubPRUrl?: string;
3030
+ /** GitHub repository (owner/repo) */
3031
+ githubRepo?: string;
3032
+ /** Duration until branch expires (e.g., "24h", "7d") */
3033
+ expiresIn?: string;
3034
+ }
3035
+ /**
3036
+ * Options for listing branches
3037
+ */
3038
+ interface ListBranchesOptions {
3039
+ /** Filter by branch status */
3040
+ status?: BranchStatus;
3041
+ /** Filter by branch type */
3042
+ type?: BranchType;
3043
+ /** Filter by GitHub repository */
3044
+ githubRepo?: string;
3045
+ /** Only show branches created by the current user */
3046
+ mine?: boolean;
3047
+ /** Maximum number of branches to return */
3048
+ limit?: number;
3049
+ /** Offset for pagination */
3050
+ offset?: number;
3051
+ }
3052
+ /**
3053
+ * Response from listing branches
3054
+ */
3055
+ interface ListBranchesResponse {
3056
+ branches: Branch[];
3057
+ total: number;
3058
+ limit: number;
3059
+ offset: number;
3060
+ }
3061
+ /**
3062
+ * Branch activity log entry
3063
+ */
3064
+ interface BranchActivity {
3065
+ /** Activity ID */
3066
+ id: string;
3067
+ /** Branch ID */
3068
+ branch_id: string;
3069
+ /** Action performed */
3070
+ action: string;
3071
+ /** Activity status */
3072
+ status: 'success' | 'failed' | 'pending';
3073
+ /** Additional details */
3074
+ details?: Record<string, unknown>;
3075
+ /** User who performed the action */
3076
+ executed_by?: string;
3077
+ /** When the activity occurred */
3078
+ created_at: string;
3079
+ }
3080
+ /**
3081
+ * Connection pool statistics
3082
+ */
3083
+ interface BranchPoolStats {
3084
+ /** Branch slug */
3085
+ slug: string;
3086
+ /** Number of active connections */
3087
+ active_connections: number;
3088
+ /** Number of idle connections */
3089
+ idle_connections: number;
3090
+ /** Total connections created */
3091
+ total_connections: number;
3092
+ /** When the pool was created */
3093
+ created_at: string;
3094
+ }
2953
3095
  /**
2954
3096
  * @deprecated Use FluxbaseResponse instead
2955
3097
  */
@@ -5501,7 +5643,7 @@ declare class EmailSettingsManager {
5501
5643
  /**
5502
5644
  * Get current email provider settings
5503
5645
  *
5504
- * Returns the current email configuration. Sensitive values (passwords, API keys)
5646
+ * Returns the current email configuration. Sensitive values (passwords, client keys)
5505
5647
  * are not returned - instead, boolean flags indicate whether they are set.
5506
5648
  *
5507
5649
  * @returns Promise resolving to EmailProviderSettings
@@ -5525,7 +5667,7 @@ declare class EmailSettingsManager {
5525
5667
  * Update email provider settings
5526
5668
  *
5527
5669
  * Supports partial updates - only provide the fields you want to change.
5528
- * Secret fields (passwords, API keys) are only updated if provided.
5670
+ * Secret fields (passwords, client keys) are only updated if provided.
5529
5671
  *
5530
5672
  * @param request - Settings to update (partial update supported)
5531
5673
  * @returns Promise resolving to EmailProviderSettings - Updated settings
@@ -6501,128 +6643,132 @@ declare class ImpersonationManager {
6501
6643
  }
6502
6644
 
6503
6645
  /**
6504
- * API Keys management client
6646
+ * Client Keys management client
6505
6647
  *
6506
- * Provides methods for managing API keys for service-to-service authentication.
6507
- * API keys allow external services to authenticate without user credentials.
6648
+ * Provides methods for managing client keys for service-to-service authentication.
6649
+ * Client keys allow external services to authenticate without user credentials.
6508
6650
  *
6509
6651
  * @example
6510
6652
  * ```typescript
6511
6653
  * const client = createClient({ url: 'http://localhost:8080' })
6512
6654
  * await client.auth.login({ email: 'user@example.com', password: 'password' })
6513
6655
  *
6514
- * // Create an API key
6515
- * const { api_key, key } = await client.management.apiKeys.create({
6656
+ * // Create a client key
6657
+ * const { client_key, key } = await client.management.clientKeys.create({
6516
6658
  * name: 'Production Service',
6517
6659
  * scopes: ['read:users', 'write:users'],
6518
6660
  * rate_limit_per_minute: 100
6519
6661
  * })
6520
6662
  *
6521
- * // List API keys
6522
- * const { api_keys } = await client.management.apiKeys.list()
6663
+ * // List client keys
6664
+ * const { client_keys } = await client.management.clientKeys.list()
6523
6665
  * ```
6524
6666
  *
6525
6667
  * @category Management
6526
6668
  */
6527
- declare class APIKeysManager {
6669
+ declare class ClientKeysManager {
6528
6670
  private fetch;
6529
6671
  constructor(fetch: FluxbaseFetch);
6530
6672
  /**
6531
- * Create a new API key
6673
+ * Create a new client key
6532
6674
  *
6533
- * @param request - API key configuration
6534
- * @returns Created API key with the full key value (only shown once)
6675
+ * @param request - Client key configuration
6676
+ * @returns Created client key with the full key value (only shown once)
6535
6677
  *
6536
6678
  * @example
6537
6679
  * ```typescript
6538
- * const { api_key, key } = await client.management.apiKeys.create({
6680
+ * const { client_key, key } = await client.management.clientKeys.create({
6539
6681
  * name: 'Production Service',
6540
- * description: 'API key for production service',
6682
+ * description: 'Client key for production service',
6541
6683
  * scopes: ['read:users', 'write:users'],
6542
6684
  * rate_limit_per_minute: 100,
6543
6685
  * expires_at: '2025-12-31T23:59:59Z'
6544
6686
  * })
6545
6687
  *
6546
6688
  * // Store the key securely - it won't be shown again
6547
- * console.log('API Key:', key)
6689
+ * console.log('Client Key:', key)
6548
6690
  * ```
6549
6691
  */
6550
- create(request: CreateAPIKeyRequest): Promise<CreateAPIKeyResponse>;
6692
+ create(request: CreateClientKeyRequest): Promise<CreateClientKeyResponse>;
6551
6693
  /**
6552
- * List all API keys for the authenticated user
6694
+ * List all client keys for the authenticated user
6553
6695
  *
6554
- * @returns List of API keys (without full key values)
6696
+ * @returns List of client keys (without full key values)
6555
6697
  *
6556
6698
  * @example
6557
6699
  * ```typescript
6558
- * const { api_keys, total } = await client.management.apiKeys.list()
6700
+ * const { client_keys, total } = await client.management.clientKeys.list()
6559
6701
  *
6560
- * api_keys.forEach(key => {
6702
+ * client_keys.forEach(key => {
6561
6703
  * console.log(`${key.name}: ${key.key_prefix}... (expires: ${key.expires_at})`)
6562
6704
  * })
6563
6705
  * ```
6564
6706
  */
6565
- list(): Promise<ListAPIKeysResponse>;
6707
+ list(): Promise<ListClientKeysResponse>;
6566
6708
  /**
6567
- * Get a specific API key by ID
6709
+ * Get a specific client key by ID
6568
6710
  *
6569
- * @param keyId - API key ID
6570
- * @returns API key details
6711
+ * @param keyId - Client key ID
6712
+ * @returns Client key details
6571
6713
  *
6572
6714
  * @example
6573
6715
  * ```typescript
6574
- * const apiKey = await client.management.apiKeys.get('key-uuid')
6575
- * console.log('Last used:', apiKey.last_used_at)
6716
+ * const clientKey = await client.management.clientKeys.get('key-uuid')
6717
+ * console.log('Last used:', clientKey.last_used_at)
6576
6718
  * ```
6577
6719
  */
6578
- get(keyId: string): Promise<APIKey>;
6720
+ get(keyId: string): Promise<ClientKey>;
6579
6721
  /**
6580
- * Update an API key
6722
+ * Update a client key
6581
6723
  *
6582
- * @param keyId - API key ID
6724
+ * @param keyId - Client key ID
6583
6725
  * @param updates - Fields to update
6584
- * @returns Updated API key
6726
+ * @returns Updated client key
6585
6727
  *
6586
6728
  * @example
6587
6729
  * ```typescript
6588
- * const updated = await client.management.apiKeys.update('key-uuid', {
6730
+ * const updated = await client.management.clientKeys.update('key-uuid', {
6589
6731
  * name: 'Updated Name',
6590
6732
  * rate_limit_per_minute: 200
6591
6733
  * })
6592
6734
  * ```
6593
6735
  */
6594
- update(keyId: string, updates: UpdateAPIKeyRequest): Promise<APIKey>;
6736
+ update(keyId: string, updates: UpdateClientKeyRequest): Promise<ClientKey>;
6595
6737
  /**
6596
- * Revoke an API key
6738
+ * Revoke a client key
6597
6739
  *
6598
6740
  * Revoked keys can no longer be used but remain in the system for audit purposes.
6599
6741
  *
6600
- * @param keyId - API key ID
6742
+ * @param keyId - Client key ID
6601
6743
  * @returns Revocation confirmation
6602
6744
  *
6603
6745
  * @example
6604
6746
  * ```typescript
6605
- * await client.management.apiKeys.revoke('key-uuid')
6606
- * console.log('API key revoked')
6747
+ * await client.management.clientKeys.revoke('key-uuid')
6748
+ * console.log('Client key revoked')
6607
6749
  * ```
6608
6750
  */
6609
- revoke(keyId: string): Promise<RevokeAPIKeyResponse>;
6751
+ revoke(keyId: string): Promise<RevokeClientKeyResponse>;
6610
6752
  /**
6611
- * Delete an API key
6753
+ * Delete a client key
6612
6754
  *
6613
- * Permanently removes the API key from the system.
6755
+ * Permanently removes the client key from the system.
6614
6756
  *
6615
- * @param keyId - API key ID
6757
+ * @param keyId - Client key ID
6616
6758
  * @returns Deletion confirmation
6617
6759
  *
6618
6760
  * @example
6619
6761
  * ```typescript
6620
- * await client.management.apiKeys.delete('key-uuid')
6621
- * console.log('API key deleted')
6762
+ * await client.management.clientKeys.delete('key-uuid')
6763
+ * console.log('Client key deleted')
6622
6764
  * ```
6623
6765
  */
6624
- delete(keyId: string): Promise<DeleteAPIKeyResponse>;
6766
+ delete(keyId: string): Promise<DeleteClientKeyResponse>;
6625
6767
  }
6768
+ /**
6769
+ * @deprecated Use ClientKeysManager instead
6770
+ */
6771
+ declare const APIKeysManager: typeof ClientKeysManager;
6626
6772
  /**
6627
6773
  * Webhooks management client
6628
6774
  *
@@ -6879,13 +7025,15 @@ declare class InvitationsManager {
6879
7025
  revoke(token: string): Promise<RevokeInvitationResponse>;
6880
7026
  }
6881
7027
  /**
6882
- * Management client for API keys, webhooks, and invitations
7028
+ * Management client for client keys, webhooks, and invitations
6883
7029
  *
6884
7030
  * @category Management
6885
7031
  */
6886
7032
  declare class FluxbaseManagement {
6887
- /** API Keys management */
6888
- apiKeys: APIKeysManager;
7033
+ /** Client Keys management */
7034
+ clientKeys: ClientKeysManager;
7035
+ /** @deprecated Use clientKeys instead */
7036
+ apiKeys: ClientKeysManager;
6889
7037
  /** Webhooks management */
6890
7038
  webhooks: WebhooksManager;
6891
7039
  /** Invitations management */
@@ -8855,7 +9003,7 @@ declare class FluxbaseAdmin {
8855
9003
  */
8856
9004
  impersonation: ImpersonationManager;
8857
9005
  /**
8858
- * Management namespace for API keys, webhooks, and invitations
9006
+ * Management namespace for client keys, webhooks, and invitations
8859
9007
  */
8860
9008
  management: FluxbaseManagement;
8861
9009
  /**
@@ -9771,6 +9919,271 @@ interface IntrospectionDirective {
9771
9919
  args: IntrospectionInputValue[];
9772
9920
  }
9773
9921
 
9922
+ /**
9923
+ * Branching module for Fluxbase SDK
9924
+ * Provides database branching capabilities for development workflows
9925
+ *
9926
+ * @example
9927
+ * ```typescript
9928
+ * // List all branches
9929
+ * const { data, error } = await client.branching.list()
9930
+ *
9931
+ * // Create a new branch for feature development
9932
+ * const { data: branch } = await client.branching.create('feature/add-auth', {
9933
+ * dataCloneMode: 'schema_only',
9934
+ * expiresIn: '7d'
9935
+ * })
9936
+ *
9937
+ * // Get branch details
9938
+ * const { data: details } = await client.branching.get('feature/add-auth')
9939
+ *
9940
+ * // Reset branch to parent state
9941
+ * await client.branching.reset('feature/add-auth')
9942
+ *
9943
+ * // Delete branch when done
9944
+ * await client.branching.delete('feature/add-auth')
9945
+ * ```
9946
+ */
9947
+
9948
+ /**
9949
+ * Branching client for database branch management
9950
+ *
9951
+ * Database branches allow you to create isolated copies of your database
9952
+ * for development, testing, and preview environments.
9953
+ *
9954
+ * @category Branching
9955
+ */
9956
+ declare class FluxbaseBranching {
9957
+ private fetch;
9958
+ constructor(fetch: FluxbaseFetch);
9959
+ /**
9960
+ * List all database branches
9961
+ *
9962
+ * @param options - Filter and pagination options
9963
+ * @returns Promise resolving to { data, error } tuple with branches list
9964
+ *
9965
+ * @example
9966
+ * ```typescript
9967
+ * // List all branches
9968
+ * const { data, error } = await client.branching.list()
9969
+ *
9970
+ * // Filter by status
9971
+ * const { data } = await client.branching.list({ status: 'ready' })
9972
+ *
9973
+ * // Filter by type
9974
+ * const { data } = await client.branching.list({ type: 'preview' })
9975
+ *
9976
+ * // Only show my branches
9977
+ * const { data } = await client.branching.list({ mine: true })
9978
+ *
9979
+ * // Pagination
9980
+ * const { data } = await client.branching.list({ limit: 10, offset: 20 })
9981
+ * ```
9982
+ */
9983
+ list(options?: ListBranchesOptions): Promise<{
9984
+ data: ListBranchesResponse | null;
9985
+ error: Error | null;
9986
+ }>;
9987
+ /**
9988
+ * Get a specific branch by ID or slug
9989
+ *
9990
+ * @param idOrSlug - Branch ID (UUID) or slug
9991
+ * @returns Promise resolving to { data, error } tuple with branch details
9992
+ *
9993
+ * @example
9994
+ * ```typescript
9995
+ * // Get by slug
9996
+ * const { data, error } = await client.branching.get('feature/add-auth')
9997
+ *
9998
+ * // Get by ID
9999
+ * const { data } = await client.branching.get('123e4567-e89b-12d3-a456-426614174000')
10000
+ * ```
10001
+ */
10002
+ get(idOrSlug: string): Promise<{
10003
+ data: Branch | null;
10004
+ error: Error | null;
10005
+ }>;
10006
+ /**
10007
+ * Create a new database branch
10008
+ *
10009
+ * @param name - Branch name (will be converted to a slug)
10010
+ * @param options - Branch creation options
10011
+ * @returns Promise resolving to { data, error } tuple with created branch
10012
+ *
10013
+ * @example
10014
+ * ```typescript
10015
+ * // Create a simple branch
10016
+ * const { data, error } = await client.branching.create('feature/add-auth')
10017
+ *
10018
+ * // Create with options
10019
+ * const { data } = await client.branching.create('feature/add-auth', {
10020
+ * dataCloneMode: 'schema_only', // Don't clone data
10021
+ * expiresIn: '7d', // Auto-delete after 7 days
10022
+ * type: 'persistent' // Won't auto-delete on PR merge
10023
+ * })
10024
+ *
10025
+ * // Create a PR preview branch
10026
+ * const { data } = await client.branching.create('pr-123', {
10027
+ * type: 'preview',
10028
+ * githubPRNumber: 123,
10029
+ * githubRepo: 'owner/repo',
10030
+ * expiresIn: '7d'
10031
+ * })
10032
+ *
10033
+ * // Clone with full data (for debugging)
10034
+ * const { data } = await client.branching.create('debug-issue-456', {
10035
+ * dataCloneMode: 'full_clone'
10036
+ * })
10037
+ * ```
10038
+ */
10039
+ create(name: string, options?: CreateBranchOptions): Promise<{
10040
+ data: Branch | null;
10041
+ error: Error | null;
10042
+ }>;
10043
+ /**
10044
+ * Delete a database branch
10045
+ *
10046
+ * This permanently deletes the branch database and all its data.
10047
+ * Cannot delete the main branch.
10048
+ *
10049
+ * @param idOrSlug - Branch ID (UUID) or slug
10050
+ * @returns Promise resolving to { error } (null on success)
10051
+ *
10052
+ * @example
10053
+ * ```typescript
10054
+ * // Delete a branch
10055
+ * const { error } = await client.branching.delete('feature/add-auth')
10056
+ *
10057
+ * if (error) {
10058
+ * console.error('Failed to delete branch:', error.message)
10059
+ * }
10060
+ * ```
10061
+ */
10062
+ delete(idOrSlug: string): Promise<{
10063
+ error: Error | null;
10064
+ }>;
10065
+ /**
10066
+ * Reset a branch to its parent state
10067
+ *
10068
+ * This drops and recreates the branch database, resetting all data
10069
+ * to match the parent branch. Cannot reset the main branch.
10070
+ *
10071
+ * @param idOrSlug - Branch ID (UUID) or slug
10072
+ * @returns Promise resolving to { data, error } tuple with reset branch
10073
+ *
10074
+ * @example
10075
+ * ```typescript
10076
+ * // Reset a branch
10077
+ * const { data, error } = await client.branching.reset('feature/add-auth')
10078
+ *
10079
+ * if (data) {
10080
+ * console.log('Branch reset, status:', data.status)
10081
+ * }
10082
+ * ```
10083
+ */
10084
+ reset(idOrSlug: string): Promise<{
10085
+ data: Branch | null;
10086
+ error: Error | null;
10087
+ }>;
10088
+ /**
10089
+ * Get activity log for a branch
10090
+ *
10091
+ * @param idOrSlug - Branch ID (UUID) or slug
10092
+ * @param limit - Maximum number of entries to return (default: 50, max: 100)
10093
+ * @returns Promise resolving to { data, error } tuple with activity entries
10094
+ *
10095
+ * @example
10096
+ * ```typescript
10097
+ * // Get recent activity
10098
+ * const { data, error } = await client.branching.getActivity('feature/add-auth')
10099
+ *
10100
+ * if (data) {
10101
+ * for (const entry of data) {
10102
+ * console.log(`${entry.action}: ${entry.status}`)
10103
+ * }
10104
+ * }
10105
+ *
10106
+ * // Get more entries
10107
+ * const { data } = await client.branching.getActivity('feature/add-auth', 100)
10108
+ * ```
10109
+ */
10110
+ getActivity(idOrSlug: string, limit?: number): Promise<{
10111
+ data: BranchActivity[] | null;
10112
+ error: Error | null;
10113
+ }>;
10114
+ /**
10115
+ * Get connection pool statistics for all branches
10116
+ *
10117
+ * This is useful for monitoring and debugging branch connections.
10118
+ *
10119
+ * @returns Promise resolving to { data, error } tuple with pool stats
10120
+ *
10121
+ * @example
10122
+ * ```typescript
10123
+ * const { data, error } = await client.branching.getPoolStats()
10124
+ *
10125
+ * if (data) {
10126
+ * for (const pool of data) {
10127
+ * console.log(`${pool.slug}: ${pool.active_connections} active`)
10128
+ * }
10129
+ * }
10130
+ * ```
10131
+ */
10132
+ getPoolStats(): Promise<{
10133
+ data: BranchPoolStats[] | null;
10134
+ error: Error | null;
10135
+ }>;
10136
+ /**
10137
+ * Check if a branch exists
10138
+ *
10139
+ * @param idOrSlug - Branch ID (UUID) or slug
10140
+ * @returns Promise resolving to true if branch exists, false otherwise
10141
+ *
10142
+ * @example
10143
+ * ```typescript
10144
+ * const exists = await client.branching.exists('feature/add-auth')
10145
+ *
10146
+ * if (!exists) {
10147
+ * await client.branching.create('feature/add-auth')
10148
+ * }
10149
+ * ```
10150
+ */
10151
+ exists(idOrSlug: string): Promise<boolean>;
10152
+ /**
10153
+ * Wait for a branch to be ready
10154
+ *
10155
+ * Polls the branch status until it reaches 'ready' or an error state.
10156
+ *
10157
+ * @param idOrSlug - Branch ID (UUID) or slug
10158
+ * @param options - Polling options
10159
+ * @returns Promise resolving to { data, error } tuple with ready branch
10160
+ *
10161
+ * @example
10162
+ * ```typescript
10163
+ * // Create branch and wait for it to be ready
10164
+ * const { data: branch } = await client.branching.create('feature/add-auth')
10165
+ *
10166
+ * const { data: ready, error } = await client.branching.waitForReady(branch!.slug, {
10167
+ * timeout: 60000, // 60 seconds
10168
+ * pollInterval: 1000 // Check every second
10169
+ * })
10170
+ *
10171
+ * if (ready) {
10172
+ * console.log('Branch is ready!')
10173
+ * }
10174
+ * ```
10175
+ */
10176
+ waitForReady(idOrSlug: string, options?: {
10177
+ /** Timeout in milliseconds (default: 30000) */
10178
+ timeout?: number;
10179
+ /** Poll interval in milliseconds (default: 1000) */
10180
+ pollInterval?: number;
10181
+ }): Promise<{
10182
+ data: Branch | null;
10183
+ error: Error | null;
10184
+ }>;
10185
+ }
10186
+
9774
10187
  /**
9775
10188
  * PostgreSQL query builder for Fluxbase SDK
9776
10189
  * Inspired by Supabase's PostgREST client
@@ -10424,7 +10837,7 @@ declare class FluxbaseClient<Database = unknown, _SchemaName extends string & ke
10424
10837
  jobs: FluxbaseJobs;
10425
10838
  /** Admin module for instance management (requires admin authentication) */
10426
10839
  admin: FluxbaseAdmin;
10427
- /** Management module for API keys, webhooks, and invitations */
10840
+ /** Management module for client keys, webhooks, and invitations */
10428
10841
  management: FluxbaseManagement;
10429
10842
  /** Settings module for reading public application settings (respects RLS policies) */
10430
10843
  settings: SettingsClient;
@@ -10490,6 +10903,33 @@ declare class FluxbaseClient<Database = unknown, _SchemaName extends string & ke
10490
10903
  * @category GraphQL
10491
10904
  */
10492
10905
  graphql: FluxbaseGraphQL;
10906
+ /**
10907
+ * Branching module for database branch management
10908
+ *
10909
+ * Database branches allow you to create isolated copies of your database
10910
+ * for development, testing, and preview environments.
10911
+ *
10912
+ * @example
10913
+ * ```typescript
10914
+ * // List all branches
10915
+ * const { data } = await client.branching.list()
10916
+ *
10917
+ * // Create a feature branch
10918
+ * const { data: branch } = await client.branching.create('feature/add-auth', {
10919
+ * dataCloneMode: 'schema_only',
10920
+ * expiresIn: '7d'
10921
+ * })
10922
+ *
10923
+ * // Reset branch to parent state
10924
+ * await client.branching.reset('feature/add-auth')
10925
+ *
10926
+ * // Delete when done
10927
+ * await client.branching.delete('feature/add-auth')
10928
+ * ```
10929
+ *
10930
+ * @category Branching
10931
+ */
10932
+ branching: FluxbaseBranching;
10493
10933
  /**
10494
10934
  * RPC module for calling PostgreSQL functions - Supabase compatible
10495
10935
  *
@@ -10885,4 +11325,4 @@ declare function isBoolean(value: unknown): value is boolean;
10885
11325
  */
10886
11326
  declare function assertType<T>(value: unknown, validator: (v: unknown) => v is T, errorMessage?: string): asserts value is T;
10887
11327
 
10888
- export { type AIChatClientMessage, type AIChatEvent, type AIChatEventType, type AIChatMessageRole, type AIChatOptions, type AIChatServerMessage, type AIChatbot, type AIChatbotSummary, type AIConversation, type AIConversationMessage, type AIProvider, type AIProviderType, type AIUsageStats, type AIUserConversationDetail, type AIUserConversationSummary, type AIUserMessage, type AIUserQueryResult, type AIUserUsageStats, type APIKey, APIKeysManager, type AcceptInvitationRequest, type AcceptInvitationResponse, type AdminAuthResponse, type AdminBucket, type AdminListBucketsResponse, type AdminListObjectsResponse, type AdminLoginRequest, type AdminMeResponse, type AdminRefreshRequest, type AdminRefreshResponse, type AdminSetupRequest, type AdminSetupStatusResponse, type AdminStorageObject, type AdminUser, type AppSettings, AppSettingsManager, type ApplyMigrationRequest, type ApplyPendingRequest, type AuthResponse, type AuthResponseData, type AuthSession, type AuthSettings, AuthSettingsManager, type AuthenticationSettings, type BroadcastCallback, type BroadcastMessage, type BundleOptions, type BundleResult, type CaptchaConfig, type CaptchaProvider, type ChatbotSpec, type ChunkedUploadSession, type Column, type CreateAIProviderRequest, type CreateAPIKeyRequest, type CreateAPIKeyResponse, type CreateColumnRequest, type CreateFunctionRequest, type CreateInvitationRequest, type CreateInvitationResponse, type CreateMigrationRequest, type CreateOAuthProviderRequest, type CreateOAuthProviderResponse, type CreateSchemaRequest, type CreateSchemaResponse, type CreateTableRequest, type CreateTableResponse, type CreateWebhookRequest, DDLManager, type DataResponse, type DeleteAPIKeyResponse, type DeleteOAuthProviderResponse, type DeleteTableResponse, type DeleteUserResponse, type DeleteWebhookResponse, type DownloadOptions, type DownloadProgress, type EdgeFunction, type EdgeFunctionExecution, type EmailProviderSettings, type EmailSettingOverride, type EmailSettings, EmailSettingsManager, type EmailTemplate, EmailTemplateManager, type EmailTemplateType, type EmbedRequest, type EmbedResponse, type EnrichedUser, type ExecutionLog, type ExecutionLogCallback, type ExecutionLogConfig, type ExecutionLogEvent, type ExecutionLogLevel, ExecutionLogsChannel, type ExecutionType, type FeatureSettings, type FileObject, type FilterOperator, FluxbaseAI, FluxbaseAIChat, FluxbaseAdmin, FluxbaseAdminAI, FluxbaseAdminFunctions, FluxbaseAdminJobs, FluxbaseAdminMigrations, FluxbaseAdminRPC, FluxbaseAdminStorage, FluxbaseAuth, type FluxbaseAuthResponse, FluxbaseClient, type FluxbaseClientOptions, type FluxbaseError, FluxbaseFetch, FluxbaseFunctions, FluxbaseGraphQL, FluxbaseJobs, FluxbaseManagement, FluxbaseOAuth, FluxbaseRPC, FluxbaseRealtime, type FluxbaseResponse, FluxbaseSettings, FluxbaseStorage, FluxbaseVector, type FunctionInvokeOptions, type FunctionSpec, type GetImpersonationResponse, type GraphQLError, type GraphQLErrorLocation, type GraphQLRequestOptions, type GraphQLResponse, type HealthResponse, type HttpMethod, type ImageFitMode, type ImageFormat, type ImpersonateAnonRequest, type ImpersonateServiceRequest, type ImpersonateUserRequest, ImpersonationManager, type ImpersonationSession, type ImpersonationTargetUser, type ImpersonationType, type IntrospectionDirective, type IntrospectionEnumValue, type IntrospectionField, type IntrospectionInputValue, type IntrospectionSchema, type IntrospectionType, type IntrospectionTypeRef, type Invitation, InvitationsManager, type InviteUserRequest, type InviteUserResponse, type ListAPIKeysResponse, type ListConversationsOptions, type ListConversationsResult, type ListEmailTemplatesResponse, type ListImpersonationSessionsOptions, type ListImpersonationSessionsResponse, type ListInvitationsOptions, type ListInvitationsResponse, type ListOAuthProvidersResponse, type ListOptions, type ListSchemasResponse, type ListSystemSettingsResponse, type ListTablesResponse, type ListUsersOptions, type ListUsersResponse, type ListWebhookDeliveriesResponse, type ListWebhooksResponse, type MailgunSettings, type Migration, type MigrationExecution, type OAuthProvider, OAuthProviderManager, type OrderBy, type OrderDirection, type PostgresChangesConfig, type PostgrestError, type PostgrestResponse, type PresenceCallback, type PresenceState, QueryBuilder, type QueryFilter, type RPCExecution, type RPCExecutionFilters, type RPCExecutionLog, type RPCExecutionStatus, type RPCInvokeResponse, type RPCProcedure, type RPCProcedureSpec, type RPCProcedureSummary, type RealtimeBroadcastPayload, type RealtimeCallback, type RealtimeChangePayload, RealtimeChannel, type RealtimeChannelConfig, type RealtimeMessage, type RealtimePostgresChangesPayload, type RealtimePresencePayload, type RequestOptions, type ResetUserPasswordResponse, type ResumableDownloadData, type ResumableDownloadOptions, type ResumableUploadOptions, type ResumableUploadProgress, type RevokeAPIKeyResponse, type RevokeInvitationResponse, type RollbackMigrationRequest, type SAMLLoginOptions, type SAMLLoginResponse, type SAMLProvider, type SAMLProvidersResponse, type SAMLSession, type SESSettings, type SMTPSettings, type Schema, SchemaQueryBuilder, type SecuritySettings, type SendEmailRequest, type SendGridSettings, type SessionResponse, SettingsClient, type SignInCredentials, type SignInWith2FAResponse, type SignUpCredentials, type SignedUrlOptions, type SignedUrlResponse, type StartImpersonationResponse, type StopImpersonationResponse, StorageBucket, type StorageObject, type StreamDownloadData, type StreamUploadOptions, type SupabaseAuthResponse, type SupabaseResponse, type SyncChatbotsOptions, type SyncChatbotsResult, type SyncError, type SyncFunctionsOptions, type SyncFunctionsResult, type SyncMigrationsOptions, type SyncMigrationsResult, type SyncRPCOptions, type SyncRPCResult, type SystemSetting, SystemSettingsManager, type Table, type TestEmailSettingsResponse, type TestEmailTemplateRequest, type TestWebhookResponse, type TransformOptions, type TwoFactorEnableResponse, type TwoFactorSetupResponse, type TwoFactorStatusResponse, type TwoFactorVerifyRequest, type UpdateAIProviderRequest, type UpdateAPIKeyRequest, type UpdateAppSettingsRequest, type UpdateAuthSettingsRequest, type UpdateAuthSettingsResponse, type UpdateConversationOptions, type UpdateEmailProviderSettingsRequest, type UpdateEmailTemplateRequest, type UpdateFunctionRequest, type UpdateMigrationRequest, type UpdateOAuthProviderRequest, type UpdateOAuthProviderResponse, type UpdateRPCProcedureRequest, type UpdateSystemSettingRequest, type UpdateUserAttributes, type UpdateUserRoleRequest, type UpdateWebhookRequest, type UploadOptions, type UploadProgress, type UpsertOptions, type User, type UserResponse, type ValidateInvitationResponse, type VectorMetric, type VectorOrderOptions, type VectorSearchOptions, type VectorSearchResult, type VoidResponse, type WeakPassword, type Webhook, type WebhookDelivery, WebhooksManager, assertType, bundleCode, createClient, denoExternalPlugin, hasPostgrestError, isArray, isAuthError, isAuthSuccess, isBoolean, isFluxbaseError, isFluxbaseSuccess, isNumber, isObject, isPostgrestSuccess, isString, loadImportMap };
11328
+ export { type AIChatClientMessage, type AIChatEvent, type AIChatEventType, type AIChatMessageRole, type AIChatOptions, type AIChatServerMessage, type AIChatbot, type AIChatbotSummary, type AIConversation, type AIConversationMessage, type AIProvider, type AIProviderType, type AIUsageStats, type AIUserConversationDetail, type AIUserConversationSummary, type AIUserMessage, type AIUserQueryResult, type AIUserUsageStats, type APIKey, APIKeysManager, type AcceptInvitationRequest, type AcceptInvitationResponse, type AdminAuthResponse, type AdminBucket, type AdminListBucketsResponse, type AdminListObjectsResponse, type AdminLoginRequest, type AdminMeResponse, type AdminRefreshRequest, type AdminRefreshResponse, type AdminSetupRequest, type AdminSetupStatusResponse, type AdminStorageObject, type AdminUser, type AppSettings, AppSettingsManager, type ApplyMigrationRequest, type ApplyPendingRequest, type AuthResponse, type AuthResponseData, type AuthSession, type AuthSettings, AuthSettingsManager, type AuthenticationSettings, type Branch, type BranchActivity, type BranchPoolStats, type BranchStatus, type BranchType, type BroadcastCallback, type BroadcastMessage, type BundleOptions, type BundleResult, type CaptchaConfig, type CaptchaProvider, type ChatbotSpec, type ChunkedUploadSession, type ClientKey, ClientKeysManager, type Column, type CreateAIProviderRequest, type CreateAPIKeyRequest, type CreateAPIKeyResponse, type CreateBranchOptions, type CreateClientKeyRequest, type CreateClientKeyResponse, type CreateColumnRequest, type CreateFunctionRequest, type CreateInvitationRequest, type CreateInvitationResponse, type CreateMigrationRequest, type CreateOAuthProviderRequest, type CreateOAuthProviderResponse, type CreateSchemaRequest, type CreateSchemaResponse, type CreateTableRequest, type CreateTableResponse, type CreateWebhookRequest, DDLManager, type DataCloneMode, type DataResponse, type DeleteAPIKeyResponse, type DeleteClientKeyResponse, type DeleteOAuthProviderResponse, type DeleteTableResponse, type DeleteUserResponse, type DeleteWebhookResponse, type DownloadOptions, type DownloadProgress, type EdgeFunction, type EdgeFunctionExecution, type EmailProviderSettings, type EmailSettingOverride, type EmailSettings, EmailSettingsManager, type EmailTemplate, EmailTemplateManager, type EmailTemplateType, type EmbedRequest, type EmbedResponse, type EnrichedUser, type ExecutionLog, type ExecutionLogCallback, type ExecutionLogConfig, type ExecutionLogEvent, type ExecutionLogLevel, ExecutionLogsChannel, type ExecutionType, type FeatureSettings, type FileObject, type FilterOperator, FluxbaseAI, FluxbaseAIChat, FluxbaseAdmin, FluxbaseAdminAI, FluxbaseAdminFunctions, FluxbaseAdminJobs, FluxbaseAdminMigrations, FluxbaseAdminRPC, FluxbaseAdminStorage, FluxbaseAuth, type FluxbaseAuthResponse, FluxbaseBranching, FluxbaseClient, type FluxbaseClientOptions, type FluxbaseError, FluxbaseFetch, FluxbaseFunctions, FluxbaseGraphQL, FluxbaseJobs, FluxbaseManagement, FluxbaseOAuth, FluxbaseRPC, FluxbaseRealtime, type FluxbaseResponse, FluxbaseSettings, FluxbaseStorage, FluxbaseVector, type FunctionInvokeOptions, type FunctionSpec, type GetImpersonationResponse, type GraphQLError, type GraphQLErrorLocation, type GraphQLRequestOptions, type GraphQLResponse, type HealthResponse, type HttpMethod, type ImageFitMode, type ImageFormat, type ImpersonateAnonRequest, type ImpersonateServiceRequest, type ImpersonateUserRequest, ImpersonationManager, type ImpersonationSession, type ImpersonationTargetUser, type ImpersonationType, type IntrospectionDirective, type IntrospectionEnumValue, type IntrospectionField, type IntrospectionInputValue, type IntrospectionSchema, type IntrospectionType, type IntrospectionTypeRef, type Invitation, InvitationsManager, type InviteUserRequest, type InviteUserResponse, type ListAPIKeysResponse, type ListBranchesOptions, type ListBranchesResponse, type ListClientKeysResponse, type ListConversationsOptions, type ListConversationsResult, type ListEmailTemplatesResponse, type ListImpersonationSessionsOptions, type ListImpersonationSessionsResponse, type ListInvitationsOptions, type ListInvitationsResponse, type ListOAuthProvidersResponse, type ListOptions, type ListSchemasResponse, type ListSystemSettingsResponse, type ListTablesResponse, type ListUsersOptions, type ListUsersResponse, type ListWebhookDeliveriesResponse, type ListWebhooksResponse, type MailgunSettings, type Migration, type MigrationExecution, type OAuthProvider, OAuthProviderManager, type OrderBy, type OrderDirection, type PostgresChangesConfig, type PostgrestError, type PostgrestResponse, type PresenceCallback, type PresenceState, QueryBuilder, type QueryFilter, type RPCExecution, type RPCExecutionFilters, type RPCExecutionLog, type RPCExecutionStatus, type RPCInvokeResponse, type RPCProcedure, type RPCProcedureSpec, type RPCProcedureSummary, type RealtimeBroadcastPayload, type RealtimeCallback, type RealtimeChangePayload, RealtimeChannel, type RealtimeChannelConfig, type RealtimeMessage, type RealtimePostgresChangesPayload, type RealtimePresencePayload, type RequestOptions, type ResetUserPasswordResponse, type ResumableDownloadData, type ResumableDownloadOptions, type ResumableUploadOptions, type ResumableUploadProgress, type RevokeAPIKeyResponse, type RevokeClientKeyResponse, type RevokeInvitationResponse, type RollbackMigrationRequest, type SAMLLoginOptions, type SAMLLoginResponse, type SAMLProvider, type SAMLProvidersResponse, type SAMLSession, type SESSettings, type SMTPSettings, type Schema, SchemaQueryBuilder, type SecuritySettings, type SendEmailRequest, type SendGridSettings, type SessionResponse, SettingsClient, type SignInCredentials, type SignInWith2FAResponse, type SignUpCredentials, type SignedUrlOptions, type SignedUrlResponse, type StartImpersonationResponse, type StopImpersonationResponse, StorageBucket, type StorageObject, type StreamDownloadData, type StreamUploadOptions, type SupabaseAuthResponse, type SupabaseResponse, type SyncChatbotsOptions, type SyncChatbotsResult, type SyncError, type SyncFunctionsOptions, type SyncFunctionsResult, type SyncMigrationsOptions, type SyncMigrationsResult, type SyncRPCOptions, type SyncRPCResult, type SystemSetting, SystemSettingsManager, type Table, type TestEmailSettingsResponse, type TestEmailTemplateRequest, type TestWebhookResponse, type TransformOptions, type TwoFactorEnableResponse, type TwoFactorSetupResponse, type TwoFactorStatusResponse, type TwoFactorVerifyRequest, type UpdateAIProviderRequest, type UpdateAPIKeyRequest, type UpdateAppSettingsRequest, type UpdateAuthSettingsRequest, type UpdateAuthSettingsResponse, type UpdateClientKeyRequest, type UpdateConversationOptions, type UpdateEmailProviderSettingsRequest, type UpdateEmailTemplateRequest, type UpdateFunctionRequest, type UpdateMigrationRequest, type UpdateOAuthProviderRequest, type UpdateOAuthProviderResponse, type UpdateRPCProcedureRequest, type UpdateSystemSettingRequest, type UpdateUserAttributes, type UpdateUserRoleRequest, type UpdateWebhookRequest, type UploadOptions, type UploadProgress, type UpsertOptions, type User, type UserResponse, type ValidateInvitationResponse, type VectorMetric, type VectorOrderOptions, type VectorSearchOptions, type VectorSearchResult, type VoidResponse, type WeakPassword, type Webhook, type WebhookDelivery, WebhooksManager, assertType, bundleCode, createClient, denoExternalPlugin, hasPostgrestError, isArray, isAuthError, isAuthSuccess, isBoolean, isFluxbaseError, isFluxbaseSuccess, isNumber, isObject, isPostgrestSuccess, isString, loadImportMap };