@base44/sdk 0.8.5 → 0.8.7

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.
Files changed (59) hide show
  1. package/README.md +47 -600
  2. package/dist/client.d.ts +90 -237
  3. package/dist/client.js +161 -29
  4. package/dist/client.types.d.ts +134 -0
  5. package/dist/client.types.js +1 -0
  6. package/dist/index.d.ts +12 -3
  7. package/dist/index.js +1 -1
  8. package/dist/modules/agents.d.ts +2 -23
  9. package/dist/modules/agents.js +3 -1
  10. package/dist/modules/agents.types.d.ts +330 -34
  11. package/dist/modules/analytics.d.ts +18 -0
  12. package/dist/modules/analytics.js +213 -0
  13. package/dist/modules/analytics.types.d.ts +42 -0
  14. package/dist/modules/analytics.types.js +1 -0
  15. package/dist/modules/app-logs.d.ts +8 -24
  16. package/dist/modules/app-logs.js +9 -19
  17. package/dist/modules/app-logs.types.d.ts +44 -0
  18. package/dist/modules/app-logs.types.js +1 -0
  19. package/dist/modules/app.types.d.ts +27 -0
  20. package/dist/modules/auth.d.ts +10 -78
  21. package/dist/modules/auth.js +24 -42
  22. package/dist/modules/auth.types.d.ts +436 -0
  23. package/dist/modules/auth.types.js +1 -0
  24. package/dist/modules/connectors.d.ts +6 -11
  25. package/dist/modules/connectors.js +6 -7
  26. package/dist/modules/connectors.types.d.ts +68 -2
  27. package/dist/modules/entities.d.ts +8 -5
  28. package/dist/modules/entities.js +22 -62
  29. package/dist/modules/entities.types.d.ts +293 -0
  30. package/dist/modules/entities.types.js +1 -0
  31. package/dist/modules/functions.d.ts +8 -7
  32. package/dist/modules/functions.js +7 -5
  33. package/dist/modules/functions.types.d.ts +50 -0
  34. package/dist/modules/functions.types.js +1 -0
  35. package/dist/modules/integrations.d.ts +8 -5
  36. package/dist/modules/integrations.js +7 -5
  37. package/dist/modules/integrations.types.d.ts +352 -0
  38. package/dist/modules/integrations.types.js +1 -0
  39. package/dist/modules/sso.d.ts +9 -14
  40. package/dist/modules/sso.js +9 -12
  41. package/dist/modules/sso.types.d.ts +44 -0
  42. package/dist/modules/sso.types.js +1 -0
  43. package/dist/modules/types.d.ts +1 -0
  44. package/dist/modules/types.js +1 -0
  45. package/dist/types.d.ts +65 -2
  46. package/dist/utils/auth-utils.d.ts +107 -45
  47. package/dist/utils/auth-utils.js +107 -33
  48. package/dist/utils/auth-utils.types.d.ts +146 -0
  49. package/dist/utils/auth-utils.types.js +1 -0
  50. package/dist/utils/axios-client.d.ts +84 -16
  51. package/dist/utils/axios-client.js +74 -13
  52. package/dist/utils/axios-client.types.d.ts +28 -0
  53. package/dist/utils/axios-client.types.js +1 -0
  54. package/dist/utils/common.d.ts +1 -0
  55. package/dist/utils/common.js +4 -0
  56. package/dist/utils/sharedInstance.d.ts +1 -0
  57. package/dist/utils/sharedInstance.js +15 -0
  58. package/dist/utils/socket-utils.d.ts +2 -2
  59. package/package.json +12 -3
@@ -1,32 +1,24 @@
1
1
  /**
2
- * Creates the auth module for the Base44 SDK
3
- * @param {import('axios').AxiosInstance} axios - Axios instance
4
- * @param {string|number} appId - Application ID
5
- * @param {string} serverUrl - Server URL
6
- * @returns {Object} Auth module with authentication methods
2
+ * Creates the auth module for the Base44 SDK.
3
+ *
4
+ * @param axios - Axios instance for API requests
5
+ * @param functionsAxiosClient - Axios instance for functions API requests
6
+ * @param appId - Application ID
7
+ * @param options - Configuration options including server URLs
8
+ * @returns Auth module with authentication and user management methods
9
+ * @internal
7
10
  */
8
11
  export function createAuthModule(axios, functionsAxiosClient, appId, options) {
9
12
  return {
10
- /**
11
- * Get current user information
12
- * @returns {Promise<Object>} Current user data
13
- */
13
+ // Get current user information
14
14
  async me() {
15
15
  return axios.get(`/apps/${appId}/entities/User/me`);
16
16
  },
17
- /**
18
- * Update current user data
19
- * @param {Object} data - Updated user data
20
- * @returns {Promise<Object>} Updated user
21
- */
17
+ // Update current user data
22
18
  async updateMe(data) {
23
19
  return axios.put(`/apps/${appId}/entities/User/me`, data);
24
20
  },
25
- /**
26
- * Redirects the user to the app's login page
27
- * @param {string} nextUrl - URL to redirect to after successful login
28
- * @throws {Error} When not in a browser environment
29
- */
21
+ // Redirects the user to the app's login page
30
22
  redirectToLogin(nextUrl) {
31
23
  var _a;
32
24
  // This function only works in a browser environment
@@ -42,12 +34,8 @@ export function createAuthModule(axios, functionsAxiosClient, appId, options) {
42
34
  // Redirect to the login page
43
35
  window.location.href = loginUrl;
44
36
  },
45
- /**
46
- * Logout the current user
47
- * Removes the token from localStorage and optionally redirects to a URL or reloads the page
48
- * @param redirectUrl - Optional URL to redirect to after logout. Reloads the page if not provided
49
- * @returns {Promise<void>}
50
- */
37
+ // Logout the current user
38
+ // Removes the token from localStorage and optionally redirects to a URL or reloads the page
51
39
  logout(redirectUrl) {
52
40
  // Remove token from axios headers
53
41
  delete axios.defaults.headers.common["Authorization"];
@@ -72,11 +60,7 @@ export function createAuthModule(axios, functionsAxiosClient, appId, options) {
72
60
  }
73
61
  }
74
62
  },
75
- /**
76
- * Set authentication token
77
- * @param {string} token - Auth token
78
- * @param {boolean} [saveToStorage=true] - Whether to save the token to localStorage
79
- */
63
+ // Set authentication token
80
64
  setToken(token, saveToStorage = true) {
81
65
  if (!token)
82
66
  return;
@@ -97,13 +81,7 @@ export function createAuthModule(axios, functionsAxiosClient, appId, options) {
97
81
  }
98
82
  }
99
83
  },
100
- /**
101
- * Login via username and password
102
- * @param email - User email
103
- * @param password - User password
104
- * @param turnstileToken - Optional Turnstile captcha token
105
- * @returns Login response with access_token and user
106
- */
84
+ // Login using username and password
107
85
  async loginViaEmailPassword(email, password, turnstileToken) {
108
86
  var _a;
109
87
  try {
@@ -129,10 +107,7 @@ export function createAuthModule(axios, functionsAxiosClient, appId, options) {
129
107
  throw error;
130
108
  }
131
109
  },
132
- /**
133
- * Verify if the current token is valid
134
- * @returns {Promise<boolean>} True if token is valid
135
- */
110
+ // Verify if the current token is valid
136
111
  async isAuthenticated() {
137
112
  try {
138
113
  await this.me();
@@ -142,35 +117,42 @@ export function createAuthModule(axios, functionsAxiosClient, appId, options) {
142
117
  return false;
143
118
  }
144
119
  },
120
+ // Invite a user to the app
145
121
  inviteUser(userEmail, role) {
146
122
  return axios.post(`/apps/${appId}/users/invite-user`, {
147
123
  user_email: userEmail,
148
124
  role,
149
125
  });
150
126
  },
127
+ // Register a new user account
151
128
  register(payload) {
152
129
  return axios.post(`/apps/${appId}/auth/register`, payload);
153
130
  },
131
+ // Verify an OTP (One-time password) code
154
132
  verifyOtp({ email, otpCode }) {
155
133
  return axios.post(`/apps/${appId}/auth/verify-otp`, {
156
134
  email,
157
135
  otp_code: otpCode,
158
136
  });
159
137
  },
138
+ // Resend an OTP code to the user's email
160
139
  resendOtp(email) {
161
140
  return axios.post(`/apps/${appId}/auth/resend-otp`, { email });
162
141
  },
142
+ // Request a password reset
163
143
  resetPasswordRequest(email) {
164
144
  return axios.post(`/apps/${appId}/auth/reset-password-request`, {
165
145
  email,
166
146
  });
167
147
  },
168
- resetPassword({ resetToken, newPassword, }) {
148
+ // Reset password using a reset token
149
+ resetPassword({ resetToken, newPassword }) {
169
150
  return axios.post(`/apps/${appId}/auth/reset-password`, {
170
151
  reset_token: resetToken,
171
152
  new_password: newPassword,
172
153
  });
173
154
  },
155
+ // Change the user's password
174
156
  changePassword({ userId, currentPassword, newPassword, }) {
175
157
  return axios.post(`/apps/${appId}/auth/change-password`, {
176
158
  user_id: userId,
@@ -0,0 +1,436 @@
1
+ /**
2
+ * An authenticated user.
3
+ */
4
+ export interface User {
5
+ /** Unique user identifier. */
6
+ id: string;
7
+ /** When the user was created. */
8
+ created_date: string;
9
+ /** When the user was last updated. */
10
+ updated_date: string;
11
+ /** User's email address. */
12
+ email: string;
13
+ /** User's full name. */
14
+ full_name: string | null;
15
+ /** Whether the user is disabled. */
16
+ disabled: boolean | null;
17
+ /** Whether the user's email has been verified. */
18
+ is_verified: boolean;
19
+ /** The app ID this user belongs to. */
20
+ app_id: string;
21
+ /** Whether this is a service account. */
22
+ is_service: boolean;
23
+ /** Internal app role.
24
+ * @internal
25
+ */
26
+ _app_role: string;
27
+ /**
28
+ * User's role in the app. Roles are configured in the app settings and determine the user's permissions and access levels.
29
+ */
30
+ role: string;
31
+ /**
32
+ * Additional custom fields defined in the user schema. Any custom properties added to the user schema in the app will be available here with their configured types and values.
33
+ */
34
+ [key: string]: any;
35
+ }
36
+ /**
37
+ * Response from login endpoints containing user information and access token.
38
+ */
39
+ export interface LoginResponse {
40
+ /** JWT access token for authentication. */
41
+ access_token: string;
42
+ /** User information. */
43
+ user: User;
44
+ }
45
+ /**
46
+ * Payload for user registration.
47
+ */
48
+ export interface RegisterParams {
49
+ /** User's email address. */
50
+ email: string;
51
+ /** User's password. */
52
+ password: string;
53
+ /** Optional {@link https://developers.cloudflare.com/turnstile/ | Cloudflare Turnstile CAPTCHA token} for bot protection. */
54
+ turnstile_token?: string | null;
55
+ /** Optional {@link https://docs.base44.com/Getting-Started/Referral-program | referral code} from an existing user. */
56
+ referral_code?: string | null;
57
+ }
58
+ /**
59
+ * Parameters for OTP verification.
60
+ */
61
+ export interface VerifyOtpParams {
62
+ /** User's email address. */
63
+ email: string;
64
+ /** One-time password code received by email. */
65
+ otpCode: string;
66
+ }
67
+ /**
68
+ * Parameters for changing a user's password.
69
+ */
70
+ export interface ChangePasswordParams {
71
+ /** User ID. */
72
+ userId: string;
73
+ /** Current password for verification. */
74
+ currentPassword: string;
75
+ /** New password to set. */
76
+ newPassword: string;
77
+ }
78
+ /**
79
+ * Parameters for resetting a password with a token.
80
+ */
81
+ export interface ResetPasswordParams {
82
+ /** Reset token received by email. */
83
+ resetToken: string;
84
+ /** New password to set. */
85
+ newPassword: string;
86
+ }
87
+ /**
88
+ * Configuration options for the auth module.
89
+ */
90
+ export interface AuthModuleOptions {
91
+ /** Server URL for API requests. */
92
+ serverUrl: string;
93
+ /** Optional base URL for the app (used for login redirects). */
94
+ appBaseUrl?: string;
95
+ }
96
+ /**
97
+ * Authentication module for managing user authentication and authorization. The module automatically stores tokens in local storage when available and manages authorization headers for API requests.
98
+ *
99
+ * This module provides comprehensive authentication functionality including:
100
+ * - Email/password login and registration
101
+ * - Token management
102
+ * - User profile access and updates
103
+ * - Password reset flows
104
+ * - OTP verification
105
+ * - User invitations
106
+ *
107
+ * The auth module is only available in user authentication mode (`base44.auth`).
108
+ */
109
+ export interface AuthModule {
110
+ /**
111
+ * Gets the current authenticated user's information.
112
+ *
113
+ * @returns Promise resolving to the user's profile data.
114
+ *
115
+ * @example
116
+ * ```typescript
117
+ * // Get current user information
118
+ * const user = await base44.auth.me();
119
+ * console.log(`Logged in as: ${user.email}`);
120
+ * console.log(`User ID: ${user.id}`);
121
+ * ```
122
+ */
123
+ me(): Promise<User>;
124
+ /**
125
+ * Updates the current authenticated user's information.
126
+ *
127
+ * Only the fields included in the data object will be updated.
128
+ * Commonly updated fields include `full_name` and custom profile fields.
129
+ *
130
+ * @param data - Object containing the fields to update.
131
+ * @returns Promise resolving to the updated user data.
132
+ *
133
+ * @example
134
+ * ```typescript
135
+ * // Update specific fields
136
+ * const updatedUser = await base44.auth.updateMe({
137
+ * full_name: 'John Doe'
138
+ * });
139
+ * console.log(`Updated user: ${updatedUser.full_name}`);
140
+ * ```
141
+ *
142
+ * @example
143
+ * ```typescript
144
+ * // Update custom fields defined in your User entity
145
+ * await base44.auth.updateMe({
146
+ * bio: 'Software developer',
147
+ * phone: '+1234567890',
148
+ * preferences: { theme: 'dark' }
149
+ * });
150
+ * ```
151
+ */
152
+ updateMe(data: Partial<Omit<User, "id" | "created_date" | "updated_date">>): Promise<User>;
153
+ /**
154
+ * Redirects the user to the app's login page.
155
+ *
156
+ * Redirects with a callback URL to return to after successful authentication. Requires a browser environment and can't be used in the backend.
157
+ *
158
+ * @param nextUrl - URL to redirect to after successful login.
159
+ * @throws {Error} When not in a browser environment.
160
+ *
161
+ * @example
162
+ * ```typescript
163
+ * // Redirect to login and come back to current page
164
+ * base44.auth.redirectToLogin(window.location.href);
165
+ * ```
166
+ *
167
+ * @example
168
+ * ```typescript
169
+ * // Redirect to login and then go to the dashboard page
170
+ * base44.auth.redirectToLogin('/dashboard');
171
+ * ```
172
+ */
173
+ redirectToLogin(nextUrl: string): void;
174
+ /**
175
+ * Logs out the current user.
176
+ *
177
+ * Removes the authentication token from local storage and Axios headers, then optionally redirects to a URL or reloads the page. Requires a browser environment and can't be used in the backend.
178
+ *
179
+ * @param redirectUrl - Optional URL to redirect to after logout. Reloads the page if not provided.
180
+ *
181
+ * @example
182
+ * ```typescript
183
+ * // Logout and reload page
184
+ * base44.auth.logout();
185
+ * ```
186
+ *
187
+ * @example
188
+ * ```typescript
189
+ * // Logout and redirect to login page
190
+ * base44.auth.logout('/login');
191
+ * ```
192
+ *
193
+ * @example
194
+ * ```typescript
195
+ * // Logout and redirect to home
196
+ * base44.auth.logout('/');
197
+ * ```
198
+ */
199
+ logout(redirectUrl?: string): void;
200
+ /**
201
+ * Sets the authentication token.
202
+ *
203
+ * Updates the authorization header for API requests and optionally saves the token to local storage for persistence. Saving to local storage requires a browser environment and is automatically skipped in backend environments.
204
+ *
205
+ * @param token - JWT authentication token.
206
+ * @param saveToStorage - Whether to save the token to local storage. Defaults to true.
207
+ *
208
+ * @example
209
+ * ```typescript
210
+ * // Set token and save to local storage
211
+ * base44.auth.setToken('eyJhbGciOiJIUzI1NiIs...');
212
+ * ```
213
+ *
214
+ * @example
215
+ * ```typescript
216
+ * // Set token without saving to local storage
217
+ * base44.auth.setToken('eyJhbGciOiJIUzI1NiIs...', false);
218
+ * ```
219
+ */
220
+ setToken(token: string, saveToStorage?: boolean): void;
221
+ /**
222
+ * Logs in a registered user using email and password.
223
+ *
224
+ * Authenticates a user with email and password credentials. The user must already have a registered account. For new users, use {@linkcode register | register()} first to create an account. On successful login, automatically sets the token for subsequent requests.
225
+ *
226
+ * @param email - User's email address.
227
+ * @param password - User's password.
228
+ * @param turnstileToken - Optional {@link https://developers.cloudflare.com/turnstile/ | Cloudflare Turnstile CAPTCHA token} for bot protection.
229
+ * @returns Promise resolving to login response with access token and user data.
230
+ * @throws Error if the email and password combination is invalid or the user is not registered.
231
+ *
232
+ * @example
233
+ * ```typescript
234
+ * // Login with email and password
235
+ * try {
236
+ * const { access_token, user } = await base44.auth.loginViaEmailPassword(
237
+ * 'user@example.com',
238
+ * 'securePassword123'
239
+ * );
240
+ * console.log('Login successful!', user);
241
+ * } catch (error) {
242
+ * console.error('Login failed:', error);
243
+ * }
244
+ * ```
245
+ *
246
+ * @example
247
+ * ```typescript
248
+ * // With captcha token
249
+ * const response = await base44.auth.loginViaEmailPassword(
250
+ * 'user@example.com',
251
+ * 'securePassword123',
252
+ * 'captcha-token-here'
253
+ * );
254
+ * ```
255
+ */
256
+ loginViaEmailPassword(email: string, password: string, turnstileToken?: string): Promise<LoginResponse>;
257
+ /**
258
+ * Checks if the current user is authenticated.
259
+ *
260
+ * @returns Promise resolving to true if authenticated, false otherwise.
261
+ *
262
+ * @example
263
+ * ```typescript
264
+ * // Check authentication status
265
+ * const isAuthenticated = await base44.auth.isAuthenticated();
266
+ * if (isAuthenticated) {
267
+ * console.log('User is logged in');
268
+ * } else {
269
+ * // Redirect to login page
270
+ * base44.auth.redirectToLogin(window.location.href);
271
+ * }
272
+ * ```
273
+ */
274
+ isAuthenticated(): Promise<boolean>;
275
+ /**
276
+ * Invites a user to the app.
277
+ *
278
+ * Sends an invitation email to a potential user with a specific role.
279
+ * Roles are configured in the app settings and determine
280
+ * the user's permissions and access levels.
281
+ *
282
+ * @param userEmail - Email address of the user to invite.
283
+ * @param role - Role to assign to the invited user. Must match a role defined in the app. For example, `'admin'` or `'user'`.
284
+ * @returns Promise that resolves when the invitation is sent successfully. Throws an error if the invitation fails.
285
+ *
286
+ * @example
287
+ * ```typescript
288
+ * try {
289
+ * await base44.auth.inviteUser('newuser@example.com', 'user');
290
+ * console.log('Invitation sent successfully!');
291
+ * } catch (error) {
292
+ * console.error('Failed to send invitation:', error);
293
+ * }
294
+ * ```
295
+ */
296
+ inviteUser(userEmail: string, role: string): Promise<any>;
297
+ /**
298
+ * Registers a new user account.
299
+ *
300
+ * Creates a new user account with email and password. After successful registration,
301
+ * use {@linkcode loginViaEmailPassword | loginViaEmailPassword()} to log in the user.
302
+ *
303
+ * @param params - Registration details including email, password, and optional fields.
304
+ * @returns Promise resolving to the registration response.
305
+ *
306
+ * @example
307
+ * ```typescript
308
+ * // Register a new user
309
+ * await base44.auth.register({
310
+ * email: 'newuser@example.com',
311
+ * password: 'securePassword123',
312
+ * referral_code: 'FRIEND2024'
313
+ * });
314
+ *
315
+ * // Login after registration
316
+ * const { access_token, user } = await base44.auth.loginViaEmailPassword(
317
+ * 'newuser@example.com',
318
+ * 'securePassword123'
319
+ * );
320
+ * ```
321
+ */
322
+ register(params: RegisterParams): Promise<any>;
323
+ /**
324
+ * Verifies an OTP (One-time password) code.
325
+ *
326
+ * Validates an OTP code sent to the user's email during registration
327
+ * or authentication.
328
+ *
329
+ * @param params - Object containing email and OTP code.
330
+ * @returns Promise resolving to the verification response if valid.
331
+ * @throws Error if the OTP code is invalid, expired, or verification fails.
332
+ *
333
+ * @example
334
+ * ```typescript
335
+ * try {
336
+ * await base44.auth.verifyOtp({
337
+ * email: 'user@example.com',
338
+ * otpCode: '123456'
339
+ * });
340
+ * console.log('Email verified successfully!');
341
+ * } catch (error) {
342
+ * console.error('Invalid or expired OTP code');
343
+ * }
344
+ * ```
345
+ */
346
+ verifyOtp(params: VerifyOtpParams): Promise<any>;
347
+ /**
348
+ * Resends an OTP code to the user's email address.
349
+ *
350
+ * Requests a new OTP code to be sent to the specified email address.
351
+ *
352
+ * @param email - Email address to send the OTP to.
353
+ * @returns Promise resolving when the OTP is sent successfully.
354
+ * @throws Error if the email is invalid or the request fails.
355
+ *
356
+ * @example
357
+ * ```typescript
358
+ * try {
359
+ * await base44.auth.resendOtp('user@example.com');
360
+ * console.log('OTP resent! Please check your email.');
361
+ * } catch (error) {
362
+ * console.error('Failed to resend OTP:', error);
363
+ * }
364
+ * ```
365
+ */
366
+ resendOtp(email: string): Promise<any>;
367
+ /**
368
+ * Requests a password reset.
369
+ *
370
+ * Sends a password reset email to the specified email address.
371
+ *
372
+ * @param email - Email address for the account to reset.
373
+ * @returns Promise resolving when the password reset email is sent successfully.
374
+ * @throws Error if the email is invalid or the request fails.
375
+ *
376
+ * @example
377
+ * ```typescript
378
+ * try {
379
+ * await base44.auth.resetPasswordRequest('user@example.com');
380
+ * console.log('Password reset email sent!');
381
+ * } catch (error) {
382
+ * console.error('Failed to send password reset email:', error);
383
+ * }
384
+ * ```
385
+ */
386
+ resetPasswordRequest(email: string): Promise<any>;
387
+ /**
388
+ * Resets password using a reset token.
389
+ *
390
+ * Completes the password reset flow by setting a new password
391
+ * using the token received by email.
392
+ *
393
+ * @param params - Object containing the reset token and new password.
394
+ * @returns Promise resolving when the password is reset successfully.
395
+ * @throws Error if the reset token is invalid, expired, or the request fails.
396
+ *
397
+ * @example
398
+ * ```typescript
399
+ * try {
400
+ * await base44.auth.resetPassword({
401
+ * resetToken: 'token-from-email',
402
+ * newPassword: 'newSecurePassword456'
403
+ * });
404
+ * console.log('Password reset successful!');
405
+ * } catch (error) {
406
+ * console.error('Failed to reset password:', error);
407
+ * }
408
+ * ```
409
+ */
410
+ resetPassword(params: ResetPasswordParams): Promise<any>;
411
+ /**
412
+ * Changes the user's password.
413
+ *
414
+ * Updates the password for an authenticated user by verifying
415
+ * the current password and setting a new one.
416
+ *
417
+ * @param params - Object containing user ID, current password, and new password.
418
+ * @returns Promise resolving when the password is changed successfully.
419
+ * @throws Error if the current password is incorrect or the request fails.
420
+ *
421
+ * @example
422
+ * ```typescript
423
+ * try {
424
+ * await base44.auth.changePassword({
425
+ * userId: 'user-123',
426
+ * currentPassword: 'oldPassword123',
427
+ * newPassword: 'newSecurePassword456'
428
+ * });
429
+ * console.log('Password changed successfully!');
430
+ * } catch (error) {
431
+ * console.error('Failed to change password:', error);
432
+ * }
433
+ * ```
434
+ */
435
+ changePassword(params: ChangePasswordParams): Promise<any>;
436
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -1,16 +1,11 @@
1
1
  import { AxiosInstance } from "axios";
2
- import { ConnectorIntegrationType, ConnectorAccessTokenResponse } from "./connectors.types.js";
2
+ import { ConnectorsModule } from "./connectors.types.js";
3
3
  /**
4
- * Creates the Connectors module for the Base44 SDK
4
+ * Creates the Connectors module for the Base44 SDK.
5
+ *
5
6
  * @param axios - Axios instance (should be service role client)
6
7
  * @param appId - Application ID
7
- * @returns Connectors module
8
+ * @returns Connectors module with methods to retrieve OAuth tokens
9
+ * @internal
8
10
  */
9
- export declare function createConnectorsModule(axios: AxiosInstance, appId: string): {
10
- /**
11
- * Retrieve an access token for a given integration type
12
- * @param integrationType - The integration type to get access token for
13
- * @returns Access token response
14
- */
15
- getAccessToken(integrationType: ConnectorIntegrationType): Promise<ConnectorAccessTokenResponse>;
16
- };
11
+ export declare function createConnectorsModule(axios: AxiosInstance, appId: string): ConnectorsModule;
@@ -1,16 +1,15 @@
1
1
  /**
2
- * Creates the Connectors module for the Base44 SDK
2
+ * Creates the Connectors module for the Base44 SDK.
3
+ *
3
4
  * @param axios - Axios instance (should be service role client)
4
5
  * @param appId - Application ID
5
- * @returns Connectors module
6
+ * @returns Connectors module with methods to retrieve OAuth tokens
7
+ * @internal
6
8
  */
7
9
  export function createConnectorsModule(axios, appId) {
8
10
  return {
9
- /**
10
- * Retrieve an access token for a given integration type
11
- * @param integrationType - The integration type to get access token for
12
- * @returns Access token response
13
- */
11
+ // Retrieve an OAuth access token for a specific external integration type
12
+ // @ts-expect-error Return type mismatch with interface - implementation returns object, interface expects string
14
13
  async getAccessToken(integrationType) {
15
14
  if (!integrationType || typeof integrationType !== "string") {
16
15
  throw new Error("Integration type is required and must be a string");