@base44-preview/sdk 0.8.4-pr.43.a6c7baf → 0.8.4-pr.47.aed2863

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
@@ -125,6 +125,9 @@ export declare function createClient(config: {
125
125
  fetchLogs(params?: Record<string, any>): Promise<any>;
126
126
  getStats(params?: Record<string, any>): Promise<any>;
127
127
  };
128
+ users: {
129
+ inviteUser(user_email: string, role: "user" | "admin"): Promise<any>;
130
+ };
128
131
  cleanup: () => void;
129
132
  };
130
133
  export declare function createClientFromRequest(request: Request): {
@@ -229,5 +232,8 @@ export declare function createClientFromRequest(request: Request): {
229
232
  fetchLogs(params?: Record<string, any>): Promise<any>;
230
233
  getStats(params?: Record<string, any>): Promise<any>;
231
234
  };
235
+ users: {
236
+ inviteUser(user_email: string, role: "user" | "admin"): Promise<any>;
237
+ };
232
238
  cleanup: () => void;
233
239
  };
package/dist/client.js CHANGED
@@ -8,6 +8,7 @@ import { getAccessToken } from "./utils/auth-utils.js";
8
8
  import { createFunctionsModule } from "./modules/functions.js";
9
9
  import { createAgentsModule } from "./modules/agents.js";
10
10
  import { createAppLogsModule } from "./modules/app-logs.js";
11
+ import { createUsersModule } from "./modules/users.js";
11
12
  import { RoomsSocket } from "./utils/socket-utils.js";
12
13
  /**
13
14
  * Create a Base44 client instance
@@ -83,6 +84,7 @@ export function createClient(config) {
83
84
  token,
84
85
  }),
85
86
  appLogs: createAppLogsModule(axiosClient, appId),
87
+ users: createUsersModule(axiosClient, appId),
86
88
  cleanup: () => {
87
89
  socket.disconnect();
88
90
  },
@@ -172,7 +174,6 @@ export function createClientFromRequest(request) {
172
174
  const appId = request.headers.get("Base44-App-Id");
173
175
  const serverUrlHeader = request.headers.get("Base44-Api-Url");
174
176
  const functionsVersion = request.headers.get("Base44-Functions-Version");
175
- const userCountry = request.headers.get("Base44-User-Country");
176
177
  if (!appId) {
177
178
  throw new Error("Base44-App-Id header is required, but is was not found on the request");
178
179
  }
@@ -195,12 +196,7 @@ export function createClientFromRequest(request) {
195
196
  }
196
197
  userToken = authHeader.split(" ")[1];
197
198
  }
198
- const forwardHeaders = {};
199
- if (userCountry) {
200
- forwardHeaders["Base44-User-Country"] = userCountry;
201
- }
202
199
  return createClient({
203
- headers: forwardHeaders,
204
200
  serverUrl: serverUrlHeader || "https://base44.app",
205
201
  appId,
206
202
  token: userToken,
@@ -0,0 +1,16 @@
1
+ import { AxiosInstance } from "axios";
2
+ /**
3
+ * Creates the users module for the Base44 SDK
4
+ * @param {AxiosInstance} axios - Axios instance
5
+ * @param {string} appId - Application ID
6
+ * @returns {Object} Users module
7
+ */
8
+ export declare function createUsersModule(axios: AxiosInstance, appId: string): {
9
+ /**
10
+ * Invite a user to the application
11
+ * @param {string} user_email - User's email address
12
+ * @param {'user'|'admin'} role - User's role (user or admin)
13
+ * @returns {Promise<any>}
14
+ */
15
+ inviteUser(user_email: string, role: "user" | "admin"): Promise<any>;
16
+ };
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Creates the users module for the Base44 SDK
3
+ * @param {AxiosInstance} axios - Axios instance
4
+ * @param {string} appId - Application ID
5
+ * @returns {Object} Users module
6
+ */
7
+ export function createUsersModule(axios, appId) {
8
+ return {
9
+ /**
10
+ * Invite a user to the application
11
+ * @param {string} user_email - User's email address
12
+ * @param {'user'|'admin'} role - User's role (user or admin)
13
+ * @returns {Promise<any>}
14
+ */
15
+ async inviteUser(user_email, role) {
16
+ if (role !== "user" && role !== "admin") {
17
+ throw new Error(`Invalid role: "${role}". Role must be either "user" or "admin".`);
18
+ }
19
+ const response = await axios.post(`/apps/${appId}/users/invite-user`, { user_email, role });
20
+ return response;
21
+ },
22
+ };
23
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@base44-preview/sdk",
3
- "version": "0.8.4-pr.43.a6c7baf",
3
+ "version": "0.8.4-pr.47.aed2863",
4
4
  "description": "JavaScript SDK for Base44 API",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",