@fluxbase/sdk 0.0.1-rc.80 → 0.0.1-rc.82

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