@base44-preview/sdk 0.8.26-pr.164.f8d1b0e → 0.8.26-pr.169.4ce3986

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
  }
@@ -84,6 +84,61 @@ 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
+ * Value accepted when filtering an entity field.
89
+ *
90
+ * Supports exact matches, `null`, array shorthand for matching any of the
91
+ * provided values, and documented MongoDB-style query operators.
92
+ *
93
+ * @typeParam T - Field value type.
94
+ */
95
+ export type EntityFilterValue<T> = EntityFilterComparable<T> | EntityFilterComparable<T>[] | EntityFilterOperators<T>;
96
+ /**
97
+ * MongoDB-style query operators accepted for a single entity field.
98
+ *
99
+ * @typeParam T - Field value type.
100
+ */
101
+ export type EntityFilterOperators<T> = EntityFilterCommonOperators<T> & {
102
+ /** Negates another field-level filter expression. */
103
+ $not?: EntityFilterCommonOperators<T>;
104
+ };
105
+ type EntityFilterComparable<T> = Exclude<T, undefined> | null;
106
+ type EntityFilterCommonOperators<T> = {
107
+ $eq?: EntityFilterComparable<T>;
108
+ $ne?: EntityFilterComparable<T>;
109
+ $gt?: EntityFilterComparable<T>;
110
+ $gte?: EntityFilterComparable<T>;
111
+ $lt?: EntityFilterComparable<T>;
112
+ $lte?: EntityFilterComparable<T>;
113
+ $in?: EntityFilterComparable<T>[];
114
+ $nin?: EntityFilterComparable<T>[];
115
+ $exists?: boolean;
116
+ } & EntityFilterStringOperators<T> & EntityFilterArrayOperators<T>;
117
+ type EntityFilterStringOperators<T> = Extract<Exclude<T, undefined | null>, string> extends never ? {} : {
118
+ $regex?: string;
119
+ };
120
+ type EntityFilterArrayElement<T> = T extends readonly (infer U)[] ? U : never;
121
+ type EntityFilterArrayOperators<T> = [
122
+ EntityFilterArrayElement<Exclude<T, undefined | null>>
123
+ ] extends [never] ? {} : {
124
+ $all?: EntityFilterArrayElement<Exclude<T, undefined | null>>[];
125
+ $size?: number;
126
+ };
127
+ /**
128
+ * Query object accepted by entity filtering methods.
129
+ *
130
+ * Field keys are typed from the entity schema. `$and`, `$or`, and `$nor`
131
+ * combine nested filter queries at the root level.
132
+ *
133
+ * @typeParam T - Entity record type.
134
+ */
135
+ export type EntityFilterQuery<T> = {
136
+ [K in keyof T]?: EntityFilterValue<T[K]>;
137
+ } & {
138
+ $and?: EntityFilterQuery<T>[];
139
+ $or?: EntityFilterQuery<T>[];
140
+ $nor?: EntityFilterQuery<T>[];
141
+ };
87
142
  /**
88
143
  * Fields added by the server to every entity record, such as `id`, `created_date`, `updated_date`, and `created_by`.
89
144
  */
@@ -189,7 +244,9 @@ export interface EntityHandler<T = any> {
189
244
  * @typeParam K - The fields to include in the response. Defaults to all fields.
190
245
  * @param query - Query object with field-value pairs. Each key should be a field name
191
246
  * 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.
247
+ * specified criteria are returned. Field names are case-sensitive. Use field-value pairs
248
+ * for exact matches, `null` for null values, arrays as shorthand for matching any of the
249
+ * provided values, or documented MongoDB query operators for advanced filtering.
193
250
  * @param sort - Sort parameter, such as `'-created_date'` for descending. Defaults to `'-created_date'`.
194
251
  * @param limit - Maximum number of results to return. Defaults to `50`.
195
252
  * @param skip - Number of results to skip for pagination. Defaults to `0`.
@@ -215,6 +272,42 @@ export interface EntityHandler<T = any> {
215
272
  *
216
273
  * @example
217
274
  * ```typescript
275
+ * // Filter by any matching value
276
+ * const records = await base44.entities.MyEntity.filter({
277
+ * external_id: ['item-1', 'item-2']
278
+ * });
279
+ * ```
280
+ *
281
+ * @example
282
+ * ```typescript
283
+ * // Filter with query operators
284
+ * const popularRecords = await base44.entities.MyEntity.filter({
285
+ * count: { $gte: 100 },
286
+ * external_id: { $in: ['item-1', 'item-2'] }
287
+ * });
288
+ * ```
289
+ *
290
+ * @example
291
+ * ```typescript
292
+ * // Filter with logical operators
293
+ * const records = await base44.entities.MyEntity.filter({
294
+ * $or: [
295
+ * { name: 'Example item' },
296
+ * { slug: 'example-item' }
297
+ * ]
298
+ * });
299
+ * ```
300
+ *
301
+ * @example
302
+ * ```typescript
303
+ * // Filter null values
304
+ * const recordsWithoutDescription = await base44.entities.MyEntity.filter({
305
+ * description: null
306
+ * });
307
+ * ```
308
+ *
309
+ * @example
310
+ * ```typescript
218
311
  * // Filter with sorting and pagination
219
312
  * const results = await base44.entities.MyEntity.filter(
220
313
  * { status: 'active' },
@@ -236,7 +329,7 @@ export interface EntityHandler<T = any> {
236
329
  * );
237
330
  * ```
238
331
  */
239
- filter<K extends keyof T = keyof T>(query: Partial<T>, sort?: SortField<T>, limit?: number, skip?: number, fields?: K[]): Promise<Pick<T, K>[]>;
332
+ filter<K extends keyof T = keyof T>(query: EntityFilterQuery<T>, sort?: SortField<T>, limit?: number, skip?: number, fields?: K[]): Promise<Pick<T, K>[]>;
240
333
  /**
241
334
  * Gets a single record by ID.
242
335
  *
@@ -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.164.f8d1b0e",
3
+ "version": "0.8.26-pr.169.4ce3986",
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",