@base44-preview/sdk 0.8.19-pr.129.4c7e3bb → 0.8.19-pr.130.1534b73
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.js +4 -1
- package/dist/client.types.d.ts +8 -1
- package/dist/index.d.ts +2 -2
- package/dist/modules/agents.types.d.ts +6 -0
- package/dist/modules/analytics.types.d.ts +4 -0
- package/dist/modules/app-logs.types.d.ts +2 -0
- package/dist/modules/auth.js +12 -3
- package/dist/modules/auth.types.d.ts +12 -1
- package/dist/modules/connectors.d.ts +10 -1
- package/dist/modules/connectors.js +35 -0
- package/dist/modules/connectors.types.d.ts +80 -2
- package/dist/modules/entities.types.d.ts +8 -0
- package/dist/modules/functions.types.d.ts +2 -0
- package/dist/modules/integrations.types.d.ts +58 -13
- package/package.json +1 -1
package/dist/client.js
CHANGED
|
@@ -3,7 +3,7 @@ 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 { createConnectorsModule } from "./modules/connectors.js";
|
|
6
|
+
import { createConnectorsModule, createUserConnectorsModule, } from "./modules/connectors.js";
|
|
7
7
|
import { getAccessToken } from "./utils/auth-utils.js";
|
|
8
8
|
import { createFunctionsModule } from "./modules/functions.js";
|
|
9
9
|
import { createAgentsModule } from "./modules/agents.js";
|
|
@@ -108,12 +108,14 @@ export function createClient(config) {
|
|
|
108
108
|
serverUrl,
|
|
109
109
|
});
|
|
110
110
|
const userModules = {
|
|
111
|
+
axiosClient,
|
|
111
112
|
entities: createEntitiesModule({
|
|
112
113
|
axios: axiosClient,
|
|
113
114
|
appId,
|
|
114
115
|
getSocket,
|
|
115
116
|
}),
|
|
116
117
|
integrations: createIntegrationsModule(axiosClient, appId),
|
|
118
|
+
connectors: createUserConnectorsModule(axiosClient, appId),
|
|
117
119
|
auth: userAuthModule,
|
|
118
120
|
functions: createFunctionsModule(functionsAxiosClient, appId),
|
|
119
121
|
agents: createAgentsModule({
|
|
@@ -139,6 +141,7 @@ export function createClient(config) {
|
|
|
139
141
|
},
|
|
140
142
|
};
|
|
141
143
|
const serviceRoleModules = {
|
|
144
|
+
axiosClient: serviceRoleAxiosClient,
|
|
142
145
|
entities: createEntitiesModule({
|
|
143
146
|
axios: serviceRoleAxiosClient,
|
|
144
147
|
appId,
|
package/dist/client.types.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
import type { AxiosInstance } from "axios";
|
|
1
2
|
import type { EntitiesModule } from "./modules/entities.types.js";
|
|
2
3
|
import type { IntegrationsModule } from "./modules/integrations.types.js";
|
|
3
4
|
import type { AuthModule } from "./modules/auth.types.js";
|
|
4
5
|
import type { SsoModule } from "./modules/sso.types.js";
|
|
5
|
-
import type { ConnectorsModule } from "./modules/connectors.types.js";
|
|
6
|
+
import type { ConnectorsModule, UserConnectorsModule } from "./modules/connectors.types.js";
|
|
6
7
|
import type { FunctionsModule } from "./modules/functions.types.js";
|
|
7
8
|
import type { AgentsModule } from "./modules/agents.types.js";
|
|
8
9
|
import type { AppLogsModule } from "./modules/app-logs.types.js";
|
|
@@ -82,6 +83,10 @@ export interface Base44Client {
|
|
|
82
83
|
appLogs: AppLogsModule;
|
|
83
84
|
/** {@link AuthModule | Auth module} for user authentication and management. */
|
|
84
85
|
auth: AuthModule;
|
|
86
|
+
/** The underlying Axios instance used for API requests. Useful for making custom API calls with the same authentication and configuration as the SDK. */
|
|
87
|
+
axiosClient: AxiosInstance;
|
|
88
|
+
/** {@link UserConnectorsModule | Connectors module} for end-user OAuth flows. */
|
|
89
|
+
connectors: UserConnectorsModule;
|
|
85
90
|
/** {@link EntitiesModule | Entities module} for CRUD operations on your data models. */
|
|
86
91
|
entities: EntitiesModule;
|
|
87
92
|
/** {@link FunctionsModule | Functions module} for invoking custom backend functions. */
|
|
@@ -117,6 +122,8 @@ export interface Base44Client {
|
|
|
117
122
|
readonly asServiceRole: {
|
|
118
123
|
/** {@link AgentsModule | Agents module} with elevated permissions. */
|
|
119
124
|
agents: AgentsModule;
|
|
125
|
+
/** The underlying Axios instance used for service role API requests. Useful for making custom API calls with service role authentication. */
|
|
126
|
+
axiosClient: AxiosInstance;
|
|
120
127
|
/** {@link AppLogsModule | App logs module} with elevated permissions. */
|
|
121
128
|
appLogs: AppLogsModule;
|
|
122
129
|
/** {@link ConnectorsModule | Connectors module} for OAuth token retrieval. */
|
package/dist/index.d.ts
CHANGED
|
@@ -6,11 +6,11 @@ export type { Base44Client, CreateClientConfig, CreateClientOptions, Base44Error
|
|
|
6
6
|
export * from "./types.js";
|
|
7
7
|
export type { DeleteManyResult, DeleteResult, EntitiesModule, EntityHandler, EntityRecord, EntityTypeRegistry, ImportResult, RealtimeEventType, RealtimeEvent, RealtimeCallback, SortField, } from "./modules/entities.types.js";
|
|
8
8
|
export type { AuthModule, LoginResponse, RegisterParams, VerifyOtpParams, ChangePasswordParams, ResetPasswordParams, User, } from "./modules/auth.types.js";
|
|
9
|
-
export type { IntegrationsModule,
|
|
9
|
+
export type { IntegrationsModule, IntegrationEndpointFunction, CoreIntegrations, InvokeLLMParams, GenerateImageParams, GenerateImageResult, UploadFileParams, UploadFileResult, SendEmailParams, SendEmailResult, ExtractDataFromUploadedFileParams, ExtractDataFromUploadedFileResult, UploadPrivateFileParams, UploadPrivateFileResult, CreateFileSignedUrlParams, CreateFileSignedUrlResult, } from "./modules/integrations.types.js";
|
|
10
10
|
export type { FunctionsModule, FunctionName, FunctionNameRegistry, } from "./modules/functions.types.js";
|
|
11
11
|
export type { AgentsModule, AgentName, AgentNameRegistry, AgentConversation, AgentMessage, AgentMessageReasoning, AgentMessageToolCall, AgentMessageUsage, AgentMessageCustomContext, AgentMessageMetadata, CreateConversationParams, } from "./modules/agents.types.js";
|
|
12
12
|
export type { AppLogsModule } from "./modules/app-logs.types.js";
|
|
13
13
|
export type { SsoModule, SsoAccessTokenResponse } from "./modules/sso.types.js";
|
|
14
|
-
export type { ConnectorsModule } from "./modules/connectors.types.js";
|
|
14
|
+
export type { ConnectorsModule, UserConnectorsModule, } from "./modules/connectors.types.js";
|
|
15
15
|
export type { CustomIntegrationsModule, CustomIntegrationCallParams, CustomIntegrationCallResponse, } from "./modules/custom-integrations.types.js";
|
|
16
16
|
export type { GetAccessTokenOptions, SaveAccessTokenOptions, RemoveAccessTokenOptions, GetLoginUrlOptions, } from "./utils/auth-utils.types.js";
|
|
@@ -170,6 +170,8 @@ export interface AgentsModuleConfig {
|
|
|
170
170
|
* send messages, and subscribe to realtime updates. Conversations can be used
|
|
171
171
|
* for chat interfaces, support systems, or any interactive AI app.
|
|
172
172
|
*
|
|
173
|
+
* ## Key Features
|
|
174
|
+
*
|
|
173
175
|
* The agents module enables you to:
|
|
174
176
|
*
|
|
175
177
|
* - **Create conversations** with agents defined in the app.
|
|
@@ -179,12 +181,16 @@ export interface AgentsModuleConfig {
|
|
|
179
181
|
* - **Attach metadata** to conversations for tracking context, categories, priorities, or linking to external systems.
|
|
180
182
|
* - **Generate WhatsApp connection URLs** for users to interact with agents through WhatsApp.
|
|
181
183
|
*
|
|
184
|
+
* ## Conversation Structure
|
|
185
|
+
*
|
|
182
186
|
* The agents module operates with a two-level hierarchy:
|
|
183
187
|
*
|
|
184
188
|
* 1. **Conversations**: Top-level containers that represent a dialogue with a specific agent. Each conversation has a unique ID, is associated with an agent by name, and belongs to the user who created it. Conversations can include optional metadata for tracking app-specific context like ticket IDs, categories, or custom fields.
|
|
185
189
|
*
|
|
186
190
|
* 2. **Messages**: Individual exchanges within a conversation. Each message has a role, content, and optional metadata like token usage, tool calls, file attachments, and reasoning information. Messages are stored as an array within their parent conversation.
|
|
187
191
|
*
|
|
192
|
+
* ## Authentication Modes
|
|
193
|
+
*
|
|
188
194
|
* This module is available to use with a client in all authentication modes:
|
|
189
195
|
*
|
|
190
196
|
* - **Anonymous or User authentication** (`base44.agents`): Access is scoped to the current user's permissions. Users must be authenticated to create and access conversations.
|
|
@@ -74,11 +74,15 @@ export type AnalyticsModuleOptions = {
|
|
|
74
74
|
*
|
|
75
75
|
* <Note> Analytics events tracked with this module appear as custom event cards in the [Analytics dashboard](/documentation/performance-and-seo/app-analytics).</Note>
|
|
76
76
|
*
|
|
77
|
+
* ## Best Practices
|
|
78
|
+
*
|
|
77
79
|
* When tracking events:
|
|
78
80
|
*
|
|
79
81
|
* - Choose clear, descriptive event names in snake_case like `signup_button_click` or `purchase_completed` rather than generic names like `click`.
|
|
80
82
|
* - Include relevant context in your properties such as identifiers like `product_id`, measurements like `price`, and flags like `is_first_purchase`.
|
|
81
83
|
*
|
|
84
|
+
* ## Authentication Modes
|
|
85
|
+
*
|
|
82
86
|
* This module is only available in user authentication mode (`base44.analytics`).
|
|
83
87
|
*/
|
|
84
88
|
export interface AnalyticsModule {
|
|
@@ -3,6 +3,8 @@
|
|
|
3
3
|
*
|
|
4
4
|
* This module provides a method to log user activity. The logs are reflected in the Analytics page in the app dashboard.
|
|
5
5
|
*
|
|
6
|
+
* ## Authentication Modes
|
|
7
|
+
*
|
|
6
8
|
* This module is available to use with a client in all authentication modes.
|
|
7
9
|
*/
|
|
8
10
|
export interface AppLogsModule {
|
package/dist/modules/auth.js
CHANGED
|
@@ -37,9 +37,18 @@ export function createAuthModule(axios, functionsAxiosClient, appId, options) {
|
|
|
37
37
|
loginWithProvider(provider, fromUrl = "/") {
|
|
38
38
|
// Build the full redirect URL
|
|
39
39
|
const redirectUrl = new URL(fromUrl, window.location.origin).toString();
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
40
|
+
const queryParams = `app_id=${appId}&from_url=${encodeURIComponent(redirectUrl)}`;
|
|
41
|
+
// SSO uses a different URL structure with appId in the path
|
|
42
|
+
let authPath;
|
|
43
|
+
if (provider === "sso") {
|
|
44
|
+
authPath = `/apps/${appId}/auth/sso/login`;
|
|
45
|
+
}
|
|
46
|
+
else {
|
|
47
|
+
// Google is the default provider, so no provider path segment needed
|
|
48
|
+
const providerPath = provider === "google" ? "" : `/${provider}`;
|
|
49
|
+
authPath = `/apps/auth${providerPath}/login`;
|
|
50
|
+
}
|
|
51
|
+
const loginUrl = `${options.appBaseUrl}/api${authPath}?${queryParams}`;
|
|
43
52
|
// Redirect to the provider login page
|
|
44
53
|
window.location.href = loginUrl;
|
|
45
54
|
},
|
|
@@ -96,6 +96,8 @@ export interface AuthModuleOptions {
|
|
|
96
96
|
/**
|
|
97
97
|
* Authentication module for managing user authentication and authorization. The module automatically stores tokens in local storage when available and manages authorization headers for API requests.
|
|
98
98
|
*
|
|
99
|
+
* ## Features
|
|
100
|
+
*
|
|
99
101
|
* This module provides comprehensive authentication functionality including:
|
|
100
102
|
* - Email/password login and registration
|
|
101
103
|
* - Token management
|
|
@@ -104,6 +106,8 @@ export interface AuthModuleOptions {
|
|
|
104
106
|
* - OTP verification
|
|
105
107
|
* - User invitations
|
|
106
108
|
*
|
|
109
|
+
* ## Authentication Modes
|
|
110
|
+
*
|
|
107
111
|
* The auth module is only available in user authentication mode (`base44.auth`).
|
|
108
112
|
*/
|
|
109
113
|
export interface AuthModule {
|
|
@@ -181,8 +185,9 @@ export interface AuthModule {
|
|
|
181
185
|
* - `'microsoft'` - {@link https://learn.microsoft.com/en-us/entra/identity-platform/v2-oauth2-auth-code-flow | Microsoft OAuth}. Enable Microsoft in your app's authentication settings before specifying this provider.
|
|
182
186
|
* - `'facebook'` - {@link https://developers.facebook.com/docs/facebook-login | Facebook Login}. Enable Facebook in your app's authentication settings before using.
|
|
183
187
|
* - `'apple'` - {@link https://developer.apple.com/sign-in-with-apple/ | Sign in with Apple}. Enable Apple in your app's authentication settings before using this provider.
|
|
188
|
+
* - `'sso'` - Enterprise SSO. Enable SSO in your app's authentication settings before using this provider.
|
|
184
189
|
*
|
|
185
|
-
* @param provider - The authentication provider to use: `'google'`, `'microsoft'`, `'facebook'`, or `'
|
|
190
|
+
* @param provider - The authentication provider to use: `'google'`, `'microsoft'`, `'facebook'`, `'apple'`, or `'sso'`.
|
|
186
191
|
* @param fromUrl - URL to redirect to after successful authentication. Defaults to `'/'`.
|
|
187
192
|
*
|
|
188
193
|
* @example
|
|
@@ -202,6 +207,12 @@ export interface AuthModule {
|
|
|
202
207
|
* // Apple
|
|
203
208
|
* base44.auth.loginWithProvider('apple', '/dashboard');
|
|
204
209
|
* ```
|
|
210
|
+
*
|
|
211
|
+
* @example
|
|
212
|
+
* ```typescript
|
|
213
|
+
* // SSO
|
|
214
|
+
* base44.auth.loginWithProvider('sso', '/dashboard');
|
|
215
|
+
* ```
|
|
205
216
|
*/
|
|
206
217
|
loginWithProvider(provider: string, fromUrl?: string): void;
|
|
207
218
|
/**
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AxiosInstance } from "axios";
|
|
2
|
-
import { ConnectorsModule } from "./connectors.types.js";
|
|
2
|
+
import { ConnectorsModule, UserConnectorsModule } from "./connectors.types.js";
|
|
3
3
|
/**
|
|
4
4
|
* Creates the Connectors module for the Base44 SDK.
|
|
5
5
|
*
|
|
@@ -9,3 +9,12 @@ import { ConnectorsModule } from "./connectors.types.js";
|
|
|
9
9
|
* @internal
|
|
10
10
|
*/
|
|
11
11
|
export declare function createConnectorsModule(axios: AxiosInstance, appId: string): ConnectorsModule;
|
|
12
|
+
/**
|
|
13
|
+
* Creates the user-scoped Connectors module (end-user OAuth flows).
|
|
14
|
+
*
|
|
15
|
+
* @param axios - Axios instance (user-scoped client)
|
|
16
|
+
* @param appId - Application ID
|
|
17
|
+
* @returns User connectors module with end-user OAuth methods
|
|
18
|
+
* @internal
|
|
19
|
+
*/
|
|
20
|
+
export declare function createUserConnectorsModule(axios: AxiosInstance, appId: string): UserConnectorsModule;
|
|
@@ -20,3 +20,38 @@ export function createConnectorsModule(axios, appId) {
|
|
|
20
20
|
},
|
|
21
21
|
};
|
|
22
22
|
}
|
|
23
|
+
/**
|
|
24
|
+
* Creates the user-scoped Connectors module (end-user OAuth flows).
|
|
25
|
+
*
|
|
26
|
+
* @param axios - Axios instance (user-scoped client)
|
|
27
|
+
* @param appId - Application ID
|
|
28
|
+
* @returns User connectors module with end-user OAuth methods
|
|
29
|
+
* @internal
|
|
30
|
+
*/
|
|
31
|
+
export function createUserConnectorsModule(axios, appId) {
|
|
32
|
+
return {
|
|
33
|
+
// @ts-expect-error Return type mismatch - implementation returns object, interface expects string
|
|
34
|
+
async getEndUserAccessToken(integrationType) {
|
|
35
|
+
if (!integrationType || typeof integrationType !== "string") {
|
|
36
|
+
throw new Error("Integration type is required and must be a string");
|
|
37
|
+
}
|
|
38
|
+
const response = await axios.get(`/apps/${appId}/end-user-auth/tokens/${integrationType}`);
|
|
39
|
+
// @ts-expect-error
|
|
40
|
+
return response.access_token;
|
|
41
|
+
},
|
|
42
|
+
async connectEndUser(integrationType) {
|
|
43
|
+
if (!integrationType || typeof integrationType !== "string") {
|
|
44
|
+
throw new Error("Integration type is required and must be a string");
|
|
45
|
+
}
|
|
46
|
+
const response = await axios.post(`/apps/${appId}/end-user-auth/initiate`, { integration_type: integrationType });
|
|
47
|
+
// @ts-expect-error
|
|
48
|
+
return response.redirect_url;
|
|
49
|
+
},
|
|
50
|
+
async disconnectEndUser(integrationType) {
|
|
51
|
+
if (!integrationType || typeof integrationType !== "string") {
|
|
52
|
+
throw new Error("Integration type is required and must be a string");
|
|
53
|
+
}
|
|
54
|
+
await axios.delete(`/apps/${appId}/end-user-auth/${integrationType}`);
|
|
55
|
+
},
|
|
56
|
+
};
|
|
57
|
+
}
|
|
@@ -21,7 +21,13 @@ export interface ConnectorAccessTokenResponse {
|
|
|
21
21
|
access_token: string;
|
|
22
22
|
}
|
|
23
23
|
/**
|
|
24
|
-
*
|
|
24
|
+
* Response from the connectors initiate endpoint.
|
|
25
|
+
*/
|
|
26
|
+
export interface ConnectorInitiateResponse {
|
|
27
|
+
redirect_url: string;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Connectors module for managing app-scoped OAuth tokens for external services.
|
|
25
31
|
*
|
|
26
32
|
* This module allows you to retrieve OAuth access tokens for external services that the app has connected to. Connectors are app-scoped. When an app builder connects an integration like Google Calendar or Slack, all users of the app share that same connection.
|
|
27
33
|
*
|
|
@@ -30,7 +36,7 @@ export interface ConnectorAccessTokenResponse {
|
|
|
30
36
|
* the API calls you make. This is useful when you need custom API interactions that aren't
|
|
31
37
|
* covered by Base44's pre-built integrations.
|
|
32
38
|
*
|
|
33
|
-
* This module is only available
|
|
39
|
+
* This module is only available via `base44.asServiceRole.connectors`.
|
|
34
40
|
*
|
|
35
41
|
* ## Dynamic Types
|
|
36
42
|
*
|
|
@@ -82,3 +88,75 @@ export interface ConnectorsModule {
|
|
|
82
88
|
*/
|
|
83
89
|
getAccessToken(integrationType: ConnectorIntegrationType): Promise<string>;
|
|
84
90
|
}
|
|
91
|
+
/**
|
|
92
|
+
* User-scoped connectors module for managing end-user OAuth connections.
|
|
93
|
+
*
|
|
94
|
+
* This module provides methods for end-user OAuth flows: initiating an OAuth connection,
|
|
95
|
+
* retrieving the end user's access token, and disconnecting the end user's connection.
|
|
96
|
+
*
|
|
97
|
+
* Unlike {@link ConnectorsModule | ConnectorsModule} which manages app-scoped tokens,
|
|
98
|
+
* this module manages tokens scoped to individual end users.
|
|
99
|
+
*
|
|
100
|
+
* Available via `base44.connectors`.
|
|
101
|
+
*
|
|
102
|
+
* ## Dynamic Types
|
|
103
|
+
*
|
|
104
|
+
* If you're working in a TypeScript project, you can generate types from your app's connector configurations to get autocomplete on integration type names. See the [Dynamic Types](/developers/references/sdk/getting-started/dynamic-types) guide to get started.
|
|
105
|
+
*/
|
|
106
|
+
export interface UserConnectorsModule {
|
|
107
|
+
/**
|
|
108
|
+
* Retrieves an OAuth access token for an end user's connection to a specific external integration.
|
|
109
|
+
*
|
|
110
|
+
* Returns the OAuth token string that belongs to the currently authenticated end user
|
|
111
|
+
* for the specified external service.
|
|
112
|
+
*
|
|
113
|
+
* @param integrationType - The type of integration, such as `'googlecalendar'`, `'slack'`, or `'github'`.
|
|
114
|
+
* @returns Promise resolving to the access token string.
|
|
115
|
+
*
|
|
116
|
+
* @example
|
|
117
|
+
* ```typescript
|
|
118
|
+
* // Get the end user's Google Calendar token
|
|
119
|
+
* const token = await base44.connectors.getEndUserAccessToken('googlecalendar');
|
|
120
|
+
*
|
|
121
|
+
* const response = await fetch('https://www.googleapis.com/calendar/v3/calendars/primary/events', {
|
|
122
|
+
* headers: { 'Authorization': `Bearer ${token}` }
|
|
123
|
+
* });
|
|
124
|
+
* ```
|
|
125
|
+
*/
|
|
126
|
+
getEndUserAccessToken(integrationType: ConnectorIntegrationType): Promise<string>;
|
|
127
|
+
/**
|
|
128
|
+
* Initiates the end-user OAuth flow for a specific external integration type.
|
|
129
|
+
*
|
|
130
|
+
* Returns a redirect URL that the end user should be navigated to in order to
|
|
131
|
+
* authenticate with the external service.
|
|
132
|
+
*
|
|
133
|
+
* @param integrationType - The type of integration, such as `'googlecalendar'`, `'slack'`, or `'github'`.
|
|
134
|
+
* @returns Promise resolving to the redirect URL string.
|
|
135
|
+
*
|
|
136
|
+
* @example
|
|
137
|
+
* ```typescript
|
|
138
|
+
* // Start Google Calendar OAuth for the end user
|
|
139
|
+
* const redirectUrl = await base44.connectors.connectEndUser('googlecalendar');
|
|
140
|
+
*
|
|
141
|
+
* // Redirect the user to the OAuth provider
|
|
142
|
+
* window.location.href = redirectUrl;
|
|
143
|
+
* ```
|
|
144
|
+
*/
|
|
145
|
+
connectEndUser(integrationType: ConnectorIntegrationType): Promise<string>;
|
|
146
|
+
/**
|
|
147
|
+
* Disconnects an end user's OAuth connection for a specific external integration type.
|
|
148
|
+
*
|
|
149
|
+
* Removes the stored OAuth credentials for the currently authenticated end user's
|
|
150
|
+
* connection to the specified external service.
|
|
151
|
+
*
|
|
152
|
+
* @param integrationType - The type of integration to disconnect, such as `'googlecalendar'`, `'slack'`, or `'github'`.
|
|
153
|
+
* @returns Promise resolving when the connection has been removed.
|
|
154
|
+
*
|
|
155
|
+
* @example
|
|
156
|
+
* ```typescript
|
|
157
|
+
* // Disconnect the end user's Google Calendar connection
|
|
158
|
+
* await base44.connectors.disconnectEndUser('googlecalendar');
|
|
159
|
+
* ```
|
|
160
|
+
*/
|
|
161
|
+
disconnectEndUser(integrationType: ConnectorIntegrationType): Promise<void>;
|
|
162
|
+
}
|
|
@@ -425,6 +425,14 @@ type DynamicEntitiesModule = {
|
|
|
425
425
|
* - **Anonymous or User authentication** (`base44.entities`): Access is scoped to the current user's permissions. Anonymous users can only access public entities, while authenticated users can access entities they have permission to view or modify.
|
|
426
426
|
* - **Service role authentication** (`base44.asServiceRole.entities`): Operations have elevated admin-level permissions. Can access all entities that the app's admin role has access to.
|
|
427
427
|
*
|
|
428
|
+
* ## Entity Handlers
|
|
429
|
+
*
|
|
430
|
+
* An entity handler is the object you get when you access an entity through `base44.entities.EntityName`. Every entity in your app automatically gets a handler with CRUD methods for managing records.
|
|
431
|
+
*
|
|
432
|
+
* For example, `base44.entities.Task` is an entity handler for Task records, and `base44.entities.User` is an entity handler for User records. Each handler provides methods like `list()`, `create()`, `update()`, and `delete()`.
|
|
433
|
+
*
|
|
434
|
+
* You don't need to instantiate or import entity handlers. They're automatically available for every entity you create in your app.
|
|
435
|
+
*
|
|
428
436
|
* ## Built-in User Entity
|
|
429
437
|
*
|
|
430
438
|
* Every app includes a built-in `User` entity that stores user account information. This entity has special security rules that can't be changed.
|
|
@@ -19,6 +19,8 @@ export type FunctionName = keyof FunctionNameRegistry extends never ? string : k
|
|
|
19
19
|
*
|
|
20
20
|
* This module allows you to invoke the custom backend functions defined in the app.
|
|
21
21
|
*
|
|
22
|
+
* ## Authentication Modes
|
|
23
|
+
*
|
|
22
24
|
* This module is available to use with a client in all authentication modes:
|
|
23
25
|
*
|
|
24
26
|
* - **Anonymous or User authentication** (`base44.functions`): Functions are invoked with the current user's permissions. Anonymous users invoke functions without authentication, while authenticated users invoke functions with their authentication context.
|
|
@@ -12,18 +12,25 @@ export type IntegrationEndpointFunction = (data: Record<string, any>) => Promise
|
|
|
12
12
|
/**
|
|
13
13
|
* A package containing integration endpoints.
|
|
14
14
|
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
15
|
+
* An integration package is a collection of endpoint functions indexed by endpoint name.
|
|
16
|
+
* Both `Core` and `custom` are integration packages that implement this structure.
|
|
17
17
|
*
|
|
18
|
-
* @example
|
|
18
|
+
* @example **Core package**
|
|
19
19
|
* ```typescript
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
* subject: 'Hello',
|
|
24
|
-
* body: 'Message'
|
|
20
|
+
* await base44.integrations.Core.InvokeLLM({
|
|
21
|
+
* prompt: 'Explain quantum computing',
|
|
22
|
+
* model: 'gpt-4'
|
|
25
23
|
* });
|
|
26
24
|
* ```
|
|
25
|
+
*
|
|
26
|
+
* @example **custom package**
|
|
27
|
+
* ```typescript
|
|
28
|
+
* await base44.integrations.custom.call(
|
|
29
|
+
* 'github',
|
|
30
|
+
* 'get:/repos/{owner}/{repo}',
|
|
31
|
+
* { pathParams: { owner: 'myorg', repo: 'myrepo' } }
|
|
32
|
+
* );
|
|
33
|
+
* ```
|
|
27
34
|
*/
|
|
28
35
|
export type IntegrationPackage = {
|
|
29
36
|
[endpointName: string]: IntegrationEndpointFunction;
|
|
@@ -324,6 +331,8 @@ export interface CoreIntegrations {
|
|
|
324
331
|
*
|
|
325
332
|
* This module provides access to integration methods for interacting with external services. Unlike the connectors module that gives you raw OAuth tokens, integrations provide pre-built functions that Base44 executes on your behalf.
|
|
326
333
|
*
|
|
334
|
+
* ## Integration Types
|
|
335
|
+
*
|
|
327
336
|
* There are two types of integrations:
|
|
328
337
|
*
|
|
329
338
|
* - **Built-in integrations** (`Core`): Pre-built functions provided by Base44 for common tasks such as AI-powered text generation, image creation, file uploads, and email. Access core integration methods using:
|
|
@@ -331,12 +340,14 @@ export interface CoreIntegrations {
|
|
|
331
340
|
* base44.integrations.Core.FunctionName(params)
|
|
332
341
|
* ```
|
|
333
342
|
*
|
|
334
|
-
* - **Custom integrations** (`custom`): Pre-configured external APIs.
|
|
343
|
+
* - **Custom workspace integrations** (`custom`): Pre-configured external APIs set up by workspace administrators. Workspace integration calls are proxied through Base44's backend, so credentials are never exposed to the frontend. Access custom workspace integration methods using:
|
|
335
344
|
* ```
|
|
336
345
|
* base44.integrations.custom.call(slug, operationId, params)
|
|
337
346
|
* ```
|
|
338
347
|
*
|
|
339
|
-
* <Info>To call a custom integration, it must be pre-configured by a workspace administrator who imports an OpenAPI specification.</Info>
|
|
348
|
+
* <Info>To call a custom workspace integration, it must be pre-configured by a workspace administrator who imports an OpenAPI specification. Learn more about [custom workspace integrations](/documentation/integrations/managing-workspace-integrations).</Info>
|
|
349
|
+
*
|
|
350
|
+
* ## Authentication Modes
|
|
340
351
|
*
|
|
341
352
|
* This module is available to use with a client in all authentication modes:
|
|
342
353
|
*
|
|
@@ -346,18 +357,52 @@ export interface CoreIntegrations {
|
|
|
346
357
|
export type IntegrationsModule = {
|
|
347
358
|
/**
|
|
348
359
|
* Core package containing built-in Base44 integration functions.
|
|
360
|
+
*
|
|
361
|
+
* @example
|
|
362
|
+
* ```typescript
|
|
363
|
+
* const response = await base44.integrations.Core.InvokeLLM({
|
|
364
|
+
* prompt: 'Explain quantum computing',
|
|
365
|
+
* model: 'gpt-4'
|
|
366
|
+
* });
|
|
367
|
+
* ```
|
|
349
368
|
*/
|
|
350
369
|
Core: CoreIntegrations;
|
|
351
370
|
/**
|
|
352
|
-
*
|
|
371
|
+
* Workspace integrations module for calling pre-configured external APIs.
|
|
372
|
+
*
|
|
373
|
+
* @example
|
|
374
|
+
* ```typescript
|
|
375
|
+
* const result = await base44.integrations.custom.call(
|
|
376
|
+
* 'github',
|
|
377
|
+
* 'get:/repos/{owner}/{repo}',
|
|
378
|
+
* { pathParams: { owner: 'myorg', repo: 'myrepo' } }
|
|
379
|
+
* );
|
|
380
|
+
* ```
|
|
353
381
|
*/
|
|
354
382
|
custom: CustomIntegrationsModule;
|
|
355
383
|
} & {
|
|
356
384
|
/**
|
|
357
385
|
* Access to additional integration packages.
|
|
358
386
|
*
|
|
359
|
-
*
|
|
360
|
-
*
|
|
387
|
+
* Allows accessing integration packages as properties. This enables both `Core` and `custom` packages,
|
|
388
|
+
* as well as any future integration packages that may be added.
|
|
389
|
+
*
|
|
390
|
+
* @example **Use Core integrations**
|
|
391
|
+
* ```typescript
|
|
392
|
+
* const response = await base44.integrations.Core.InvokeLLM({
|
|
393
|
+
* prompt: 'Explain quantum computing',
|
|
394
|
+
* model: 'gpt-4'
|
|
395
|
+
* });
|
|
396
|
+
* ```
|
|
397
|
+
*
|
|
398
|
+
* @example **Use custom integrations**
|
|
399
|
+
* ```typescript
|
|
400
|
+
* const result = await base44.integrations.custom.call(
|
|
401
|
+
* 'github',
|
|
402
|
+
* 'get:/repos/{owner}/{repo}',
|
|
403
|
+
* { pathParams: { owner: 'myorg', repo: 'myrepo' } }
|
|
404
|
+
* );
|
|
405
|
+
* ```
|
|
361
406
|
*/
|
|
362
407
|
[packageName: string]: IntegrationPackage;
|
|
363
408
|
};
|