@base44-preview/sdk 0.8.17-pr.49.b78ce52 → 0.8.17-pr.70.d526c10
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.types.d.ts +4 -1
- package/dist/modules/agents.types.d.ts +2 -2
- package/dist/modules/auth.js +0 -10
- package/dist/modules/auth.types.d.ts +0 -21
- package/dist/modules/connectors.types.d.ts +4 -6
- package/dist/modules/custom-integrations.types.d.ts +36 -54
- package/dist/modules/entities.types.d.ts +5 -0
- package/dist/modules/integrations.types.d.ts +17 -26
- package/package.json +1 -1
package/dist/client.types.d.ts
CHANGED
|
@@ -83,7 +83,10 @@ export interface Base44Client {
|
|
|
83
83
|
agents: AgentsModule;
|
|
84
84
|
/** {@link AppLogsModule | App logs module} for tracking app usage. */
|
|
85
85
|
appLogs: AppLogsModule;
|
|
86
|
-
/**
|
|
86
|
+
/**
|
|
87
|
+
* {@link AnalyticsModule | Analytics module} for tracking app usage.
|
|
88
|
+
* @internal
|
|
89
|
+
*/
|
|
87
90
|
analytics: AnalyticsModule;
|
|
88
91
|
/** Cleanup function to disconnect WebSocket connections. Call when you're done with the client. */
|
|
89
92
|
cleanup: () => void;
|
|
@@ -72,7 +72,7 @@ export interface AgentMessageMetadata {
|
|
|
72
72
|
export interface AgentConversation {
|
|
73
73
|
/** Unique identifier for the conversation. */
|
|
74
74
|
id: string;
|
|
75
|
-
/**
|
|
75
|
+
/** App ID. */
|
|
76
76
|
app_id: string;
|
|
77
77
|
/** Name of the agent in this conversation. */
|
|
78
78
|
agent_name: string;
|
|
@@ -140,7 +140,7 @@ export interface AgentsModuleConfig {
|
|
|
140
140
|
axios: AxiosInstance;
|
|
141
141
|
/** Function to get WebSocket instance for real-time updates (lazy initialization) */
|
|
142
142
|
getSocket: () => ReturnType<typeof RoomsSocket>;
|
|
143
|
-
/**
|
|
143
|
+
/** App ID */
|
|
144
144
|
appId: string;
|
|
145
145
|
/** Server URL */
|
|
146
146
|
serverUrl?: string;
|
package/dist/modules/auth.js
CHANGED
|
@@ -34,16 +34,6 @@ 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
|
-
},
|
|
47
37
|
// Logout the current user
|
|
48
38
|
// Removes the token from localStorage and optionally redirects to a URL or reloads the page
|
|
49
39
|
logout(redirectUrl) {
|
|
@@ -171,27 +171,6 @@ 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;
|
|
195
174
|
/**
|
|
196
175
|
* Logs out the current user.
|
|
197
176
|
*
|
|
@@ -11,9 +11,7 @@ export interface ConnectorAccessTokenResponse {
|
|
|
11
11
|
/**
|
|
12
12
|
* Connectors module for managing OAuth tokens for external services.
|
|
13
13
|
*
|
|
14
|
-
* This module allows you to retrieve OAuth access tokens for external services
|
|
15
|
-
* that the app has connected to. Use these tokens to make API
|
|
16
|
-
* calls to external services.
|
|
14
|
+
* 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.
|
|
17
15
|
*
|
|
18
16
|
* Unlike the integrations module that provides pre-built functions, connectors give you
|
|
19
17
|
* raw OAuth tokens so you can call external service APIs directly with full control over
|
|
@@ -26,9 +24,9 @@ export interface ConnectorsModule {
|
|
|
26
24
|
/**
|
|
27
25
|
* Retrieves an OAuth access token for a specific external integration type.
|
|
28
26
|
*
|
|
29
|
-
* Returns the OAuth token string for an external service that
|
|
30
|
-
* has connected to.
|
|
31
|
-
* to that external service.
|
|
27
|
+
* Returns the OAuth token string for an external service that an app builder
|
|
28
|
+
* has connected to. This token represents the connected app builder's account
|
|
29
|
+
* and can be used to make authenticated API calls to that external service on behalf of the app.
|
|
32
30
|
*
|
|
33
31
|
* @param integrationType - The type of integration, such as `'googlecalendar'`, `'slack'`, or `'github'`.
|
|
34
32
|
* @returns Promise resolving to the access token string.
|
|
@@ -7,18 +7,13 @@ export interface CustomIntegrationCallParams {
|
|
|
7
7
|
*/
|
|
8
8
|
payload?: Record<string, any>;
|
|
9
9
|
/**
|
|
10
|
-
* Path parameters to substitute in the URL
|
|
10
|
+
* Path parameters to substitute in the URL. For example, `{ owner: "user", repo: "repo" }`.
|
|
11
11
|
*/
|
|
12
12
|
pathParams?: Record<string, string>;
|
|
13
13
|
/**
|
|
14
14
|
* Query string parameters to append to the URL.
|
|
15
15
|
*/
|
|
16
16
|
queryParams?: Record<string, any>;
|
|
17
|
-
/**
|
|
18
|
-
* Additional headers to send with this specific request.
|
|
19
|
-
* These are merged with the integration's configured headers.
|
|
20
|
-
*/
|
|
21
|
-
headers?: Record<string, string>;
|
|
22
17
|
}
|
|
23
18
|
/**
|
|
24
19
|
* Response from a custom integration call.
|
|
@@ -39,60 +34,17 @@ export interface CustomIntegrationCallResponse {
|
|
|
39
34
|
data: any;
|
|
40
35
|
}
|
|
41
36
|
/**
|
|
42
|
-
* Module for calling custom
|
|
43
|
-
*
|
|
44
|
-
* Custom integrations allow workspace administrators to connect any external API
|
|
45
|
-
* by importing an OpenAPI specification. Apps in the workspace can then call
|
|
46
|
-
* these integrations using this module.
|
|
47
|
-
*
|
|
48
|
-
* Unlike the built-in integrations (like `Core`), custom integrations:
|
|
49
|
-
* - Are defined per-workspace by importing OpenAPI specs
|
|
50
|
-
* - Use a slug-based identifier instead of package names
|
|
51
|
-
* - Proxy requests through Base44's backend (credentials never exposed to frontend)
|
|
52
|
-
*
|
|
53
|
-
* @example
|
|
54
|
-
* ```typescript
|
|
55
|
-
* // Call a custom GitHub integration
|
|
56
|
-
* const response = await base44.integrations.custom.call(
|
|
57
|
-
* "github", // integration slug (defined by workspace admin)
|
|
58
|
-
* "listIssues", // operation ID from the OpenAPI spec
|
|
59
|
-
* {
|
|
60
|
-
* pathParams: { owner: "myorg", repo: "myrepo" },
|
|
61
|
-
* queryParams: { state: "open", per_page: 100 }
|
|
62
|
-
* }
|
|
63
|
-
* );
|
|
37
|
+
* Module for calling custom pre-configured API integrations.
|
|
64
38
|
*
|
|
65
|
-
*
|
|
66
|
-
* console.log("Issues:", response.data);
|
|
67
|
-
* } else {
|
|
68
|
-
* console.error("API returned error:", response.status_code);
|
|
69
|
-
* }
|
|
70
|
-
* ```
|
|
71
|
-
*
|
|
72
|
-
* @example
|
|
73
|
-
* ```typescript
|
|
74
|
-
* // Call with request body payload
|
|
75
|
-
* const response = await base44.integrations.custom.call(
|
|
76
|
-
* "github",
|
|
77
|
-
* "createIssue",
|
|
78
|
-
* {
|
|
79
|
-
* pathParams: { owner: "myorg", repo: "myrepo" },
|
|
80
|
-
* payload: {
|
|
81
|
-
* title: "Bug report",
|
|
82
|
-
* body: "Something is broken",
|
|
83
|
-
* labels: ["bug"]
|
|
84
|
-
* }
|
|
85
|
-
* }
|
|
86
|
-
* );
|
|
87
|
-
* ```
|
|
39
|
+
* Custom integrations allow workspace administrators to connect any external API by importing an OpenAPI specification. Apps in the workspace can then call these integrations using this module.
|
|
88
40
|
*/
|
|
89
41
|
export interface CustomIntegrationsModule {
|
|
90
42
|
/**
|
|
91
43
|
* Call a custom integration endpoint.
|
|
92
44
|
*
|
|
93
|
-
* @param slug - The integration's unique identifier
|
|
94
|
-
* @param operationId - The
|
|
95
|
-
* @param params - Optional parameters including payload, pathParams,
|
|
45
|
+
* @param slug - The integration's unique identifier, as defined by the workspace admin.
|
|
46
|
+
* @param operationId - The endpoint in `method:path` format. For example, `"get:/contacts"`, or `"post:/users/{id}"`. The method is the HTTP verb in lowercase and the path matches the OpenAPI specification.
|
|
47
|
+
* @param params - Optional parameters including payload, pathParams, and queryParams.
|
|
96
48
|
* @returns Promise resolving to the integration call response.
|
|
97
49
|
*
|
|
98
50
|
* @throws {Error} If slug is not provided.
|
|
@@ -100,6 +52,36 @@ export interface CustomIntegrationsModule {
|
|
|
100
52
|
* @throws {Base44Error} If the integration or operation is not found (404).
|
|
101
53
|
* @throws {Base44Error} If the external API call fails (502).
|
|
102
54
|
* @throws {Base44Error} If the request times out (504).
|
|
55
|
+
*
|
|
56
|
+
* @example
|
|
57
|
+
* ```typescript
|
|
58
|
+
* // Call a custom CRM integration
|
|
59
|
+
* const response = await base44.integrations.custom.call(
|
|
60
|
+
* "my-crm",
|
|
61
|
+
* "get:/contacts",
|
|
62
|
+
* { queryParams: { limit: 10 } }
|
|
63
|
+
* );
|
|
64
|
+
*
|
|
65
|
+
* if (response.success) {
|
|
66
|
+
* console.log("Contacts:", response.data);
|
|
67
|
+
* }
|
|
68
|
+
* ```
|
|
69
|
+
*
|
|
70
|
+
* @example
|
|
71
|
+
* ```typescript
|
|
72
|
+
* // Call with path params and request body
|
|
73
|
+
* const response = await base44.integrations.custom.call(
|
|
74
|
+
* "github",
|
|
75
|
+
* "post:/repos/{owner}/{repo}/issues",
|
|
76
|
+
* {
|
|
77
|
+
* pathParams: { owner: "myorg", repo: "myrepo" },
|
|
78
|
+
* payload: {
|
|
79
|
+
* title: "Bug report",
|
|
80
|
+
* body: "Something is broken"
|
|
81
|
+
* }
|
|
82
|
+
* }
|
|
83
|
+
* );
|
|
84
|
+
* ```
|
|
103
85
|
*/
|
|
104
86
|
call(slug: string, operationId: string, params?: CustomIntegrationCallParams): Promise<CustomIntegrationCallResponse>;
|
|
105
87
|
}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Event types for realtime entity updates.
|
|
3
|
+
* @internal
|
|
3
4
|
*/
|
|
4
5
|
export type RealtimeEventType = "create" | "update" | "delete";
|
|
5
6
|
/**
|
|
6
7
|
* Payload received when a realtime event occurs.
|
|
8
|
+
* @internal
|
|
7
9
|
*/
|
|
8
10
|
export interface RealtimeEvent {
|
|
9
11
|
/** The type of change that occurred */
|
|
@@ -17,10 +19,12 @@ export interface RealtimeEvent {
|
|
|
17
19
|
}
|
|
18
20
|
/**
|
|
19
21
|
* Callback function invoked when a realtime event occurs.
|
|
22
|
+
* @internal
|
|
20
23
|
*/
|
|
21
24
|
export type RealtimeCallback = (event: RealtimeEvent) => void;
|
|
22
25
|
/**
|
|
23
26
|
* Function returned from subscribe, call it to unsubscribe.
|
|
27
|
+
* @internal
|
|
24
28
|
*/
|
|
25
29
|
export type Subscription = () => void;
|
|
26
30
|
/**
|
|
@@ -285,6 +289,7 @@ export interface EntityHandler {
|
|
|
285
289
|
* // Later, unsubscribe
|
|
286
290
|
* unsubscribe();
|
|
287
291
|
* ```
|
|
292
|
+
* @internal
|
|
288
293
|
*/
|
|
289
294
|
subscribe(callback: RealtimeCallback): Subscription;
|
|
290
295
|
}
|
|
@@ -320,22 +320,28 @@ export interface CoreIntegrations {
|
|
|
320
320
|
CreateFileSignedUrl(params: CreateFileSignedUrlParams): Promise<CreateFileSignedUrlResult>;
|
|
321
321
|
}
|
|
322
322
|
/**
|
|
323
|
-
* Integrations module for calling integration
|
|
323
|
+
* Integrations module for calling integration methods.
|
|
324
324
|
*
|
|
325
|
-
* This module provides access to integration
|
|
326
|
-
* services. Integrations are organized into packages. Base44 provides built-in integrations
|
|
327
|
-
* in the `Core` package.
|
|
325
|
+
* 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.
|
|
328
326
|
*
|
|
329
|
-
*
|
|
330
|
-
* pre-built functions that Base44 executes on your behalf.
|
|
327
|
+
* There are two types of integrations:
|
|
331
328
|
*
|
|
332
|
-
*
|
|
333
|
-
*
|
|
329
|
+
* - **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:
|
|
330
|
+
* ```
|
|
331
|
+
* base44.integrations.Core.FunctionName(params)
|
|
332
|
+
* ```
|
|
333
|
+
*
|
|
334
|
+
* - **Custom integrations** (`custom`): Pre-configured external APIs. Custom integration calls are proxied through Base44's backend, so credentials are never exposed to the frontend. Access custom integration methods using:
|
|
335
|
+
* ```
|
|
336
|
+
* base44.integrations.custom.call(slug, operationId, params)
|
|
337
|
+
* ```
|
|
338
|
+
*
|
|
339
|
+
* <Info>To call a custom integration, it must be pre-configured by a workspace administrator who imports an OpenAPI specification.</Info>
|
|
334
340
|
*
|
|
335
341
|
* This module is available to use with a client in all authentication modes:
|
|
336
342
|
*
|
|
337
|
-
* - **Anonymous or User authentication** (`base44.integrations`): Integration
|
|
338
|
-
* - **Service role authentication** (`base44.asServiceRole.integrations`): Integration
|
|
343
|
+
* - **Anonymous or User authentication** (`base44.integrations`): Integration methods are invoked with the current user's permissions. Anonymous users invoke methods without authentication, while authenticated users invoke methods with their authentication context.
|
|
344
|
+
* - **Service role authentication** (`base44.asServiceRole.integrations`): Integration methods are invoked with elevated admin-level permissions. The methods execute with admin authentication context.
|
|
339
345
|
*/
|
|
340
346
|
export type IntegrationsModule = {
|
|
341
347
|
/**
|
|
@@ -343,22 +349,7 @@ export type IntegrationsModule = {
|
|
|
343
349
|
*/
|
|
344
350
|
Core: CoreIntegrations;
|
|
345
351
|
/**
|
|
346
|
-
* Custom integrations module for calling
|
|
347
|
-
*
|
|
348
|
-
* Allows calling external APIs that workspace admins have configured
|
|
349
|
-
* by importing OpenAPI specifications.
|
|
350
|
-
*
|
|
351
|
-
* @example
|
|
352
|
-
* ```typescript
|
|
353
|
-
* const response = await base44.integrations.custom.call(
|
|
354
|
-
* "github", // integration slug
|
|
355
|
-
* "listIssues", // operation ID
|
|
356
|
-
* {
|
|
357
|
-
* pathParams: { owner: "myorg", repo: "myrepo" },
|
|
358
|
-
* queryParams: { state: "open" }
|
|
359
|
-
* }
|
|
360
|
-
* );
|
|
361
|
-
* ```
|
|
352
|
+
* Custom integrations module for calling pre-configured external APIs.
|
|
362
353
|
*/
|
|
363
354
|
custom: CustomIntegrationsModule;
|
|
364
355
|
} & {
|