@base44-preview/sdk 0.8.18-pr.78.cf66512 → 0.8.18-pr.79.454901f
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 +18 -18
- package/dist/index.d.ts +1 -1
- package/dist/modules/agents.types.d.ts +15 -9
- package/dist/modules/analytics.types.d.ts +79 -3
- package/dist/modules/auth.types.d.ts +2 -0
- package/dist/modules/connectors.types.d.ts +4 -6
- package/dist/modules/custom-integrations.types.d.ts +38 -54
- package/dist/modules/entities.types.d.ts +11 -9
- package/dist/modules/integrations.types.d.ts +17 -26
- package/package.json +3 -1
package/dist/client.types.d.ts
CHANGED
|
@@ -74,20 +74,20 @@ export interface CreateClientConfig {
|
|
|
74
74
|
* Provides access to all SDK modules for interacting with the app.
|
|
75
75
|
*/
|
|
76
76
|
export interface Base44Client {
|
|
77
|
-
/** {@link EntitiesModule | Entities module} for CRUD operations on your data models. */
|
|
78
|
-
entities: EntitiesModule;
|
|
79
|
-
/** {@link IntegrationsModule | Integrations module} for calling pre-built integration endpoints. */
|
|
80
|
-
integrations: IntegrationsModule;
|
|
81
|
-
/** {@link AuthModule | Auth module} for user authentication and management. */
|
|
82
|
-
auth: AuthModule;
|
|
83
|
-
/** {@link FunctionsModule | Functions module} for invoking custom backend functions. */
|
|
84
|
-
functions: FunctionsModule;
|
|
85
77
|
/** {@link AgentsModule | Agents module} for managing AI agent conversations. */
|
|
86
78
|
agents: AgentsModule;
|
|
79
|
+
/** {@link AnalyticsModule | Analytics module} for tracking custom events in your app. */
|
|
80
|
+
analytics: AnalyticsModule;
|
|
87
81
|
/** {@link AppLogsModule | App logs module} for tracking app usage. */
|
|
88
82
|
appLogs: AppLogsModule;
|
|
89
|
-
/** {@link
|
|
90
|
-
|
|
83
|
+
/** {@link AuthModule | Auth module} for user authentication and management. */
|
|
84
|
+
auth: AuthModule;
|
|
85
|
+
/** {@link EntitiesModule | Entities module} for CRUD operations on your data models. */
|
|
86
|
+
entities: EntitiesModule;
|
|
87
|
+
/** {@link FunctionsModule | Functions module} for invoking custom backend functions. */
|
|
88
|
+
functions: FunctionsModule;
|
|
89
|
+
/** {@link IntegrationsModule | Integrations module} for calling pre-built integration endpoints. */
|
|
90
|
+
integrations: IntegrationsModule;
|
|
91
91
|
/** Cleanup function to disconnect WebSocket connections. Call when you're done with the client. */
|
|
92
92
|
cleanup: () => void;
|
|
93
93
|
/**
|
|
@@ -115,22 +115,22 @@ export interface Base44Client {
|
|
|
115
115
|
* @throws {Error} When accessed without providing a serviceToken during client creation
|
|
116
116
|
*/
|
|
117
117
|
readonly asServiceRole: {
|
|
118
|
+
/** {@link AgentsModule | Agents module} with elevated permissions. */
|
|
119
|
+
agents: AgentsModule;
|
|
120
|
+
/** {@link AppLogsModule | App logs module} with elevated permissions. */
|
|
121
|
+
appLogs: AppLogsModule;
|
|
122
|
+
/** {@link ConnectorsModule | Connectors module} for OAuth token retrieval. */
|
|
123
|
+
connectors: ConnectorsModule;
|
|
118
124
|
/** {@link EntitiesModule | Entities module} with elevated permissions. */
|
|
119
125
|
entities: EntitiesModule;
|
|
126
|
+
/** {@link FunctionsModule | Functions module} with elevated permissions. */
|
|
127
|
+
functions: FunctionsModule;
|
|
120
128
|
/** {@link IntegrationsModule | Integrations module} with elevated permissions. */
|
|
121
129
|
integrations: IntegrationsModule;
|
|
122
130
|
/** {@link SsoModule | SSO module} for generating SSO tokens.
|
|
123
131
|
* @internal
|
|
124
132
|
*/
|
|
125
133
|
sso: SsoModule;
|
|
126
|
-
/** {@link ConnectorsModule | Connectors module} for OAuth token retrieval. */
|
|
127
|
-
connectors: ConnectorsModule;
|
|
128
|
-
/** {@link FunctionsModule | Functions module} with elevated permissions. */
|
|
129
|
-
functions: FunctionsModule;
|
|
130
|
-
/** {@link AgentsModule | Agents module} with elevated permissions. */
|
|
131
|
-
agents: AgentsModule;
|
|
132
|
-
/** {@link AppLogsModule | App logs module} with elevated permissions. */
|
|
133
|
-
appLogs: AppLogsModule;
|
|
134
134
|
/** Cleanup function to disconnect WebSocket connections. */
|
|
135
135
|
cleanup: () => void;
|
|
136
136
|
};
|
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, RealtimeEventType, RealtimeEvent, RealtimeCallback,
|
|
7
|
+
export type { EntitiesModule, EntityHandler, RealtimeEventType, RealtimeEvent, RealtimeCallback, } 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;
|
|
@@ -138,9 +138,9 @@ export interface CreateConversationParams {
|
|
|
138
138
|
export interface AgentsModuleConfig {
|
|
139
139
|
/** Axios instance for HTTP requests */
|
|
140
140
|
axios: AxiosInstance;
|
|
141
|
-
/** Function to get WebSocket instance for
|
|
141
|
+
/** Function to get WebSocket instance for realtime 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;
|
|
@@ -151,7 +151,7 @@ export interface AgentsModuleConfig {
|
|
|
151
151
|
* Agents module for managing AI agent conversations.
|
|
152
152
|
*
|
|
153
153
|
* This module provides methods to create and manage conversations with AI agents,
|
|
154
|
-
* send messages, and subscribe to
|
|
154
|
+
* send messages, and subscribe to realtime updates. Conversations can be used
|
|
155
155
|
* for chat interfaces, support systems, or any interactive AI app.
|
|
156
156
|
*
|
|
157
157
|
* The agents module enables you to:
|
|
@@ -159,7 +159,7 @@ export interface AgentsModuleConfig {
|
|
|
159
159
|
* - **Create conversations** with agents defined in the app.
|
|
160
160
|
* - **Send messages** from users to agents and receive AI-generated responses.
|
|
161
161
|
* - **Retrieve conversations** individually or as filtered lists with sorting and pagination.
|
|
162
|
-
* - **Subscribe to
|
|
162
|
+
* - **Subscribe to realtime updates** using WebSocket connections to receive instant notifications when new messages arrive.
|
|
163
163
|
* - **Attach metadata** to conversations for tracking context, categories, priorities, or linking to external systems.
|
|
164
164
|
* - **Generate WhatsApp connection URLs** for users to interact with agents through WhatsApp.
|
|
165
165
|
*
|
|
@@ -275,7 +275,7 @@ export interface AgentsModule {
|
|
|
275
275
|
* Adds a message to a conversation.
|
|
276
276
|
*
|
|
277
277
|
* Sends a message to the agent and updates the conversation. This method
|
|
278
|
-
* also updates the
|
|
278
|
+
* also updates the realtime socket to notify any subscribers.
|
|
279
279
|
*
|
|
280
280
|
* @param conversation - The conversation to add the message to.
|
|
281
281
|
* @param message - The message to add.
|
|
@@ -293,19 +293,25 @@ export interface AgentsModule {
|
|
|
293
293
|
*/
|
|
294
294
|
addMessage(conversation: AgentConversation, message: Partial<AgentMessage>): Promise<AgentMessage>;
|
|
295
295
|
/**
|
|
296
|
-
* Subscribes to
|
|
296
|
+
* Subscribes to realtime updates for a conversation.
|
|
297
297
|
*
|
|
298
298
|
* Establishes a WebSocket connection to receive instant updates when new
|
|
299
299
|
* messages are added to the conversation. Returns an unsubscribe function
|
|
300
300
|
* to clean up the connection.
|
|
301
301
|
*
|
|
302
302
|
* @param conversationId - The conversation ID to subscribe to.
|
|
303
|
-
* @param onUpdate - Callback function called when the conversation is updated.
|
|
303
|
+
* @param onUpdate - Callback function called when the conversation is updated. The callback receives a conversation object with the following properties:
|
|
304
|
+
* - `id`: Unique identifier for the conversation.
|
|
305
|
+
* - `agent_name`: Name of the agent in this conversation.
|
|
306
|
+
* - `created_date`: ISO 8601 timestamp of when the conversation was created.
|
|
307
|
+
* - `updated_date`: ISO 8601 timestamp of when the conversation was last updated.
|
|
308
|
+
* - `messages`: Array of messages in the conversation. Each message includes `id`, `role` (`'user'`, `'assistant'`, or `'system'`), `content`, `created_date`, and optionally `tool_calls`, `reasoning`, `file_urls`, and `usage`.
|
|
309
|
+
* - `metadata`: Optional metadata associated with the conversation.
|
|
304
310
|
* @returns Unsubscribe function to stop receiving updates.
|
|
305
311
|
*
|
|
306
312
|
* @example
|
|
307
313
|
* ```typescript
|
|
308
|
-
* // Subscribe to
|
|
314
|
+
* // Subscribe to realtime updates
|
|
309
315
|
* const unsubscribe = base44.agents.subscribeToConversation(
|
|
310
316
|
* 'conv-123',
|
|
311
317
|
* (updatedConversation) => {
|
|
@@ -1,8 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Properties for analytics events.
|
|
3
|
+
*
|
|
4
|
+
* Key-value pairs with additional event data. Values can be strings, numbers, booleans, or null.
|
|
5
|
+
*/
|
|
1
6
|
export type TrackEventProperties = {
|
|
2
7
|
[key: string]: string | number | boolean | null | undefined;
|
|
3
8
|
};
|
|
9
|
+
/**
|
|
10
|
+
* Parameters for tracking an analytics event.
|
|
11
|
+
*/
|
|
4
12
|
export type TrackEventParams = {
|
|
13
|
+
/**
|
|
14
|
+
* Name of the event to track.
|
|
15
|
+
*
|
|
16
|
+
* Use descriptive names like `button_click`, `form_submit`, or `purchase_completed`.
|
|
17
|
+
*/
|
|
5
18
|
eventName: string;
|
|
19
|
+
/**
|
|
20
|
+
* Optional key-value pairs with additional event data.
|
|
21
|
+
*
|
|
22
|
+
* Values can be strings, numbers, booleans, or null.
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* ```typescript
|
|
26
|
+
* base44.analytics.track({
|
|
27
|
+
* eventName: 'add_to_cart',
|
|
28
|
+
* properties: {
|
|
29
|
+
* product_id: 'prod_123',
|
|
30
|
+
* price: 29.99,
|
|
31
|
+
* quantity: 2
|
|
32
|
+
* }
|
|
33
|
+
* });
|
|
34
|
+
* ```
|
|
35
|
+
*/
|
|
6
36
|
properties?: TrackEventProperties;
|
|
7
37
|
};
|
|
8
38
|
export type TrackEventIntrinsicData = {
|
|
@@ -37,6 +67,52 @@ export type AnalyticsModuleOptions = {
|
|
|
37
67
|
batchSize?: number;
|
|
38
68
|
heartBeatInterval?: number;
|
|
39
69
|
};
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
70
|
+
/**
|
|
71
|
+
* Analytics module for tracking custom events in your app.
|
|
72
|
+
*
|
|
73
|
+
* Use this module to track specific user actions. Track things like button clicks, form submissions, purchases, and feature usage.
|
|
74
|
+
*
|
|
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
|
+
*
|
|
77
|
+
* When tracking events:
|
|
78
|
+
*
|
|
79
|
+
* - Choose clear, descriptive event names in snake_case like `signup_button_click` or `purchase_completed` rather than generic names like `click`.
|
|
80
|
+
* - Include relevant context in your properties such as identifiers like `product_id`, measurements like `price`, and flags like `is_first_purchase`.
|
|
81
|
+
*
|
|
82
|
+
* This module is only available in user authentication mode (`base44.analytics`).
|
|
83
|
+
*/
|
|
84
|
+
export interface AnalyticsModule {
|
|
85
|
+
/**
|
|
86
|
+
* Tracks a custom event that appears as a card in your Analytics dashboard.
|
|
87
|
+
*
|
|
88
|
+
* Each unique event name becomes its own card showing total count and trends over time. This method returns immediately and events are sent in batches in the background.
|
|
89
|
+
*
|
|
90
|
+
* @param params - Event parameters.
|
|
91
|
+
* @param params.eventName - Name of the event. This becomes the card title in your dashboard. Use descriptive names like `'signup_button_click'` or `'purchase_completed'`.
|
|
92
|
+
* @param params.properties - Optional data to attach to the event. You can filter and analyze events by these properties in the dashboard.
|
|
93
|
+
*
|
|
94
|
+
* @example Track a button click
|
|
95
|
+
* ```typescript
|
|
96
|
+
* // Track a button click
|
|
97
|
+
* base44.analytics.track({
|
|
98
|
+
* eventName: 'signup_button_click'
|
|
99
|
+
* });
|
|
100
|
+
* ```
|
|
101
|
+
*
|
|
102
|
+
* @example Track with properties
|
|
103
|
+
* ```typescript
|
|
104
|
+
* // Track with properties
|
|
105
|
+
* base44.analytics.track({
|
|
106
|
+
* eventName: 'add_to_cart',
|
|
107
|
+
* properties: {
|
|
108
|
+
* product_id: 'prod_123',
|
|
109
|
+
* product_name: 'Premium Widget',
|
|
110
|
+
* price: 29.99,
|
|
111
|
+
* quantity: 2,
|
|
112
|
+
* is_first_purchase: true
|
|
113
|
+
* }
|
|
114
|
+
* });
|
|
115
|
+
* ```
|
|
116
|
+
*/
|
|
117
|
+
track(params: TrackEventParams): void;
|
|
118
|
+
}
|
|
@@ -176,6 +176,7 @@ export interface AuthModule {
|
|
|
176
176
|
*
|
|
177
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
178
|
*
|
|
179
|
+
* @internal
|
|
179
180
|
* @param provider - Name of the supported authentication provider (e.g., 'google', 'microsoft').
|
|
180
181
|
* @param fromUrl - URL to redirect to after successful authentication. Defaults to '/'.
|
|
181
182
|
*
|
|
@@ -190,6 +191,7 @@ export interface AuthModule {
|
|
|
190
191
|
* // Login with GitHub and redirect to dashboard
|
|
191
192
|
* base44.auth.loginWithProvider('microsoft', '/dashboard');
|
|
192
193
|
* ```
|
|
194
|
+
* @internal
|
|
193
195
|
*/
|
|
194
196
|
loginWithProvider(provider: string, fromUrl?: string): void;
|
|
195
197
|
/**
|
|
@@ -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.
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Parameters for calling a custom integration endpoint.
|
|
3
|
+
* @internal
|
|
3
4
|
*/
|
|
4
5
|
export interface CustomIntegrationCallParams {
|
|
5
6
|
/**
|
|
@@ -7,21 +8,17 @@ export interface CustomIntegrationCallParams {
|
|
|
7
8
|
*/
|
|
8
9
|
payload?: Record<string, any>;
|
|
9
10
|
/**
|
|
10
|
-
* Path parameters to substitute in the URL
|
|
11
|
+
* Path parameters to substitute in the URL. For example, `{ owner: "user", repo: "repo" }`.
|
|
11
12
|
*/
|
|
12
13
|
pathParams?: Record<string, string>;
|
|
13
14
|
/**
|
|
14
15
|
* Query string parameters to append to the URL.
|
|
15
16
|
*/
|
|
16
17
|
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
18
|
}
|
|
23
19
|
/**
|
|
24
20
|
* Response from a custom integration call.
|
|
21
|
+
* @internal
|
|
25
22
|
*/
|
|
26
23
|
export interface CustomIntegrationCallResponse {
|
|
27
24
|
/**
|
|
@@ -39,60 +36,17 @@ export interface CustomIntegrationCallResponse {
|
|
|
39
36
|
data: any;
|
|
40
37
|
}
|
|
41
38
|
/**
|
|
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
|
-
* );
|
|
39
|
+
* Module for calling custom pre-configured API integrations.
|
|
64
40
|
*
|
|
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
|
-
* ```
|
|
41
|
+
* 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
42
|
*/
|
|
89
43
|
export interface CustomIntegrationsModule {
|
|
90
44
|
/**
|
|
91
45
|
* Call a custom integration endpoint.
|
|
92
46
|
*
|
|
93
|
-
* @param slug - The integration's unique identifier
|
|
94
|
-
* @param operationId - The
|
|
95
|
-
* @param params - Optional parameters including payload, pathParams,
|
|
47
|
+
* @param slug - The integration's unique identifier, as defined by the workspace admin.
|
|
48
|
+
* @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.
|
|
49
|
+
* @param params - Optional parameters including payload, pathParams, and queryParams.
|
|
96
50
|
* @returns Promise resolving to the integration call response.
|
|
97
51
|
*
|
|
98
52
|
* @throws {Error} If slug is not provided.
|
|
@@ -100,6 +54,36 @@ export interface CustomIntegrationsModule {
|
|
|
100
54
|
* @throws {Base44Error} If the integration or operation is not found (404).
|
|
101
55
|
* @throws {Base44Error} If the external API call fails (502).
|
|
102
56
|
* @throws {Base44Error} If the request times out (504).
|
|
57
|
+
*
|
|
58
|
+
* @example
|
|
59
|
+
* ```typescript
|
|
60
|
+
* // Call a custom CRM integration
|
|
61
|
+
* const response = await base44.integrations.custom.call(
|
|
62
|
+
* "my-crm",
|
|
63
|
+
* "get:/contacts",
|
|
64
|
+
* { queryParams: { limit: 10 } }
|
|
65
|
+
* );
|
|
66
|
+
*
|
|
67
|
+
* if (response.success) {
|
|
68
|
+
* console.log("Contacts:", response.data);
|
|
69
|
+
* }
|
|
70
|
+
* ```
|
|
71
|
+
*
|
|
72
|
+
* @example
|
|
73
|
+
* ```typescript
|
|
74
|
+
* // Call with path params and request body
|
|
75
|
+
* const response = await base44.integrations.custom.call(
|
|
76
|
+
* "github",
|
|
77
|
+
* "post:/repos/{owner}/{repo}/issues",
|
|
78
|
+
* {
|
|
79
|
+
* pathParams: { owner: "myorg", repo: "myrepo" },
|
|
80
|
+
* payload: {
|
|
81
|
+
* title: "Bug report",
|
|
82
|
+
* body: "Something is broken"
|
|
83
|
+
* }
|
|
84
|
+
* }
|
|
85
|
+
* );
|
|
86
|
+
* ```
|
|
103
87
|
*/
|
|
104
88
|
call(slug: string, operationId: string, params?: CustomIntegrationCallParams): Promise<CustomIntegrationCallResponse>;
|
|
105
89
|
}
|
|
@@ -19,10 +19,6 @@ export interface RealtimeEvent {
|
|
|
19
19
|
* Callback function invoked when a realtime event occurs.
|
|
20
20
|
*/
|
|
21
21
|
export type RealtimeCallback = (event: RealtimeEvent) => void;
|
|
22
|
-
/**
|
|
23
|
-
* Function returned from subscribe, call it to unsubscribe.
|
|
24
|
-
*/
|
|
25
|
-
export type Subscription = () => void;
|
|
26
22
|
/**
|
|
27
23
|
* Entity handler providing CRUD operations for a specific entity type.
|
|
28
24
|
*
|
|
@@ -270,10 +266,16 @@ export interface EntityHandler {
|
|
|
270
266
|
/**
|
|
271
267
|
* Subscribes to realtime updates for all records of this entity type.
|
|
272
268
|
*
|
|
273
|
-
*
|
|
269
|
+
* Establishes a WebSocket connection to receive instant updates when any
|
|
270
|
+
* record is created, updated, or deleted. Returns an unsubscribe function
|
|
271
|
+
* to clean up the connection.
|
|
274
272
|
*
|
|
275
|
-
* @param callback -
|
|
276
|
-
*
|
|
273
|
+
* @param callback - Callback function called when an entity changes. The callback receives an event object with the following properties:
|
|
274
|
+
* - `type`: The type of change that occurred - `'create'`, `'update'`, or `'delete'`.
|
|
275
|
+
* - `data`: The entity data after the change.
|
|
276
|
+
* - `id`: The unique identifier of the affected entity.
|
|
277
|
+
* - `timestamp`: ISO 8601 timestamp of when the event occurred.
|
|
278
|
+
* @returns Unsubscribe function to stop receiving updates.
|
|
277
279
|
*
|
|
278
280
|
* @example
|
|
279
281
|
* ```typescript
|
|
@@ -282,11 +284,11 @@ export interface EntityHandler {
|
|
|
282
284
|
* console.log(`Task ${event.id} was ${event.type}d:`, event.data);
|
|
283
285
|
* });
|
|
284
286
|
*
|
|
285
|
-
* // Later,
|
|
287
|
+
* // Later, clean up the subscription
|
|
286
288
|
* unsubscribe();
|
|
287
289
|
* ```
|
|
288
290
|
*/
|
|
289
|
-
subscribe(callback: RealtimeCallback):
|
|
291
|
+
subscribe(callback: RealtimeCallback): () => void;
|
|
290
292
|
}
|
|
291
293
|
/**
|
|
292
294
|
* 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
|
} & {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@base44-preview/sdk",
|
|
3
|
-
"version": "0.8.18-pr.
|
|
3
|
+
"version": "0.8.18-pr.79.454901f",
|
|
4
4
|
"description": "JavaScript SDK for Base44 API",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -19,7 +19,9 @@
|
|
|
19
19
|
"docs": "typedoc",
|
|
20
20
|
"prepublishOnly": "npm run build",
|
|
21
21
|
"create-docs": "npm run create-docs:generate && npm run create-docs:process",
|
|
22
|
+
"create-docs-local": "npm run create-docs && npm run copy-docs-local",
|
|
22
23
|
"push-docs": "node scripts/mintlify-post-processing/push-to-docs-repo.js",
|
|
24
|
+
"copy-docs-local": "node scripts/mintlify-post-processing/copy-to-local-docs.js",
|
|
23
25
|
"create-docs:generate": "typedoc",
|
|
24
26
|
"create-docs:process": "node scripts/mintlify-post-processing/file-processing/file-processing.js"
|
|
25
27
|
},
|