@fluxbase/sdk 2026.1.1-rc.1 → 2026.1.1-rc.11

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.js CHANGED
@@ -332,6 +332,7 @@ async function wrapAsyncVoid(operation) {
332
332
  // src/auth.ts
333
333
  var AUTH_STORAGE_KEY = "fluxbase.auth.session";
334
334
  var OAUTH_PROVIDER_KEY = "fluxbase.auth.oauth_provider";
335
+ var OAUTH_REDIRECT_URI_KEY = "fluxbase.auth.oauth_redirect_uri";
335
336
  var AUTO_REFRESH_TICK_THRESHOLD = 10;
336
337
  var AUTO_REFRESH_TICK_MINIMUM = 1e3;
337
338
  var MAX_REFRESH_RETRIES = 3;
@@ -545,6 +546,33 @@ var FluxbaseAuth = class {
545
546
  return await this.fetch.get("/api/v1/auth/captcha/config");
546
547
  });
547
548
  }
549
+ /**
550
+ * Get comprehensive authentication configuration from the server
551
+ * Returns all public auth settings including signup status, OAuth providers,
552
+ * SAML providers, password requirements, and CAPTCHA config in a single request.
553
+ *
554
+ * Use this to:
555
+ * - Conditionally render signup forms based on signup_enabled
556
+ * - Display available OAuth/SAML provider buttons
557
+ * - Show password requirements to users
558
+ * - Configure CAPTCHA widgets
559
+ *
560
+ * @returns Promise with complete authentication configuration
561
+ * @example
562
+ * ```typescript
563
+ * const { data, error } = await client.auth.getAuthConfig();
564
+ * if (data) {
565
+ * console.log('Signup enabled:', data.signup_enabled);
566
+ * console.log('OAuth providers:', data.oauth_providers);
567
+ * console.log('Password min length:', data.password_min_length);
568
+ * }
569
+ * ```
570
+ */
571
+ async getAuthConfig() {
572
+ return wrapAsync(async () => {
573
+ return await this.fetch.get("/api/v1/auth/config");
574
+ });
575
+ }
548
576
  /**
549
577
  * Sign out the current user
550
578
  */
@@ -924,14 +952,19 @@ var FluxbaseAuth = class {
924
952
  if (!provider) {
925
953
  throw new Error("No OAuth provider found. Call signInWithOAuth first.");
926
954
  }
955
+ const redirectUri = this.storage?.getItem(OAUTH_REDIRECT_URI_KEY);
927
956
  const params = new URLSearchParams({ code });
928
957
  if (state) {
929
958
  params.append("state", state);
930
959
  }
960
+ if (redirectUri) {
961
+ params.append("redirect_uri", redirectUri);
962
+ }
931
963
  const response = await this.fetch.get(
932
964
  `/api/v1/auth/oauth/${provider}/callback?${params.toString()}`
933
965
  );
934
966
  this.storage?.removeItem(OAUTH_PROVIDER_KEY);
967
+ this.storage?.removeItem(OAUTH_REDIRECT_URI_KEY);
935
968
  const session = {
936
969
  ...response,
937
970
  expires_at: Date.now() + response.expires_in * 1e3
@@ -955,6 +988,9 @@ var FluxbaseAuth = class {
955
988
  const url = result.data.url;
956
989
  if (typeof window !== "undefined") {
957
990
  this.storage?.setItem(OAUTH_PROVIDER_KEY, provider);
991
+ if (options?.redirect_uri) {
992
+ this.storage?.setItem(OAUTH_REDIRECT_URI_KEY, options.redirect_uri);
993
+ }
958
994
  window.location.href = url;
959
995
  } else {
960
996
  throw new Error(
@@ -7721,6 +7757,46 @@ var FluxbaseAdminAI = class {
7721
7757
  return { data: null, error };
7722
7758
  }
7723
7759
  }
7760
+ /**
7761
+ * Set a provider as the embedding provider
7762
+ *
7763
+ * @param id - Provider ID
7764
+ * @returns Promise resolving to { data, error } tuple
7765
+ *
7766
+ * @example
7767
+ * ```typescript
7768
+ * const { data, error } = await client.admin.ai.setEmbeddingProvider('uuid')
7769
+ * ```
7770
+ */
7771
+ async setEmbeddingProvider(id) {
7772
+ try {
7773
+ const data = await this.fetch.put(`/api/v1/admin/ai/providers/${id}/embedding`, {});
7774
+ return { data, error: null };
7775
+ } catch (error) {
7776
+ return { data: null, error };
7777
+ }
7778
+ }
7779
+ /**
7780
+ * Clear explicit embedding provider preference (revert to default)
7781
+ *
7782
+ * @param id - Provider ID to clear
7783
+ * @returns Promise resolving to { data, error } tuple
7784
+ *
7785
+ * @example
7786
+ * ```typescript
7787
+ * const { data, error } = await client.admin.ai.clearEmbeddingProvider('uuid')
7788
+ * ```
7789
+ */
7790
+ async clearEmbeddingProvider(id) {
7791
+ try {
7792
+ const data = await this.fetch.delete(
7793
+ `/api/v1/admin/ai/providers/${id}/embedding`
7794
+ );
7795
+ return { data, error: null };
7796
+ } catch (error) {
7797
+ return { data: null, error };
7798
+ }
7799
+ }
7724
7800
  // ============================================================================
7725
7801
  // KNOWLEDGE BASE MANAGEMENT (RAG)
7726
7802
  // ============================================================================