@declaro/data 2.0.0-beta.115 → 2.0.0-beta.116

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.
@@ -18,5 +18,6 @@ export declare class BaseModelService<TSchema extends AnyModelSchema> {
18
18
  getDescriptor(action: string, scope?: string): ActionDescriptor;
19
19
  getPrimaryKeyValue(input: InferLookup<TSchema>): InferPrimaryKeyType<TSchema>;
20
20
  getPrimaryKeyValue(input: InferInput<TSchema>): InferPrimaryKeyType<TSchema>;
21
+ getSchema(): TSchema;
21
22
  }
22
23
  //# sourceMappingURL=base-model-service.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"base-model-service.d.ts","sourceRoot":"","sources":["../../../../src/domain/services/base-model-service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,KAAK,cAAc,EAAoB,MAAM,eAAe,CAAA;AACvF,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAA;AAC7D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAA;AAC3D,OAAO,KAAK,EACR,mBAAmB,EACnB,UAAU,EACV,WAAW,EACX,mBAAmB,EACtB,MAAM,qCAAqC,CAAA;AAE5C,MAAM,WAAW,cAAc;IAC3B;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAA;CACjB;AAED,qBAAa,gBAAgB,CAAC,OAAO,SAAS,cAAc;IACxD,SAAS,CAAC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAA;IACpC,SAAS,CAAC,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAA;IAClC,SAAS,CAAC,QAAQ,CAAC,cAAc,EAAE,mBAAmB,CAAC,OAAO,CAAC,CAAA;IAC/D,SAAS,CAAC,QAAQ,CAAC,OAAO,EAAE,iBAAiB,CAAC,OAAO,CAAC,CAAC,SAAS,CAAC,CAAA;IACjE,SAAS,CAAC,QAAQ,CAAC,UAAU,EAAE,WAAW,CAA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,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM;IAS5C,kBAAkB,CAAC,KAAK,EAAE,WAAW,CAAC,OAAO,CAAC,GAAG,mBAAmB,CAAC,OAAO,CAAC;IAC7E,kBAAkB,CAAC,KAAK,EAAE,UAAU,CAAC,OAAO,CAAC,GAAG,mBAAmB,CAAC,OAAO,CAAC;IAQrE,SAAS;CAGnB"}
@@ -1 +1 @@
1
- {"version":3,"file":"read-only-model-service.d.ts","sourceRoot":"","sources":["../../../../src/domain/services/read-only-model-service.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAS,MAAM,eAAe,CAAA;AAC1D,OAAO,KAAK,EACR,WAAW,EACX,YAAY,EACZ,WAAW,EACX,kBAAkB,EAClB,SAAS,EACZ,MAAM,qCAAqC,CAAA;AAG5C,OAAO,EAAE,gBAAgB,EAAE,KAAK,cAAc,EAAE,MAAM,sBAAsB,CAAA;AAC5E,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAA;AAG5D,MAAM,WAAW,YAAa,SAAQ,cAAc;CAAG;AACvD,MAAM,WAAW,cAAc,CAAC,OAAO,SAAS,cAAc,CAAE,SAAQ,cAAc;IAClF,UAAU,CAAC,EAAE,gBAAgB,CAAA;IAC7B,IAAI,CAAC,EAAE,SAAS,CAAC,OAAO,CAAC,CAAA;CAC5B;AAED,qBAAa,oBAAoB,CAAC,OAAO,SAAS,cAAc,CAAE,SAAQ,gBAAgB,CAAC,OAAO,CAAC;IAC/F;;;;;;OAMG;IACG,eAAe,CAAC,MAAM,EAAE,WAAW,CAAC,OAAO,CAAC,GAAG,OAAO,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;IAalF;;;;;;;OAOG;IACG,gBAAgB,CAAC,OAAO,EAAE,WAAW,CAAC,OAAO,CAAC,GAAG,OAAO,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;IAapF;;;;;OAKG;IACG,IAAI,CAAC,MAAM,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S,cAAc,CAAE,SAAQ,gBAAgB,CAAC,OAAO,CAAC;IAC/F;;;;;;OAMG;IACG,eAAe,CAAC,MAAM,EAAE,WAAW,CAAC,OAAO,CAAC,GAAG,OAAO,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;IAIlF;;;;;;;OAOG;IACG,gBAAgB,CAAC,OAAO,EAAE,WAAW,CAAC,OAAO,CAAC,GAAG,OAAO,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;IAIpF;;;;;OAKG;IACG,IAAI,CAAC,MAAM,EAAE,WAAW,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC,EAAE,YAAY,GAAG,OAAO,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;IAqB/F;;;;;OAKG;IACG,QAAQ,CAAC,OAAO,EAAE,WAAW,CAAC,OAAO,CAAC,EAAE,EAAE,OAAO,CAAC,EAAE,YAAY,GAAG,OAAO,CAAC,WAAW,CAAC,OAAO,CAAC,EAAE,CAAC;IAqBxG;;;;;OAKG;IACG,MAAM,CACR,OAAO,EAAE,YAAY,CAAC,OAAO,CAAC,EAC9B,OAAO,CAAC,EAAE,cAAc,CAAC,OAAO,CAAC,GAClC,OAAO,CAAC,kBAAkB,CAAC,OAAO,CAAC,CAAC;IAyBvC;;;;OAIG;IACG,KAAK,CAAC,OAAO,EAAE,YAAY,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC,EAAE,cAAc,CAAC,OAAO,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC;CAqBlG"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@declaro/data",
3
- "version": "2.0.0-beta.115",
3
+ "version": "2.0.0-beta.116",
4
4
  "description": "A data-mapper framework for managing application data across integrated systems.",
5
5
  "main": "dist/node/index.cjs",
6
6
  "module": "dist/node/index.js",
@@ -22,9 +22,9 @@
22
22
  "@declaro/zod": "^2.0.0-beta.51"
23
23
  },
24
24
  "devDependencies": {
25
- "@declaro/auth": "^2.0.0-beta.115",
26
- "@declaro/core": "^2.0.0-beta.115",
27
- "@declaro/zod": "^2.0.0-beta.115",
25
+ "@declaro/auth": "^2.0.0-beta.116",
26
+ "@declaro/core": "^2.0.0-beta.116",
27
+ "@declaro/zod": "^2.0.0-beta.116",
28
28
  "crypto-browserify": "^3.12.1",
29
29
  "typescript": "^5.8.3",
30
30
  "uuid": "^11.1.0",
@@ -43,5 +43,5 @@
43
43
  "require": "./dist/node/index.cjs",
44
44
  "browser": "./dist/browser/index.js"
45
45
  },
46
- "gitHead": "a5c034ab3eb439e123c7e999efdfc7270d4e12b8"
46
+ "gitHead": "dcb1fc259530da343bd6557a123cc394c79e84ec"
47
47
  }
@@ -47,4 +47,8 @@ export class BaseModelService<TSchema extends AnyModelSchema> {
47
47
  }
48
48
  return input[this.entityMetadata.primaryKey]
49
49
  }
50
+
51
+ public getSchema() {
52
+ return this.schema
53
+ }
50
54
  }
@@ -4,6 +4,7 @@ import { MockMemoryRepository } from '../../test/mock/repositories/mock-memory-r
4
4
  import { MockBookSchema, type MockBookInput } from '../../test/mock/models/mock-book-models'
5
5
  import { EventManager } from '@declaro/core'
6
6
  import { mock } from 'bun:test'
7
+ import type { InferDetail } from '../../shared/utils/schema-inference'
7
8
 
8
9
  describe('ModelService', () => {
9
10
  const namespace = 'books'
@@ -881,16 +882,38 @@ describe('ModelService', () => {
881
882
  }
882
883
  }
883
884
 
884
- class TestService extends ModelService<typeof mockSchema> {}
885
+ class TestServiceWithNormalization extends ModelService<typeof mockSchema> {
886
+ async normalizeDetail(detail: InferDetail<typeof mockSchema>): Promise<InferDetail<typeof mockSchema>> {
887
+ // Handle null case (e.g., when load returns null)
888
+ if (!detail) return detail
889
+
890
+ // Convert string dates back to Date objects
891
+ if (typeof detail.publishedDate === 'string') {
892
+ detail.publishedDate = new Date(detail.publishedDate) as any
893
+ }
894
+ return detail
895
+ }
896
+
897
+ async normalizeSummary(summary: InferDetail<typeof mockSchema>): Promise<InferDetail<typeof mockSchema>> {
898
+ // Handle null case (e.g., when load returns null)
899
+ if (!summary) return summary
900
+
901
+ // Convert string dates back to Date objects
902
+ if (typeof summary.publishedDate === 'string') {
903
+ summary.publishedDate = new Date(summary.publishedDate) as any
904
+ }
905
+ return summary
906
+ }
907
+ }
885
908
 
886
909
  let testRepository: TestRepository
887
- let testService: TestService
910
+ let testService: TestServiceWithNormalization
888
911
 
889
912
  beforeEach(() => {
890
913
  testRepository = new TestRepository()
891
914
  emitter = new EventManager()
892
915
 
893
- testService = new TestService({
916
+ testService = new TestServiceWithNormalization({
894
917
  repository: testRepository,
895
918
  emitter,
896
919
  schema: mockSchema,
@@ -898,7 +921,7 @@ describe('ModelService', () => {
898
921
  })
899
922
  })
900
923
 
901
- it('should normalize details in the create response', async () => {
924
+ it('should allow custom normalization of details in the create response when overridden', async () => {
902
925
  const input = { id: 200, title: 'Create Test', author: 'Creator', publishedDate: new Date() }
903
926
  const record = await testService.create(input)
904
927
 
@@ -909,7 +932,7 @@ describe('ModelService', () => {
909
932
  expect(actualDate).toBeInstanceOf(Date)
910
933
  })
911
934
 
912
- it('should normalize details in the update response', async () => {
935
+ it('should allow custom normalization of details in the update response when overridden', async () => {
913
936
  const input = { id: 201, title: 'Update Test', author: 'Updater', publishedDate: new Date() }
914
937
  await testRepository.create(input)
915
938
 
@@ -923,7 +946,7 @@ describe('ModelService', () => {
923
946
  expect(actualDate).toBeInstanceOf(Date)
924
947
  })
925
948
 
926
- it('should normalize details in the upsert response when creating', async () => {
949
+ it('should allow custom normalization of details in the upsert response when creating and overridden', async () => {
927
950
  const input = { id: 202, title: 'Upsert Create Test', author: 'Upserter', publishedDate: new Date() }
928
951
  const record = await testService.upsert(input)
929
952
 
@@ -934,7 +957,7 @@ describe('ModelService', () => {
934
957
  expect(actualDate).toBeInstanceOf(Date)
935
958
  })
936
959
 
937
- it('should normalize details in the upsert response when updating', async () => {
960
+ it('should allow custom normalization of details in the upsert response when updating and overridden', async () => {
938
961
  const input = { id: 203, title: 'Upsert Update Test', author: 'Upserter', publishedDate: new Date() }
939
962
  await testRepository.create(input)
940
963
 
@@ -953,7 +976,7 @@ describe('ModelService', () => {
953
976
  expect(actualDate).toBeInstanceOf(Date)
954
977
  })
955
978
 
956
- it('should normalize details in the bulkUpsert response', async () => {
979
+ it('should allow custom normalization of details in the bulkUpsert response when overridden', async () => {
957
980
  const input1 = { id: 204, title: 'Bulk Test 1', author: 'Bulk Author 1', publishedDate: new Date() }
958
981
  const input2 = { id: 205, title: 'Bulk Test 2', author: 'Bulk Author 2', publishedDate: new Date() }
959
982
 
@@ -968,7 +991,7 @@ describe('ModelService', () => {
968
991
  }
969
992
  })
970
993
 
971
- it('should normalize details in the bulkUpsert response with mixed create and update', async () => {
994
+ it('should allow custom normalization of details in the bulkUpsert response with mixed create and update when overridden', async () => {
972
995
  const existingInput = { id: 206, title: 'Existing', author: 'Existing Author', publishedDate: new Date() }
973
996
  await testRepository.create(existingInput)
974
997
 
@@ -991,7 +1014,7 @@ describe('ModelService', () => {
991
1014
  }
992
1015
  })
993
1016
 
994
- it('should normalize summaries in the remove response', async () => {
1017
+ it('should allow custom normalization of summaries in the remove response when overridden', async () => {
995
1018
  const input = { id: 208, title: 'Remove Test', author: 'Remover', publishedDate: new Date() }
996
1019
  await testRepository.create(input)
997
1020
 
@@ -1004,7 +1027,7 @@ describe('ModelService', () => {
1004
1027
  expect(actualDate).toBeInstanceOf(Date)
1005
1028
  })
1006
1029
 
1007
- it('should normalize summaries in the restore response', async () => {
1030
+ it('should allow custom normalization of summaries in the restore response when overridden', async () => {
1008
1031
  const input = { id: 209, title: 'Restore Test', author: 'Restorer', publishedDate: new Date() }
1009
1032
  await testRepository.create(input)
1010
1033
  await testRepository.remove({ id: 209 })
@@ -1017,5 +1040,21 @@ describe('ModelService', () => {
1017
1040
  expect(actualDate).toEqual(expectedDate)
1018
1041
  expect(actualDate).toBeInstanceOf(Date)
1019
1042
  })
1043
+
1044
+ it('should not normalize data by default when normalization methods are not overridden', async () => {
1045
+ const defaultService = new ModelService({
1046
+ repository: testRepository,
1047
+ emitter,
1048
+ schema: mockSchema,
1049
+ namespace,
1050
+ })
1051
+
1052
+ const input = { id: 210, title: 'Default Test', author: 'Default Author', publishedDate: new Date() }
1053
+ const record = await defaultService.create(input)
1054
+
1055
+ // Should return the raw string from repository since no normalization is applied
1056
+ expect(record.publishedDate as any).toBe('2024-01-01')
1057
+ expect(typeof record.publishedDate).toBe('string')
1058
+ })
1020
1059
  })
1021
1060
  })
@@ -335,18 +335,41 @@ describe('ReadOnlyModelService', () => {
335
335
  return results
336
336
  }
337
337
  }
338
- class TestService extends ReadOnlyModelService<typeof mockSchema> {}
339
338
 
340
- let testService: TestService
339
+ class TestServiceWithNormalization extends ReadOnlyModelService<typeof mockSchema> {
340
+ async normalizeDetail(detail: InferDetail<typeof mockSchema>): Promise<InferDetail<typeof mockSchema>> {
341
+ // Handle null case (e.g., when load returns null)
342
+ if (!detail) return detail
343
+
344
+ // Convert string dates back to Date objects
345
+ if (typeof detail.publishedDate === 'string') {
346
+ detail.publishedDate = new Date(detail.publishedDate) as any
347
+ }
348
+ return detail
349
+ }
350
+
351
+ async normalizeSummary(summary: InferDetail<typeof mockSchema>): Promise<InferDetail<typeof mockSchema>> {
352
+ // Handle null case (e.g., when load returns null)
353
+ if (!summary) return summary
354
+
355
+ // Convert string dates back to Date objects
356
+ if (typeof summary.publishedDate === 'string') {
357
+ summary.publishedDate = new Date(summary.publishedDate) as any
358
+ }
359
+ return summary
360
+ }
361
+ }
362
+
363
+ let testService: TestServiceWithNormalization
341
364
 
342
365
  beforeEach(() => {
343
366
  repository = new TestRepository()
344
367
  emitter = new EventManager()
345
368
 
346
- testService = new TestService({ repository, emitter, schema: mockSchema, namespace })
369
+ testService = new TestServiceWithNormalization({ repository, emitter, schema: mockSchema, namespace })
347
370
  })
348
371
 
349
- it('should normalize details in the load response', async () => {
372
+ it('should allow custom normalization of details in the load response when overridden', async () => {
350
373
  const input = { id: 100, title: 'Normalization Test', author: 'Normalizer', publishedDate: new Date() }
351
374
  await repository.create(input)
352
375
 
@@ -359,7 +382,7 @@ describe('ReadOnlyModelService', () => {
359
382
  expect(actualDate).toBeInstanceOf(Date)
360
383
  })
361
384
 
362
- it('should normalize details in the loadMany response', async () => {
385
+ it('should allow custom normalization of details in the loadMany response when overridden', async () => {
363
386
  const input1 = { id: 101, title: 'Normalization Test 1', author: 'Normalizer 1', publishedDate: new Date() }
364
387
  const input2 = { id: 102, title: 'Normalization Test 2', author: 'Normalizer 2', publishedDate: new Date() }
365
388
  await repository.create(input1)
@@ -376,7 +399,7 @@ describe('ReadOnlyModelService', () => {
376
399
  }
377
400
  })
378
401
 
379
- it('should normalize details in the search response', async () => {
402
+ it('should allow custom normalization of summaries in the search response when overridden', async () => {
380
403
  const input1 = { id: 103, title: 'Normalization Test 3', author: 'Normalizer 3', publishedDate: new Date() }
381
404
  const input2 = { id: 104, title: 'Normalization Test 4', author: 'Normalizer 4', publishedDate: new Date() }
382
405
  await repository.create(input1)
@@ -392,5 +415,18 @@ describe('ReadOnlyModelService', () => {
392
415
  expect(actualDate).toBeInstanceOf(Date)
393
416
  }
394
417
  })
418
+
419
+ it('should not normalize data by default when normalization methods are not overridden', async () => {
420
+ const defaultService = new ReadOnlyModelService({ repository, emitter, schema: mockSchema, namespace })
421
+
422
+ const input = { id: 105, title: 'Default Test', author: 'Default Author', publishedDate: new Date() }
423
+ await repository.create(input)
424
+
425
+ const record = await defaultService.load({ id: 105 })
426
+
427
+ // Should return the raw string from repository since no normalization is applied
428
+ expect(record.publishedDate as any).toBe('2024-01-01')
429
+ expect(typeof record.publishedDate).toBe('string')
430
+ })
395
431
  })
396
432
  })
@@ -10,7 +10,6 @@ import { ModelQueryEvent } from '../events/event-types'
10
10
  import { QueryEvent } from '../events/query-event'
11
11
  import { BaseModelService, type IActionOptions } from './base-model-service'
12
12
  import type { IPaginationInput } from '../models/pagination'
13
- import type { IUpdateOptions } from './model-service'
14
13
 
15
14
  export interface ILoadOptions extends IActionOptions {}
16
15
  export interface ISearchOptions<TSchema extends AnyModelSchema> extends IActionOptions {
@@ -27,15 +26,6 @@ export class ReadOnlyModelService<TSchema extends AnyModelSchema> extends BaseMo
27
26
  * @returns The normalized detail data.
28
27
  */
29
28
  async normalizeDetail(detail: InferDetail<TSchema>): Promise<InferDetail<TSchema>> {
30
- const detailModel = this.schema.definition.detail as Model<any, any>
31
- if (detailModel) {
32
- const validation = await detailModel.validate(detail, { strict: false })
33
- if (validation.issues) {
34
- console.warn(`${detailModel.labels.singularLabel} shape did not match the expected schema`, validation)
35
- } else {
36
- return validation.value
37
- }
38
- }
39
29
  return detail
40
30
  }
41
31
 
@@ -48,15 +38,6 @@ export class ReadOnlyModelService<TSchema extends AnyModelSchema> extends BaseMo
48
38
  * @returns The normalized summary data.
49
39
  */
50
40
  async normalizeSummary(summary: InferDetail<TSchema>): Promise<InferDetail<TSchema>> {
51
- const summaryModel = this.schema.definition.summary as Model<any, any>
52
- if (summaryModel) {
53
- const validation = await summaryModel.validate(summary, { strict: false })
54
- if (validation.issues) {
55
- console.warn(`${summaryModel.labels.singularLabel} shape did not match the expected schema`)
56
- } else {
57
- return validation.value
58
- }
59
- }
60
41
  return summary
61
42
  }
62
43