@base44-preview/sdk 0.8.19-pr.135.d9d067f → 0.8.20-pr.130.bda52d3
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 +1 -1
- package/dist/modules/auth.types.d.ts +6 -5
- package/dist/modules/connectors.d.ts +10 -1
- package/dist/modules/connectors.js +35 -1
- package/dist/modules/connectors.types.d.ts +184 -31
- package/dist/modules/integrations.types.d.ts +8 -3
- 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
|
@@ -11,6 +11,6 @@ export type { FunctionsModule, FunctionName, FunctionNameRegistry, } from "./mod
|
|
|
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";
|
|
@@ -181,11 +181,11 @@ export interface AuthModule {
|
|
|
181
181
|
* Initiates an OAuth login flow with one of the built-in providers. Requires a browser environment and can't be used in the backend.
|
|
182
182
|
*
|
|
183
183
|
* Supported providers:
|
|
184
|
-
* - `'google'
|
|
185
|
-
* - `'microsoft'
|
|
186
|
-
* - `'facebook'
|
|
187
|
-
* - `'apple'
|
|
188
|
-
* - `'sso'
|
|
184
|
+
* - `'google'`: {@link https://developers.google.com/identity/protocols/oauth2 | Google OAuth}. Enabled by default.
|
|
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.
|
|
186
|
+
* - `'facebook'`: {@link https://developers.facebook.com/docs/facebook-login | Facebook Login}. Enable Facebook in your app's authentication settings before using.
|
|
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. {@link https://docs.base44.com/Setting-up-your-app/Setting-up-SSO | Set up an SSO provider} in your app's authentication settings before using this provider.
|
|
189
189
|
*
|
|
190
190
|
* @param provider - The authentication provider to use: `'google'`, `'microsoft'`, `'facebook'`, `'apple'`, or `'sso'`.
|
|
191
191
|
* @param fromUrl - URL to redirect to after successful authentication. Defaults to `'/'`.
|
|
@@ -213,6 +213,7 @@ export interface AuthModule {
|
|
|
213
213
|
* // SSO
|
|
214
214
|
* base44.auth.loginWithProvider('sso', '/dashboard');
|
|
215
215
|
* ```
|
|
216
|
+
*
|
|
216
217
|
*/
|
|
217
218
|
loginWithProvider(provider: string, fromUrl?: string): void;
|
|
218
219
|
/**
|
|
@@ -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;
|
|
@@ -14,7 +14,6 @@ export function createConnectorsModule(axios, appId) {
|
|
|
14
14
|
*/
|
|
15
15
|
// @ts-expect-error Return type mismatch with interface - implementation returns string, interface expects string but implementation is typed as ConnectorAccessTokenResponse
|
|
16
16
|
async getAccessToken(integrationType) {
|
|
17
|
-
console.warn("[Base44 SDK] connectors.getAccessToken() is deprecated. Use getConnection(integrationType) and use the returned accessToken instead.");
|
|
18
17
|
if (!integrationType || typeof integrationType !== "string") {
|
|
19
18
|
throw new Error("Integration type is required and must be a string");
|
|
20
19
|
}
|
|
@@ -36,3 +35,38 @@ export function createConnectorsModule(axios, appId) {
|
|
|
36
35
|
},
|
|
37
36
|
};
|
|
38
37
|
}
|
|
38
|
+
/**
|
|
39
|
+
* Creates the user-scoped Connectors module (end-user OAuth flows).
|
|
40
|
+
*
|
|
41
|
+
* @param axios - Axios instance (user-scoped client)
|
|
42
|
+
* @param appId - Application ID
|
|
43
|
+
* @returns User connectors module with end-user OAuth methods
|
|
44
|
+
* @internal
|
|
45
|
+
*/
|
|
46
|
+
export function createUserConnectorsModule(axios, appId) {
|
|
47
|
+
return {
|
|
48
|
+
// @ts-expect-error Return type mismatch - implementation returns object, interface expects string
|
|
49
|
+
async getAppUserAccessToken(connectorId) {
|
|
50
|
+
if (!connectorId || typeof connectorId !== "string") {
|
|
51
|
+
throw new Error("Connector ID is required and must be a string");
|
|
52
|
+
}
|
|
53
|
+
const response = await axios.get(`/apps/${appId}/end-user-auth/connectors/${connectorId}/token`);
|
|
54
|
+
// @ts-expect-error
|
|
55
|
+
return response.access_token;
|
|
56
|
+
},
|
|
57
|
+
async connectAppUser(connectorId) {
|
|
58
|
+
if (!connectorId || typeof connectorId !== "string") {
|
|
59
|
+
throw new Error("Connector ID is required and must be a string");
|
|
60
|
+
}
|
|
61
|
+
const response = await axios.post(`/apps/${appId}/end-user-auth/connectors/${connectorId}/initiate`);
|
|
62
|
+
// @ts-expect-error
|
|
63
|
+
return response.redirect_url;
|
|
64
|
+
},
|
|
65
|
+
async disconnectAppUser(connectorId) {
|
|
66
|
+
if (!connectorId || typeof connectorId !== "string") {
|
|
67
|
+
throw new Error("Connector ID is required and must be a string");
|
|
68
|
+
}
|
|
69
|
+
await axios.delete(`/apps/${appId}/end-user-auth/connectors/${connectorId}`);
|
|
70
|
+
},
|
|
71
|
+
};
|
|
72
|
+
}
|
|
@@ -24,7 +24,7 @@ export interface ConnectorAccessTokenResponse {
|
|
|
24
24
|
connection_config: Record<string, string> | null;
|
|
25
25
|
}
|
|
26
26
|
/**
|
|
27
|
-
*
|
|
27
|
+
* Connection details.
|
|
28
28
|
*/
|
|
29
29
|
export interface ConnectorConnectionResponse {
|
|
30
30
|
/** The OAuth access token for the external service. */
|
|
@@ -33,15 +33,53 @@ export interface ConnectorConnectionResponse {
|
|
|
33
33
|
connectionConfig: Record<string, string> | null;
|
|
34
34
|
}
|
|
35
35
|
/**
|
|
36
|
-
*
|
|
36
|
+
* Response from the connectors initiate endpoint.
|
|
37
|
+
*/
|
|
38
|
+
export interface ConnectorInitiateResponse {
|
|
39
|
+
redirect_url: string;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Connectors module for managing app-scoped OAuth tokens for external services.
|
|
37
43
|
*
|
|
38
|
-
* 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
|
|
44
|
+
* 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, Slack, or GitHub, all users of the app share that same connection.
|
|
39
45
|
*
|
|
40
46
|
* Unlike the integrations module that provides pre-built functions, connectors give you
|
|
41
47
|
* raw OAuth tokens so you can call external service APIs directly with full control over
|
|
42
48
|
* the API calls you make. This is useful when you need custom API interactions that aren't
|
|
43
49
|
* covered by Base44's pre-built integrations.
|
|
44
50
|
*
|
|
51
|
+
* ## Available connectors
|
|
52
|
+
*
|
|
53
|
+
* All connectors work through [`getConnection()`](#getconnection). Pass the integration type string and use the returned OAuth token to call the external service's API directly.
|
|
54
|
+
*
|
|
55
|
+
* | Service | Type identifier |
|
|
56
|
+
* |---|---|
|
|
57
|
+
* | Box | `box` |
|
|
58
|
+
* | ClickUp | `clickup` |
|
|
59
|
+
* | Discord | `discord` |
|
|
60
|
+
* | GitHub | `github` |
|
|
61
|
+
* | Gmail | `gmail` |
|
|
62
|
+
* | Google Analytics | `google_analytics` |
|
|
63
|
+
* | Google BigQuery | `googlebigquery` |
|
|
64
|
+
* | Google Calendar | `googlecalendar` |
|
|
65
|
+
* | Google Docs | `googledocs` |
|
|
66
|
+
* | Google Drive | `googledrive` |
|
|
67
|
+
* | Google Sheets | `googlesheets` |
|
|
68
|
+
* | Google Slides | `googleslides` |
|
|
69
|
+
* | HubSpot | `hubspot` |
|
|
70
|
+
* | LinkedIn | `linkedin` |
|
|
71
|
+
* | Notion | `notion` |
|
|
72
|
+
* | Salesforce | `salesforce` |
|
|
73
|
+
* | Slack User | `slack` |
|
|
74
|
+
* | Slack Bot | `slackbot` |
|
|
75
|
+
* | TikTok | `tiktok` |
|
|
76
|
+
* | Wrike | `wrike` |
|
|
77
|
+
*
|
|
78
|
+
* See the integration guides for more details:
|
|
79
|
+
*
|
|
80
|
+
* - **Scopes and permissions**: {@link https://docs.base44.com/Integrations/gmail-connector#gmail-scopes-and-permissions | Gmail}, {@link https://docs.base44.com/Integrations/linkedin-connector#linkedin-scopes-and-permissions | LinkedIn}, {@link https://docs.base44.com/Integrations/slack-connector#slack-scopes-and-permissions | Slack}
|
|
81
|
+
* - **Slack connector types**: {@link https://docs.base44.com/Integrations/slack-connector#about-the-slack-connectors | About the Slack connectors} explains the difference between `slack` and `slackbot`
|
|
82
|
+
*
|
|
45
83
|
* ## Authentication Modes
|
|
46
84
|
*
|
|
47
85
|
* This module is only available to use with a client in service role authentication mode, which means it can only be used in backend environments.
|
|
@@ -52,15 +90,15 @@ export interface ConnectorConnectionResponse {
|
|
|
52
90
|
*/
|
|
53
91
|
export interface ConnectorsModule {
|
|
54
92
|
/**
|
|
55
|
-
* Retrieves an OAuth access token for a specific external integration type.
|
|
93
|
+
* Retrieves an OAuth access token for a specific [external integration type](#available-connectors).
|
|
56
94
|
*
|
|
57
|
-
* @deprecated Use {@link getConnection}
|
|
95
|
+
* @deprecated Use {@link getConnection} instead.
|
|
58
96
|
*
|
|
59
97
|
* Returns the OAuth token string for an external service that an app builder
|
|
60
98
|
* has connected to. This token represents the connected app builder's account
|
|
61
99
|
* and can be used to make authenticated API calls to that external service on behalf of the app.
|
|
62
100
|
*
|
|
63
|
-
* @param integrationType - The type of integration, such as `'googlecalendar'`, `'slack'`,
|
|
101
|
+
* @param integrationType - The type of integration, such as `'googlecalendar'`, `'slack'`, `'slackbot'`, `'github'`, or `'discord'`. See [Available connectors](#available-connectors) for the full list.
|
|
64
102
|
* @returns Promise resolving to the access token string.
|
|
65
103
|
*
|
|
66
104
|
* @example
|
|
@@ -82,8 +120,8 @@ export interface ConnectorsModule {
|
|
|
82
120
|
*
|
|
83
121
|
* @example
|
|
84
122
|
* ```typescript
|
|
85
|
-
* // Slack connection
|
|
86
|
-
* // Get Slack
|
|
123
|
+
* // Slack User connection
|
|
124
|
+
* // Get Slack user token and list channels
|
|
87
125
|
* const slackToken = await base44.asServiceRole.connectors.getAccessToken('slack');
|
|
88
126
|
*
|
|
89
127
|
* // List all public and private channels
|
|
@@ -95,43 +133,158 @@ export interface ConnectorsModule {
|
|
|
95
133
|
*
|
|
96
134
|
* const data = await slackResponse.json();
|
|
97
135
|
* ```
|
|
136
|
+
*
|
|
137
|
+
* @example
|
|
138
|
+
* ```typescript
|
|
139
|
+
* // Slack Bot connection
|
|
140
|
+
* // Get Slack bot token and post a message with a custom bot identity
|
|
141
|
+
* const botToken = await base44.asServiceRole.connectors.getAccessToken('slackbot');
|
|
142
|
+
*
|
|
143
|
+
* const response = await fetch('https://slack.com/api/chat.postMessage', {
|
|
144
|
+
* method: 'POST',
|
|
145
|
+
* headers: {
|
|
146
|
+
* 'Authorization': `Bearer ${botToken}`,
|
|
147
|
+
* 'Content-Type': 'application/json'
|
|
148
|
+
* },
|
|
149
|
+
* body: JSON.stringify({
|
|
150
|
+
* channel: '#alerts',
|
|
151
|
+
* text: 'Deployment to production completed successfully.',
|
|
152
|
+
* username: 'Deploy Bot',
|
|
153
|
+
* icon_emoji: ':rocket:'
|
|
154
|
+
* })
|
|
155
|
+
* });
|
|
156
|
+
*
|
|
157
|
+
* const result = await response.json();
|
|
158
|
+
* ```
|
|
98
159
|
*/
|
|
99
160
|
getAccessToken(integrationType: ConnectorIntegrationType): Promise<string>;
|
|
100
161
|
/**
|
|
101
|
-
* Retrieves the OAuth access token and connection configuration for a specific external integration type.
|
|
162
|
+
* Retrieves the OAuth access token and connection configuration for a specific [external integration type](#available-connectors).
|
|
163
|
+
*
|
|
164
|
+
* Some connectors require connection-specific parameters to build API calls.
|
|
165
|
+
* In such cases, the returned `connectionConfig` is an object with the additional parameters. If there are no extra parameters needed for the connection, the `connectionConfig` is `null`.
|
|
102
166
|
*
|
|
103
|
-
*
|
|
104
|
-
*
|
|
105
|
-
* extra parameters beyond the access token (e.g., a shop domain, account ID, or API base URL).
|
|
167
|
+
* For example, a service might need a subdomain to construct the API URL in
|
|
168
|
+
* the form of `{subdomain}.example.com`. In such a case the subdomain will be available as a property of the `connectionConfig` object.
|
|
106
169
|
*
|
|
107
|
-
* @param integrationType - The type of integration, such as `'googlecalendar'`, `'slack'`,
|
|
170
|
+
* @param integrationType - The type of integration, such as `'googlecalendar'`, `'slack'`, `'slackbot'`, `'github'`, or `'discord'`. See [Available connectors](#available-connectors) for the full list.
|
|
108
171
|
* @returns Promise resolving to a {@link ConnectorConnectionResponse} with `accessToken` and `connectionConfig`.
|
|
109
172
|
*
|
|
110
173
|
* @example
|
|
111
174
|
* ```typescript
|
|
112
|
-
* //
|
|
113
|
-
*
|
|
114
|
-
*
|
|
115
|
-
*
|
|
175
|
+
* // Google Calendar connection
|
|
176
|
+
* // Get Google Calendar OAuth token and fetch upcoming events
|
|
177
|
+
* const { accessToken } = await base44.asServiceRole.connectors.getConnection('googlecalendar');
|
|
178
|
+
*
|
|
179
|
+
* const timeMin = new Date().toISOString();
|
|
180
|
+
* const url = `https://www.googleapis.com/calendar/v3/calendars/primary/events?maxResults=10&orderBy=startTime&singleEvents=true&timeMin=${timeMin}`;
|
|
181
|
+
*
|
|
182
|
+
* const calendarResponse = await fetch(url, {
|
|
183
|
+
* headers: { Authorization: `Bearer ${accessToken}` }
|
|
184
|
+
* });
|
|
185
|
+
*
|
|
186
|
+
* const events = await calendarResponse.json();
|
|
116
187
|
* ```
|
|
117
188
|
*
|
|
118
189
|
* @example
|
|
119
190
|
* ```typescript
|
|
120
|
-
* //
|
|
121
|
-
*
|
|
122
|
-
* const { accessToken
|
|
123
|
-
*
|
|
124
|
-
*
|
|
125
|
-
*
|
|
126
|
-
*
|
|
127
|
-
*
|
|
128
|
-
*
|
|
129
|
-
*
|
|
130
|
-
*
|
|
131
|
-
*
|
|
132
|
-
*
|
|
133
|
-
*
|
|
191
|
+
* // Slack connection
|
|
192
|
+
* // Get Slack OAuth token and list channels
|
|
193
|
+
* const { accessToken } = await base44.asServiceRole.connectors.getConnection('slack');
|
|
194
|
+
*
|
|
195
|
+
* const url = 'https://slack.com/api/conversations.list?types=public_channel,private_channel&limit=100';
|
|
196
|
+
*
|
|
197
|
+
* const slackResponse = await fetch(url, {
|
|
198
|
+
* headers: { Authorization: `Bearer ${accessToken}` }
|
|
199
|
+
* });
|
|
200
|
+
*
|
|
201
|
+
* const data = await slackResponse.json();
|
|
202
|
+
* ```
|
|
203
|
+
*
|
|
204
|
+
* @example
|
|
205
|
+
* ```typescript
|
|
206
|
+
* // Using connectionConfig
|
|
207
|
+
* // Some connectors return a subdomain or other params needed to build the API URL
|
|
208
|
+
* const { accessToken, connectionConfig } = await base44.asServiceRole.connectors.getConnection('myservice');
|
|
209
|
+
*
|
|
210
|
+
* const subdomain = connectionConfig?.subdomain;
|
|
211
|
+
* const response = await fetch(
|
|
212
|
+
* `https://${subdomain}.example.com/api/v1/resources`,
|
|
213
|
+
* { headers: { Authorization: `Bearer ${accessToken}` } }
|
|
214
|
+
* );
|
|
215
|
+
*
|
|
216
|
+
* const data = await response.json();
|
|
134
217
|
* ```
|
|
135
218
|
*/
|
|
136
219
|
getConnection(integrationType: ConnectorIntegrationType): Promise<ConnectorConnectionResponse>;
|
|
137
220
|
}
|
|
221
|
+
/**
|
|
222
|
+
* User-scoped connectors module for managing end-user OAuth connections.
|
|
223
|
+
*
|
|
224
|
+
* This module provides methods for end-user OAuth flows: initiating an OAuth connection,
|
|
225
|
+
* retrieving the end user's access token, and disconnecting the end user's connection.
|
|
226
|
+
*
|
|
227
|
+
* Unlike {@link ConnectorsModule | ConnectorsModule} which manages app-scoped tokens,
|
|
228
|
+
* this module manages tokens scoped to individual end users. Methods are keyed on
|
|
229
|
+
* the connector ID (the OrgConnector's database ID) rather than the integration type.
|
|
230
|
+
*
|
|
231
|
+
* Available via `base44.connectors`.
|
|
232
|
+
*/
|
|
233
|
+
export interface UserConnectorsModule {
|
|
234
|
+
/**
|
|
235
|
+
* Retrieves an OAuth access token for an end user's connection to a specific connector.
|
|
236
|
+
*
|
|
237
|
+
* Returns the OAuth token string that belongs to the currently authenticated end user
|
|
238
|
+
* for the specified connector.
|
|
239
|
+
*
|
|
240
|
+
* @param connectorId - The connector ID (OrgConnector database ID).
|
|
241
|
+
* @returns Promise resolving to the access token string.
|
|
242
|
+
*
|
|
243
|
+
* @example
|
|
244
|
+
* ```typescript
|
|
245
|
+
* // Get the end user's access token for a connector
|
|
246
|
+
* const token = await base44.connectors.getAppUserAccessToken('abc123def');
|
|
247
|
+
*
|
|
248
|
+
* const response = await fetch('https://www.googleapis.com/calendar/v3/calendars/primary/events', {
|
|
249
|
+
* headers: { 'Authorization': `Bearer ${token}` }
|
|
250
|
+
* });
|
|
251
|
+
* ```
|
|
252
|
+
*/
|
|
253
|
+
getAppUserAccessToken(connectorId: string): Promise<string>;
|
|
254
|
+
/**
|
|
255
|
+
* Initiates the end-user OAuth flow for a specific connector.
|
|
256
|
+
*
|
|
257
|
+
* Returns a redirect URL that the end user should be navigated to in order to
|
|
258
|
+
* authenticate with the external service. The scopes and integration type are
|
|
259
|
+
* derived from the connector configuration server-side.
|
|
260
|
+
*
|
|
261
|
+
* @param connectorId - The connector ID (OrgConnector database ID).
|
|
262
|
+
* @returns Promise resolving to the redirect URL string.
|
|
263
|
+
*
|
|
264
|
+
* @example
|
|
265
|
+
* ```typescript
|
|
266
|
+
* // Start OAuth for the end user
|
|
267
|
+
* const redirectUrl = await base44.connectors.connectAppUser('abc123def');
|
|
268
|
+
*
|
|
269
|
+
* // Redirect the user to the OAuth provider
|
|
270
|
+
* window.location.href = redirectUrl;
|
|
271
|
+
* ```
|
|
272
|
+
*/
|
|
273
|
+
connectAppUser(connectorId: string): Promise<string>;
|
|
274
|
+
/**
|
|
275
|
+
* Disconnects an end user's OAuth connection for a specific connector.
|
|
276
|
+
*
|
|
277
|
+
* Removes the stored OAuth credentials for the currently authenticated end user's
|
|
278
|
+
* connection to the specified connector.
|
|
279
|
+
*
|
|
280
|
+
* @param connectorId - The connector ID (OrgConnector database ID).
|
|
281
|
+
* @returns Promise resolving when the connection has been removed.
|
|
282
|
+
*
|
|
283
|
+
* @example
|
|
284
|
+
* ```typescript
|
|
285
|
+
* // Disconnect the end user's connection
|
|
286
|
+
* await base44.connectors.disconnectAppUser('abc123def');
|
|
287
|
+
* ```
|
|
288
|
+
*/
|
|
289
|
+
disconnectAppUser(connectorId: string): Promise<void>;
|
|
290
|
+
}
|
|
@@ -19,7 +19,7 @@ export type IntegrationEndpointFunction = (data: Record<string, any>) => Promise
|
|
|
19
19
|
* ```typescript
|
|
20
20
|
* await base44.integrations.Core.InvokeLLM({
|
|
21
21
|
* prompt: 'Explain quantum computing',
|
|
22
|
-
* model: '
|
|
22
|
+
* model: 'gpt_5'
|
|
23
23
|
* });
|
|
24
24
|
* ```
|
|
25
25
|
*
|
|
@@ -41,6 +41,11 @@ export type IntegrationPackage = {
|
|
|
41
41
|
export interface InvokeLLMParams {
|
|
42
42
|
/** The prompt text to send to the model */
|
|
43
43
|
prompt: string;
|
|
44
|
+
/** Optionally specify a model to override the app-level model setting for this specific call.
|
|
45
|
+
*
|
|
46
|
+
* Options: `"gpt_5_mini"`, `"gemini_3_flash"`, `"gpt_5"`, `"gemini_3_pro"`, `"claude_sonnet_4_6"`, `"claude_opus_4_6"`
|
|
47
|
+
*/
|
|
48
|
+
model?: 'gpt_5_mini' | 'gemini_3_flash' | 'gpt_5' | 'gemini_3_pro' | 'claude_sonnet_4_6' | 'claude_opus_4_6';
|
|
44
49
|
/** If set to `true`, the LLM will use Google Search, Maps, and News to gather real-time context before answering.
|
|
45
50
|
* @default false
|
|
46
51
|
*/
|
|
@@ -362,7 +367,7 @@ export type IntegrationsModule = {
|
|
|
362
367
|
* ```typescript
|
|
363
368
|
* const response = await base44.integrations.Core.InvokeLLM({
|
|
364
369
|
* prompt: 'Explain quantum computing',
|
|
365
|
-
* model: '
|
|
370
|
+
* model: 'gpt_5'
|
|
366
371
|
* });
|
|
367
372
|
* ```
|
|
368
373
|
*/
|
|
@@ -391,7 +396,7 @@ export type IntegrationsModule = {
|
|
|
391
396
|
* ```typescript
|
|
392
397
|
* const response = await base44.integrations.Core.InvokeLLM({
|
|
393
398
|
* prompt: 'Explain quantum computing',
|
|
394
|
-
* model: '
|
|
399
|
+
* model: 'gpt_5'
|
|
395
400
|
* });
|
|
396
401
|
* ```
|
|
397
402
|
*
|