@base44-preview/sdk 0.7.2-pr.30.982623a → 0.7.3-dev.9d3dc69

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/client.d.ts CHANGED
@@ -19,6 +19,7 @@ export declare function createClient(config: {
19
19
  serviceToken?: string;
20
20
  requiresAuth?: boolean;
21
21
  functionsVersion?: string;
22
+ headers?: Record<string, string>;
22
23
  options?: CreateClientOptions;
23
24
  onRedirectToLogin?: () => void;
24
25
  }): {
@@ -71,6 +72,28 @@ export declare function createClient(config: {
71
72
  user: any;
72
73
  }>;
73
74
  isAuthenticated(): Promise<boolean>;
75
+ inviteUser(userEmail: string, role: string): Promise<import("axios").AxiosResponse<any, any>>;
76
+ register(payload: {
77
+ email: string;
78
+ password: string;
79
+ turnstile_token?: string | null;
80
+ referral_code?: string | null;
81
+ }): Promise<import("axios").AxiosResponse<any, any>>;
82
+ verifyOtp({ email, otpCode }: {
83
+ email: string;
84
+ otpCode: string;
85
+ }): Promise<import("axios").AxiosResponse<any, any>>;
86
+ resendOtp(email: string): Promise<import("axios").AxiosResponse<any, any>>;
87
+ resetPasswordRequest(email: string): Promise<import("axios").AxiosResponse<any, any>>;
88
+ resetPassword({ resetToken, newPassword, }: {
89
+ resetToken: string;
90
+ newPassword: string;
91
+ }): Promise<import("axios").AxiosResponse<any, any>>;
92
+ changePassword({ userId, currentPassword, newPassword, }: {
93
+ userId: string;
94
+ currentPassword: string;
95
+ newPassword: string;
96
+ }): Promise<import("axios").AxiosResponse<any, any>>;
74
97
  };
75
98
  functions: {
76
99
  invoke(functionName: string, data: Record<string, any>): Promise<import("axios").AxiosResponse<any, any>>;
@@ -138,6 +161,28 @@ export declare function createClientFromRequest(request: Request): {
138
161
  user: any;
139
162
  }>;
140
163
  isAuthenticated(): Promise<boolean>;
164
+ inviteUser(userEmail: string, role: string): Promise<import("axios").AxiosResponse<any, any>>;
165
+ register(payload: {
166
+ email: string;
167
+ password: string;
168
+ turnstile_token?: string | null;
169
+ referral_code?: string | null;
170
+ }): Promise<import("axios").AxiosResponse<any, any>>;
171
+ verifyOtp({ email, otpCode }: {
172
+ email: string;
173
+ otpCode: string;
174
+ }): Promise<import("axios").AxiosResponse<any, any>>;
175
+ resendOtp(email: string): Promise<import("axios").AxiosResponse<any, any>>;
176
+ resetPasswordRequest(email: string): Promise<import("axios").AxiosResponse<any, any>>;
177
+ resetPassword({ resetToken, newPassword, }: {
178
+ resetToken: string;
179
+ newPassword: string;
180
+ }): Promise<import("axios").AxiosResponse<any, any>>;
181
+ changePassword({ userId, currentPassword, newPassword, }: {
182
+ userId: string;
183
+ currentPassword: string;
184
+ newPassword: string;
185
+ }): Promise<import("axios").AxiosResponse<any, any>>;
141
186
  };
142
187
  functions: {
143
188
  invoke(functionName: string, data: Record<string, any>): Promise<import("axios").AxiosResponse<any, any>>;
package/dist/client.js CHANGED
@@ -18,7 +18,7 @@ import { RoomsSocket } from "./utils/socket-utils.js";
18
18
  * @returns {Object} Base44 client instance
19
19
  */
20
20
  export function createClient(config) {
21
- const { serverUrl = "https://base44.app", appId, token, serviceToken, requiresAuth = false, options, functionsVersion, onRedirectToLogin, } = config;
21
+ const { serverUrl = "https://base44.app", appId, token, serviceToken, requiresAuth = false, options, functionsVersion, onRedirectToLogin, headers: optionalHeaders, } = config;
22
22
  const socketConfig = {
23
23
  serverUrl,
24
24
  mountPath: "/ws-user-apps/socket.io/",
@@ -30,6 +30,7 @@ export function createClient(config) {
30
30
  config: socketConfig,
31
31
  });
32
32
  const headers = {
33
+ ...optionalHeaders,
33
34
  "X-App-Id": String(appId),
34
35
  };
35
36
  const functionHeaders = functionsVersion
@@ -56,4 +56,26 @@ export declare function createAuthModule(axios: AxiosInstance, functionsAxiosCli
56
56
  * @returns {Promise<boolean>} True if token is valid
57
57
  */
58
58
  isAuthenticated(): Promise<boolean>;
59
+ inviteUser(userEmail: string, role: string): Promise<import("axios").AxiosResponse<any, any>>;
60
+ register(payload: {
61
+ email: string;
62
+ password: string;
63
+ turnstile_token?: string | null;
64
+ referral_code?: string | null;
65
+ }): Promise<import("axios").AxiosResponse<any, any>>;
66
+ verifyOtp({ email, otpCode }: {
67
+ email: string;
68
+ otpCode: string;
69
+ }): Promise<import("axios").AxiosResponse<any, any>>;
70
+ resendOtp(email: string): Promise<import("axios").AxiosResponse<any, any>>;
71
+ resetPasswordRequest(email: string): Promise<import("axios").AxiosResponse<any, any>>;
72
+ resetPassword({ resetToken, newPassword, }: {
73
+ resetToken: string;
74
+ newPassword: string;
75
+ }): Promise<import("axios").AxiosResponse<any, any>>;
76
+ changePassword({ userId, currentPassword, newPassword, }: {
77
+ userId: string;
78
+ currentPassword: string;
79
+ newPassword: string;
80
+ }): Promise<import("axios").AxiosResponse<any, any>>;
59
81
  };
@@ -39,7 +39,7 @@ export function createAuthModule(axios, functionsAxiosClient, appId, options) {
39
39
  // If nextUrl is not provided, use the current URL
40
40
  const redirectUrl = nextUrl || window.location.href;
41
41
  // Build the login URL
42
- const loginUrl = `${options.serverUrl}/login?from_url=${encodeURIComponent(redirectUrl)}`;
42
+ const loginUrl = `${options.serverUrl}/login?from_url=${encodeURIComponent(redirectUrl)}&app_id=${appId}`;
43
43
  // Redirect to the login page
44
44
  window.location.href = loginUrl;
45
45
  },
@@ -141,5 +141,41 @@ export function createAuthModule(axios, functionsAxiosClient, appId, options) {
141
141
  return false;
142
142
  }
143
143
  },
144
+ inviteUser(userEmail, role) {
145
+ return axios.post(`/apps/${appId}/users/invite-user`, {
146
+ user_email: userEmail,
147
+ role,
148
+ });
149
+ },
150
+ register(payload) {
151
+ return axios.post(`/apps/${appId}/auth/register`, payload);
152
+ },
153
+ verifyOtp({ email, otpCode }) {
154
+ return axios.post(`/apps/${appId}/auth/verify-otp`, {
155
+ email,
156
+ otp_code: otpCode,
157
+ });
158
+ },
159
+ resendOtp(email) {
160
+ return axios.post(`/apps/${appId}/auth/resend-otp`, { email });
161
+ },
162
+ resetPasswordRequest(email) {
163
+ return axios.post(`/apps/${appId}/auth/reset-password-request`, {
164
+ email,
165
+ });
166
+ },
167
+ resetPassword({ resetToken, newPassword, }) {
168
+ return axios.post(`/apps/${appId}/auth/reset-password`, {
169
+ reset_token: resetToken,
170
+ new_password: newPassword,
171
+ });
172
+ },
173
+ changePassword({ userId, currentPassword, newPassword, }) {
174
+ return axios.post(`/apps/${appId}/auth/change-password`, {
175
+ user_id: userId,
176
+ current_password: currentPassword,
177
+ new_password: newPassword,
178
+ });
179
+ },
144
180
  };
145
181
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@base44-preview/sdk",
3
- "version": "0.7.2-pr.30.982623a",
3
+ "version": "0.7.3-dev.9d3dc69",
4
4
  "description": "JavaScript SDK for Base44 API",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",