@auto-engineer/server-generator-apollo-emmett 1.78.0 → 1.80.0

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.
@@ -1,5 +1,5 @@
1
1
 
2
- > @auto-engineer/server-generator-apollo-emmett@1.78.0 build /home/runner/work/auto-engineer/auto-engineer/packages/server-generator-apollo-emmett
2
+ > @auto-engineer/server-generator-apollo-emmett@1.80.0 build /home/runner/work/auto-engineer/auto-engineer/packages/server-generator-apollo-emmett
3
3
  > tsc && tsx ../../scripts/fix-esm-imports.ts && rm -rf dist/src/codegen/templates && mkdir -p dist/src/codegen && cp -r src/codegen/templates dist/src/codegen/templates && cp src/server.ts dist/src && cp -r src/utils dist/src && cp -r src/domain dist/src
4
4
 
5
5
  Fixed ESM imports in dist/
@@ -1,5 +1,5 @@
1
1
 
2
- > @auto-engineer/server-generator-apollo-emmett@1.77.0 test /home/runner/work/auto-engineer/auto-engineer/packages/server-generator-apollo-emmett
2
+ > @auto-engineer/server-generator-apollo-emmett@1.79.0 test /home/runner/work/auto-engineer/auto-engineer/packages/server-generator-apollo-emmett
3
3
  > vitest run --reporter=dot
4
4
 
5
5
 
@@ -9,6 +9,6 @@
9
9
 
10
10
   Test Files  30 passed | 1 skipped (31)
11
11
   Tests  174 passed | 1 skipped (175)
12
-  Start at  17:15:27
13
-  Duration  38.46s (transform 4.83s, setup 0ms, collect 77.27s, tests 20.50s, environment 27ms, prepare 6.30s)
12
+  Start at  23:09:25
13
+  Duration  22.14s (transform 2.91s, setup 0ms, collect 44.94s, tests 9.58s, environment 7ms, prepare 4.37s)
14
14
 
@@ -1,4 +1,4 @@
1
1
 
2
- > @auto-engineer/server-generator-apollo-emmett@1.77.0 type-check /home/runner/work/auto-engineer/auto-engineer/packages/server-generator-apollo-emmett
2
+ > @auto-engineer/server-generator-apollo-emmett@1.79.0 type-check /home/runner/work/auto-engineer/auto-engineer/packages/server-generator-apollo-emmett
3
3
  > tsc --noEmit --project tsconfig.json
4
4
 
package/CHANGELOG.md CHANGED
@@ -1,5 +1,75 @@
1
1
  # @auto-engineer/server-generator-apollo-emmett
2
2
 
3
+ ## 1.80.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [`43082f0`](https://github.com/BeOnAuto/auto-engineer/commit/43082f08820c36d3f380b0e47b98263bc0287cf2) Thanks [@github-actions[bot]](https://github.com/github-actions%5Bbot%5D)! - - **server-checks**: extract runLintCheck core logic
8
+ - **server-checks**: extract runTypeCheck core logic
9
+ - **server-checks**: extract findProjectRoot into shared module
10
+ - **app-implementer**: replace Message[] with ChatTurn in RefinementHistory
11
+ - **react-component-implementer**: replace Message[] with ChatTurn in RefinementHistory
12
+
13
+ ### Patch Changes
14
+
15
+ - [`4bdde8b`](https://github.com/BeOnAuto/auto-engineer/commit/4bdde8b4803a8e85234786e4d2e0cc227ad10859) Thanks [@SamHatoum](https://github.com/SamHatoum)! - - Temporarily disabled existing tests in app and component generator specs for upcoming refactor
16
+
17
+ - [`3e7f02d`](https://github.com/BeOnAuto/auto-engineer/commit/3e7f02d79e078374c02c76ee7d261c76c35ce3be) Thanks [@SamHatoum](https://github.com/SamHatoum)! - - format files with biome
18
+
19
+ - Updated dependencies [[`4bdde8b`](https://github.com/BeOnAuto/auto-engineer/commit/4bdde8b4803a8e85234786e4d2e0cc227ad10859), [`43082f0`](https://github.com/BeOnAuto/auto-engineer/commit/43082f08820c36d3f380b0e47b98263bc0287cf2), [`3e7f02d`](https://github.com/BeOnAuto/auto-engineer/commit/3e7f02d79e078374c02c76ee7d261c76c35ce3be)]:
20
+ - @auto-engineer/message-bus@1.80.0
21
+ - @auto-engineer/narrative@1.80.0
22
+
23
+ ## 1.79.0
24
+
25
+ ### Minor Changes
26
+
27
+ - [`ec198e5`](https://github.com/BeOnAuto/auto-engineer/commit/ec198e559e662df16611ba433c56938304a869b6) Thanks [@rami-hatoum](https://github.com/rami-hatoum)! - - **server-checks**: extract findProjectRoot into shared module
28
+
29
+ - [`f460341`](https://github.com/BeOnAuto/auto-engineer/commit/f46034125e102b216d35a59f7260170480dc7fa4) Thanks [@rami-hatoum](https://github.com/rami-hatoum)! - - **server-checks**: extract runTypeCheck core logic
30
+
31
+ - [`ec1480d`](https://github.com/BeOnAuto/auto-engineer/commit/ec1480d6431df13948ae26dc2ad691c28ddafdf8) Thanks [@github-actions[bot]](https://github.com/github-actions%5Bbot%5D)! - - **react-component-implementer**: add aesthetic quality checks to visual evaluator
32
+ - **app-implementer**: add comprehensive recipe-based visual design system
33
+ - **react-component-implementer**: replace design principles with Tailwind recipes
34
+ - **global**: version packages
35
+ - **react-component-implementer**: finalize ketchup plan for design system upgrade
36
+
37
+ - [`8eb0244`](https://github.com/BeOnAuto/auto-engineer/commit/8eb02443763228e8182cfb3c30606e94cc9f0c30) Thanks [@rami-hatoum](https://github.com/rami-hatoum)! - - **server-checks**: extract runLintCheck core logic
38
+
39
+ ### Patch Changes
40
+
41
+ - [`506b0b4`](https://github.com/BeOnAuto/auto-engineer/commit/506b0b4810247e10c0896d45a37f4f0610d53455) Thanks [@rami-hatoum](https://github.com/rami-hatoum)! - - **react-component-implementer**: replace Message[] with ChatTurn in RefinementHistory
42
+
43
+ - [`087f977`](https://github.com/BeOnAuto/auto-engineer/commit/087f9776128b0610b945f23d0f4c3bc1a3d816dd) Thanks [@rami-hatoum](https://github.com/rami-hatoum)! - - **app-implementer**: replace Message[] with ChatTurn in RefinementHistory
44
+
45
+ - [`9bc98b4`](https://github.com/BeOnAuto/auto-engineer/commit/9bc98b4f384fa3417447e65286b015e1e10e63e9) Thanks [@rami-hatoum](https://github.com/rami-hatoum)! - - **server-checks**: slim CheckLint handler to delegate to runLintCheck
46
+
47
+ - [`b3ed5c1`](https://github.com/BeOnAuto/auto-engineer/commit/b3ed5c10575d00ca106237137bafc3524e8e9d82) Thanks [@rami-hatoum](https://github.com/rami-hatoum)! - - **server-generator-apollo-emmett**: ketchup plan for slim ReadModel API
48
+
49
+ - [`9c7ad8f`](https://github.com/BeOnAuto/auto-engineer/commit/9c7ad8fb3dd5d8321a80c4035baa9fe20701b651) Thanks [@rami-hatoum](https://github.com/rami-hatoum)! - - **global**: ketchup plan for LLM context growth optimization
50
+
51
+ - [`cedc3c0`](https://github.com/BeOnAuto/auto-engineer/commit/cedc3c0995af6025ab3d38a5a65d5bec9b4ecc7d) Thanks [@rami-hatoum](https://github.com/rami-hatoum)! - - **model-factory**: add ChatMessage and ChatTurn types for refinement history
52
+
53
+ - [`9757597`](https://github.com/BeOnAuto/auto-engineer/commit/9757597a1e562dfe81efa2de128aa10e8d091c79) Thanks [@rami-hatoum](https://github.com/rami-hatoum)! - - **server-checks**: add ketchup plan for unify check commands
54
+
55
+ - [`8104cc8`](https://github.com/BeOnAuto/auto-engineer/commit/8104cc82e7193c6a1a52a60da844a3e3fdb20b3b) Thanks [@rami-hatoum](https://github.com/rami-hatoum)! - - **server-checks**: export findProjectRoot, runTypeCheck, runLintCheck from index
56
+
57
+ - [`0bdb8d9`](https://github.com/BeOnAuto/auto-engineer/commit/0bdb8d9e606ce702cb7bbe81cbdc1f55fff58881) Thanks [@rami-hatoum](https://github.com/rami-hatoum)! - - **server-checks**: finalize ketchup plan for unify check commands
58
+
59
+ - [`31f65ac`](https://github.com/BeOnAuto/auto-engineer/commit/31f65acb9dfb656edfd482afc454bb4373b1d29d) Thanks [@rami-hatoum](https://github.com/rami-hatoum)! - - **server-generator-apollo-emmett**: slim ReadModel API to find + findOne
60
+
61
+ - [`25f8375`](https://github.com/BeOnAuto/auto-engineer/commit/25f8375ac181f09ff50aca3bccc3132b97814637) Thanks [@rami-hatoum](https://github.com/rami-hatoum)! - - **react-component-implementer**: replace lint-tier with runLintCheck, delete type-checker
62
+
63
+ - [`ab92096`](https://github.com/BeOnAuto/auto-engineer/commit/ab920961c9fd7515be9c09b4dbb1054bf03c94b9) Thanks [@rami-hatoum](https://github.com/rami-hatoum)! - - **react-component-implementer**: replace type-check-tier with runTypeCheck
64
+
65
+ - [`bcd8c4a`](https://github.com/BeOnAuto/auto-engineer/commit/bcd8c4a1e5e3d867c248d6bd55f66d7ef4863f46) Thanks [@rami-hatoum](https://github.com/rami-hatoum)! - - **server-checks**: use shared findProjectRoot in check-tests
66
+
67
+ - [`41ed452`](https://github.com/BeOnAuto/auto-engineer/commit/41ed4525bc796b1bdc1825fed20dd9f336108ca8) Thanks [@rami-hatoum](https://github.com/rami-hatoum)! - - **server-checks**: slim CheckTypes handler to delegate to runTypeCheck
68
+
69
+ - Updated dependencies [[`506b0b4`](https://github.com/BeOnAuto/auto-engineer/commit/506b0b4810247e10c0896d45a37f4f0610d53455), [`087f977`](https://github.com/BeOnAuto/auto-engineer/commit/087f9776128b0610b945f23d0f4c3bc1a3d816dd), [`9bc98b4`](https://github.com/BeOnAuto/auto-engineer/commit/9bc98b4f384fa3417447e65286b015e1e10e63e9), [`b3ed5c1`](https://github.com/BeOnAuto/auto-engineer/commit/b3ed5c10575d00ca106237137bafc3524e8e9d82), [`ec198e5`](https://github.com/BeOnAuto/auto-engineer/commit/ec198e559e662df16611ba433c56938304a869b6), [`9c7ad8f`](https://github.com/BeOnAuto/auto-engineer/commit/9c7ad8fb3dd5d8321a80c4035baa9fe20701b651), [`cedc3c0`](https://github.com/BeOnAuto/auto-engineer/commit/cedc3c0995af6025ab3d38a5a65d5bec9b4ecc7d), [`f460341`](https://github.com/BeOnAuto/auto-engineer/commit/f46034125e102b216d35a59f7260170480dc7fa4), [`9757597`](https://github.com/BeOnAuto/auto-engineer/commit/9757597a1e562dfe81efa2de128aa10e8d091c79), [`8104cc8`](https://github.com/BeOnAuto/auto-engineer/commit/8104cc82e7193c6a1a52a60da844a3e3fdb20b3b), [`ec1480d`](https://github.com/BeOnAuto/auto-engineer/commit/ec1480d6431df13948ae26dc2ad691c28ddafdf8), [`0bdb8d9`](https://github.com/BeOnAuto/auto-engineer/commit/0bdb8d9e606ce702cb7bbe81cbdc1f55fff58881), [`31f65ac`](https://github.com/BeOnAuto/auto-engineer/commit/31f65acb9dfb656edfd482afc454bb4373b1d29d), [`25f8375`](https://github.com/BeOnAuto/auto-engineer/commit/25f8375ac181f09ff50aca3bccc3132b97814637), [`ab92096`](https://github.com/BeOnAuto/auto-engineer/commit/ab920961c9fd7515be9c09b4dbb1054bf03c94b9), [`bcd8c4a`](https://github.com/BeOnAuto/auto-engineer/commit/bcd8c4a1e5e3d867c248d6bd55f66d7ef4863f46), [`41ed452`](https://github.com/BeOnAuto/auto-engineer/commit/41ed4525bc796b1bdc1825fed20dd9f336108ca8), [`8eb0244`](https://github.com/BeOnAuto/auto-engineer/commit/8eb02443763228e8182cfb3c30606e94cc9f0c30)]:
70
+ - @auto-engineer/message-bus@1.79.0
71
+ - @auto-engineer/narrative@1.79.0
72
+
3
73
  ## 1.78.0
4
74
 
5
75
  ### Minor Changes
@@ -377,15 +377,12 @@ describe('projection.ts.ejs', () => {
377
377
  ): Promise<Wishlist[]> {
378
378
  const model = new ReadModel<Wishlist>(ctx.database, 'WishlistProjection');
379
379
 
380
- // ## IMPLEMENTATION INSTRUCTIONS ##
381
- // You can query the projection using the ReadModel API:
382
- // - model.getAll() fetch all documents
383
- // - model.getById(id) — fetch a single document by ID (default key: 'id')
384
- // - model.find(filterFn) — filter documents using a predicate
385
- // - model.first(filterFn) — fetch the first document matching a predicate
380
+ // ReadModel API:
381
+ // - model.find(filterFn?) → T[] returns all matches (or all documents if no filter)
382
+ // - model.findOne(filterFn) T | null returns the first match
386
383
  //
387
- // Example below uses \\\`.find()\\\` to filter
388
- // change the logic for the query as needed to meet the requirements for the current slice.
384
+ // The scaffolded code below uses find() returning an array.
385
+ // If this query should return a single item, switch to findOne().
389
386
 
390
387
  return model.find((item) => {
391
388
  if (sessionId !== undefined && item.sessionId !== sessionId) return false;
@@ -104,15 +104,12 @@ describe('query.resolver.ts.ejs', () => {
104
104
  ): Promise<AvailableListings[]> {
105
105
  const model = new ReadModel<AvailableListings>(ctx.database, 'AvailablePropertiesProjection');
106
106
 
107
- // ## IMPLEMENTATION INSTRUCTIONS ##
108
- // You can query the projection using the ReadModel API:
109
- // - model.getAll() fetch all documents
110
- // - model.getById(id) — fetch a single document by ID (default key: 'id')
111
- // - model.find(filterFn) — filter documents using a predicate
112
- // - model.first(filterFn) — fetch the first document matching a predicate
107
+ // ReadModel API:
108
+ // - model.find(filterFn?) → T[] returns all matches (or all documents if no filter)
109
+ // - model.findOne(filterFn) T | null returns the first match
113
110
  //
114
- // Example below uses \\\`.find()\\\` to filter
115
- // change the logic for the query as needed to meet the requirements for the current slice.
111
+ // The scaffolded code below uses find() returning an array.
112
+ // If this query should return a single item, switch to findOne().
116
113
 
117
114
  return model.find((item) => {
118
115
  if (location !== undefined && item.location !== location) return false;
@@ -235,15 +232,12 @@ describe('query.resolver.ts.ejs', () => {
235
232
  ): Promise<SuggestedItems[]> {
236
233
  const model = new ReadModel<SuggestedItems>(ctx.database, 'SuggestedItemsProjection');
237
234
 
238
- // ## IMPLEMENTATION INSTRUCTIONS ##
239
- // You can query the projection using the ReadModel API:
240
- // - model.getAll() fetch all documents
241
- // - model.getById(id) — fetch a single document by ID (default key: 'id')
242
- // - model.find(filterFn) — filter documents using a predicate
243
- // - model.first(filterFn) — fetch the first document matching a predicate
235
+ // ReadModel API:
236
+ // - model.find(filterFn?) → T[] returns all matches (or all documents if no filter)
237
+ // - model.findOne(filterFn) T | null returns the first match
244
238
  //
245
- // Example below uses \\\`.find()\\\` to filter
246
- // change the logic for the query as needed to meet the requirements for the current slice.
239
+ // The scaffolded code below uses find() returning an array.
240
+ // If this query should return a single item, switch to findOne().
247
241
 
248
242
  return model.find((item) => {
249
243
  if (sessionId !== undefined && item.sessionId !== sessionId) return false;
@@ -411,15 +405,12 @@ describe('query.resolver.ts.ejs', () => {
411
405
  ): Promise<QuestionnaireProgress[]> {
412
406
  const model = new ReadModel<QuestionnaireProgress>(ctx.database, 'Questionnaires');
413
407
 
414
- // ## IMPLEMENTATION INSTRUCTIONS ##
415
- // You can query the projection using the ReadModel API:
416
- // - model.getAll() fetch all documents
417
- // - model.getById(id) — fetch a single document by ID (default key: 'id')
418
- // - model.find(filterFn) — filter documents using a predicate
419
- // - model.first(filterFn) — fetch the first document matching a predicate
408
+ // ReadModel API:
409
+ // - model.find(filterFn?) → T[] returns all matches (or all documents if no filter)
410
+ // - model.findOne(filterFn) T | null returns the first match
420
411
  //
421
- // Example below uses \\\`.find()\\\` to filter
422
- // change the logic for the query as needed to meet the requirements for the current slice.
412
+ // The scaffolded code below uses find() returning an array.
413
+ // If this query should return a single item, switch to findOne().
423
414
 
424
415
  return model.find((item) => {
425
416
  if (participantId !== undefined && item.participantId !== participantId) return false;
@@ -936,15 +927,12 @@ describe('query.resolver.ts.ejs', () => {
936
927
  ): Promise<RecipeMatchesRecipes[]> {
937
928
  const model = new ReadModel<RecipeMatchesRecipes>(ctx.database, 'RecipeMatchesProjection');
938
929
 
939
- // ## IMPLEMENTATION INSTRUCTIONS ##
940
- // You can query the projection using the ReadModel API:
941
- // - model.getAll() fetch all documents
942
- // - model.getById(id) — fetch a single document by ID (default key: 'id')
943
- // - model.find(filterFn) — filter documents using a predicate
944
- // - model.first(filterFn) — fetch the first document matching a predicate
930
+ // ReadModel API:
931
+ // - model.find(filterFn?) → T[] returns all matches (or all documents if no filter)
932
+ // - model.findOne(filterFn) T | null returns the first match
945
933
  //
946
- // Example below uses \\\`.find()\\\` to filter
947
- // change the logic for the query as needed to meet the requirements for the current slice.
934
+ // The scaffolded code below uses find() returning an array.
935
+ // If this query should return a single item, switch to findOne().
948
936
 
949
937
  return model.find((item) => {
950
938
  if (pantryId !== undefined && item.pantryId !== pantryId) return false;
@@ -1181,15 +1169,12 @@ describe('query.resolver.ts.ejs', () => {
1181
1169
  ): Promise<RecipeMatchesRecipes[]> {
1182
1170
  const model = new ReadModel<RecipeMatchesRecipes>(ctx.database, 'RecipeMatchesProjection');
1183
1171
 
1184
- // ## IMPLEMENTATION INSTRUCTIONS ##
1185
- // You can query the projection using the ReadModel API:
1186
- // - model.getAll() fetch all documents
1187
- // - model.getById(id) — fetch a single document by ID (default key: 'id')
1188
- // - model.find(filterFn) — filter documents using a predicate
1189
- // - model.first(filterFn) — fetch the first document matching a predicate
1172
+ // ReadModel API:
1173
+ // - model.find(filterFn?) → T[] returns all matches (or all documents if no filter)
1174
+ // - model.findOne(filterFn) T | null returns the first match
1190
1175
  //
1191
- // Example below uses \\\`.find()\\\` to filter
1192
- // change the logic for the query as needed to meet the requirements for the current slice.
1176
+ // The scaffolded code below uses find() returning an array.
1177
+ // If this query should return a single item, switch to findOne().
1193
1178
 
1194
1179
  return model.find((item) => {
1195
1180
  if (pantryId !== undefined && item.pantryId !== pantryId) return false;
@@ -156,15 +156,12 @@ async <%= queryName %>(
156
156
  ): Promise<<%= viewType %>[]> {
157
157
  const model = new ReadModel<<%= viewType %>>(ctx.database, '<%= collectionName %>');
158
158
 
159
- // ## IMPLEMENTATION INSTRUCTIONS ##
160
- // You can query the projection using the ReadModel API:
161
- // - model.getAll() fetch all documents
162
- // - model.getById(id) — fetch a single document by ID (default key: 'id')
163
- // - model.find(filterFn) — filter documents using a predicate
164
- // - model.first(filterFn) — fetch the first document matching a predicate
159
+ // ReadModel API:
160
+ // - model.find(filterFn?) → T[] returns all matches (or all documents if no filter)
161
+ // - model.findOne(filterFn) T | null returns the first match
165
162
  //
166
- // Example below uses \`.find()\` to filter
167
- // change the logic for the query as needed to meet the requirements for the current slice.
163
+ // The scaffolded code below uses find() returning an array.
164
+ // If this query should return a single item, switch to findOne().
168
165
 
169
166
  return model.find((<%= hasArgs ? 'item' : '_item' %>) => {
170
167
  <% if (parsedRequest?.args?.length) {
@@ -2,9 +2,7 @@ import type { InMemoryDatabase } from '@event-driven-io/emmett';
2
2
  export declare class ReadModel<T extends Record<string, unknown>> {
3
3
  private collection;
4
4
  constructor(database: InMemoryDatabase, collectionName: string);
5
- getAll(): Promise<T[]>;
6
- getById(id: string, idField?: keyof T): Promise<T | null>;
7
- find(filterFn: (item: T) => boolean): Promise<T[]>;
8
- first(filterFn: (item: T) => boolean): Promise<T | null>;
5
+ find(filterFn?: (item: T) => boolean): Promise<T[]>;
6
+ findOne(filterFn: (item: T) => boolean): Promise<T | null>;
9
7
  }
10
8
  //# sourceMappingURL=ReadModel.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ReadModel.d.ts","sourceRoot":"","sources":["../../../../src/domain/shared/ReadModel.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAEhE,qBAAa,SAAS,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IACtD,OAAO,CAAC,UAAU,CAAC;gBAEP,QAAQ,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM;IAIxD,MAAM,IAAI,OAAO,CAAC,CAAC,EAAE,CAAC;IAItB,OAAO,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,GAAE,MAAM,CAAmB,GAAG,OAAO,CAAC,CAAC,GAAG,IAAI,CAAC;IAI1E,IAAI,CAAC,QAAQ,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,OAAO,GAAG,OAAO,CAAC,CAAC,EAAE,CAAC;IAIlD,KAAK,CAAC,QAAQ,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,OAAO,GAAG,OAAO,CAAC,CAAC,GAAG,IAAI,CAAC;CAI/D"}
1
+ {"version":3,"file":"ReadModel.d.ts","sourceRoot":"","sources":["../../../../src/domain/shared/ReadModel.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAEhE,qBAAa,SAAS,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IACtD,OAAO,CAAC,UAAU,CAAC;gBAEP,QAAQ,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM;IAIxD,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,OAAO,GAAG,OAAO,CAAC,CAAC,EAAE,CAAC;IAInD,OAAO,CAAC,QAAQ,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,OAAO,GAAG,OAAO,CAAC,CAAC,GAAG,IAAI,CAAC;CAGjE"}
@@ -2,18 +2,11 @@ export class ReadModel {
2
2
  constructor(database, collectionName) {
3
3
  this.collection = database.collection(collectionName);
4
4
  }
5
- async getAll() {
6
- return this.collection.find();
7
- }
8
- async getById(id, idField = 'id') {
9
- return this.collection.findOne((doc) => doc[idField] === id);
10
- }
11
5
  async find(filterFn) {
12
6
  return this.collection.find(filterFn);
13
7
  }
14
- async first(filterFn) {
15
- const all = await this.collection.find(filterFn);
16
- return all[0] ?? null;
8
+ async findOne(filterFn) {
9
+ return this.collection.findOne(filterFn);
17
10
  }
18
11
  }
19
12
  //# sourceMappingURL=ReadModel.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ReadModel.js","sourceRoot":"","sources":["../../../../src/domain/shared/ReadModel.ts"],"names":[],"mappings":"AAEA,MAAM,OAAO,SAAS;IAGpB,YAAY,QAA0B,EAAE,cAAsB;QAC5D,IAAI,CAAC,UAAU,GAAG,QAAQ,CAAC,UAAU,CAAI,cAAc,CAAC,CAAC;IAC3D,CAAC;IAED,KAAK,CAAC,MAAM;QACV,OAAO,IAAI,CAAC,UAAU,CAAC,IAAI,EAAE,CAAC;IAChC,CAAC;IAED,KAAK,CAAC,OAAO,CAAC,EAAU,EAAE,UAAmB,IAAe;QAC1D,OAAO,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC,CAAC;IAC/D,CAAC;IAED,KAAK,CAAC,IAAI,CAAC,QAA8B;QACvC,OAAO,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IACxC,CAAC;IAED,KAAK,CAAC,KAAK,CAAC,QAA8B;QACxC,MAAM,GAAG,GAAG,MAAM,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QACjD,OAAO,GAAG,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC;IACxB,CAAC;CACF"}
1
+ {"version":3,"file":"ReadModel.js","sourceRoot":"","sources":["../../../../src/domain/shared/ReadModel.ts"],"names":[],"mappings":"AAEA,MAAM,OAAO,SAAS;IAGpB,YAAY,QAA0B,EAAE,cAAsB;QAC5D,IAAI,CAAC,UAAU,GAAG,QAAQ,CAAC,UAAU,CAAI,cAAc,CAAC,CAAC;IAC3D,CAAC;IAED,KAAK,CAAC,IAAI,CAAC,QAA+B;QACxC,OAAO,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IACxC,CAAC;IAED,KAAK,CAAC,OAAO,CAAC,QAA8B;QAC1C,OAAO,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;IAC3C,CAAC;CACF"}
@@ -7,20 +7,11 @@ export class ReadModel<T extends Record<string, unknown>> {
7
7
  this.collection = database.collection<T>(collectionName);
8
8
  }
9
9
 
10
- async getAll(): Promise<T[]> {
11
- return this.collection.find();
12
- }
13
-
14
- async getById(id: string, idField: keyof T = 'id' as keyof T): Promise<T | null> {
15
- return this.collection.findOne((doc) => doc[idField] === id);
16
- }
17
-
18
- async find(filterFn: (item: T) => boolean): Promise<T[]> {
10
+ async find(filterFn?: (item: T) => boolean): Promise<T[]> {
19
11
  return this.collection.find(filterFn);
20
12
  }
21
13
 
22
- async first(filterFn: (item: T) => boolean): Promise<T | null> {
23
- const all = await this.collection.find(filterFn);
24
- return all[0] ?? null;
14
+ async findOne(filterFn: (item: T) => boolean): Promise<T | null> {
15
+ return this.collection.findOne(filterFn);
25
16
  }
26
17
  }