@base44-preview/sdk 0.8.0-pr.40.3483989 → 0.8.1-dev.7a02156

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
@@ -44,9 +44,6 @@ export declare function createClient(config: {
44
44
  sso: {
45
45
  getAccessToken(userid: string): Promise<import("axios").AxiosResponse<any, any>>;
46
46
  };
47
- externalAuth: {
48
- getAccessToken(integrationType: import("./types.js").ExternalAuthIntegrationType): Promise<import("./types.js").ExternalAuthAccessTokenResponse>;
49
- };
50
47
  functions: {
51
48
  invoke(functionName: string, data: Record<string, any>): Promise<import("axios").AxiosResponse<any, any>>;
52
49
  };
@@ -62,6 +59,11 @@ export declare function createClient(config: {
62
59
  subscribeToConversation: (conversationId: string, onUpdate?: (conversation: import("./types.js").AgentConversation) => void) => () => void;
63
60
  getWhatsAppConnectURL: (agentName: string) => string;
64
61
  };
62
+ appLogs: {
63
+ logUserInApp(pageName: string): Promise<void>;
64
+ fetchLogs(params?: Record<string, any>): Promise<any>;
65
+ getStats(params?: Record<string, any>): Promise<any>;
66
+ };
65
67
  cleanup: () => void;
66
68
  };
67
69
  entities: {};
@@ -115,6 +117,11 @@ export declare function createClient(config: {
115
117
  subscribeToConversation: (conversationId: string, onUpdate?: (conversation: import("./types.js").AgentConversation) => void) => () => void;
116
118
  getWhatsAppConnectURL: (agentName: string) => string;
117
119
  };
120
+ appLogs: {
121
+ logUserInApp(pageName: string): Promise<void>;
122
+ fetchLogs(params?: Record<string, any>): Promise<any>;
123
+ getStats(params?: Record<string, any>): Promise<any>;
124
+ };
118
125
  cleanup: () => void;
119
126
  };
120
127
  export declare function createClientFromRequest(request: Request): {
@@ -138,9 +145,6 @@ export declare function createClientFromRequest(request: Request): {
138
145
  sso: {
139
146
  getAccessToken(userid: string): Promise<import("axios").AxiosResponse<any, any>>;
140
147
  };
141
- externalAuth: {
142
- getAccessToken(integrationType: import("./types.js").ExternalAuthIntegrationType): Promise<import("./types.js").ExternalAuthAccessTokenResponse>;
143
- };
144
148
  functions: {
145
149
  invoke(functionName: string, data: Record<string, any>): Promise<import("axios").AxiosResponse<any, any>>;
146
150
  };
@@ -156,6 +160,11 @@ export declare function createClientFromRequest(request: Request): {
156
160
  subscribeToConversation: (conversationId: string, onUpdate?: (conversation: import("./types.js").AgentConversation) => void) => () => void;
157
161
  getWhatsAppConnectURL: (agentName: string) => string;
158
162
  };
163
+ appLogs: {
164
+ logUserInApp(pageName: string): Promise<void>;
165
+ fetchLogs(params?: Record<string, any>): Promise<any>;
166
+ getStats(params?: Record<string, any>): Promise<any>;
167
+ };
159
168
  cleanup: () => void;
160
169
  };
161
170
  entities: {};
@@ -209,5 +218,10 @@ export declare function createClientFromRequest(request: Request): {
209
218
  subscribeToConversation: (conversationId: string, onUpdate?: (conversation: import("./types.js").AgentConversation) => void) => () => void;
210
219
  getWhatsAppConnectURL: (agentName: string) => string;
211
220
  };
221
+ appLogs: {
222
+ logUserInApp(pageName: string): Promise<void>;
223
+ fetchLogs(params?: Record<string, any>): Promise<any>;
224
+ getStats(params?: Record<string, any>): Promise<any>;
225
+ };
212
226
  cleanup: () => void;
213
227
  };
package/dist/client.js CHANGED
@@ -3,10 +3,10 @@ import { createEntitiesModule } from "./modules/entities.js";
3
3
  import { createIntegrationsModule } from "./modules/integrations.js";
4
4
  import { createAuthModule } from "./modules/auth.js";
5
5
  import { createSsoModule } from "./modules/sso.js";
6
- import { createExternalAuthModule } from "./modules/external-auth.js";
7
6
  import { getAccessToken } from "./utils/auth-utils.js";
8
7
  import { createFunctionsModule } from "./modules/functions.js";
9
8
  import { createAgentsModule } from "./modules/agents.js";
9
+ import { createAppLogsModule } from "./modules/app-logs.js";
10
10
  import { RoomsSocket } from "./utils/socket-utils.js";
11
11
  /**
12
12
  * Create a Base44 client instance
@@ -81,6 +81,7 @@ export function createClient(config) {
81
81
  serverUrl,
82
82
  token,
83
83
  }),
84
+ appLogs: createAppLogsModule(axiosClient, appId),
84
85
  cleanup: () => {
85
86
  socket.disconnect();
86
87
  },
@@ -89,7 +90,6 @@ export function createClient(config) {
89
90
  entities: createEntitiesModule(serviceRoleAxiosClient, appId),
90
91
  integrations: createIntegrationsModule(serviceRoleAxiosClient, appId),
91
92
  sso: createSsoModule(serviceRoleAxiosClient, appId, token),
92
- externalAuth: createExternalAuthModule(serviceRoleAxiosClient, appId),
93
93
  functions: createFunctionsModule(serviceRoleFunctionsAxiosClient, appId),
94
94
  agents: createAgentsModule({
95
95
  axios: serviceRoleAxiosClient,
@@ -98,6 +98,7 @@ export function createClient(config) {
98
98
  serverUrl,
99
99
  token,
100
100
  }),
101
+ appLogs: createAppLogsModule(serviceRoleAxiosClient, appId),
101
102
  cleanup: () => {
102
103
  socket.disconnect();
103
104
  },
@@ -34,7 +34,7 @@ export function createAgentsModule({ axios, socket, appId, serverUrl, token, })
34
34
  });
35
35
  };
36
36
  const getWhatsAppConnectURL = (agentName) => {
37
- const baseUrl = `${serverUrl}/whatsapp/${appId}/${encodeURIComponent(agentName)}`;
37
+ const baseUrl = `${serverUrl}/api/apps/${appId}/agents/${encodeURIComponent(agentName)}/whatsapp`;
38
38
  const accessToken = token !== null && token !== void 0 ? token : getAccessToken();
39
39
  if (accessToken) {
40
40
  return `${baseUrl}?token=${accessToken}`;
@@ -0,0 +1,27 @@
1
+ import { AxiosInstance } from "axios";
2
+ /**
3
+ * Creates the app logs module for the Base44 SDK
4
+ * @param {AxiosInstance} axios - Axios instance
5
+ * @param {string} appId - Application ID
6
+ * @returns {Object} App logs module
7
+ */
8
+ export declare function createAppLogsModule(axios: AxiosInstance, appId: string): {
9
+ /**
10
+ * Log user activity in the app
11
+ * @param {string} pageName - Name of the page being visited
12
+ * @returns {Promise<void>}
13
+ */
14
+ logUserInApp(pageName: string): Promise<void>;
15
+ /**
16
+ * Fetch app logs with optional parameters
17
+ * @param {Object} params - Query parameters for filtering logs
18
+ * @returns {Promise<any>} App logs data
19
+ */
20
+ fetchLogs(params?: Record<string, any>): Promise<any>;
21
+ /**
22
+ * Get app statistics
23
+ * @param {Object} params - Query parameters for filtering stats
24
+ * @returns {Promise<any>} App statistics
25
+ */
26
+ getStats(params?: Record<string, any>): Promise<any>;
27
+ };
@@ -0,0 +1,37 @@
1
+ /**
2
+ * Creates the app logs module for the Base44 SDK
3
+ * @param {AxiosInstance} axios - Axios instance
4
+ * @param {string} appId - Application ID
5
+ * @returns {Object} App logs module
6
+ */
7
+ export function createAppLogsModule(axios, appId) {
8
+ const baseURL = `/app-logs/${appId}`;
9
+ return {
10
+ /**
11
+ * Log user activity in the app
12
+ * @param {string} pageName - Name of the page being visited
13
+ * @returns {Promise<void>}
14
+ */
15
+ async logUserInApp(pageName) {
16
+ await axios.post(`${baseURL}/log-user-in-app/${pageName}`);
17
+ },
18
+ /**
19
+ * Fetch app logs with optional parameters
20
+ * @param {Object} params - Query parameters for filtering logs
21
+ * @returns {Promise<any>} App logs data
22
+ */
23
+ async fetchLogs(params = {}) {
24
+ const response = await axios.get(baseURL, { params });
25
+ return response;
26
+ },
27
+ /**
28
+ * Get app statistics
29
+ * @param {Object} params - Query parameters for filtering stats
30
+ * @returns {Promise<any>} App statistics
31
+ */
32
+ async getStats(params = {}) {
33
+ const response = await axios.get(`${baseURL}/stats`, { params });
34
+ return response;
35
+ },
36
+ };
37
+ }
@@ -1,3 +1,2 @@
1
1
  export * from "./app.types.js";
2
2
  export * from "./agents.types.js";
3
- export * from "./external-auth.types.js";
@@ -1,3 +1,2 @@
1
1
  export * from "./app.types.js";
2
2
  export * from "./agents.types.js";
3
- export * from "./external-auth.types.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@base44-preview/sdk",
3
- "version": "0.8.0-pr.40.3483989",
3
+ "version": "0.8.1-dev.7a02156",
4
4
  "description": "JavaScript SDK for Base44 API",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -1,16 +0,0 @@
1
- import { AxiosInstance } from "axios";
2
- import { ExternalAuthIntegrationType, ExternalAuthAccessTokenResponse } from "./external-auth.types.js";
3
- /**
4
- * Creates the External Auth module for the Base44 SDK
5
- * @param axios - Axios instance (should be service role client)
6
- * @param appId - Application ID
7
- * @returns External Auth module
8
- */
9
- export declare function createExternalAuthModule(axios: AxiosInstance, appId: string): {
10
- /**
11
- * Retrieve an access token for a given integration type
12
- * @param integrationType - The integration type to get access token for
13
- * @returns Access token response
14
- */
15
- getAccessToken(integrationType: ExternalAuthIntegrationType): Promise<ExternalAuthAccessTokenResponse>;
16
- };
@@ -1,23 +0,0 @@
1
- /**
2
- * Creates the External Auth module for the Base44 SDK
3
- * @param axios - Axios instance (should be service role client)
4
- * @param appId - Application ID
5
- * @returns External Auth module
6
- */
7
- export function createExternalAuthModule(axios, appId) {
8
- return {
9
- /**
10
- * Retrieve an access token for a given integration type
11
- * @param integrationType - The integration type to get access token for
12
- * @returns Access token response
13
- */
14
- async getAccessToken(integrationType) {
15
- if (!integrationType || typeof integrationType !== "string") {
16
- throw new Error("Integration type is required and must be a string");
17
- }
18
- const response = await axios.get(`/apps/${appId}/external-auth/tokens/${integrationType}`);
19
- // @ts-expect-error
20
- return response.access_token;
21
- },
22
- };
23
- }
@@ -1,4 +0,0 @@
1
- export type ExternalAuthIntegrationType = string;
2
- export type ExternalAuthAccessTokenResponse = {
3
- access_token: string;
4
- };
@@ -1 +0,0 @@
1
- export {};