@base44-preview/sdk 0.7.2-pr.30.51b5464 → 0.7.3-pr.30.0aa029e

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,32 @@ 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
+ loginViaUsernamePassword({ email, password, }: {
88
+ email: string;
89
+ password: string;
90
+ }): Promise<import("axios").AxiosResponse<any, any>>;
91
+ resetPasswordRequest(email: string): Promise<import("axios").AxiosResponse<any, any>>;
92
+ resetPassword({ resetToken, newPassword, }: {
93
+ resetToken: string;
94
+ newPassword: string;
95
+ }): Promise<import("axios").AxiosResponse<any, any>>;
96
+ changePassword({ userId, currentPassword, newPassword, }: {
97
+ userId: string;
98
+ currentPassword: string;
99
+ newPassword: string;
100
+ }): Promise<import("axios").AxiosResponse<any, any>>;
74
101
  };
75
102
  functions: {
76
103
  invoke(functionName: string, data: Record<string, any>): Promise<import("axios").AxiosResponse<any, any>>;
@@ -138,6 +165,32 @@ export declare function createClientFromRequest(request: Request): {
138
165
  user: any;
139
166
  }>;
140
167
  isAuthenticated(): Promise<boolean>;
168
+ inviteUser(userEmail: string, role: string): Promise<import("axios").AxiosResponse<any, any>>;
169
+ register(payload: {
170
+ email: string;
171
+ password: string;
172
+ turnstile_token?: string | null;
173
+ referral_code?: string | null;
174
+ }): Promise<import("axios").AxiosResponse<any, any>>;
175
+ verifyOtp({ email, otpCode }: {
176
+ email: string;
177
+ otpCode: string;
178
+ }): Promise<import("axios").AxiosResponse<any, any>>;
179
+ resendOtp(email: string): Promise<import("axios").AxiosResponse<any, any>>;
180
+ loginViaUsernamePassword({ email, password, }: {
181
+ email: string;
182
+ password: string;
183
+ }): Promise<import("axios").AxiosResponse<any, any>>;
184
+ resetPasswordRequest(email: string): Promise<import("axios").AxiosResponse<any, any>>;
185
+ resetPassword({ resetToken, newPassword, }: {
186
+ resetToken: string;
187
+ newPassword: string;
188
+ }): Promise<import("axios").AxiosResponse<any, any>>;
189
+ changePassword({ userId, currentPassword, newPassword, }: {
190
+ userId: string;
191
+ currentPassword: string;
192
+ newPassword: string;
193
+ }): Promise<import("axios").AxiosResponse<any, any>>;
141
194
  };
142
195
  functions: {
143
196
  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,30 @@ 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
+ loginViaUsernamePassword({ email, password, }: {
72
+ email: string;
73
+ password: string;
74
+ }): Promise<import("axios").AxiosResponse<any, any>>;
75
+ resetPasswordRequest(email: string): Promise<import("axios").AxiosResponse<any, any>>;
76
+ resetPassword({ resetToken, newPassword, }: {
77
+ resetToken: string;
78
+ newPassword: string;
79
+ }): Promise<import("axios").AxiosResponse<any, any>>;
80
+ changePassword({ userId, currentPassword, newPassword, }: {
81
+ userId: string;
82
+ currentPassword: string;
83
+ newPassword: string;
84
+ }): Promise<import("axios").AxiosResponse<any, any>>;
59
85
  };
@@ -141,5 +141,44 @@ 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
+ loginViaUsernamePassword({ email, password, }) {
163
+ return axios.post(`/apps/${appId}/auth/login`, { email, password });
164
+ },
165
+ resetPasswordRequest(email) {
166
+ return axios.post(`/apps/${appId}/auth/reset-password-request`, {
167
+ email,
168
+ });
169
+ },
170
+ resetPassword({ resetToken, newPassword, }) {
171
+ return axios.post(`/apps/${appId}/auth/reset-password`, {
172
+ reset_token: resetToken,
173
+ new_password: newPassword,
174
+ });
175
+ },
176
+ changePassword({ userId, currentPassword, newPassword, }) {
177
+ return axios.post(`/apps/${appId}/auth/change-password`, {
178
+ user_id: userId,
179
+ current_password: currentPassword,
180
+ new_password: newPassword,
181
+ });
182
+ },
144
183
  };
145
184
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@base44-preview/sdk",
3
- "version": "0.7.2-pr.30.51b5464",
3
+ "version": "0.7.3-pr.30.0aa029e",
4
4
  "description": "JavaScript SDK for Base44 API",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",