@base44-preview/sdk 0.8.13-pr.63.6dc705a → 0.8.13-pr.70.e91dc9c
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 +11 -10
- package/dist/client.types.d.ts +0 -5
- package/dist/index.d.ts +1 -1
- package/dist/modules/agents.types.d.ts +2 -2
- package/dist/modules/connectors.types.d.ts +4 -6
- package/dist/modules/custom-integrations.types.d.ts +49 -55
- package/dist/modules/entities.d.ts +12 -3
- package/dist/modules/entities.js +47 -5
- package/dist/modules/entities.types.d.ts +45 -0
- package/dist/modules/integrations.types.d.ts +17 -26
- package/package.json +1 -1
package/dist/client.js
CHANGED
|
@@ -47,11 +47,7 @@ import { createAnalyticsModule } from "./modules/analytics.js";
|
|
|
47
47
|
* ```
|
|
48
48
|
*/
|
|
49
49
|
export function createClient(config) {
|
|
50
|
-
const { serverUrl = "https://base44.app", appId, token, serviceToken, requiresAuth = false, appBaseUrl, options, functionsVersion, headers: optionalHeaders,
|
|
51
|
-
// Config takes precedence, fallback to URL query param in browser
|
|
52
|
-
const urlHasStagingDb = typeof window !== "undefined"
|
|
53
|
-
&& new URLSearchParams(window.location.search).get("use_staging_db") === "true";
|
|
54
|
-
const useStagingDb = configUseStagingDb !== null && configUseStagingDb !== void 0 ? configUseStagingDb : urlHasStagingDb;
|
|
50
|
+
const { serverUrl = "https://base44.app", appId, token, serviceToken, requiresAuth = false, appBaseUrl, options, functionsVersion, headers: optionalHeaders, } = config;
|
|
55
51
|
const socketConfig = {
|
|
56
52
|
serverUrl,
|
|
57
53
|
mountPath: "/ws-user-apps/socket.io/",
|
|
@@ -71,7 +67,6 @@ export function createClient(config) {
|
|
|
71
67
|
const headers = {
|
|
72
68
|
...optionalHeaders,
|
|
73
69
|
"X-App-Id": String(appId),
|
|
74
|
-
"Base44-Use-Staging-DB": String(useStagingDb),
|
|
75
70
|
};
|
|
76
71
|
const functionHeaders = functionsVersion
|
|
77
72
|
? {
|
|
@@ -109,7 +104,11 @@ export function createClient(config) {
|
|
|
109
104
|
serverUrl,
|
|
110
105
|
});
|
|
111
106
|
const userModules = {
|
|
112
|
-
entities: createEntitiesModule(
|
|
107
|
+
entities: createEntitiesModule({
|
|
108
|
+
axios: axiosClient,
|
|
109
|
+
appId,
|
|
110
|
+
getSocket,
|
|
111
|
+
}),
|
|
113
112
|
integrations: createIntegrationsModule(axiosClient, appId),
|
|
114
113
|
auth: userAuthModule,
|
|
115
114
|
functions: createFunctionsModule(functionsAxiosClient, appId),
|
|
@@ -136,7 +135,11 @@ export function createClient(config) {
|
|
|
136
135
|
},
|
|
137
136
|
};
|
|
138
137
|
const serviceRoleModules = {
|
|
139
|
-
entities: createEntitiesModule(
|
|
138
|
+
entities: createEntitiesModule({
|
|
139
|
+
axios: serviceRoleAxiosClient,
|
|
140
|
+
appId,
|
|
141
|
+
getSocket,
|
|
142
|
+
}),
|
|
140
143
|
integrations: createIntegrationsModule(serviceRoleAxiosClient, appId),
|
|
141
144
|
sso: createSsoModule(serviceRoleAxiosClient, appId, token),
|
|
142
145
|
connectors: createConnectorsModule(serviceRoleAxiosClient, appId),
|
|
@@ -304,7 +307,6 @@ export function createClientFromRequest(request) {
|
|
|
304
307
|
const appId = request.headers.get("Base44-App-Id");
|
|
305
308
|
const serverUrlHeader = request.headers.get("Base44-Api-Url");
|
|
306
309
|
const functionsVersion = request.headers.get("Base44-Functions-Version");
|
|
307
|
-
const useStagingDb = request.headers.get("Base44-Use-Staging-DB") === "true";
|
|
308
310
|
const stateHeader = request.headers.get("Base44-State");
|
|
309
311
|
if (!appId) {
|
|
310
312
|
throw new Error("Base44-App-Id header is required, but is was not found on the request");
|
|
@@ -339,7 +341,6 @@ export function createClientFromRequest(request) {
|
|
|
339
341
|
token: userToken,
|
|
340
342
|
serviceToken: serviceRoleToken,
|
|
341
343
|
functionsVersion: functionsVersion !== null && functionsVersion !== void 0 ? functionsVersion : undefined,
|
|
342
|
-
useStagingDb: useStagingDb !== null && useStagingDb !== void 0 ? useStagingDb : undefined,
|
|
343
344
|
headers: additionalHeaders,
|
|
344
345
|
});
|
|
345
346
|
}
|
package/dist/client.types.d.ts
CHANGED
|
@@ -60,11 +60,6 @@ export interface CreateClientConfig {
|
|
|
60
60
|
* @internal
|
|
61
61
|
*/
|
|
62
62
|
headers?: Record<string, string>;
|
|
63
|
-
/**
|
|
64
|
-
* Whether to use the staging database. Defaults to false.
|
|
65
|
-
* When true, API requests will use the staging database instead of production.
|
|
66
|
-
*/
|
|
67
|
-
useStagingDb?: boolean;
|
|
68
63
|
/**
|
|
69
64
|
* Additional client options.
|
|
70
65
|
*/
|
package/dist/index.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ import { getAccessToken, saveAccessToken, removeAccessToken, getLoginUrl } from
|
|
|
4
4
|
export { createClient, createClientFromRequest, Base44Error, getAccessToken, saveAccessToken, removeAccessToken, getLoginUrl, };
|
|
5
5
|
export type { Base44Client, CreateClientConfig, CreateClientOptions, Base44ErrorJSON, };
|
|
6
6
|
export * from "./types.js";
|
|
7
|
-
export type { EntitiesModule, EntityHandler, } from "./modules/entities.types.js";
|
|
7
|
+
export type { EntitiesModule, EntityHandler, RealtimeEventType, RealtimeEvent, RealtimeCallback, Subscription, } from "./modules/entities.types.js";
|
|
8
8
|
export type { AuthModule, LoginResponse, RegisterParams, VerifyOtpParams, ChangePasswordParams, ResetPasswordParams, User, } from "./modules/auth.types.js";
|
|
9
9
|
export type { IntegrationsModule, IntegrationPackage, 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 } from "./modules/functions.types.js";
|
|
@@ -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;
|
|
@@ -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.
|
|
@@ -3,20 +3,23 @@
|
|
|
3
3
|
*/
|
|
4
4
|
export interface CustomIntegrationCallParams {
|
|
5
5
|
/**
|
|
6
|
-
* Request body
|
|
6
|
+
* Request body to send to the external API. The payload is JSON-serialized before being sent.
|
|
7
7
|
*/
|
|
8
8
|
payload?: Record<string, any>;
|
|
9
9
|
/**
|
|
10
|
-
* Path parameters to substitute
|
|
10
|
+
* Path parameters to substitute into the URL template.
|
|
11
|
+
* For example, if the API endpoint is `/repos/{owner}/{repo}/issues`,
|
|
12
|
+
* pass `{ owner: "myorg", repo: "myrepo" }`.
|
|
11
13
|
*/
|
|
12
14
|
pathParams?: Record<string, string>;
|
|
13
15
|
/**
|
|
14
16
|
* Query string parameters to append to the URL.
|
|
17
|
+
* For example, `{ state: "open", per_page: 50 }` becomes `?state=open&per_page=50`.
|
|
15
18
|
*/
|
|
16
19
|
queryParams?: Record<string, any>;
|
|
17
20
|
/**
|
|
18
|
-
* Additional headers to
|
|
19
|
-
* These are merged with the integration
|
|
21
|
+
* Additional HTTP headers to include in the request.
|
|
22
|
+
* These headers are merged with any headers configured for the integration itself, with headers specified here taking precedence in case of conflicts.
|
|
20
23
|
*/
|
|
21
24
|
headers?: Record<string, string>;
|
|
22
25
|
}
|
|
@@ -33,66 +36,25 @@ export interface CustomIntegrationCallResponse {
|
|
|
33
36
|
*/
|
|
34
37
|
status_code: number;
|
|
35
38
|
/**
|
|
36
|
-
* The response
|
|
37
|
-
*
|
|
39
|
+
* The parsed JSON response body from the external API.
|
|
40
|
+
* The structure depends on the API endpoint being called.
|
|
38
41
|
*/
|
|
39
42
|
data: any;
|
|
40
43
|
}
|
|
41
44
|
/**
|
|
42
|
-
*
|
|
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
|
-
* );
|
|
64
|
-
*
|
|
65
|
-
* if (response.success) {
|
|
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
|
-
* ```
|
|
45
|
+
* Custom integrations module for calling workspace-level API integrations.
|
|
88
46
|
*/
|
|
89
47
|
export interface CustomIntegrationsModule {
|
|
90
48
|
/**
|
|
91
49
|
* Call a custom integration endpoint.
|
|
92
50
|
*
|
|
93
|
-
*
|
|
94
|
-
*
|
|
95
|
-
*
|
|
51
|
+
* Custom integrations are external APIs that have been pre-configured by a workspace administrator who imports an OpenAPI specification. Each integration is identified by a slug and exposes operations defined in the specification.
|
|
52
|
+
*
|
|
53
|
+
* Requests are proxied through Base44's backend, so API credentials aren't exposed. That means you can safely use this method to call external APIs from frontend code.
|
|
54
|
+
*
|
|
55
|
+
* @param slug - The integration's unique identifier, as defined by the workspace admin.
|
|
56
|
+
* @param operationId - The operation ID from the OpenAPI specification, such as `"listIssues"` or `"getUser"`.
|
|
57
|
+
* @param params - Optional parameters to send to the external API.
|
|
96
58
|
* @returns Promise resolving to the integration call response.
|
|
97
59
|
*
|
|
98
60
|
* @throws {Error} If slug is not provided.
|
|
@@ -100,6 +62,38 @@ export interface CustomIntegrationsModule {
|
|
|
100
62
|
* @throws {Base44Error} If the integration or operation is not found (404).
|
|
101
63
|
* @throws {Base44Error} If the external API call fails (502).
|
|
102
64
|
* @throws {Base44Error} If the request times out (504).
|
|
65
|
+
*
|
|
66
|
+
* @example
|
|
67
|
+
* ```typescript
|
|
68
|
+
* // GET request with path and query parameters
|
|
69
|
+
* const response = await base44.integrations.custom.call(
|
|
70
|
+
* "github",
|
|
71
|
+
* "listRepoIssues",
|
|
72
|
+
* {
|
|
73
|
+
* pathParams: { owner: "myorg", repo: "myrepo" },
|
|
74
|
+
* queryParams: { state: "open", per_page: 50 }
|
|
75
|
+
* }
|
|
76
|
+
* );
|
|
77
|
+
*
|
|
78
|
+
* if (response.success) {
|
|
79
|
+
* console.log("Found issues:", response.data.length);
|
|
80
|
+
* }
|
|
81
|
+
* ```
|
|
82
|
+
*
|
|
83
|
+
* @example
|
|
84
|
+
* ```typescript
|
|
85
|
+
* // POST request with a JSON body
|
|
86
|
+
* const response = await base44.integrations.custom.call(
|
|
87
|
+
* "slack",
|
|
88
|
+
* "postMessage",
|
|
89
|
+
* {
|
|
90
|
+
* payload: {
|
|
91
|
+
* channel: "#general",
|
|
92
|
+
* text: "Hello from Base44!"
|
|
93
|
+
* }
|
|
94
|
+
* }
|
|
95
|
+
* );
|
|
96
|
+
* ```
|
|
103
97
|
*/
|
|
104
98
|
call(slug: string, operationId: string, params?: CustomIntegrationCallParams): Promise<CustomIntegrationCallResponse>;
|
|
105
99
|
}
|
|
@@ -1,11 +1,20 @@
|
|
|
1
1
|
import { AxiosInstance } from "axios";
|
|
2
2
|
import { EntitiesModule } from "./entities.types";
|
|
3
|
+
import { RoomsSocket } from "../utils/socket-utils.js";
|
|
4
|
+
/**
|
|
5
|
+
* Configuration for the entities module.
|
|
6
|
+
* @internal
|
|
7
|
+
*/
|
|
8
|
+
export interface EntitiesModuleConfig {
|
|
9
|
+
axios: AxiosInstance;
|
|
10
|
+
appId: string;
|
|
11
|
+
getSocket: () => ReturnType<typeof RoomsSocket>;
|
|
12
|
+
}
|
|
3
13
|
/**
|
|
4
14
|
* Creates the entities module for the Base44 SDK.
|
|
5
15
|
*
|
|
6
|
-
* @param
|
|
7
|
-
* @param appId - Application ID
|
|
16
|
+
* @param config - Configuration object containing axios, appId, and getSocket
|
|
8
17
|
* @returns Entities module with dynamic entity access
|
|
9
18
|
* @internal
|
|
10
19
|
*/
|
|
11
|
-
export declare function createEntitiesModule(
|
|
20
|
+
export declare function createEntitiesModule(config: EntitiesModuleConfig): EntitiesModule;
|
package/dist/modules/entities.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Creates the entities module for the Base44 SDK.
|
|
3
3
|
*
|
|
4
|
-
* @param
|
|
5
|
-
* @param appId - Application ID
|
|
4
|
+
* @param config - Configuration object containing axios, appId, and getSocket
|
|
6
5
|
* @returns Entities module with dynamic entity access
|
|
7
6
|
* @internal
|
|
8
7
|
*/
|
|
9
|
-
export function createEntitiesModule(
|
|
8
|
+
export function createEntitiesModule(config) {
|
|
9
|
+
const { axios, appId, getSocket } = config;
|
|
10
10
|
// Using Proxy to dynamically handle entity names
|
|
11
11
|
return new Proxy({}, {
|
|
12
12
|
get(target, entityName) {
|
|
@@ -17,20 +17,41 @@ export function createEntitiesModule(axios, appId) {
|
|
|
17
17
|
return undefined;
|
|
18
18
|
}
|
|
19
19
|
// Create entity handler
|
|
20
|
-
return createEntityHandler(axios, appId, entityName);
|
|
20
|
+
return createEntityHandler(axios, appId, entityName, getSocket);
|
|
21
21
|
},
|
|
22
22
|
});
|
|
23
23
|
}
|
|
24
|
+
/**
|
|
25
|
+
* Parses the realtime message data and extracts event information.
|
|
26
|
+
* @internal
|
|
27
|
+
*/
|
|
28
|
+
function parseRealtimeMessage(dataStr) {
|
|
29
|
+
var _a;
|
|
30
|
+
try {
|
|
31
|
+
const parsed = JSON.parse(dataStr);
|
|
32
|
+
return {
|
|
33
|
+
type: parsed.type,
|
|
34
|
+
data: parsed.data,
|
|
35
|
+
id: parsed.id || ((_a = parsed.data) === null || _a === void 0 ? void 0 : _a.id),
|
|
36
|
+
timestamp: parsed.timestamp || new Date().toISOString(),
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
catch (error) {
|
|
40
|
+
console.warn("[Base44 SDK] Failed to parse realtime message:", error);
|
|
41
|
+
return null;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
24
44
|
/**
|
|
25
45
|
* Creates a handler for a specific entity.
|
|
26
46
|
*
|
|
27
47
|
* @param axios - Axios instance
|
|
28
48
|
* @param appId - Application ID
|
|
29
49
|
* @param entityName - Entity name
|
|
50
|
+
* @param getSocket - Function to get the socket instance
|
|
30
51
|
* @returns Entity handler with CRUD methods
|
|
31
52
|
* @internal
|
|
32
53
|
*/
|
|
33
|
-
function createEntityHandler(axios, appId, entityName) {
|
|
54
|
+
function createEntityHandler(axios, appId, entityName, getSocket) {
|
|
34
55
|
const baseURL = `/apps/${appId}/entities/${entityName}`;
|
|
35
56
|
return {
|
|
36
57
|
// List entities with optional pagination and sorting
|
|
@@ -95,5 +116,26 @@ function createEntityHandler(axios, appId, entityName) {
|
|
|
95
116
|
},
|
|
96
117
|
});
|
|
97
118
|
},
|
|
119
|
+
// Subscribe to realtime updates
|
|
120
|
+
subscribe(callback) {
|
|
121
|
+
const room = `entities:${appId}:${entityName}`;
|
|
122
|
+
// Get the socket and subscribe to the room
|
|
123
|
+
const socket = getSocket();
|
|
124
|
+
const unsubscribe = socket.subscribeToRoom(room, {
|
|
125
|
+
update_model: (msg) => {
|
|
126
|
+
const event = parseRealtimeMessage(msg.data);
|
|
127
|
+
if (!event) {
|
|
128
|
+
return;
|
|
129
|
+
}
|
|
130
|
+
try {
|
|
131
|
+
callback(event);
|
|
132
|
+
}
|
|
133
|
+
catch (error) {
|
|
134
|
+
console.error("[Base44 SDK] Subscription callback error:", error);
|
|
135
|
+
}
|
|
136
|
+
},
|
|
137
|
+
});
|
|
138
|
+
return unsubscribe;
|
|
139
|
+
},
|
|
98
140
|
};
|
|
99
141
|
}
|
|
@@ -1,3 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Event types for realtime entity updates.
|
|
3
|
+
*/
|
|
4
|
+
export type RealtimeEventType = "create" | "update" | "delete";
|
|
5
|
+
/**
|
|
6
|
+
* Payload received when a realtime event occurs.
|
|
7
|
+
*/
|
|
8
|
+
export interface RealtimeEvent {
|
|
9
|
+
/** The type of change that occurred */
|
|
10
|
+
type: RealtimeEventType;
|
|
11
|
+
/** The entity data */
|
|
12
|
+
data: any;
|
|
13
|
+
/** The unique identifier of the affected entity */
|
|
14
|
+
id: string;
|
|
15
|
+
/** ISO 8601 timestamp of when the event occurred */
|
|
16
|
+
timestamp: string;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Callback function invoked when a realtime event occurs.
|
|
20
|
+
*/
|
|
21
|
+
export type RealtimeCallback = (event: RealtimeEvent) => void;
|
|
22
|
+
/**
|
|
23
|
+
* Function returned from subscribe, call it to unsubscribe.
|
|
24
|
+
*/
|
|
25
|
+
export type Subscription = () => void;
|
|
1
26
|
/**
|
|
2
27
|
* Entity handler providing CRUD operations for a specific entity type.
|
|
3
28
|
*
|
|
@@ -242,6 +267,26 @@ export interface EntityHandler {
|
|
|
242
267
|
* ```
|
|
243
268
|
*/
|
|
244
269
|
importEntities(file: File): Promise<any>;
|
|
270
|
+
/**
|
|
271
|
+
* Subscribes to realtime updates for all records of this entity type.
|
|
272
|
+
*
|
|
273
|
+
* Receives notifications whenever any record is created, updated, or deleted.
|
|
274
|
+
*
|
|
275
|
+
* @param callback - Function called when an entity changes.
|
|
276
|
+
* @returns Unsubscribe function to stop listening.
|
|
277
|
+
*
|
|
278
|
+
* @example
|
|
279
|
+
* ```typescript
|
|
280
|
+
* // Subscribe to all Task changes
|
|
281
|
+
* const unsubscribe = base44.entities.Task.subscribe((event) => {
|
|
282
|
+
* console.log(`Task ${event.id} was ${event.type}d:`, event.data);
|
|
283
|
+
* });
|
|
284
|
+
*
|
|
285
|
+
* // Later, unsubscribe
|
|
286
|
+
* unsubscribe();
|
|
287
|
+
* ```
|
|
288
|
+
*/
|
|
289
|
+
subscribe(callback: RealtimeCallback): Subscription;
|
|
245
290
|
}
|
|
246
291
|
/**
|
|
247
292
|
* Entities module for managing app data.
|
|
@@ -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
|
} & {
|