@base44-preview/sdk 0.8.26-pr.164.f8d1b0e → 0.8.26-pr.167.fdb48d8
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/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, UpdateManyResult, } from "./modules/entities.types.js";
|
|
7
|
+
export type { DeleteManyResult, DeleteResult, EntitiesModule, EntityFilterOperators, EntityFilterQuery, EntityFilterValue, 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";
|
|
@@ -43,7 +43,7 @@ export interface AgentMessageToolCall {
|
|
|
43
43
|
/** Arguments passed to the tool as JSON string. */
|
|
44
44
|
arguments_string: string;
|
|
45
45
|
/** Status of the tool call. */
|
|
46
|
-
status: "running" | "success" | "error" | "stopped";
|
|
46
|
+
status: "running" | "success" | "error" | "stopped" | "waiting_for_user_input";
|
|
47
47
|
/** Results from the tool call. */
|
|
48
48
|
results?: string;
|
|
49
49
|
}
|
package/dist/modules/entities.js
CHANGED
|
@@ -131,10 +131,24 @@ function createEntityHandler(axios, appId, entityName, getSocket) {
|
|
|
131
131
|
const socket = getSocket();
|
|
132
132
|
const unsubscribe = socket.subscribeToRoom(room, {
|
|
133
133
|
update_model: (msg) => {
|
|
134
|
+
var _a;
|
|
134
135
|
const event = parseRealtimeMessage(msg.data);
|
|
135
136
|
if (!event) {
|
|
136
137
|
return;
|
|
137
138
|
}
|
|
139
|
+
// Server signals oversize broadcasts with `_oversize: true` on
|
|
140
|
+
// `data`. The wire payload was slimmed to fit under the realtime
|
|
141
|
+
// transport cap, so big string fields arrive as empty strings (or
|
|
142
|
+
// the whole record collapses to a stub). Surface this to the
|
|
143
|
+
// developer console so they know to fetch the full record on
|
|
144
|
+
// demand (e.g. a follow-up entities.X.get(id) call) instead of
|
|
145
|
+
// rendering the slimmed payload directly. Skip on delete events
|
|
146
|
+
// — the record no longer exists.
|
|
147
|
+
if (event.type !== "delete" && ((_a = event.data) === null || _a === void 0 ? void 0 : _a._oversize)) {
|
|
148
|
+
console.error(`[Base44 SDK] Realtime broadcast for ${entityName}#${event.id} was oversize and got slimmed for transport. ` +
|
|
149
|
+
`Fields >10 KB are empty and the rest of the record may be a stub. ` +
|
|
150
|
+
`Call \`entities.${entityName}.get("${event.id}")\` to fetch the full record.`);
|
|
151
|
+
}
|
|
138
152
|
try {
|
|
139
153
|
callback(event);
|
|
140
154
|
}
|
|
@@ -84,6 +84,74 @@ export interface ImportResult<T = any> {
|
|
|
84
84
|
* ```
|
|
85
85
|
*/
|
|
86
86
|
export type SortField<T> = (keyof T & string) | `+${keyof T & string}` | `-${keyof T & string}`;
|
|
87
|
+
/**
|
|
88
|
+
* Entity filter query type system.
|
|
89
|
+
*
|
|
90
|
+
* `EntityFilterQuery<T>` keeps field names tied to the entity schema while
|
|
91
|
+
* allowing Base44's documented filtering syntax. Each field can use an exact
|
|
92
|
+
* value, `null`, an array shorthand for matching any listed value, or a
|
|
93
|
+
* field-level operator object. Root-level `$and`, `$or`, and `$nor` combine
|
|
94
|
+
* nested filter queries.
|
|
95
|
+
*
|
|
96
|
+
* Operator values are typed from the field they filter where possible. For
|
|
97
|
+
* example, numeric fields accept numeric comparison values, string fields
|
|
98
|
+
* accept `$regex`, and array fields accept `$all` and `$size`.
|
|
99
|
+
*/
|
|
100
|
+
/**
|
|
101
|
+
* Value accepted when filtering an entity field.
|
|
102
|
+
*
|
|
103
|
+
* Supports exact matches, `null`, array shorthand for matching any of the
|
|
104
|
+
* provided values, and documented MongoDB-style query operators.
|
|
105
|
+
*
|
|
106
|
+
* @typeParam T - Field value type.
|
|
107
|
+
*/
|
|
108
|
+
export type EntityFilterValue<T> = EntityFilterComparable<T> | EntityFilterComparable<T>[] | EntityFilterOperators<T>;
|
|
109
|
+
/**
|
|
110
|
+
* MongoDB-style query operators accepted for a single entity field.
|
|
111
|
+
*
|
|
112
|
+
* @typeParam T - Field value type.
|
|
113
|
+
*/
|
|
114
|
+
export type EntityFilterOperators<T> = EntityFilterCommonOperators<T> & {
|
|
115
|
+
/** Negates another field-level filter expression. */
|
|
116
|
+
$not?: EntityFilterCommonOperators<T>;
|
|
117
|
+
};
|
|
118
|
+
type EntityFilterComparable<T> = Exclude<T, undefined> | null;
|
|
119
|
+
type EntityFilterCommonOperators<T> = {
|
|
120
|
+
$eq?: EntityFilterComparable<T>;
|
|
121
|
+
$ne?: EntityFilterComparable<T>;
|
|
122
|
+
$gt?: EntityFilterComparable<T>;
|
|
123
|
+
$gte?: EntityFilterComparable<T>;
|
|
124
|
+
$lt?: EntityFilterComparable<T>;
|
|
125
|
+
$lte?: EntityFilterComparable<T>;
|
|
126
|
+
$in?: EntityFilterComparable<T>[];
|
|
127
|
+
$nin?: EntityFilterComparable<T>[];
|
|
128
|
+
$exists?: boolean;
|
|
129
|
+
} & EntityFilterStringOperators<T> & EntityFilterArrayOperators<T>;
|
|
130
|
+
type EntityFilterStringOperators<T> = Extract<Exclude<T, undefined | null>, string> extends never ? {} : {
|
|
131
|
+
$regex?: string;
|
|
132
|
+
};
|
|
133
|
+
type EntityFilterArrayElement<T> = T extends readonly (infer U)[] ? U : never;
|
|
134
|
+
type EntityFilterArrayOperators<T> = [
|
|
135
|
+
EntityFilterArrayElement<Exclude<T, undefined | null>>
|
|
136
|
+
] extends [never] ? {} : {
|
|
137
|
+
$all?: EntityFilterArrayElement<Exclude<T, undefined | null>>[];
|
|
138
|
+
$size?: number;
|
|
139
|
+
};
|
|
140
|
+
/**
|
|
141
|
+
* Query object accepted by entity filtering methods.
|
|
142
|
+
*
|
|
143
|
+
* Field keys are typed from the entity schema. `$and`, `$or`, and `$nor`
|
|
144
|
+
* combine nested filter queries at the root level.
|
|
145
|
+
*
|
|
146
|
+
* @typeParam T - Entity record type.
|
|
147
|
+
*/
|
|
148
|
+
export type EntityFilterQuery<T> = {
|
|
149
|
+
[K in keyof T]?: EntityFilterValue<T[K]>;
|
|
150
|
+
} & {
|
|
151
|
+
$and?: EntityFilterQuery<T>[];
|
|
152
|
+
$or?: EntityFilterQuery<T>[];
|
|
153
|
+
$nor?: EntityFilterQuery<T>[];
|
|
154
|
+
};
|
|
87
155
|
/**
|
|
88
156
|
* Fields added by the server to every entity record, such as `id`, `created_date`, `updated_date`, and `created_by`.
|
|
89
157
|
*/
|
|
@@ -189,7 +257,9 @@ export interface EntityHandler<T = any> {
|
|
|
189
257
|
* @typeParam K - The fields to include in the response. Defaults to all fields.
|
|
190
258
|
* @param query - Query object with field-value pairs. Each key should be a field name
|
|
191
259
|
* from your entity schema, and each value is the criteria to match. Records matching all
|
|
192
|
-
* specified criteria are returned. Field names are case-sensitive.
|
|
260
|
+
* specified criteria are returned. Field names are case-sensitive. Use field-value pairs
|
|
261
|
+
* for exact matches, `null` for null values, arrays as shorthand for matching any of the
|
|
262
|
+
* provided values, or documented MongoDB query operators for advanced filtering.
|
|
193
263
|
* @param sort - Sort parameter, such as `'-created_date'` for descending. Defaults to `'-created_date'`.
|
|
194
264
|
* @param limit - Maximum number of results to return. Defaults to `50`.
|
|
195
265
|
* @param skip - Number of results to skip for pagination. Defaults to `0`.
|
|
@@ -215,6 +285,42 @@ export interface EntityHandler<T = any> {
|
|
|
215
285
|
*
|
|
216
286
|
* @example
|
|
217
287
|
* ```typescript
|
|
288
|
+
* // Filter by any matching value
|
|
289
|
+
* const records = await base44.entities.MyEntity.filter({
|
|
290
|
+
* external_id: ['item-1', 'item-2']
|
|
291
|
+
* });
|
|
292
|
+
* ```
|
|
293
|
+
*
|
|
294
|
+
* @example
|
|
295
|
+
* ```typescript
|
|
296
|
+
* // Filter with query operators
|
|
297
|
+
* const popularRecords = await base44.entities.MyEntity.filter({
|
|
298
|
+
* count: { $gte: 100 },
|
|
299
|
+
* external_id: { $in: ['item-1', 'item-2'] }
|
|
300
|
+
* });
|
|
301
|
+
* ```
|
|
302
|
+
*
|
|
303
|
+
* @example
|
|
304
|
+
* ```typescript
|
|
305
|
+
* // Filter with logical operators
|
|
306
|
+
* const records = await base44.entities.MyEntity.filter({
|
|
307
|
+
* $or: [
|
|
308
|
+
* { name: 'Example item' },
|
|
309
|
+
* { slug: 'example-item' }
|
|
310
|
+
* ]
|
|
311
|
+
* });
|
|
312
|
+
* ```
|
|
313
|
+
*
|
|
314
|
+
* @example
|
|
315
|
+
* ```typescript
|
|
316
|
+
* // Filter null values
|
|
317
|
+
* const recordsWithoutDescription = await base44.entities.MyEntity.filter({
|
|
318
|
+
* description: null
|
|
319
|
+
* });
|
|
320
|
+
* ```
|
|
321
|
+
*
|
|
322
|
+
* @example
|
|
323
|
+
* ```typescript
|
|
218
324
|
* // Filter with sorting and pagination
|
|
219
325
|
* const results = await base44.entities.MyEntity.filter(
|
|
220
326
|
* { status: 'active' },
|
|
@@ -236,7 +342,7 @@ export interface EntityHandler<T = any> {
|
|
|
236
342
|
* );
|
|
237
343
|
* ```
|
|
238
344
|
*/
|
|
239
|
-
filter<K extends keyof T = keyof T>(query:
|
|
345
|
+
filter<K extends keyof T = keyof T>(query: EntityFilterQuery<T>, sort?: SortField<T>, limit?: number, skip?: number, fields?: K[]): Promise<Pick<T, K>[]>;
|
|
240
346
|
/**
|
|
241
347
|
* Gets a single record by ID.
|
|
242
348
|
*
|
|
@@ -43,9 +43,9 @@ export interface InvokeLLMParams {
|
|
|
43
43
|
prompt: string;
|
|
44
44
|
/** Optionally specify a model to override the app-level model setting for this specific call.
|
|
45
45
|
*
|
|
46
|
-
* Options: `"gpt_5_mini"`, `"gemini_3_flash"`, `"gpt_5"`, `"gpt_5_4"`, `"gemini_3_1_pro"`, `"claude_sonnet_4_6"`, `"claude_opus_4_6"`
|
|
46
|
+
* Options: `"gpt_5_mini"`, `"gemini_3_flash"`, `"gpt_5"`, `"gpt_5_4"`, `"gpt_5_5"`, `"gemini_3_1_pro"`, `"claude_sonnet_4_6"`, `"claude_opus_4_6"`, `"claude_opus_4_7"`
|
|
47
47
|
*/
|
|
48
|
-
model?: 'gpt_5_mini' | 'gemini_3_flash' | 'gpt_5' | 'gpt_5_4' | 'gemini_3_1_pro' | 'claude_sonnet_4_6' | 'claude_opus_4_6';
|
|
48
|
+
model?: 'gpt_5_mini' | 'gemini_3_flash' | 'gpt_5' | 'gpt_5_4' | 'gpt_5_5' | 'gemini_3_1_pro' | 'claude_sonnet_4_6' | 'claude_opus_4_6' | 'claude_opus_4_7';
|
|
49
49
|
/** If set to `true`, the LLM will use Google Search, Maps, and News to gather real-time context before answering.
|
|
50
50
|
* @default false
|
|
51
51
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@base44-preview/sdk",
|
|
3
|
-
"version": "0.8.26-pr.
|
|
3
|
+
"version": "0.8.26-pr.167.fdb48d8",
|
|
4
4
|
"description": "JavaScript SDK for Base44 API",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -11,7 +11,8 @@
|
|
|
11
11
|
"scripts": {
|
|
12
12
|
"build": "tsc",
|
|
13
13
|
"lint": "eslint src",
|
|
14
|
-
"test": "vitest run",
|
|
14
|
+
"test": "npm run test:types && vitest run",
|
|
15
|
+
"test:types": "tsc --noEmit -p tsconfig.type-tests.json",
|
|
15
16
|
"test:unit": "vitest run tests/unit",
|
|
16
17
|
"test:e2e": "vitest run tests/e2e",
|
|
17
18
|
"test:watch": "vitest",
|