@fluxbase/sdk 0.0.1-rc.81 → 0.0.1-rc.83

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
@@ -6921,9 +6921,20 @@ var FluxbaseAdminAI = class {
6921
6921
  */
6922
6922
  async createProvider(request) {
6923
6923
  try {
6924
+ const normalizedConfig = {};
6925
+ if (request.config) {
6926
+ for (const [key, value] of Object.entries(request.config)) {
6927
+ if (value !== void 0 && value !== null) {
6928
+ normalizedConfig[key] = String(value);
6929
+ }
6930
+ }
6931
+ }
6924
6932
  const data = await this.fetch.post(
6925
6933
  "/api/v1/admin/ai/providers",
6926
- request
6934
+ {
6935
+ ...request,
6936
+ config: normalizedConfig
6937
+ }
6927
6938
  );
6928
6939
  return { data, error: null };
6929
6940
  } catch (error) {
@@ -6951,9 +6962,19 @@ var FluxbaseAdminAI = class {
6951
6962
  */
6952
6963
  async updateProvider(id, updates) {
6953
6964
  try {
6965
+ let normalizedUpdates = updates;
6966
+ if (updates.config) {
6967
+ const normalizedConfig = {};
6968
+ for (const [key, value] of Object.entries(updates.config)) {
6969
+ if (value !== void 0 && value !== null) {
6970
+ normalizedConfig[key] = String(value);
6971
+ }
6972
+ }
6973
+ normalizedUpdates = { ...updates, config: normalizedConfig };
6974
+ }
6954
6975
  const data = await this.fetch.put(
6955
6976
  `/api/v1/admin/ai/providers/${id}`,
6956
- updates
6977
+ normalizedUpdates
6957
6978
  );
6958
6979
  return { data, error: null };
6959
6980
  } catch (error) {
@@ -10353,6 +10374,46 @@ function createClient(fluxbaseUrl, fluxbaseKey, options) {
10353
10374
  return new FluxbaseClient(url, key, options);
10354
10375
  }
10355
10376
 
10377
+ // src/type-guards.ts
10378
+ function isFluxbaseError(response) {
10379
+ return response.error !== null;
10380
+ }
10381
+ function isFluxbaseSuccess(response) {
10382
+ return response.error === null;
10383
+ }
10384
+ function isAuthError(response) {
10385
+ return response.error !== null;
10386
+ }
10387
+ function isAuthSuccess(response) {
10388
+ return response.error === null;
10389
+ }
10390
+ function hasPostgrestError(response) {
10391
+ return response.error !== null;
10392
+ }
10393
+ function isPostgrestSuccess(response) {
10394
+ return response.error === null && response.data !== null;
10395
+ }
10396
+ function isObject(value) {
10397
+ return typeof value === "object" && value !== null && !Array.isArray(value);
10398
+ }
10399
+ function isArray(value) {
10400
+ return Array.isArray(value);
10401
+ }
10402
+ function isString(value) {
10403
+ return typeof value === "string";
10404
+ }
10405
+ function isNumber(value) {
10406
+ return typeof value === "number" && !Number.isNaN(value);
10407
+ }
10408
+ function isBoolean(value) {
10409
+ return typeof value === "boolean";
10410
+ }
10411
+ function assertType(value, validator, errorMessage = "Type assertion failed") {
10412
+ if (!validator(value)) {
10413
+ throw new Error(errorMessage);
10414
+ }
10415
+ }
10416
+
10356
10417
  exports.APIKeysManager = APIKeysManager;
10357
10418
  exports.AppSettingsManager = AppSettingsManager;
10358
10419
  exports.AuthSettingsManager = AuthSettingsManager;
@@ -10390,9 +10451,21 @@ exports.SettingsClient = SettingsClient;
10390
10451
  exports.StorageBucket = StorageBucket;
10391
10452
  exports.SystemSettingsManager = SystemSettingsManager;
10392
10453
  exports.WebhooksManager = WebhooksManager;
10454
+ exports.assertType = assertType;
10393
10455
  exports.bundleCode = bundleCode;
10394
10456
  exports.createClient = createClient;
10395
10457
  exports.denoExternalPlugin = denoExternalPlugin;
10458
+ exports.hasPostgrestError = hasPostgrestError;
10459
+ exports.isArray = isArray;
10460
+ exports.isAuthError = isAuthError;
10461
+ exports.isAuthSuccess = isAuthSuccess;
10462
+ exports.isBoolean = isBoolean;
10463
+ exports.isFluxbaseError = isFluxbaseError;
10464
+ exports.isFluxbaseSuccess = isFluxbaseSuccess;
10465
+ exports.isNumber = isNumber;
10466
+ exports.isObject = isObject;
10467
+ exports.isPostgrestSuccess = isPostgrestSuccess;
10468
+ exports.isString = isString;
10396
10469
  exports.loadImportMap = loadImportMap;
10397
10470
  //# sourceMappingURL=index.cjs.map
10398
10471
  //# sourceMappingURL=index.cjs.map