@base44-preview/sdk 0.8.20-pr.130.bda52d3 → 0.8.20-pr.130.c6776c6

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 CHANGED
@@ -108,7 +108,6 @@ export function createClient(config) {
108
108
  serverUrl,
109
109
  });
110
110
  const userModules = {
111
- axiosClient,
112
111
  entities: createEntitiesModule({
113
112
  axios: axiosClient,
114
113
  appId,
@@ -141,7 +140,6 @@ export function createClient(config) {
141
140
  },
142
141
  };
143
142
  const serviceRoleModules = {
144
- axiosClient: serviceRoleAxiosClient,
145
143
  entities: createEntitiesModule({
146
144
  axios: serviceRoleAxiosClient,
147
145
  appId,
@@ -1,4 +1,3 @@
1
- import type { AxiosInstance } from "axios";
2
1
  import type { EntitiesModule } from "./modules/entities.types.js";
3
2
  import type { IntegrationsModule } from "./modules/integrations.types.js";
4
3
  import type { AuthModule } from "./modules/auth.types.js";
@@ -22,8 +21,13 @@ export interface CreateClientOptions {
22
21
  */
23
22
  export interface CreateClientConfig {
24
23
  /**
25
- * The Base44 server URL. Defaults to "https://base44.app".
26
- * @internal
24
+ * The Base44 server URL.
25
+ *
26
+ * You don't need to set this for production use. The SDK defaults to `https://base44.app`.
27
+ *
28
+ * Set this when using a local development server to point SDK requests at your local machine instead of the hosted backend.
29
+ *
30
+ * @defaultValue `"https://base44.app"`
27
31
  */
28
32
  serverUrl?: string;
29
33
  /**
@@ -83,9 +87,7 @@ export interface Base44Client {
83
87
  appLogs: AppLogsModule;
84
88
  /** {@link AuthModule | Auth module} for user authentication and management. */
85
89
  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. */
90
+ /** {@link UserConnectorsModule | Connectors module} for app-user OAuth flows. */
89
91
  connectors: UserConnectorsModule;
90
92
  /** {@link EntitiesModule | Entities module} for CRUD operations on your data models. */
91
93
  entities: EntitiesModule;
@@ -122,8 +124,6 @@ export interface Base44Client {
122
124
  readonly asServiceRole: {
123
125
  /** {@link AgentsModule | Agents module} with elevated permissions. */
124
126
  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;
127
127
  /** {@link AppLogsModule | App logs module} with elevated permissions. */
128
128
  appLogs: AppLogsModule;
129
129
  /** {@link ConnectorsModule | Connectors module} for OAuth token retrieval. */
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 { DeleteManyResult, DeleteResult, EntitiesModule, EntityHandler, EntityRecord, EntityTypeRegistry, ImportResult, RealtimeEventType, RealtimeEvent, RealtimeCallback, SortField, } from "./modules/entities.types.js";
7
+ export type { DeleteManyResult, DeleteResult, EntitiesModule, EntityHandler, EntityRecord, EntityTypeRegistry, ImportResult, RealtimeEventType, RealtimeEvent, RealtimeCallback, SortField, UpdateManyResult, } 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, 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, FunctionName, FunctionNameRegistry, } from "./modules/functions.types.js";
@@ -10,11 +10,11 @@ import { ConnectorsModule, UserConnectorsModule } from "./connectors.types.js";
10
10
  */
11
11
  export declare function createConnectorsModule(axios: AxiosInstance, appId: string): ConnectorsModule;
12
12
  /**
13
- * Creates the user-scoped Connectors module (end-user OAuth flows).
13
+ * Creates the user-scoped Connectors module (app-user OAuth flows).
14
14
  *
15
15
  * @param axios - Axios instance (user-scoped client)
16
16
  * @param appId - Application ID
17
- * @returns User connectors module with end-user OAuth methods
17
+ * @returns User connectors module with app-user OAuth methods
18
18
  * @internal
19
19
  */
20
20
  export declare function createUserConnectorsModule(axios: AxiosInstance, appId: string): UserConnectorsModule;
@@ -36,11 +36,11 @@ export function createConnectorsModule(axios, appId) {
36
36
  };
37
37
  }
38
38
  /**
39
- * Creates the user-scoped Connectors module (end-user OAuth flows).
39
+ * Creates the user-scoped Connectors module (app-user OAuth flows).
40
40
  *
41
41
  * @param axios - Axios instance (user-scoped client)
42
42
  * @param appId - Application ID
43
- * @returns User connectors module with end-user OAuth methods
43
+ * @returns User connectors module with app-user OAuth methods
44
44
  * @internal
45
45
  */
46
46
  export function createUserConnectorsModule(axios, appId) {
@@ -50,7 +50,7 @@ export function createUserConnectorsModule(axios, appId) {
50
50
  if (!connectorId || typeof connectorId !== "string") {
51
51
  throw new Error("Connector ID is required and must be a string");
52
52
  }
53
- const response = await axios.get(`/apps/${appId}/end-user-auth/connectors/${connectorId}/token`);
53
+ const response = await axios.get(`/apps/${appId}/app-user-auth/connectors/${connectorId}/token`);
54
54
  // @ts-expect-error
55
55
  return response.access_token;
56
56
  },
@@ -58,7 +58,7 @@ export function createUserConnectorsModule(axios, appId) {
58
58
  if (!connectorId || typeof connectorId !== "string") {
59
59
  throw new Error("Connector ID is required and must be a string");
60
60
  }
61
- const response = await axios.post(`/apps/${appId}/end-user-auth/connectors/${connectorId}/initiate`);
61
+ const response = await axios.post(`/apps/${appId}/app-user-auth/connectors/${connectorId}/initiate`);
62
62
  // @ts-expect-error
63
63
  return response.redirect_url;
64
64
  },
@@ -66,7 +66,7 @@ export function createUserConnectorsModule(axios, appId) {
66
66
  if (!connectorId || typeof connectorId !== "string") {
67
67
  throw new Error("Connector ID is required and must be a string");
68
68
  }
69
- await axios.delete(`/apps/${appId}/end-user-auth/connectors/${connectorId}`);
69
+ await axios.delete(`/apps/${appId}/app-user-auth/connectors/${connectorId}`);
70
70
  },
71
71
  };
72
72
  }
@@ -54,30 +54,42 @@ export interface ConnectorInitiateResponse {
54
54
  *
55
55
  * | Service | Type identifier |
56
56
  * |---|---|
57
+ * | Airtable | `airtable` |
57
58
  * | Box | `box` |
58
59
  * | ClickUp | `clickup` |
59
60
  * | Discord | `discord` |
61
+ * | Dropbox | `dropbox` |
60
62
  * | GitHub | `github` |
61
63
  * | Gmail | `gmail` |
62
64
  * | Google Analytics | `google_analytics` |
63
65
  * | Google BigQuery | `googlebigquery` |
64
66
  * | Google Calendar | `googlecalendar` |
67
+ * | Google Classroom | `google_classroom` |
65
68
  * | Google Docs | `googledocs` |
66
69
  * | Google Drive | `googledrive` |
70
+ * | Google Search Console | `google_search_console` |
67
71
  * | Google Sheets | `googlesheets` |
68
72
  * | Google Slides | `googleslides` |
69
73
  * | HubSpot | `hubspot` |
74
+ * | Linear | `linear` |
70
75
  * | LinkedIn | `linkedin` |
76
+ * | Microsoft Teams | `microsoft_teams` |
77
+ * | Microsoft OneDrive | `one_drive` |
71
78
  * | Notion | `notion` |
79
+ * | Outlook | `outlook` |
72
80
  * | Salesforce | `salesforce` |
81
+ * | SharePoint | `share_point` |
73
82
  * | Slack User | `slack` |
74
83
  * | Slack Bot | `slackbot` |
84
+ * | Splitwise | `splitwise` |
75
85
  * | TikTok | `tiktok` |
86
+ * | Typeform | `typeform` |
87
+ * | Wix | `wix` |
76
88
  * | Wrike | `wrike` |
77
89
  *
78
90
  * See the integration guides for more details:
79
91
  *
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}
92
+ * - **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}, {@link https://docs.base44.com/Integrations/github-connector#github-scopes-and-permissions | GitHub}
81
93
  * - **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
94
  *
83
95
  * ## Authentication Modes
@@ -219,9 +231,9 @@ export interface ConnectorsModule {
219
231
  getConnection(integrationType: ConnectorIntegrationType): Promise<ConnectorConnectionResponse>;
220
232
  }
221
233
  /**
222
- * User-scoped connectors module for managing end-user OAuth connections.
234
+ * User-scoped connectors module for managing app-user OAuth connections.
223
235
  *
224
- * This module provides methods for end-user OAuth flows: initiating an OAuth connection,
236
+ * This module provides methods for app-user OAuth flows: initiating an OAuth connection,
225
237
  * retrieving the end user's access token, and disconnecting the end user's connection.
226
238
  *
227
239
  * Unlike {@link ConnectorsModule | ConnectorsModule} which manages app-scoped tokens,
@@ -252,7 +264,7 @@ export interface UserConnectorsModule {
252
264
  */
253
265
  getAppUserAccessToken(connectorId: string): Promise<string>;
254
266
  /**
255
- * Initiates the end-user OAuth flow for a specific connector.
267
+ * Initiates the app-user OAuth flow for a specific connector.
256
268
  *
257
269
  * Returns a redirect URL that the end user should be navigated to in order to
258
270
  * authenticate with the external service. The scopes and integration type are
@@ -106,6 +106,14 @@ function createEntityHandler(axios, appId, entityName, getSocket) {
106
106
  async bulkCreate(data) {
107
107
  return axios.post(`${baseURL}/bulk`, data);
108
108
  },
109
+ // Update multiple entities matching a query using a MongoDB update operator
110
+ async updateMany(query, data) {
111
+ return axios.patch(`${baseURL}/update-many`, { query, data });
112
+ },
113
+ // Update multiple entities by ID, each with its own update data
114
+ async bulkUpdate(data) {
115
+ return axios.put(`${baseURL}/bulk`, data);
116
+ },
109
117
  // Import entities from a file
110
118
  async importEntities(file) {
111
119
  const formData = new FormData();
@@ -39,6 +39,17 @@ export interface DeleteManyResult {
39
39
  /** Number of entities that were deleted. */
40
40
  deleted: number;
41
41
  }
42
+ /**
43
+ * Result returned when updating multiple entities via a query.
44
+ */
45
+ export interface UpdateManyResult {
46
+ /** Whether the operation was successful. */
47
+ success: boolean;
48
+ /** Number of entities that were updated. */
49
+ updated: number;
50
+ /** Whether there are more entities matching the query that were not updated in this batch. When `true`, call `updateMany` again with the same query to update the next batch. */
51
+ has_more: boolean;
52
+ }
42
53
  /**
43
54
  * Result returned when importing entities from a file.
44
55
  *
@@ -348,6 +359,87 @@ export interface EntityHandler<T = any> {
348
359
  * ```
349
360
  */
350
361
  bulkCreate(data: Partial<T>[]): Promise<T[]>;
362
+ /**
363
+ * Updates multiple records matching a query using a MongoDB update operator.
364
+ *
365
+ * Applies the same update operation to all records matching the query.
366
+ * The `data` parameter must contain one or more MongoDB update operators
367
+ * (e.g., `$set`, `$inc`, `$push`). Multiple operators can be combined in a
368
+ * single call, but each field may only appear in one operator.
369
+ *
370
+ * Results are batched in groups of up to 500 — when `has_more` is `true`
371
+ * in the response, call `updateMany` again with the same query to update
372
+ * the next batch.
373
+ *
374
+ * @param query - Query object to filter which records to update. Records matching all
375
+ * specified criteria will be updated.
376
+ * @param data - Update operation object containing one or more MongoDB update operators.
377
+ * Each field may only appear in one operator per call.
378
+ * Supported operators: `$set`, `$rename`, `$unset`, `$inc`, `$mul`, `$min`, `$max`,
379
+ * `$currentDate`, `$addToSet`, `$push`, `$pull`.
380
+ * @returns Promise resolving to the update result.
381
+ *
382
+ * @example
383
+ * ```typescript
384
+ * // Set status to 'archived' for all completed records
385
+ * const result = await base44.entities.MyEntity.updateMany(
386
+ * { status: 'completed' },
387
+ * { $set: { status: 'archived' } }
388
+ * );
389
+ * console.log(`Updated ${result.updated} records`);
390
+ * ```
391
+ *
392
+ * @example
393
+ * ```typescript
394
+ * // Combine multiple operators in a single call
395
+ * const result = await base44.entities.MyEntity.updateMany(
396
+ * { category: 'sales' },
397
+ * { $set: { status: 'done' }, $inc: { view_count: 1 } }
398
+ * );
399
+ * ```
400
+ *
401
+ * @example
402
+ * ```typescript
403
+ * // Handle batched updates for large datasets
404
+ * let hasMore = true;
405
+ * let totalUpdated = 0;
406
+ * while (hasMore) {
407
+ * const result = await base44.entities.MyEntity.updateMany(
408
+ * { status: 'pending' },
409
+ * { $set: { status: 'processed' } }
410
+ * );
411
+ * totalUpdated += result.updated;
412
+ * hasMore = result.has_more;
413
+ * }
414
+ * ```
415
+ */
416
+ updateMany(query: Partial<T>, data: Record<string, Record<string, any>>): Promise<UpdateManyResult>;
417
+ /**
418
+ * Updates multiple records in a single request, each with its own update data.
419
+ *
420
+ * Unlike `updateMany` which applies the same update to all matching records,
421
+ * `bulkUpdate` allows different updates for each record. Each item in the
422
+ * array must include an `id` field identifying which record to update.
423
+ *
424
+ * **Note:** Maximum 500 items per request.
425
+ *
426
+ * @param data - Array of update objects (max 500). Each object must have an `id` field
427
+ * and any number of fields to update.
428
+ * @returns Promise resolving to an array of updated records.
429
+ *
430
+ * @example
431
+ * ```typescript
432
+ * // Update multiple records with different data
433
+ * const updated = await base44.entities.MyEntity.bulkUpdate([
434
+ * { id: 'entity-1', status: 'paid', amount: 999 },
435
+ * { id: 'entity-2', status: 'cancelled' },
436
+ * { id: 'entity-3', name: 'Renamed Item' }
437
+ * ]);
438
+ * ```
439
+ */
440
+ bulkUpdate(data: (Partial<T> & {
441
+ id: string;
442
+ })[]): Promise<T[]>;
351
443
  /**
352
444
  * Imports records from a file.
353
445
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@base44-preview/sdk",
3
- "version": "0.8.20-pr.130.bda52d3",
3
+ "version": "0.8.20-pr.130.c6776c6",
4
4
  "description": "JavaScript SDK for Base44 API",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",