@rebasepro/server-postgresql 0.0.1-canary.4d4fb3e → 0.0.1-canary.ca2cb6e

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.
Files changed (136) hide show
  1. package/dist/common/src/collections/CollectionRegistry.d.ts +8 -0
  2. package/dist/common/src/util/entities.d.ts +22 -0
  3. package/dist/common/src/util/relations.d.ts +14 -4
  4. package/dist/common/src/util/resolutions.d.ts +1 -1
  5. package/dist/index.es.js +1254 -591
  6. package/dist/index.es.js.map +1 -1
  7. package/dist/index.umd.js +1254 -591
  8. package/dist/index.umd.js.map +1 -1
  9. package/dist/server-postgresql/src/PostgresBackendDriver.d.ts +17 -29
  10. package/dist/server-postgresql/src/auth/services.d.ts +7 -3
  11. package/dist/server-postgresql/src/collections/PostgresCollectionRegistry.d.ts +1 -1
  12. package/dist/server-postgresql/src/connection.d.ts +34 -1
  13. package/dist/server-postgresql/src/data-transformer.d.ts +26 -4
  14. package/dist/server-postgresql/src/databasePoolManager.d.ts +2 -2
  15. package/dist/server-postgresql/src/schema/auth-schema.d.ts +139 -38
  16. package/dist/server-postgresql/src/schema/doctor-cli.d.ts +2 -0
  17. package/dist/server-postgresql/src/schema/doctor.d.ts +43 -0
  18. package/dist/server-postgresql/src/schema/generate-drizzle-schema-logic.d.ts +1 -1
  19. package/dist/server-postgresql/src/schema/test-schema.d.ts +24 -0
  20. package/dist/server-postgresql/src/services/EntityFetchService.d.ts +22 -8
  21. package/dist/server-postgresql/src/services/EntityPersistService.d.ts +1 -1
  22. package/dist/server-postgresql/src/services/RelationService.d.ts +11 -5
  23. package/dist/server-postgresql/src/services/entity-helpers.d.ts +16 -2
  24. package/dist/server-postgresql/src/services/entityService.d.ts +8 -6
  25. package/dist/server-postgresql/src/services/realtimeService.d.ts +2 -0
  26. package/dist/server-postgresql/src/utils/drizzle-conditions.d.ts +2 -2
  27. package/dist/types/src/controllers/auth.d.ts +2 -0
  28. package/dist/types/src/controllers/client.d.ts +119 -7
  29. package/dist/types/src/controllers/collection_registry.d.ts +4 -3
  30. package/dist/types/src/controllers/customization_controller.d.ts +7 -1
  31. package/dist/types/src/controllers/data.d.ts +34 -7
  32. package/dist/types/src/controllers/data_driver.d.ts +20 -28
  33. package/dist/types/src/controllers/database_admin.d.ts +2 -2
  34. package/dist/types/src/controllers/email.d.ts +34 -0
  35. package/dist/types/src/controllers/index.d.ts +1 -0
  36. package/dist/types/src/controllers/local_config_persistence.d.ts +4 -4
  37. package/dist/types/src/controllers/navigation.d.ts +5 -5
  38. package/dist/types/src/controllers/registry.d.ts +6 -3
  39. package/dist/types/src/controllers/side_entity_controller.d.ts +7 -6
  40. package/dist/types/src/controllers/storage.d.ts +24 -26
  41. package/dist/types/src/rebase_context.d.ts +8 -4
  42. package/dist/types/src/types/backend.d.ts +4 -1
  43. package/dist/types/src/types/builders.d.ts +5 -4
  44. package/dist/types/src/types/chips.d.ts +1 -1
  45. package/dist/types/src/types/collections.d.ts +169 -125
  46. package/dist/types/src/types/cron.d.ts +102 -0
  47. package/dist/types/src/types/data_source.d.ts +1 -1
  48. package/dist/types/src/types/entity_actions.d.ts +8 -8
  49. package/dist/types/src/types/entity_callbacks.d.ts +15 -15
  50. package/dist/types/src/types/entity_link_builder.d.ts +1 -1
  51. package/dist/types/src/types/entity_overrides.d.ts +2 -1
  52. package/dist/types/src/types/entity_views.d.ts +8 -8
  53. package/dist/types/src/types/export_import.d.ts +3 -3
  54. package/dist/types/src/types/index.d.ts +1 -0
  55. package/dist/types/src/types/plugins.d.ts +72 -18
  56. package/dist/types/src/types/properties.d.ts +118 -33
  57. package/dist/types/src/types/relations.d.ts +1 -1
  58. package/dist/types/src/types/slots.d.ts +30 -6
  59. package/dist/types/src/types/translations.d.ts +44 -0
  60. package/dist/types/src/types/user_management_delegate.d.ts +1 -0
  61. package/drizzle-test/0000_woozy_junta.sql +6 -0
  62. package/drizzle-test/0001_youthful_arachne.sql +1 -0
  63. package/drizzle-test/0002_lively_dragon_lord.sql +2 -0
  64. package/drizzle-test/0003_mean_king_cobra.sql +2 -0
  65. package/drizzle-test/meta/0000_snapshot.json +47 -0
  66. package/drizzle-test/meta/0001_snapshot.json +48 -0
  67. package/drizzle-test/meta/0002_snapshot.json +38 -0
  68. package/drizzle-test/meta/0003_snapshot.json +48 -0
  69. package/drizzle-test/meta/_journal.json +34 -0
  70. package/drizzle-test-out/0000_tan_trauma.sql +6 -0
  71. package/drizzle-test-out/0001_rapid_drax.sql +1 -0
  72. package/drizzle-test-out/meta/0000_snapshot.json +44 -0
  73. package/drizzle-test-out/meta/0001_snapshot.json +54 -0
  74. package/drizzle-test-out/meta/_journal.json +20 -0
  75. package/drizzle.test.config.ts +10 -0
  76. package/package.json +88 -89
  77. package/scratch.ts +41 -0
  78. package/src/PostgresBackendDriver.ts +63 -79
  79. package/src/PostgresBootstrapper.ts +7 -8
  80. package/src/auth/ensure-tables.ts +158 -86
  81. package/src/auth/services.ts +109 -50
  82. package/src/cli.ts +259 -16
  83. package/src/collections/PostgresCollectionRegistry.ts +6 -6
  84. package/src/connection.ts +70 -48
  85. package/src/data-transformer.ts +155 -116
  86. package/src/databasePoolManager.ts +6 -5
  87. package/src/history/HistoryService.ts +3 -12
  88. package/src/interfaces.ts +3 -3
  89. package/src/schema/auth-schema.ts +26 -3
  90. package/src/schema/doctor-cli.ts +47 -0
  91. package/src/schema/doctor.ts +595 -0
  92. package/src/schema/generate-drizzle-schema-logic.ts +204 -57
  93. package/src/schema/generate-drizzle-schema.ts +6 -6
  94. package/src/schema/test-schema.ts +11 -0
  95. package/src/services/BranchService.ts +5 -5
  96. package/src/services/EntityFetchService.ts +317 -188
  97. package/src/services/EntityPersistService.ts +15 -17
  98. package/src/services/RelationService.ts +299 -37
  99. package/src/services/entity-helpers.ts +39 -13
  100. package/src/services/entityService.ts +11 -9
  101. package/src/services/realtimeService.ts +58 -29
  102. package/src/utils/drizzle-conditions.ts +25 -24
  103. package/src/websocket.ts +52 -21
  104. package/test/auth-services.test.ts +131 -39
  105. package/test/batch-many-to-many-regression.test.ts +573 -0
  106. package/test/branchService.test.ts +22 -12
  107. package/test/data-transformer-hardening.test.ts +417 -0
  108. package/test/data-transformer.test.ts +175 -0
  109. package/test/doctor.test.ts +182 -0
  110. package/test/entityService.errors.test.ts +31 -16
  111. package/test/entityService.relations.test.ts +155 -59
  112. package/test/entityService.subcollection-search.test.ts +107 -57
  113. package/test/entityService.test.ts +105 -47
  114. package/test/generate-drizzle-schema.test.ts +262 -69
  115. package/test/historyService.test.ts +31 -16
  116. package/test/n-plus-one-regression.test.ts +314 -0
  117. package/test/postgresDataDriver.test.ts +260 -168
  118. package/test/realtimeService.test.ts +70 -39
  119. package/test/relation-pipeline-gaps.test.ts +637 -0
  120. package/test/relations.test.ts +492 -39
  121. package/test-drizzle-bug.ts +18 -0
  122. package/test-drizzle-out/0000_cultured_freak.sql +7 -0
  123. package/test-drizzle-out/0001_tiresome_professor_monster.sql +1 -0
  124. package/test-drizzle-out/meta/0000_snapshot.json +55 -0
  125. package/test-drizzle-out/meta/0001_snapshot.json +63 -0
  126. package/test-drizzle-out/meta/_journal.json +20 -0
  127. package/test-drizzle-prompt.sh +2 -0
  128. package/test-policy-prompt.sh +3 -0
  129. package/test-programmatic.ts +30 -0
  130. package/test-programmatic2.ts +59 -0
  131. package/test-schema-no-policies.ts +12 -0
  132. package/test_drizzle_mock.js +2 -2
  133. package/test_find_changed.mjs +3 -1
  134. package/test_hash.js +14 -0
  135. package/tsconfig.json +1 -1
  136. package/vite.config.ts +5 -5
@@ -11,19 +11,24 @@ const mockAuthorsTable = {
11
11
  _def: { tableName: "authors" }
12
12
  };
13
13
  const mockPostsTable = {
14
- id: { name: "id", dataType: "number" },
14
+ id: { name: "id",
15
+ dataType: "number" },
15
16
  title: { name: "title" },
16
- author_id: { name: "author_id", dataType: "number" },
17
+ author_id: { name: "author_id",
18
+ dataType: "number" },
17
19
  _def: { tableName: "posts" }
18
20
  };
19
21
  const mockTagsTable = {
20
- id: { name: "id", dataType: "number" },
22
+ id: { name: "id",
23
+ dataType: "number" },
21
24
  name: { name: "name" },
22
25
  _def: { tableName: "tags" }
23
26
  };
24
27
  const mockPostsTagsTable = {
25
- post_id: { name: "post_id", dataType: "number" },
26
- tag_id: { name: "tag_id", dataType: "number" },
28
+ post_id: { name: "post_id",
29
+ dataType: "number" },
30
+ tag_id: { name: "tag_id",
31
+ dataType: "number" },
27
32
  _def: { tableName: "posts_tags" }
28
33
  };
29
34
  const mockProjectUsersTable = {
@@ -43,7 +48,7 @@ const tagsCollection: EntityCollection = {
43
48
  id: { type: "number" },
44
49
  name: { type: "string" }
45
50
  },
46
- idField: "id",
51
+ idField: "id"
47
52
  };
48
53
 
49
54
  const projectUsersCollection: EntityCollection = {
@@ -94,7 +99,7 @@ const postsCollection: EntityCollection = {
94
99
  }
95
100
  }
96
101
  ],
97
- idField: "id",
102
+ idField: "id"
98
103
  };
99
104
 
100
105
  authorsCollection = {
@@ -118,7 +123,7 @@ authorsCollection = {
118
123
  foreignKeyOnTarget: "author_id"
119
124
  }
120
125
  ],
121
- idField: "id",
126
+ idField: "id"
122
127
  };
123
128
 
124
129
  describe("EntityService", () => {
@@ -157,7 +162,7 @@ describe("EntityService", () => {
157
162
  update: jest.fn().mockReturnThis(),
158
163
  set: jest.fn().mockReturnThis(),
159
164
  delete: jest.fn().mockReturnThis(),
160
- transaction: jest.fn((callback) => callback(db)),
165
+ transaction: jest.fn((callback) => callback(db))
161
166
  } as unknown as jest.Mocked<NodePgDatabase>;
162
167
 
163
168
  entityService = new EntityService(db, collectionRegistry);
@@ -220,7 +225,7 @@ describe("EntityService", () => {
220
225
  db.limit.mockResolvedValue([{
221
226
  id: 4,
222
227
  title: "Post by Jane",
223
- author_id: "3" // Database stores the foreign key
228
+ author_id: "3" // Database stores the foreign key
224
229
  }]);
225
230
 
226
231
  const entity = await entityService.saveEntity("posts", newPost);
@@ -228,7 +233,7 @@ describe("EntityService", () => {
228
233
  // 1. Check that the relation was serialized to a foreign key for the database insert
229
234
  expect(db.values).toHaveBeenCalledWith(expect.objectContaining({
230
235
  title: "Post by Jane",
231
- author_id: "3" // Should be serialized to FK for database storage
236
+ author_id: "3" // Should be serialized to FK for database storage
232
237
  }));
233
238
 
234
239
  // 2. Check that the returned entity has the relation deserialized correctly
@@ -303,8 +308,12 @@ describe("EntityService", () => {
303
308
  describe("fetchCollectionFromPath", () => {
304
309
  it("should fetch related entities from a nested path", async () => {
305
310
  const mockRelatedPosts = [
306
- { id: 1, title: "Post by John", author_id: 1 },
307
- { id: 2, title: "Another Post by John", author_id: 1 }
311
+ { id: 1,
312
+ title: "Post by John",
313
+ author_id: 1 },
314
+ { id: 2,
315
+ title: "Another Post by John",
316
+ author_id: 1 }
308
317
  ];
309
318
  // RelationService.fetchEntitiesUsingJoins ends query chain with where(), not orderBy()
310
319
  // Make where() awaitable by returning a promise-like object
@@ -333,7 +342,8 @@ describe("EntityService - Comprehensive Tests", () => {
333
342
 
334
343
  // Extended mock tables for more complex scenarios
335
344
  const mockUsersTable = {
336
- id: { name: "id", dataType: "number" },
345
+ id: { name: "id",
346
+ dataType: "number" },
337
347
  email: { name: "email" },
338
348
  name: { name: "name" },
339
349
  created_at: { name: "created_at" },
@@ -384,7 +394,8 @@ describe("EntityService - Comprehensive Tests", () => {
384
394
  };
385
395
 
386
396
  const mockTagsTable = {
387
- id: { name: "id", dataType: "number" },
397
+ id: { name: "id",
398
+ dataType: "number" },
388
399
  name: { name: "name" },
389
400
  _def: { tableName: "tags" }
390
401
  };
@@ -399,7 +410,8 @@ describe("EntityService - Comprehensive Tests", () => {
399
410
  email: { type: "string" },
400
411
  name: { type: "string" },
401
412
  created_at: { type: "date" },
402
- companies: { type: "relation", relationName: "companies" }
413
+ companies: { type: "relation",
414
+ relationName: "companies" }
403
415
  },
404
416
  relations: [{
405
417
  relationName: "companies",
@@ -418,8 +430,10 @@ describe("EntityService - Comprehensive Tests", () => {
418
430
  properties: {
419
431
  id: { type: "number" },
420
432
  name: { type: "string" },
421
- owner: { type: "relation", relationName: "owner" },
422
- projects: { type: "relation", relationName: "projects" }
433
+ owner: { type: "relation",
434
+ relationName: "owner" },
435
+ projects: { type: "relation",
436
+ relationName: "projects" }
423
437
  },
424
438
  relations: [
425
439
  {
@@ -450,9 +464,12 @@ describe("EntityService - Comprehensive Tests", () => {
450
464
  description: { type: "string" },
451
465
  status: { type: "string" },
452
466
  priority: { type: "number" },
453
- company: { type: "relation", relationName: "company" },
454
- tasks: { type: "relation", relationName: "tasks" },
455
- tags: { type: "relation", relationName: "tags" }
467
+ company: { type: "relation",
468
+ relationName: "company" },
469
+ tasks: { type: "relation",
470
+ relationName: "tasks" },
471
+ tags: { type: "relation",
472
+ relationName: "tags" }
456
473
  },
457
474
  relations: [
458
475
  {
@@ -491,8 +508,10 @@ describe("EntityService - Comprehensive Tests", () => {
491
508
  properties: {
492
509
  id: { type: "number" },
493
510
  title: { type: "string" },
494
- project: { type: "relation", relationName: "project" },
495
- assignee: { type: "relation", relationName: "assignee" }
511
+ project: { type: "relation",
512
+ relationName: "project" },
513
+ assignee: { type: "relation",
514
+ relationName: "assignee" }
496
515
  },
497
516
  relations: [
498
517
  {
@@ -531,8 +550,10 @@ describe("EntityService - Comprehensive Tests", () => {
531
550
  properties: {
532
551
  id: { type: "number" },
533
552
  name: { type: "string" },
534
- parent: { type: "relation", relationName: "parent" },
535
- children: { type: "relation", relationName: "children" }
553
+ parent: { type: "relation",
554
+ relationName: "parent" },
555
+ children: { type: "relation",
556
+ relationName: "children" }
536
557
  },
537
558
  relations: [
538
559
  {
@@ -591,7 +612,7 @@ describe("EntityService - Comprehensive Tests", () => {
591
612
  update: jest.fn().mockReturnThis(),
592
613
  set: jest.fn().mockReturnThis(),
593
614
  delete: jest.fn().mockReturnThis(),
594
- transaction: jest.fn((callback) => callback(db)),
615
+ transaction: jest.fn((callback) => callback(db))
595
616
  } as unknown as jest.Mocked<NodePgDatabase>;
596
617
 
597
618
  // Add a then method to make the db object awaitable when the query chain ends
@@ -602,7 +623,9 @@ describe("EntityService - Comprehensive Tests", () => {
602
623
 
603
624
  describe("fetchEntity - Edge Cases", () => {
604
625
  it("should handle numeric IDs correctly", async () => {
605
- const mockUser = { id: 123, email: "test@example.com", name: "Test User" };
626
+ const mockUser = { id: 123,
627
+ email: "test@example.com",
628
+ name: "Test User" };
606
629
  db.limit.mockResolvedValue([mockUser]);
607
630
 
608
631
  const entity = await entityService.fetchEntity("users", 123);
@@ -623,7 +646,8 @@ describe("EntityService - Comprehensive Tests", () => {
623
646
  jest.spyOn(collectionRegistry, "getCollectionByPath").mockReturnValue(stringIdCollection);
624
647
  jest.spyOn(collectionRegistry, "getTable").mockImplementation(tableName => {
625
648
  if (tableName === "users") return {
626
- id: { name: "id", dataType: "string" },
649
+ id: { name: "id",
650
+ dataType: "string" },
627
651
  email: { name: "email" },
628
652
  name: { name: "name" },
629
653
  _def: { tableName: "users" }
@@ -637,7 +661,9 @@ describe("EntityService - Comprehensive Tests", () => {
637
661
  return undefined;
638
662
  });
639
663
 
640
- const mockUser = { id: "uuid-123", email: "test@example.com", name: "Test User" };
664
+ const mockUser = { id: "uuid-123",
665
+ email: "test@example.com",
666
+ name: "Test User" };
641
667
  db.limit.mockResolvedValue([mockUser]);
642
668
 
643
669
  const entity = await entityService.fetchEntity("users", "uuid-123");
@@ -655,7 +681,10 @@ describe("EntityService - Comprehensive Tests", () => {
655
681
  });
656
682
 
657
683
  it("should handle entities with null relation fields", async () => {
658
- const mockTask = { id: 1, title: "Task 1", project_id: null, assignee_id: null };
684
+ const mockTask = { id: 1,
685
+ title: "Task 1",
686
+ project_id: null,
687
+ assignee_id: null };
659
688
  db.limit.mockResolvedValue([mockTask]);
660
689
 
661
690
  const entity = await entityService.fetchEntity("tasks", 1);
@@ -665,10 +694,10 @@ describe("EntityService - Comprehensive Tests", () => {
665
694
  // on the relation resolution logic, so we should check if they are either
666
695
  // undefined or have the expected structure
667
696
  if (entity?.values.project) {
668
- expect(entity.values.project).toHaveProperty('__type', 'relation');
697
+ expect(entity.values.project).toHaveProperty("__type", "relation");
669
698
  }
670
699
  if (entity?.values.assignee) {
671
- expect(entity.values.assignee).toHaveProperty('__type', 'relation');
700
+ expect(entity.values.assignee).toHaveProperty("__type", "relation");
672
701
  }
673
702
 
674
703
  // The main test is that the entity was successfully fetched despite null relations
@@ -680,13 +709,20 @@ describe("EntityService - Comprehensive Tests", () => {
680
709
  describe("fetchCollection - Filtering and Pagination", () => {
681
710
  it("should apply filters correctly", async () => {
682
711
  const mockProjects = [
683
- { id: 1, title: "Project 1", status: "active", priority: 1 },
684
- { id: 2, title: "Project 2", status: "active", priority: 2 }
712
+ { id: 1,
713
+ title: "Project 1",
714
+ status: "active",
715
+ priority: 1 },
716
+ { id: 2,
717
+ title: "Project 2",
718
+ status: "active",
719
+ priority: 2 }
685
720
  ];
686
721
  db.orderBy.mockResolvedValue(mockProjects);
687
722
 
688
723
  await entityService.fetchCollection("projects", {
689
- filter: { status: ["==", "active"], priority: [">=", 1] }
724
+ filter: { status: ["==", "active"],
725
+ priority: [">=", 1] }
690
726
  });
691
727
 
692
728
  expect(db.where).toHaveBeenCalled();
@@ -694,8 +730,12 @@ describe("EntityService - Comprehensive Tests", () => {
694
730
 
695
731
  it("should apply ordering correctly", async () => {
696
732
  const mockProjects = [
697
- { id: 2, title: "Project 2", priority: 2 },
698
- { id: 1, title: "Project 1", priority: 1 }
733
+ { id: 2,
734
+ title: "Project 2",
735
+ priority: 2 },
736
+ { id: 1,
737
+ title: "Project 1",
738
+ priority: 1 }
699
739
  ];
700
740
  db.orderBy.mockResolvedValue(mockProjects);
701
741
 
@@ -709,8 +749,10 @@ describe("EntityService - Comprehensive Tests", () => {
709
749
 
710
750
  it("should apply limit correctly", async () => {
711
751
  const mockProjects = [
712
- { id: 1, title: "Project 1" },
713
- { id: 2, title: "Project 2" }
752
+ { id: 1,
753
+ title: "Project 1" },
754
+ { id: 2,
755
+ title: "Project 2" }
714
756
  ];
715
757
  // Override the then method to return our mock data for this specific test
716
758
  (db as unknown as Record<string, jest.Mock>).then = jest.fn((resolve) => resolve(mockProjects));
@@ -726,8 +768,12 @@ describe("EntityService - Comprehensive Tests", () => {
726
768
  describe("Nested Path Relations", () => {
727
769
  it("should handle deep nested paths", async () => {
728
770
  const mockTasks = [
729
- { id: 1, title: "Task 1", project_id: 1 },
730
- { id: 2, title: "Task 2", project_id: 1 }
771
+ { id: 1,
772
+ title: "Task 1",
773
+ project_id: 1 },
774
+ { id: 2,
775
+ title: "Task 2",
776
+ project_id: 1 }
731
777
  ];
732
778
  // RelationService.fetchEntitiesUsingJoins ends query chain with where(), not orderBy()
733
779
  // Make where() awaitable by returning a promise-like object
@@ -746,8 +792,12 @@ describe("EntityService - Comprehensive Tests", () => {
746
792
 
747
793
  it("should handle self-referencing relations", async () => {
748
794
  const mockCategories = [
749
- { id: 2, name: "Subcategory 1", parent_id: 1 },
750
- { id: 3, name: "Subcategory 2", parent_id: 1 }
795
+ { id: 2,
796
+ name: "Subcategory 1",
797
+ parent_id: 1 },
798
+ { id: 3,
799
+ name: "Subcategory 2",
800
+ parent_id: 1 }
751
801
  ];
752
802
  // RelationService.fetchEntitiesUsingJoins ends query chain with where(), not orderBy()
753
803
  db.where.mockReturnValue({
@@ -780,7 +830,9 @@ describe("EntityService - Comprehensive Tests", () => {
780
830
  const newProject = {
781
831
  title: "New Project",
782
832
  description: "A new project",
783
- company: { id: "1", path: "companies", __type: "relation" }
833
+ company: { id: "1",
834
+ path: "companies",
835
+ __type: "relation" }
784
836
  };
785
837
 
786
838
  db.returning.mockResolvedValue([{ id: 5 }]);
@@ -803,7 +855,9 @@ describe("EntityService - Comprehensive Tests", () => {
803
855
  it("should handle updating entity with relation changes", async () => {
804
856
  const updatedTask = {
805
857
  title: "Updated Task",
806
- assignee: { id: "2", path: "users", __type: "relation" }
858
+ assignee: { id: "2",
859
+ path: "users",
860
+ __type: "relation" }
807
861
  };
808
862
 
809
863
  db.returning.mockResolvedValue([{ id: 1 }]);
@@ -864,7 +918,9 @@ describe("EntityService - Comprehensive Tests", () => {
864
918
  describe("searchEntities", () => {
865
919
  it("should perform search across specified fields", async () => {
866
920
  const mockResults = [
867
- { id: 1, title: "Searchable Project", description: "Test description" }
921
+ { id: 1,
922
+ title: "Searchable Project",
923
+ description: "Test description" }
868
924
  ];
869
925
  // Override the then method to return our mock data for this specific test
870
926
  (db as unknown as Record<string, jest.Mock>).then = jest.fn((resolve) => resolve(mockResults));
@@ -877,7 +933,9 @@ describe("EntityService - Comprehensive Tests", () => {
877
933
 
878
934
  it("should combine search with filters", async () => {
879
935
  const mockResults = [
880
- { id: 1, title: "Active Project", status: "active" }
936
+ { id: 1,
937
+ title: "Active Project",
938
+ status: "active" }
881
939
  ];
882
940
  // Override the then method to return our mock data for this specific test
883
941
  (db as unknown as Record<string, jest.Mock>).then = jest.fn((resolve) => resolve(mockResults));