File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ import { createSsoModule } from "./modules/sso.js";
66import { getAccessToken } from "./utils/auth-utils.js" ;
77import { createFunctionsModule } from "./modules/functions.js" ;
88import { createAgentsModule } from "./modules/agents.js" ;
9+ import { createAppLogsModule } from "./modules/app-logs.js" ;
910import { RoomsSocket , RoomsSocketConfig } from "./utils/socket-utils.js" ;
1011
1112export type CreateClientOptions = {
@@ -116,6 +117,7 @@ export function createClient(config: {
116117 serverUrl,
117118 token,
118119 } ) ,
120+ appLogs : createAppLogsModule ( axiosClient , appId ) ,
119121 cleanup : ( ) => {
120122 socket . disconnect ( ) ;
121123 } ,
@@ -133,6 +135,7 @@ export function createClient(config: {
133135 serverUrl,
134136 token,
135137 } ) ,
138+ appLogs : createAppLogsModule ( serviceRoleAxiosClient , appId ) ,
136139 cleanup : ( ) => {
137140 socket . disconnect ( ) ;
138141 } ,
Original file line number Diff line number Diff line change 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+
You can’t perform that action at this time.
0 commit comments