@base44-preview/sdk 0.8.50-pr.290.40fc74a → 0.8.50-pr.290.cf1f6a8

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.
@@ -341,6 +341,9 @@ 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
+ *
344
347
  * @typeParam K - The fields to include in the response. Defaults to all fields.
345
348
  * @param sort - Sort parameter, such as `'-created_date'` for descending. Defaults to `'-created_date'`.
346
349
  * @param limit - Maximum number of results to return. Defaults to `5000`.
@@ -406,6 +409,9 @@ export interface EntityHandler<T = any> {
406
409
  * and records deleted between pages never shift the boundary. `skip` is kept
407
410
  * for existing code and is deprecated for loops.
408
411
  *
412
+ * **Note:** Returns an empty result if a row-level security rule denies
413
+ * this call. See {@link EntitiesModule | Denied reads and writes}.
414
+ *
409
415
  * @typeParam K - The fields to include in the response. Defaults to all fields.
410
416
  * @param query - Query object with field-value pairs. Each key should be a field name
411
417
  * from your entity schema, and each value is the criteria to match. Records matching all
@@ -526,6 +532,10 @@ export interface EntityHandler<T = any> {
526
532
  *
527
533
  * Retrieves a specific record using its unique identifier.
528
534
  *
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
+ *
529
539
  * @param id - The unique identifier of the record.
530
540
  * @returns Promise resolving to the record.
531
541
  *
@@ -542,6 +552,9 @@ export interface EntityHandler<T = any> {
542
552
  *
543
553
  * Creates a new record with the provided data.
544
554
  *
555
+ * **Note:** Throws a permission error if a row-level security rule
556
+ * denies this call. See {@link EntitiesModule | Denied reads and writes}.
557
+ *
545
558
  * @param data - Object containing the record data.
546
559
  * @returns Promise resolving to the created record.
547
560
  *
@@ -568,6 +581,9 @@ export interface EntityHandler<T = any> {
568
581
  * To update multiple specific records with different data each, use
569
582
  * {@linkcode bulkUpdate | bulkUpdate()}.
570
583
  *
584
+ * **Note:** Throws a permission error if a row-level security rule
585
+ * denies this call. See {@link EntitiesModule | Denied reads and writes}.
586
+ *
571
587
  * @param id - The unique identifier of the record to update.
572
588
  * @param data - Object containing the fields to update.
573
589
  * @returns Promise resolving to the updated record.
@@ -596,6 +612,10 @@ export interface EntityHandler<T = any> {
596
612
  *
597
613
  * Permanently removes a record from the database.
598
614
  *
615
+ * **Note:** Usually throws a not-found error if a row-level security rule
616
+ * denies this call, some rules can instead throw a permission error. See
617
+ * {@link EntitiesModule | Denied reads and writes}.
618
+ *
599
619
  * @param id - The unique identifier of the record to delete.
600
620
  * @returns Promise resolving to the deletion result.
601
621
  *
@@ -950,16 +970,6 @@ type DynamicEntitiesModule = {
950
970
  * - **Anonymous or User authentication** (`base44.entities`): Access is scoped to the current user's permissions. Anonymous users can only access public entities, while authenticated users can access entities they have permission to view or modify.
951
971
  * - **Service role authentication** (`base44.asServiceRole.entities`): Operations bypass entity access rules and field-level security entirely. Can read and write any record in any entity.
952
972
  *
953
- * ## How denied reads and writes differ
954
- *
955
- * Row-level security handles reads and writes differently.
956
- *
957
- * | Operation | When a rule denies it |
958
- * | --- | --- |
959
- * | `list()`, `filter()` | Returns an empty result, the same as if nothing matched. No error is thrown. |
960
- * | `get()` | Throws a not-found error, whether or not the record exists. |
961
- * | `create()`, `update()` | Throws a permission error with HTTP 403. |
962
- *
963
973
  * ## Entity Handlers
964
974
  *
965
975
  * An entity handler is the object you get when you access an entity through `base44.entities.EntityName`. Every entity in your app automatically gets a handler with CRUD methods for managing records.
@@ -974,6 +984,18 @@ type DynamicEntitiesModule = {
974
984
  *
975
985
  * 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.
976
986
  *
987
+ * ## Denied reads and writes
988
+ *
989
+ * Denied reads behave as if the data doesn't exist, so they don't reveal
990
+ * what's there. Denied writes throw, so a blocked change never fails silently.
991
+ *
992
+ * | Operation | When a rule denies it |
993
+ * | --- | --- |
994
+ * | `list()`, `filter()` | Returns an empty result, the same as if nothing matched. No error is thrown. |
995
+ * | `get()` | Throws a not-found error (HTTP 404), whether or not the record exists. |
996
+ * | `create()`, `update()` | Throws a permission error (HTTP 403). |
997
+ * | `delete()` | Usually throws a not-found error like {@linkcode EntityHandler.get | get()}. Some rules can instead throw a permission error (HTTP 403). |
998
+ *
977
999
  * ## Generated Types
978
1000
  *
979
1001
  * 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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@base44-preview/sdk",
3
- "version": "0.8.50-pr.290.40fc74a",
3
+ "version": "0.8.50-pr.290.cf1f6a8",
4
4
  "description": "JavaScript SDK for Base44 API",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",