@base44-preview/sdk 0.8.16-pr.71.6dfec93 → 0.8.17-pr.49.b78ce52
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/README.md +2 -2
- package/dist/modules/agents.js +4 -34
- package/dist/modules/analytics.js +2 -2
- package/dist/modules/auth.js +10 -0
- package/dist/modules/auth.types.d.ts +21 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -12,7 +12,7 @@ The SDK provides access to Base44's functionality through the following modules:
|
|
|
12
12
|
- **[`connectors`](https://docs.base44.com/sdk-docs/interfaces/connectors)**: Manage OAuth connections and access tokens for third-party services.
|
|
13
13
|
- **[`entities`](https://docs.base44.com/sdk-docs/interfaces/entities)**: Work with your app's data entities using CRUD operations.
|
|
14
14
|
- **[`functions`](https://docs.base44.com/sdk-docs/interfaces/functions)**: Execute backend functions.
|
|
15
|
-
- **[`integrations`](https://docs.base44.com/sdk-docs/type-aliases/integrations)**:
|
|
15
|
+
- **[`integrations`](https://docs.base44.com/sdk-docs/type-aliases/integrations)**: Pre-built server-side functions for external services.
|
|
16
16
|
|
|
17
17
|
## Example
|
|
18
18
|
|
|
@@ -78,4 +78,4 @@ Generate API documentation locally:
|
|
|
78
78
|
npm run create-docs
|
|
79
79
|
cd docs
|
|
80
80
|
mintlify dev
|
|
81
|
-
```
|
|
81
|
+
```
|
package/dist/modules/agents.js
CHANGED
|
@@ -22,46 +22,16 @@ export function createAgentsModule({ axios, getSocket, appId, serverUrl, token,
|
|
|
22
22
|
...conversation,
|
|
23
23
|
messages: [...(conversation.messages || []), message],
|
|
24
24
|
});
|
|
25
|
-
return axios.post(`${baseURL}/conversations/${conversation.id}/messages`,
|
|
25
|
+
return axios.post(`${baseURL}/conversations/${conversation.id}/messages`, message);
|
|
26
26
|
};
|
|
27
27
|
const subscribeToConversation = (conversationId, onUpdate) => {
|
|
28
28
|
const room = `/agent-conversations/${conversationId}`;
|
|
29
29
|
const socket = getSocket();
|
|
30
|
-
// Store the promise for initial conversation state
|
|
31
|
-
let currentConversation;
|
|
32
|
-
const conversationPromise = getConversation(conversationId).then((conv) => {
|
|
33
|
-
currentConversation = conv;
|
|
34
|
-
return conv;
|
|
35
|
-
});
|
|
36
30
|
return socket.subscribeToRoom(room, {
|
|
37
31
|
connect: () => { },
|
|
38
|
-
update_model:
|
|
39
|
-
const
|
|
40
|
-
|
|
41
|
-
if (data._agent_message) {
|
|
42
|
-
// Wait for initial conversation to be loaded
|
|
43
|
-
await conversationPromise;
|
|
44
|
-
const message = data._agent_message;
|
|
45
|
-
// Update local conversation state
|
|
46
|
-
if (currentConversation) {
|
|
47
|
-
const messages = currentConversation.messages || [];
|
|
48
|
-
const existingIndex = messages.findIndex((m) => m.id === message.id);
|
|
49
|
-
const updatedMessages = existingIndex !== -1
|
|
50
|
-
? messages.map((m, i) => (i === existingIndex ? message : m))
|
|
51
|
-
: [...messages, message];
|
|
52
|
-
currentConversation = {
|
|
53
|
-
...currentConversation,
|
|
54
|
-
messages: updatedMessages,
|
|
55
|
-
};
|
|
56
|
-
onUpdate === null || onUpdate === void 0 ? void 0 : onUpdate(currentConversation);
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
else {
|
|
60
|
-
// Old format: full conversation object
|
|
61
|
-
const conv = data;
|
|
62
|
-
currentConversation = conv;
|
|
63
|
-
onUpdate === null || onUpdate === void 0 ? void 0 : onUpdate(conv);
|
|
64
|
-
}
|
|
32
|
+
update_model: ({ data: jsonStr }) => {
|
|
33
|
+
const conv = JSON.parse(jsonStr);
|
|
34
|
+
onUpdate === null || onUpdate === void 0 ? void 0 : onUpdate(conv);
|
|
65
35
|
},
|
|
66
36
|
});
|
|
67
37
|
};
|
|
@@ -6,8 +6,8 @@ export const ANALYTICS_SESSION_DURATION_EVENT_NAME = "__session_duration_event__
|
|
|
6
6
|
export const ANALYTICS_CONFIG_ENABLE_URL_PARAM_KEY = "analytics-enable";
|
|
7
7
|
export const ANALYTICS_SESSION_ID_LOCAL_STORAGE_KEY = "base44_analytics_session_id";
|
|
8
8
|
const defaultConfiguration = {
|
|
9
|
-
// default to
|
|
10
|
-
enabled:
|
|
9
|
+
// default to enabled //
|
|
10
|
+
enabled: true,
|
|
11
11
|
maxQueueSize: 1000,
|
|
12
12
|
throttleTime: 1000,
|
|
13
13
|
batchSize: 30,
|
package/dist/modules/auth.js
CHANGED
|
@@ -34,6 +34,16 @@ export function createAuthModule(axios, functionsAxiosClient, appId, options) {
|
|
|
34
34
|
// Redirect to the login page
|
|
35
35
|
window.location.href = loginUrl;
|
|
36
36
|
},
|
|
37
|
+
// Redirects the user to a provider's login page
|
|
38
|
+
loginWithProvider(provider, fromUrl = "/") {
|
|
39
|
+
// Build the full redirect URL
|
|
40
|
+
const redirectUrl = new URL(fromUrl, window.location.origin).toString();
|
|
41
|
+
// Build the provider login URL (google is the default, so no provider path needed)
|
|
42
|
+
const providerPath = provider === "google" ? "" : `/${provider}`;
|
|
43
|
+
const loginUrl = `${options.serverUrl}/api/apps/auth${providerPath}/login?app_id=${appId}&from_url=${encodeURIComponent(redirectUrl)}`;
|
|
44
|
+
// Redirect to the provider login page
|
|
45
|
+
window.location.href = loginUrl;
|
|
46
|
+
},
|
|
37
47
|
// Logout the current user
|
|
38
48
|
// Removes the token from localStorage and optionally redirects to a URL or reloads the page
|
|
39
49
|
logout(redirectUrl) {
|
|
@@ -171,6 +171,27 @@ export interface AuthModule {
|
|
|
171
171
|
* ```
|
|
172
172
|
*/
|
|
173
173
|
redirectToLogin(nextUrl: string): void;
|
|
174
|
+
/**
|
|
175
|
+
* Redirects the user to a third-party authentication provider's login page.
|
|
176
|
+
*
|
|
177
|
+
* Initiates OAuth/SSO login flow with providers like Google, Microsoft, etc. Requires a browser environment and can't be used in the backend.
|
|
178
|
+
*
|
|
179
|
+
* @param provider - Name of the supported authentication provider (e.g., 'google', 'microsoft').
|
|
180
|
+
* @param fromUrl - URL to redirect to after successful authentication. Defaults to '/'.
|
|
181
|
+
*
|
|
182
|
+
* @example
|
|
183
|
+
* ```typescript
|
|
184
|
+
* // Login with Google and return to current page
|
|
185
|
+
* base44.auth.loginWithProvider('google', window.location.pathname);
|
|
186
|
+
* ```
|
|
187
|
+
*
|
|
188
|
+
* @example
|
|
189
|
+
* ```typescript
|
|
190
|
+
* // Login with GitHub and redirect to dashboard
|
|
191
|
+
* base44.auth.loginWithProvider('microsoft', '/dashboard');
|
|
192
|
+
* ```
|
|
193
|
+
*/
|
|
194
|
+
loginWithProvider(provider: string, fromUrl?: string): void;
|
|
174
195
|
/**
|
|
175
196
|
* Logs out the current user.
|
|
176
197
|
*
|