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