@base44-preview/sdk 0.8.50-pr.290.e7ccb0e → 0.8.50-pr.291.10ee07f

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.
@@ -33,7 +33,7 @@ export interface AiGatewayModuleConfig {
33
33
  * `connection()` hands you a `baseURL` and `token` that authenticate as your
34
34
  * Base44 app. An OpenAI-compatible client is any library, such as the `openai`
35
35
  * SDK or the Vercel AI SDK, that has the same request and response format
36
- * as OpenAI's Chat Completions API and lets you point it at a custom `baseURL`
36
+ * as OpenAI's API and lets you point it at a custom `baseURL`
37
37
  * instead of OpenAI's own servers. Pass `connection()`'s values to one of
38
38
  * these clients and it works against Base44's gateway exactly as it would
39
39
  * against the provider directly, no separate account, API key, or billing
@@ -55,6 +55,15 @@ export interface AiGatewayModuleConfig {
55
55
  * Pass `'automatic'` to let Base44 choose one, or pin a specific model such
56
56
  * as `'claude_sonnet_4_6'`, `'gpt_5_5'`, or `'gemini_3_1_pro'`.
57
57
  *
58
+ * ## Images
59
+ *
60
+ * The gateway also serves OpenAI's image endpoints, `/images/generations`
61
+ * and `/images/edits`, so you can generate images and edit them using
62
+ * reference images. Image requests use their own set of models: pass
63
+ * `'automatic'` to let Base44 choose one, or pin a model such as
64
+ * `'gemini_3_1_flash_image'` or `'gpt_image_2'`. For request options, the
65
+ * full model list, and limits, see [Generate images with the AI Gateway](/developers/references/sdk/getting-started/ai-gateway-images).
66
+ *
58
67
  * ## Authentication Modes
59
68
  *
60
69
  * There's no permission difference between modes. Both just determine which
@@ -145,6 +154,29 @@ export interface AiGatewayModule {
145
154
  *
146
155
  * await agent.generate({ prompt: `Review this return request: ${JSON.stringify(returnRequest)}` });
147
156
  * ```
157
+ *
158
+ * @example
159
+ * ```typescript
160
+ * // Generate an image
161
+ * import { createClientFromRequest } from "@base44/sdk";
162
+ * import { generateImage } from "ai";
163
+ * import { createOpenAICompatible } from "@ai-sdk/openai-compatible";
164
+ *
165
+ * // Runs inside a backend function
166
+ * const base44 = createClientFromRequest(request);
167
+ * const { baseURL, token } = base44.aiGateway.connection();
168
+ * const models = createOpenAICompatible({ name: "base44", baseURL, apiKey: token });
169
+ *
170
+ * const { image } = await generateImage({
171
+ * model: models.imageModel("automatic"),
172
+ * prompt: "A watercolor illustration of a lighthouse at dawn",
173
+ * // Base44 options go under the provider name you passed above
174
+ * providerOptions: { base44: { aspect_ratio: "16:9" } },
175
+ * });
176
+ *
177
+ * const file = new File([image.uint8Array], "lighthouse.png", { type: image.mediaType });
178
+ * const { file_url } = await base44.integrations.Core.UploadFile({ file });
179
+ * ```
148
180
  */
149
181
  connection(options?: AiGatewayConnectionOptions): AiGatewayConnection;
150
182
  }
@@ -341,9 +341,6 @@ export interface EntityHandler<T = any> {
341
341
  * and records deleted between pages never shift the boundary. `skip` is kept
342
342
  * for existing code and is deprecated for loops.
343
343
  *
344
- * **Note:** Returns an empty result if a row-level security rule denies
345
- * this call. See {@link EntitiesModule | Denied reads and writes}.
346
- *
347
344
  * @typeParam K - The fields to include in the response. Defaults to all fields.
348
345
  * @param sort - Sort parameter, such as `'-created_date'` for descending. Defaults to `'-created_date'`.
349
346
  * @param limit - Maximum number of results to return. Defaults to `5000`.
@@ -409,9 +406,6 @@ export interface EntityHandler<T = any> {
409
406
  * and records deleted between pages never shift the boundary. `skip` is kept
410
407
  * for existing code and is deprecated for loops.
411
408
  *
412
- * **Note:** Returns an empty result if a row-level security rule denies
413
- * this call. See {@link EntitiesModule | Denied reads and writes}.
414
- *
415
409
  * @typeParam K - The fields to include in the response. Defaults to all fields.
416
410
  * @param query - Query object with field-value pairs. Each key should be a field name
417
411
  * from your entity schema, and each value is the criteria to match. Records matching all
@@ -532,10 +526,6 @@ export interface EntityHandler<T = any> {
532
526
  *
533
527
  * Retrieves a specific record using its unique identifier.
534
528
  *
535
- * **Note:** Throws a not-found error, whether or not the record exists,
536
- * if a row-level security rule denies this call. See
537
- * {@link EntitiesModule | Denied reads and writes}.
538
- *
539
529
  * @param id - The unique identifier of the record.
540
530
  * @returns Promise resolving to the record.
541
531
  *
@@ -552,9 +542,6 @@ export interface EntityHandler<T = any> {
552
542
  *
553
543
  * Creates a new record with the provided data.
554
544
  *
555
- * **Note:** Throws a permission error if a row-level security rule
556
- * denies this call. See {@link EntitiesModule | Denied reads and writes}.
557
- *
558
545
  * @param data - Object containing the record data.
559
546
  * @returns Promise resolving to the created record.
560
547
  *
@@ -581,9 +568,6 @@ export interface EntityHandler<T = any> {
581
568
  * To update multiple specific records with different data each, use
582
569
  * {@linkcode bulkUpdate | bulkUpdate()}.
583
570
  *
584
- * **Note:** Throws a permission error if a row-level security rule
585
- * denies this call. See {@link EntitiesModule | Denied reads and writes}.
586
- *
587
571
  * @param id - The unique identifier of the record to update.
588
572
  * @param data - Object containing the fields to update.
589
573
  * @returns Promise resolving to the updated record.
@@ -980,17 +964,6 @@ type DynamicEntitiesModule = {
980
964
  *
981
965
  * Regular users can only read and update their own user record. With service role authentication, you can read, update, and delete any user. You can't create users using the entities module. Instead, use the functions of the {@link AuthModule | auth module} to invite or register new users.
982
966
  *
983
- * ## Denied reads and writes
984
- *
985
- * Denied reads behave as if the data doesn't exist, so they don't reveal
986
- * what's there. Denied writes throw, so a blocked change never fails silently.
987
- *
988
- * | Operation | When a rule denies it |
989
- * | --- | --- |
990
- * | `list()`, `filter()` | Returns an empty result, the same as if nothing matched. No error is thrown. |
991
- * | `get()` | Throws a not-found error (HTTP 404), whether or not the record exists. |
992
- * | `create()`, `update()` | Throws a permission error (HTTP 403). |
993
- *
994
967
  * ## Generated Types
995
968
  *
996
969
  * If you're working in a TypeScript project, you can generate types from your entity schemas to get autocomplete and type checking on all entity methods. See the [Dynamic Types](/developers/references/sdk/getting-started/dynamic-types) guide to get started.
@@ -59,8 +59,17 @@ export interface InvokeLLMParams {
59
59
  * Parameters for the GenerateImage function.
60
60
  */
61
61
  export interface GenerateImageParams {
62
- /** Description of the image to generate. */
62
+ /**
63
+ * Description of the image to generate. When you pass `existing_image_urls`,
64
+ * describe what to do with the reference images instead.
65
+ */
63
66
  prompt: string;
67
+ /**
68
+ * URLs of images to use as references, for example to edit an existing
69
+ * image, match a style, or add visual context. Images that can't be read are
70
+ * skipped. If none of them can be read, the request fails.
71
+ */
72
+ existing_image_urls?: string[];
64
73
  }
65
74
  export interface GenerateImageResult {
66
75
  /** URL of the generated image. */
@@ -173,12 +182,17 @@ export interface CoreIntegrations {
173
182
  */
174
183
  InvokeLLM(params: InvokeLLMParams): Promise<string | object>;
175
184
  /**
176
- * Create AI-generated images from text prompts.
185
+ * Create AI-generated images from text prompts, optionally guided by reference images.
177
186
  *
178
187
  * Images are generated as PNG files at approximately 1024px on the shorter side. The
179
188
  * exact dimensions vary by aspect ratio.
180
189
  *
181
- * Prompts that violate the AI provider's content policy will be refused.
190
+ * Pass `existing_image_urls` to edit an existing image or to guide the result
191
+ * with reference images. To choose the model, aspect ratio, resolution, or
192
+ * quality, use the [AI Gateway image endpoints](/developers/references/sdk/getting-started/ai-gateway-images)
193
+ * instead.
194
+ *
195
+ * Prompts that violate the AI provider's content policy are refused.
182
196
  *
183
197
  * @param params - Parameters for image generation
184
198
  * @returns Promise resolving to an object containing the URL of the generated PNG image.
@@ -191,6 +205,15 @@ export interface CoreIntegrations {
191
205
  * });
192
206
  * console.log(url); // https://...generated_image.png
193
207
  * ```
208
+ *
209
+ * @example
210
+ * ```typescript
211
+ * // Edit an existing image
212
+ * const {url} = await base44.integrations.Core.GenerateImage({
213
+ * prompt: "Replace the background with a sunset beach",
214
+ * existing_image_urls: [productPhotoUrl]
215
+ * });
216
+ * ```
194
217
  */
195
218
  GenerateImage(params: GenerateImageParams): Promise<GenerateImageResult>;
196
219
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@base44-preview/sdk",
3
- "version": "0.8.50-pr.290.e7ccb0e",
3
+ "version": "0.8.50-pr.291.10ee07f",
4
4
  "description": "JavaScript SDK for Base44 API",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",