swiftbase-sdk 1.0.2 → 1.0.4

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
@@ -295,4 +295,66 @@ declare class Storage {
295
295
  deleteObject(key: string): Promise<void>;
296
296
  }
297
297
 
298
- export { type AuthorizeOptions, type BucketInfo, type ChangePasswordInput, type ListObjectsResult, type LoginInput, PaginatedResponse, type Profile, type ProfileInput, type ResetPasswordInput, type S3Object, Storage, type StorageOptions, type TokenResponse, assignRole, changePassword, createRole, createService, db, deleteRole, deleteService, getAccessToken, getProfile, getRoles, getServices, getUsers, handleRedirectCallback, initializeSdk, isLoggedIn, loginService as login, loginService, loginWithPassword, loginWithRedirect, logout, refreshTokens, resetPassword, search, setAccessToken, setRefreshToken, unassignRole, updateProfile, updateUser, verifyServiceToken, verifyToken };
298
+ interface AIToolCall {
299
+ id: string;
300
+ type: "function";
301
+ function: {
302
+ name: string;
303
+ arguments: string;
304
+ };
305
+ }
306
+ interface AITool {
307
+ type: "function";
308
+ function: {
309
+ name: string;
310
+ description?: string;
311
+ parameters?: Record<string, any>;
312
+ };
313
+ }
314
+ interface AIChatMessage {
315
+ role: "system" | "user" | "assistant" | "tool";
316
+ content?: string | null;
317
+ name?: string;
318
+ tool_call_id?: string;
319
+ tool_calls?: AIToolCall[];
320
+ }
321
+ interface AIChatCompletionOptions {
322
+ model?: string;
323
+ messages: AIChatMessage[];
324
+ tools?: AITool[];
325
+ tool_choice?: any;
326
+ temperature?: number;
327
+ max_tokens?: number;
328
+ }
329
+ interface AIChatCompletionResponse {
330
+ id?: string;
331
+ object?: string;
332
+ created?: number;
333
+ model?: string;
334
+ choices: Array<{
335
+ index?: number;
336
+ message: {
337
+ role: string;
338
+ content: string | null;
339
+ tool_calls?: AIToolCall[];
340
+ };
341
+ finish_reason?: string;
342
+ }>;
343
+ usage?: {
344
+ prompt_tokens: number;
345
+ completion_tokens: number;
346
+ total_tokens: number;
347
+ };
348
+ }
349
+ /**
350
+ * Generate completion using the AI service.
351
+ */
352
+ declare const ai: {
353
+ chat: {
354
+ completions: {
355
+ create: (options: AIChatCompletionOptions) => Promise<AIChatCompletionResponse>;
356
+ };
357
+ };
358
+ };
359
+
360
+ export { type AIChatCompletionOptions, type AIChatCompletionResponse, type AIChatMessage, type AuthorizeOptions, type BucketInfo, type ChangePasswordInput, type ListObjectsResult, type LoginInput, PaginatedResponse, type Profile, type ProfileInput, type ResetPasswordInput, type S3Object, Storage, type StorageOptions, type TokenResponse, ai, assignRole, changePassword, createRole, createService, db, deleteRole, deleteService, getAccessToken, getProfile, getRoles, getServices, getUsers, handleRedirectCallback, initializeSdk, isLoggedIn, loginService as login, loginService, loginWithPassword, loginWithRedirect, logout, refreshTokens, resetPassword, search, setAccessToken, setRefreshToken, unassignRole, updateProfile, updateUser, verifyServiceToken, verifyToken };
package/dist/index.d.ts CHANGED
@@ -295,4 +295,66 @@ declare class Storage {
295
295
  deleteObject(key: string): Promise<void>;
296
296
  }
297
297
 
298
- export { type AuthorizeOptions, type BucketInfo, type ChangePasswordInput, type ListObjectsResult, type LoginInput, PaginatedResponse, type Profile, type ProfileInput, type ResetPasswordInput, type S3Object, Storage, type StorageOptions, type TokenResponse, assignRole, changePassword, createRole, createService, db, deleteRole, deleteService, getAccessToken, getProfile, getRoles, getServices, getUsers, handleRedirectCallback, initializeSdk, isLoggedIn, loginService as login, loginService, loginWithPassword, loginWithRedirect, logout, refreshTokens, resetPassword, search, setAccessToken, setRefreshToken, unassignRole, updateProfile, updateUser, verifyServiceToken, verifyToken };
298
+ interface AIToolCall {
299
+ id: string;
300
+ type: "function";
301
+ function: {
302
+ name: string;
303
+ arguments: string;
304
+ };
305
+ }
306
+ interface AITool {
307
+ type: "function";
308
+ function: {
309
+ name: string;
310
+ description?: string;
311
+ parameters?: Record<string, any>;
312
+ };
313
+ }
314
+ interface AIChatMessage {
315
+ role: "system" | "user" | "assistant" | "tool";
316
+ content?: string | null;
317
+ name?: string;
318
+ tool_call_id?: string;
319
+ tool_calls?: AIToolCall[];
320
+ }
321
+ interface AIChatCompletionOptions {
322
+ model?: string;
323
+ messages: AIChatMessage[];
324
+ tools?: AITool[];
325
+ tool_choice?: any;
326
+ temperature?: number;
327
+ max_tokens?: number;
328
+ }
329
+ interface AIChatCompletionResponse {
330
+ id?: string;
331
+ object?: string;
332
+ created?: number;
333
+ model?: string;
334
+ choices: Array<{
335
+ index?: number;
336
+ message: {
337
+ role: string;
338
+ content: string | null;
339
+ tool_calls?: AIToolCall[];
340
+ };
341
+ finish_reason?: string;
342
+ }>;
343
+ usage?: {
344
+ prompt_tokens: number;
345
+ completion_tokens: number;
346
+ total_tokens: number;
347
+ };
348
+ }
349
+ /**
350
+ * Generate completion using the AI service.
351
+ */
352
+ declare const ai: {
353
+ chat: {
354
+ completions: {
355
+ create: (options: AIChatCompletionOptions) => Promise<AIChatCompletionResponse>;
356
+ };
357
+ };
358
+ };
359
+
360
+ export { type AIChatCompletionOptions, type AIChatCompletionResponse, type AIChatMessage, type AuthorizeOptions, type BucketInfo, type ChangePasswordInput, type ListObjectsResult, type LoginInput, PaginatedResponse, type Profile, type ProfileInput, type ResetPasswordInput, type S3Object, Storage, type StorageOptions, type TokenResponse, ai, assignRole, changePassword, createRole, createService, db, deleteRole, deleteService, getAccessToken, getProfile, getRoles, getServices, getUsers, handleRedirectCallback, initializeSdk, isLoggedIn, loginService as login, loginService, loginWithPassword, loginWithRedirect, logout, refreshTokens, resetPassword, search, setAccessToken, setRefreshToken, unassignRole, updateProfile, updateUser, verifyServiceToken, verifyToken };
package/dist/index.js CHANGED
@@ -3695,7 +3695,7 @@ var initializeSdk = (projectId, options) => {
3695
3695
  }
3696
3696
  if (typeof window !== "undefined") {
3697
3697
  app.userManager = new UserManager({
3698
- authority: app.baseUrl.replace("api.swiftbase", "identity.swiftbase").replace("app.swiftbase", "identity.swiftbase"),
3698
+ authority: app.baseUrl,
3699
3699
  client_id: app.projectId,
3700
3700
  redirect_uri: window.location.origin,
3701
3701
  post_logout_redirect_uri: window.location.origin,
@@ -4732,9 +4732,28 @@ var Storage = class {
4732
4732
  });
4733
4733
  }
4734
4734
  };
4735
+
4736
+ // src/ai.ts
4737
+ var ai = {
4738
+ chat: {
4739
+ completions: {
4740
+ create: (options) => __async(null, null, function* () {
4741
+ return yield makeRequest("post" /* POST */, "/api/ai/chat/completions", void 0, {
4742
+ model: options.model || "gemini-3.5-flash-lite",
4743
+ messages: options.messages,
4744
+ tools: options.tools,
4745
+ tool_choice: options.tool_choice,
4746
+ temperature: options.temperature,
4747
+ max_tokens: options.max_tokens
4748
+ });
4749
+ })
4750
+ }
4751
+ }
4752
+ };
4735
4753
  export {
4736
4754
  PaginatedResponse,
4737
4755
  Storage,
4756
+ ai,
4738
4757
  assignRole,
4739
4758
  changePassword,
4740
4759
  createRole,