@base44-preview/sdk 0.8.18-pr.117.84e1a4f → 0.8.18-pr.120.baff2e3

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/README.md CHANGED
@@ -9,31 +9,32 @@ You can use it in two ways:
9
9
 
10
10
  ## Installation
11
11
 
12
- Install the SDK via npm:
12
+ **Inside Base44 apps**: The SDK is already available. No installation needed.
13
+
14
+ **External apps**: Install the SDK via npm:
13
15
 
14
16
  ```bash
15
17
  npm install @base44/sdk
16
18
  ```
17
19
 
18
- > **Note**: In Base44-generated apps, the SDK is already installed for you.
19
-
20
20
  ## Modules
21
21
 
22
22
  The SDK provides access to Base44's functionality through the following modules:
23
23
 
24
24
  - **[`agents`](https://docs.base44.com/developers/references/sdk/docs/interfaces/agents)**: Interact with AI agents and manage conversations.
25
+ - **[`analytics`](https://docs.base44.com/developers/references/sdk/docs/interfaces/analytics)**: Track custom events in your app.
25
26
  - **[`app-logs`](https://docs.base44.com/developers/references/sdk/docs/interfaces/app-logs)**: Access and query app logs.
26
27
  - **[`auth`](https://docs.base44.com/developers/references/sdk/docs/interfaces/auth)**: Manage user authentication, registration, and session handling.
27
28
  - **[`connectors`](https://docs.base44.com/developers/references/sdk/docs/interfaces/connectors)**: Manage OAuth connections and access tokens for third-party services.
28
29
  - **[`entities`](https://docs.base44.com/developers/references/sdk/docs/interfaces/entities)**: Work with your app's data entities using CRUD operations.
29
30
  - **[`functions`](https://docs.base44.com/developers/references/sdk/docs/interfaces/functions)**: Execute backend functions.
30
- - **[`integrations`](https://docs.base44.com/developers/references/sdk/docs/type-aliases/integrations)**: Pre-built integrations for external services.
31
+ - **[`integrations`](https://docs.base44.com/developers/references/sdk/docs/type-aliases/integrations)**: Access pre-built and third-party integrations.
31
32
 
32
- ## Quick starts
33
+ ## Quickstarts
33
34
 
34
- How you get started depends on your context:
35
+ How you get started depends on whether you're working inside a Base44-generated app or building your own.
35
36
 
36
- ### Inside a Base44 app
37
+ ### Inside Base44 apps
37
38
 
38
39
  In Base44-generated apps, the client is pre-configured. Just import and use it:
39
40
 
@@ -58,32 +59,32 @@ const tasks = await base44.entities.Task.list();
58
59
 
59
60
  ### External apps
60
61
 
61
- When using Base44 as a backend for your own app, create and configure the client yourself:
62
+ When using Base44 as a backend for your own app, install the SDK and create the client yourself:
62
63
 
63
64
  ```typescript
64
- import { createClient } from '@base44/sdk';
65
+ import { createClient } from "@base44/sdk";
65
66
 
66
67
  // Create a client for your Base44 app
67
68
  const base44 = createClient({
68
- appId: 'your-app-id' // Find this in the Base44 editor URL
69
+ appId: "your-app-id", // Find this in the Base44 editor URL
69
70
  });
70
71
 
71
- // Read public data (anonymous access)
72
+ // Read public data
72
73
  const products = await base44.entities.Products.list();
73
74
 
74
75
  // Authenticate a user (token is automatically set)
75
- await base44.auth.loginViaEmailPassword('user@example.com', 'password');
76
+ await base44.auth.loginViaEmailPassword("user@example.com", "password");
76
77
 
77
- // Now operations use the authenticated user's permissions
78
+ // Access user's data
78
79
  const userOrders = await base44.entities.Orders.list();
79
80
  ```
80
81
 
81
82
  ### Service role
82
83
 
83
- For backend code that needs admin-level access, use the service role. Service role is only available in Base44-hosted backend functions:
84
+ By default, the client operates with user-level permissions, limiting access to what the current user can see and do. The service role provides elevated permissions for backend operations and is only available in Base44-hosted backend functions. External backends can't use service role permissions.
84
85
 
85
86
  ```typescript
86
- import { createClientFromRequest } from 'npm:@base44/sdk';
87
+ import { createClientFromRequest } from "npm:@base44/sdk";
87
88
 
88
89
  Deno.serve(async (req) => {
89
90
  const base44 = createClientFromRequest(req);
@@ -97,7 +98,15 @@ Deno.serve(async (req) => {
97
98
 
98
99
  ## Learn more
99
100
 
100
- For complete documentation, guides, and API reference, visit the **[Base44 SDK Documentation](https://docs.base44.com/developers/landing)**.
101
+ The best way to get started with the JavaScript SDK is to have Base44 build an app for you. Once you have an app, you can explore the generated code and experiment with the SDK to see how it works in practice. You can also ask Base44 to demonstrate specific features of the SDK.
102
+
103
+ For a deeper understanding, check out these guides:
104
+
105
+ 1. [Base44 client](https://docs.base44.com/developers/references/sdk/getting-started/client) - Work with the client in frontend, backend, and external app contexts.
106
+ 2. [Work with data](https://docs.base44.com/developers/references/sdk/getting-started/work-with-data) - Create, read, update, and delete data.
107
+ 3. [Common SDK patterns](https://docs.base44.com/developers/references/sdk/getting-started/work-with-sdk) - Authentication, integrations, functions, and error handling.
108
+
109
+ For the complete documentation and API reference, visit the **[Base44 Developer Docs](https://docs.base44.com/developers/home)**.
101
110
 
102
111
  ## Development
103
112
 
package/dist/index.d.ts CHANGED
@@ -4,11 +4,11 @@ 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, EntityTypeRegistry, RealtimeEventType, RealtimeEvent, RealtimeCallback, } from "./modules/entities.types.js";
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
- export type { FunctionsModule, FunctionNameRegistry, } from "./modules/functions.types.js";
11
- export type { AgentsModule, AgentNameRegistry, AgentConversation, AgentMessage, AgentMessageReasoning, AgentMessageToolCall, AgentMessageUsage, AgentMessageCustomContext, AgentMessageMetadata, CreateConversationParams, } from "./modules/agents.types.js";
10
+ export type { FunctionsModule } from "./modules/functions.types.js";
11
+ export type { AgentsModule, 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
14
  export type { ConnectorsModule } from "./modules/connectors.types.js";
@@ -1,16 +1,6 @@
1
1
  import { AxiosInstance } from "axios";
2
2
  import { RoomsSocket } from "../utils/socket-utils.js";
3
3
  import { ModelFilterParams } from "../types.js";
4
- /**
5
- * Registry of agent names.
6
- * Augment this interface to enable autocomplete for agent names.
7
- */
8
- export interface AgentNameRegistry {
9
- }
10
- /**
11
- * Agent name type - uses registry keys if augmented, otherwise string.
12
- */
13
- export type AgentName = keyof AgentNameRegistry extends never ? string : keyof AgentNameRegistry;
14
4
  /**
15
5
  * Reasoning information for an agent message.
16
6
  *
@@ -137,7 +127,7 @@ export interface AgentMessage {
137
127
  */
138
128
  export interface CreateConversationParams {
139
129
  /** The name of the agent to create a conversation with. */
140
- agent_name: AgentName;
130
+ agent_name: string;
141
131
  /** Optional metadata to attach to the conversation. */
142
132
  metadata?: Record<string, any>;
143
133
  }
@@ -352,5 +342,5 @@ export interface AgentsModule {
352
342
  * // User can open this URL to start a WhatsApp conversation
353
343
  * ```
354
344
  */
355
- getWhatsAppConnectURL(agentName: AgentName): string;
345
+ getWhatsAppConnectURL(agentName: string): string;
356
346
  }
@@ -70,12 +70,6 @@ export interface ImportResult<T = any> {
70
70
  * ```
71
71
  */
72
72
  export type SortField<T> = (keyof T & string) | `+${keyof T & string}` | `-${keyof T & string}`;
73
- /**
74
- * Registry mapping entity names to their TypeScript types.
75
- * Augment this interface to enable type-safe entity access.
76
- */
77
- export interface EntityTypeRegistry {
78
- }
79
73
  /**
80
74
  * Entity handler providing CRUD operations for a specific entity type.
81
75
  *
@@ -282,7 +276,7 @@ export interface EntityHandler<T = any> {
282
276
  * status: 'completed',
283
277
  * priority: 'low'
284
278
  * });
285
- * console.log('Deleted:', result.deleted);
279
+ * console.log('Deleted:', result);
286
280
  * ```
287
281
  */
288
282
  deleteMany(query: Partial<T>): Promise<DeleteManyResult>;
@@ -323,7 +317,7 @@ export interface EntityHandler<T = any> {
323
317
  * if (file) {
324
318
  * const result = await base44.entities.MyEntity.importEntities(file);
325
319
  * if (result.status === 'success' && result.output) {
326
- * console.log(`Imported ${result.output?.length} records`);
320
+ * console.log(`Imported ${result.output.length} records`);
327
321
  * }
328
322
  * }
329
323
  * };
@@ -357,18 +351,6 @@ export interface EntityHandler<T = any> {
357
351
  */
358
352
  subscribe(callback: RealtimeCallback<T>): () => void;
359
353
  }
360
- /**
361
- * Typed entities module - maps registry keys to typed handlers.
362
- */
363
- type TypedEntitiesModule = {
364
- [K in keyof EntityTypeRegistry]: EntityHandler<EntityTypeRegistry[K]>;
365
- };
366
- /**
367
- * Dynamic entities module - allows any entity name with untyped handler.
368
- */
369
- type DynamicEntitiesModule = {
370
- [entityName: string]: EntityHandler<any>;
371
- };
372
354
  /**
373
355
  * Entities module for managing app data.
374
356
  *
@@ -402,5 +384,18 @@ type DynamicEntitiesModule = {
402
384
  * const allUsers = await base44.asServiceRole.entities.User.list();
403
385
  * ```
404
386
  */
405
- export type EntitiesModule = TypedEntitiesModule & DynamicEntitiesModule;
406
- export {};
387
+ export interface EntitiesModule {
388
+ /**
389
+ * Access any entity by name.
390
+ *
391
+ * Use this to access entities defined in the app.
392
+ *
393
+ * @example
394
+ * ```typescript
395
+ * // Access entities dynamically
396
+ * base44.entities.MyEntity
397
+ * base44.entities.AnotherEntity
398
+ * ```
399
+ */
400
+ [entityName: string]: EntityHandler<any>;
401
+ }
@@ -1,13 +1,3 @@
1
- /**
2
- * Registry of function names.
3
- * Augment this interface to enable autocomplete for function names.
4
- */
5
- export interface FunctionNameRegistry {
6
- }
7
- /**
8
- * Function name type - uses registry keys if augmented, otherwise string.
9
- */
10
- export type FunctionName = keyof FunctionNameRegistry extends never ? string : keyof FunctionNameRegistry;
11
1
  /**
12
2
  * Functions module for invoking custom backend functions.
13
3
  *
@@ -56,5 +46,5 @@ export interface FunctionsModule {
56
46
  * };
57
47
  * ```
58
48
  */
59
- invoke(functionName: FunctionName, data?: Record<string, any>): Promise<any>;
49
+ invoke(functionName: string, data: Record<string, any>): Promise<any>;
60
50
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@base44-preview/sdk",
3
- "version": "0.8.18-pr.117.84e1a4f",
3
+ "version": "0.8.18-pr.120.baff2e3",
4
4
  "description": "JavaScript SDK for Base44 API",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",