Skip to content

Commit 29b43da

Browse files
committed
Merge branch 'main' into external-auth/init
2 parents b53c4f3 + 01fb2e8 commit 29b43da

File tree

5 files changed

+50
-4
lines changed

5 files changed

+50
-4
lines changed

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@base44/sdk",
3-
"version": "0.8.0",
3+
"version": "0.8.3",
44
"description": "JavaScript SDK for Base44 API",
55
"main": "dist/index.js",
66
"types": "dist/index.d.ts",

src/client.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import { createAppConnectionsModule } from "./modules/app-connections.js";
77
import { getAccessToken } from "./utils/auth-utils.js";
88
import { createFunctionsModule } from "./modules/functions.js";
99
import { createAgentsModule } from "./modules/agents.js";
10+
import { createAppLogsModule } from "./modules/app-logs.js";
1011
import { RoomsSocket, RoomsSocketConfig } from "./utils/socket-utils.js";
1112

1213
export type CreateClientOptions = {
@@ -117,6 +118,7 @@ export function createClient(config: {
117118
serverUrl,
118119
token,
119120
}),
121+
appLogs: createAppLogsModule(axiosClient, appId),
120122
cleanup: () => {
121123
socket.disconnect();
122124
},
@@ -135,6 +137,7 @@ export function createClient(config: {
135137
serverUrl,
136138
token,
137139
}),
140+
appLogs: createAppLogsModule(serviceRoleAxiosClient, appId),
138141
cleanup: () => {
139142
socket.disconnect();
140143
},

src/modules/agents.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ export function createAgentsModule({
8080
};
8181

8282
const getWhatsAppConnectURL = (agentName: string) => {
83-
const baseUrl = `${serverUrl}/whatsapp/${appId}/${encodeURIComponent(agentName)}`;
83+
const baseUrl = `${serverUrl}/api/apps/${appId}/agents/${encodeURIComponent(agentName)}/whatsapp`;
8484
const accessToken = token ?? getAccessToken();
8585

8686
if (accessToken) {

src/modules/app-logs.ts

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
import { AxiosInstance } from "axios";
2+
3+
/**
4+
* Creates the app logs module for the Base44 SDK
5+
* @param {AxiosInstance} axios - Axios instance
6+
* @param {string} appId - Application ID
7+
* @returns {Object} App logs module
8+
*/
9+
export function createAppLogsModule(axios: AxiosInstance, appId: string) {
10+
const baseURL = `/app-logs/${appId}`;
11+
12+
return {
13+
/**
14+
* Log user activity in the app
15+
* @param {string} pageName - Name of the page being visited
16+
* @returns {Promise<void>}
17+
*/
18+
async logUserInApp(pageName: string): Promise<void> {
19+
await axios.post(`${baseURL}/log-user-in-app/${pageName}`);
20+
},
21+
22+
/**
23+
* Fetch app logs with optional parameters
24+
* @param {Object} params - Query parameters for filtering logs
25+
* @returns {Promise<any>} App logs data
26+
*/
27+
async fetchLogs(params: Record<string, any> = {}): Promise<any> {
28+
const response = await axios.get(baseURL, { params });
29+
return response;
30+
},
31+
32+
/**
33+
* Get app statistics
34+
* @param {Object} params - Query parameters for filtering stats
35+
* @returns {Promise<any>} App statistics
36+
*/
37+
async getStats(params: Record<string, any> = {}): Promise<any> {
38+
const response = await axios.get(`${baseURL}/stats`, { params });
39+
return response;
40+
},
41+
};
42+
}
43+

0 commit comments

Comments
 (0)