@api-client/core 0.14.0 → 0.14.1

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 (140) hide show
  1. package/build/src/amf/AmfTypes.d.ts +1 -1
  2. package/build/src/amf/AmfTypes.js +1 -1
  3. package/build/src/amf/AmfTypes.js.map +1 -1
  4. package/build/src/amf/Utils.d.ts +0 -6
  5. package/build/src/amf/Utils.d.ts.map +1 -1
  6. package/build/src/amf/Utils.js +0 -14
  7. package/build/src/amf/Utils.js.map +1 -1
  8. package/build/src/browser.d.ts +1 -0
  9. package/build/src/browser.d.ts.map +1 -1
  10. package/build/src/browser.js +1 -0
  11. package/build/src/browser.js.map +1 -1
  12. package/build/src/index.d.ts +1 -0
  13. package/build/src/index.d.ts.map +1 -1
  14. package/build/src/index.js +1 -0
  15. package/build/src/index.js.map +1 -1
  16. package/build/src/legacy.d.ts +0 -8
  17. package/build/src/legacy.d.ts.map +1 -1
  18. package/build/src/legacy.js +0 -9
  19. package/build/src/legacy.js.map +1 -1
  20. package/build/src/modeling/Bindings.d.ts +1 -1
  21. package/build/src/modeling/Bindings.js.map +1 -1
  22. package/build/src/modeling/DataDomain.js +2 -2
  23. package/build/src/modeling/DataDomain.js.map +1 -1
  24. package/build/src/modeling/DataFormat.d.ts +0 -40
  25. package/build/src/modeling/DataFormat.d.ts.map +1 -1
  26. package/build/src/modeling/DataFormat.js +0 -27
  27. package/build/src/modeling/DataFormat.js.map +1 -1
  28. package/build/src/modeling/DomainAssociation.d.ts +28 -0
  29. package/build/src/modeling/DomainAssociation.d.ts.map +1 -1
  30. package/build/src/modeling/DomainAssociation.js +73 -4
  31. package/build/src/modeling/DomainAssociation.js.map +1 -1
  32. package/build/src/modeling/DomainEntity.d.ts +25 -9
  33. package/build/src/modeling/DomainEntity.d.ts.map +1 -1
  34. package/build/src/modeling/DomainEntity.js +65 -21
  35. package/build/src/modeling/DomainEntity.js.map +1 -1
  36. package/build/src/modeling/DomainFile.d.ts +1 -1
  37. package/build/src/modeling/DomainFile.js +1 -1
  38. package/build/src/modeling/DomainFile.js.map +1 -1
  39. package/build/src/modeling/DomainImpactAnalysis.d.ts +1 -1
  40. package/build/src/modeling/DomainImpactAnalysis.d.ts.map +1 -1
  41. package/build/src/modeling/DomainImpactAnalysis.js +3 -3
  42. package/build/src/modeling/DomainImpactAnalysis.js.map +1 -1
  43. package/build/src/modeling/DomainModel.d.ts +2 -2
  44. package/build/src/modeling/DomainModel.js +2 -2
  45. package/build/src/modeling/DomainModel.js.map +1 -1
  46. package/build/src/modeling/DomainProperty.d.ts +28 -12
  47. package/build/src/modeling/DomainProperty.d.ts.map +1 -1
  48. package/build/src/modeling/DomainProperty.js +61 -26
  49. package/build/src/modeling/DomainProperty.js.map +1 -1
  50. package/build/src/modeling/Semantics.d.ts +109 -0
  51. package/build/src/modeling/Semantics.d.ts.map +1 -0
  52. package/build/src/modeling/Semantics.js +97 -0
  53. package/build/src/modeling/Semantics.js.map +1 -0
  54. package/build/src/models/kinds.d.ts +0 -24
  55. package/build/src/models/kinds.d.ts.map +1 -1
  56. package/build/src/models/kinds.js +0 -24
  57. package/build/src/models/kinds.js.map +1 -1
  58. package/build/src/models/store/data_catalog.d.ts +1 -1
  59. package/build/src/models/store/data_catalog.js.map +1 -1
  60. package/build/tsconfig.tsbuildinfo +1 -1
  61. package/data/models/example-generator-api.json +11 -11
  62. package/package.json +1 -1
  63. package/src/amf/AmfTypes.ts +1 -1
  64. package/src/amf/Utils.ts +0 -15
  65. package/src/modeling/Bindings.ts +1 -1
  66. package/src/modeling/DataDomain.ts +2 -2
  67. package/src/modeling/DataFormat.ts +0 -48
  68. package/src/modeling/DomainAssociation.ts +66 -3
  69. package/src/modeling/DomainEntity.ts +56 -17
  70. package/src/modeling/DomainFile.ts +1 -1
  71. package/src/modeling/DomainImpactAnalysis.ts +3 -3
  72. package/src/modeling/DomainModel.ts +2 -2
  73. package/src/modeling/DomainProperty.ts +60 -21
  74. package/src/modeling/Semantics.ts +178 -0
  75. package/src/modeling/graph.md +14 -14
  76. package/src/modeling/readme.md +29 -29
  77. package/src/models/kinds.ts +0 -25
  78. package/src/models/store/data_catalog.ts +1 -1
  79. package/tests/unit/modeling/data_domain_change_observers.spec.ts +11 -10
  80. package/tests/unit/modeling/data_domain_entities.spec.ts +129 -1
  81. package/tests/unit/modeling/data_domain_property.spec.ts +1 -1
  82. package/tests/unit/modeling/domain_asociation.spec.ts +177 -0
  83. package/tests/unit/modeling/domain_entity.spec.ts +27 -26
  84. package/tests/unit/modeling/domain_entity_example_generator_json.spec.ts +11 -11
  85. package/tests/unit/modeling/domain_entity_example_generator_xml.spec.ts +10 -10
  86. package/tests/unit/modeling/{domain.property.spec.ts → domain_property.spec.ts} +139 -23
  87. package/build/src/amf/AmfShapeGenerator.d.ts +0 -103
  88. package/build/src/amf/AmfShapeGenerator.d.ts.map +0 -1
  89. package/build/src/amf/AmfShapeGenerator.js +0 -416
  90. package/build/src/amf/AmfShapeGenerator.js.map +0 -1
  91. package/build/src/modeling/legacy/DataAssociation.d.ts +0 -284
  92. package/build/src/modeling/legacy/DataAssociation.d.ts.map +0 -1
  93. package/build/src/modeling/legacy/DataAssociation.js +0 -443
  94. package/build/src/modeling/legacy/DataAssociation.js.map +0 -1
  95. package/build/src/modeling/legacy/DataEntity.d.ts +0 -358
  96. package/build/src/modeling/legacy/DataEntity.d.ts.map +0 -1
  97. package/build/src/modeling/legacy/DataEntity.js +0 -855
  98. package/build/src/modeling/legacy/DataEntity.js.map +0 -1
  99. package/build/src/modeling/legacy/DataEntityBuilder.d.ts +0 -162
  100. package/build/src/modeling/legacy/DataEntityBuilder.d.ts.map +0 -1
  101. package/build/src/modeling/legacy/DataEntityBuilder.js +0 -221
  102. package/build/src/modeling/legacy/DataEntityBuilder.js.map +0 -1
  103. package/build/src/modeling/legacy/DataImpactAnalysis.d.ts +0 -298
  104. package/build/src/modeling/legacy/DataImpactAnalysis.d.ts.map +0 -1
  105. package/build/src/modeling/legacy/DataImpactAnalysis.js +0 -441
  106. package/build/src/modeling/legacy/DataImpactAnalysis.js.map +0 -1
  107. package/build/src/modeling/legacy/DataModel.d.ts +0 -99
  108. package/build/src/modeling/legacy/DataModel.d.ts.map +0 -1
  109. package/build/src/modeling/legacy/DataModel.js +0 -237
  110. package/build/src/modeling/legacy/DataModel.js.map +0 -1
  111. package/build/src/modeling/legacy/DataNamespace.d.ts +0 -340
  112. package/build/src/modeling/legacy/DataNamespace.d.ts.map +0 -1
  113. package/build/src/modeling/legacy/DataNamespace.js +0 -784
  114. package/build/src/modeling/legacy/DataNamespace.js.map +0 -1
  115. package/build/src/modeling/legacy/DataProperty.d.ts +0 -332
  116. package/build/src/modeling/legacy/DataProperty.d.ts.map +0 -1
  117. package/build/src/modeling/legacy/DataProperty.js +0 -415
  118. package/build/src/modeling/legacy/DataProperty.js.map +0 -1
  119. package/build/src/models/store/DataFile.d.ts +0 -29
  120. package/build/src/models/store/DataFile.d.ts.map +0 -1
  121. package/build/src/models/store/DataFile.js +0 -87
  122. package/build/src/models/store/DataFile.js.map +0 -1
  123. package/src/amf/AmfShapeGenerator.ts +0 -477
  124. package/src/modeling/legacy/DataAssociation.ts +0 -554
  125. package/src/modeling/legacy/DataEntity.ts +0 -1019
  126. package/src/modeling/legacy/DataEntityBuilder.ts +0 -236
  127. package/src/modeling/legacy/DataImpactAnalysis.ts +0 -530
  128. package/src/modeling/legacy/DataModel.ts +0 -276
  129. package/src/modeling/legacy/DataNamespace.ts +0 -929
  130. package/src/modeling/legacy/DataProperty.ts +0 -630
  131. package/src/models/store/DataFile.ts +0 -95
  132. package/tests/unit/modeling/legacy/amf_shape_generator.spec.ts +0 -1041
  133. package/tests/unit/modeling/legacy/data_association.spec.ts +0 -710
  134. package/tests/unit/modeling/legacy/data_entity.spec.ts +0 -2061
  135. package/tests/unit/modeling/legacy/data_entity_generator_json.spec.ts +0 -987
  136. package/tests/unit/modeling/legacy/data_entity_generator_xml.spec.ts +0 -1451
  137. package/tests/unit/modeling/legacy/data_model.spec.ts +0 -395
  138. package/tests/unit/modeling/legacy/data_namespace.spec.ts +0 -1312
  139. package/tests/unit/modeling/legacy/data_property.spec.ts +0 -887
  140. package/tests/unit/modeling/legacy/impact_analysis.spec.ts +0 -373
@@ -9,7 +9,7 @@ const dateRe = /^[0-9]{4}-[0-9]{2}-[0-9]{2}$/
9
9
  const timeRe = /^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}$/
10
10
  const mime = 'application/json'
11
11
 
12
- test.group('JSON DataEntity Generator: string', (group) => {
12
+ test.group('JSON DomainEntity Generator: string', (group) => {
13
13
  let e1: DomainEntity
14
14
 
15
15
  group.each.setup(() => {
@@ -140,7 +140,7 @@ test.group('JSON DataEntity Generator: string', (group) => {
140
140
  })
141
141
  })
142
142
 
143
- test.group('JSON DataEntity Generator: number', (group) => {
143
+ test.group('JSON DomainEntity Generator: number', (group) => {
144
144
  let e1: DomainEntity
145
145
 
146
146
  group.each.setup(() => {
@@ -289,7 +289,7 @@ test.group('JSON DataEntity Generator: number', (group) => {
289
289
  })
290
290
  })
291
291
 
292
- test.group('JSON DataEntity Generator: int64 format', (group) => {
292
+ test.group('JSON DomainEntity Generator: int64 format', (group) => {
293
293
  let e1: DomainEntity
294
294
  let p1: DomainProperty
295
295
 
@@ -416,7 +416,7 @@ test.group('JSON DataEntity Generator: int64 format', (group) => {
416
416
  })
417
417
  })
418
418
 
419
- test.group('JSON DataEntity Generator: date', (group) => {
419
+ test.group('JSON DomainEntity Generator: date', (group) => {
420
420
  let e1: DomainEntity
421
421
 
422
422
  group.each.setup(() => {
@@ -492,7 +492,7 @@ test.group('JSON DataEntity Generator: date', (group) => {
492
492
  })
493
493
  })
494
494
 
495
- test.group('JSON DataEntity Generator: datetime', (group) => {
495
+ test.group('JSON DomainEntity Generator: datetime', (group) => {
496
496
  let e1: DomainEntity
497
497
 
498
498
  group.each.setup(() => {
@@ -557,7 +557,7 @@ test.group('JSON DataEntity Generator: datetime', (group) => {
557
557
  })
558
558
  })
559
559
 
560
- test.group('JSON DataEntity Generator: time', (group) => {
560
+ test.group('JSON DomainEntity Generator: time', (group) => {
561
561
  let e1: DomainEntity
562
562
 
563
563
  group.each.setup(() => {
@@ -633,7 +633,7 @@ test.group('JSON DataEntity Generator: time', (group) => {
633
633
  })
634
634
  })
635
635
 
636
- test.group('JSON DataEntity Generator: boolean', (group) => {
636
+ test.group('JSON DomainEntity Generator: boolean', (group) => {
637
637
  let e1: DomainEntity
638
638
 
639
639
  group.each.setup(() => {
@@ -662,7 +662,7 @@ test.group('JSON DataEntity Generator: boolean', (group) => {
662
662
  })
663
663
  })
664
664
 
665
- // test.group('JSON DataEntity Generator: nil', (group) => {
665
+ // test.group('JSON DomainEntity Generator: nil', (group) => {
666
666
  // let e1: DomainEntity
667
667
 
668
668
  // group.each.setup(() => {
@@ -691,7 +691,7 @@ test.group('JSON DataEntity Generator: boolean', (group) => {
691
691
  // })
692
692
  // })
693
693
 
694
- test.group('JSON DataEntity Generator: binary', (group) => {
694
+ test.group('JSON DomainEntity Generator: binary', (group) => {
695
695
  let e1: DomainEntity
696
696
 
697
697
  group.each.setup(() => {
@@ -715,7 +715,7 @@ test.group('JSON DataEntity Generator: binary', (group) => {
715
715
  })
716
716
  })
717
717
 
718
- test.group('JSON DataEntity Generator: associations', (group) => {
718
+ test.group('JSON DomainEntity Generator: associations', (group) => {
719
719
  let n1: DataDomain
720
720
  let d1: DomainModel
721
721
  let e1: DomainEntity
@@ -906,7 +906,7 @@ test.group('JSON DataEntity Generator: associations', (group) => {
906
906
  })
907
907
  })
908
908
 
909
- test.group('JSON DataEntity Generator: parents', (group) => {
909
+ test.group('JSON DomainEntity Generator: parents', (group) => {
910
910
  let d1: DomainModel
911
911
  let e1: DomainEntity
912
912
  let e2: DomainEntity
@@ -7,7 +7,7 @@ const dateRe = /^[0-9]{4}-[0-9]{2}-[0-9]{2}$/
7
7
  const timeRe = /^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}$/
8
8
  const mime = 'application/xml'
9
9
 
10
- test.group('XML DataEntity Generator: string', (group) => {
10
+ test.group('XML DomainEntity Generator: string', (group) => {
11
11
  let e1: DomainEntity
12
12
 
13
13
  group.each.setup(() => {
@@ -177,7 +177,7 @@ test.group('XML DataEntity Generator: string', (group) => {
177
177
  })
178
178
  })
179
179
 
180
- test.group('XML DataEntity Generator: number', (group) => {
180
+ test.group('XML DomainEntity Generator: number', (group) => {
181
181
  let e1: DomainEntity
182
182
 
183
183
  group.each.setup(() => {
@@ -416,7 +416,7 @@ test.group('XML DataEntity Generator: number', (group) => {
416
416
  })
417
417
  })
418
418
 
419
- test.group('XML DataEntity Generator: int64 format', (group) => {
419
+ test.group('XML DomainEntity Generator: int64 format', (group) => {
420
420
  let e1: DomainEntity
421
421
  let p1: DomainProperty
422
422
 
@@ -641,7 +641,7 @@ test.group('XML DataEntity Generator: int64 format', (group) => {
641
641
  })
642
642
  })
643
643
 
644
- test.group('XML DataEntity Generator: date', (group) => {
644
+ test.group('XML DomainEntity Generator: date', (group) => {
645
645
  let e1: DomainEntity
646
646
 
647
647
  group.each.setup(() => {
@@ -768,7 +768,7 @@ test.group('XML DataEntity Generator: date', (group) => {
768
768
  })
769
769
  })
770
770
 
771
- test.group('XML DataEntity Generator: datetime', (group) => {
771
+ test.group('XML DomainEntity Generator: datetime', (group) => {
772
772
  let e1: DomainEntity
773
773
 
774
774
  group.each.setup(() => {
@@ -877,7 +877,7 @@ test.group('XML DataEntity Generator: datetime', (group) => {
877
877
  })
878
878
  })
879
879
 
880
- test.group('XML DataEntity Generator: time', (group) => {
880
+ test.group('XML DomainEntity Generator: time', (group) => {
881
881
  let e1: DomainEntity
882
882
 
883
883
  group.each.setup(() => {
@@ -1004,7 +1004,7 @@ test.group('XML DataEntity Generator: time', (group) => {
1004
1004
  })
1005
1005
  })
1006
1006
 
1007
- test.group('XML DataEntity Generator: boolean', (group) => {
1007
+ test.group('XML DomainEntity Generator: boolean', (group) => {
1008
1008
  let e1: DomainEntity
1009
1009
 
1010
1010
  group.each.setup(() => {
@@ -1049,7 +1049,7 @@ test.group('XML DataEntity Generator: boolean', (group) => {
1049
1049
  })
1050
1050
  })
1051
1051
 
1052
- // test.group('XML DataEntity Generator: nil', (group) => {
1052
+ // test.group('XML DomainEntity Generator: nil', (group) => {
1053
1053
  // let e1: DomainEntity
1054
1054
 
1055
1055
  // group.each.setup(() => {
@@ -1094,7 +1094,7 @@ test.group('XML DataEntity Generator: boolean', (group) => {
1094
1094
  // })
1095
1095
  // })
1096
1096
 
1097
- test.group('XML DataEntity Generator: associations', (group) => {
1097
+ test.group('XML DomainEntity Generator: associations', (group) => {
1098
1098
  let d1: DomainModel
1099
1099
  let e1: DomainEntity
1100
1100
  let e2: DomainEntity
@@ -1319,7 +1319,7 @@ test.group('XML DataEntity Generator: associations', (group) => {
1319
1319
  }).skip()
1320
1320
  })
1321
1321
 
1322
- test.group('XML DataEntity Generator: parents', (group) => {
1322
+ test.group('XML DomainEntity Generator: parents', (group) => {
1323
1323
  let d1: DomainModel
1324
1324
  let e1: DomainEntity
1325
1325
  let e2: DomainEntity
@@ -1,5 +1,6 @@
1
1
  import { test } from '@japa/runner'
2
2
  import { DataDomain, DomainPropertyKind, DomainProperty, Thing, DataFormat } from '../../../src/index.js'
3
+ import { SemanticType } from '../../../src/modeling/Semantics.js'
3
4
 
4
5
  test.group('DomainProperty.createSchema()', () => {
5
6
  test('creates a schema with default values', ({ assert }) => {
@@ -17,7 +18,7 @@ test.group('DomainProperty.createSchema()', () => {
17
18
  assert.isUndefined(schema.writeOnly)
18
19
  assert.isUndefined(schema.deprecated)
19
20
  assert.isUndefined(schema.tags)
20
- assert.isUndefined(schema.taxonomy)
21
+ assert.isUndefined(schema.semantics)
21
22
  assert.isUndefined(schema.schema)
22
23
  assert.deepEqual(schema.bindings, [])
23
24
  })
@@ -34,7 +35,7 @@ test.group('DomainProperty.createSchema()', () => {
34
35
  writeOnly: true,
35
36
  deprecated: true,
36
37
  tags: ['tag1', 'tag2'],
37
- taxonomy: ['tax1', 'tax2'],
38
+ semantics: [{ id: SemanticType.CreatedTimestamp }],
38
39
  type: 'number',
39
40
  schema: { minimum: 0 },
40
41
  bindings: [{ type: 'web', schema: { format: 'float' } }],
@@ -51,7 +52,7 @@ test.group('DomainProperty.createSchema()', () => {
51
52
  assert.isTrue(schema.writeOnly)
52
53
  assert.isTrue(schema.deprecated)
53
54
  assert.deepEqual(schema.tags, ['tag1', 'tag2'])
54
- assert.deepEqual(schema.taxonomy, ['tax1', 'tax2'])
55
+ assert.deepEqual(schema.semantics, [{ id: SemanticType.CreatedTimestamp }])
55
56
  assert.deepEqual(schema.schema, { minimum: 0 })
56
57
  assert.deepEqual(schema.bindings, [{ type: 'web', schema: { format: 'float' } }])
57
58
  })
@@ -87,7 +88,7 @@ test.group('DomainProperty.createSchema()', () => {
87
88
  writeOnly: undefined,
88
89
  deprecated: undefined,
89
90
  tags: undefined,
90
- taxonomy: undefined,
91
+ semantics: undefined,
91
92
  schema: undefined,
92
93
  bindings: undefined,
93
94
  })
@@ -104,7 +105,7 @@ test.group('DomainProperty.createSchema()', () => {
104
105
  assert.isUndefined(schema.writeOnly)
105
106
  assert.isUndefined(schema.deprecated)
106
107
  assert.isUndefined(schema.tags)
107
- assert.isUndefined(schema.taxonomy)
108
+ assert.isUndefined(schema.semantics)
108
109
  assert.isUndefined(schema.schema)
109
110
  assert.deepEqual(schema.bindings, [])
110
111
  })
@@ -128,7 +129,7 @@ test.group('DomainProperty.createSchema()', () => {
128
129
  // @ts-expect-error Testing null values
129
130
  tags: null,
130
131
  // @ts-expect-error Testing null values
131
- taxonomy: null,
132
+ semantics: null,
132
133
  // @ts-expect-error Testing null values
133
134
  schema: null,
134
135
  // @ts-expect-error Testing null values
@@ -142,7 +143,7 @@ test.group('DomainProperty.createSchema()', () => {
142
143
  assert.isUndefined(schema.writeOnly)
143
144
  assert.isUndefined(schema.deprecated)
144
145
  assert.isUndefined(schema.tags)
145
- assert.isUndefined(schema.taxonomy)
146
+ assert.isUndefined(schema.semantics)
146
147
  assert.isUndefined(schema.schema)
147
148
  assert.deepEqual(schema.bindings, [])
148
149
  })
@@ -150,11 +151,11 @@ test.group('DomainProperty.createSchema()', () => {
150
151
  test('creates a schema with all properties empty array', ({ assert }) => {
151
152
  const schema = DomainProperty.createSchema({
152
153
  tags: [],
153
- taxonomy: [],
154
+ semantics: [],
154
155
  bindings: [],
155
156
  })
156
157
  assert.deepEqual(schema.tags, [])
157
- assert.deepEqual(schema.taxonomy, [])
158
+ assert.deepEqual(schema.semantics, [])
158
159
  assert.deepEqual(schema.bindings, [])
159
160
  })
160
161
 
@@ -180,11 +181,11 @@ test.group('DomainProperty.createSchema()', () => {
180
181
  test('creates a schema with all array properties set to empty arrays', ({ assert }) => {
181
182
  const schema = DomainProperty.createSchema({
182
183
  tags: [],
183
- taxonomy: [],
184
+ semantics: [],
184
185
  bindings: [],
185
186
  })
186
187
  assert.deepEqual(schema.tags, [])
187
- assert.deepEqual(schema.taxonomy, [])
188
+ assert.deepEqual(schema.semantics, [])
188
189
  assert.deepEqual(schema.bindings, [])
189
190
  })
190
191
 
@@ -202,12 +203,12 @@ test.group('DomainProperty.createSchema()', () => {
202
203
  // @ts-expect-error Testing null values
203
204
  tags: null,
204
205
  // @ts-expect-error Testing null values
205
- taxonomy: null,
206
+ semantics: null,
206
207
  // @ts-expect-error Testing null values
207
208
  bindings: null,
208
209
  })
209
210
  assert.isUndefined(schema.tags)
210
- assert.isUndefined(schema.taxonomy)
211
+ assert.isUndefined(schema.semantics)
211
212
  assert.deepEqual(schema.bindings, [])
212
213
  })
213
214
 
@@ -242,7 +243,7 @@ test.group('DomainProperty.constructor()', () => {
242
243
  assert.isUndefined(property.writeOnly)
243
244
  assert.isUndefined(property.deprecated)
244
245
  assert.deepEqual(property.tags, [])
245
- assert.deepEqual(property.taxonomy, [])
246
+ assert.deepEqual(property.semantics, [])
246
247
  assert.isUndefined(property.schema)
247
248
  assert.deepEqual(property.bindings, [])
248
249
  assert.equal(property['parent'], parent)
@@ -263,7 +264,7 @@ test.group('DomainProperty.constructor()', () => {
263
264
  writeOnly: true,
264
265
  deprecated: true,
265
266
  tags: ['tag1', 'tag2'],
266
- taxonomy: ['tax1', 'tax2'],
267
+ semantics: [{ id: SemanticType.CreatedTimestamp }],
267
268
  type: 'number',
268
269
  schema: { minimum: 0 },
269
270
  bindings: [{ type: 'web', schema: { format: 'float' } }],
@@ -281,7 +282,7 @@ test.group('DomainProperty.constructor()', () => {
281
282
  assert.isTrue(property.writeOnly)
282
283
  assert.isTrue(property.deprecated)
283
284
  assert.deepEqual(property.tags, ['tag1', 'tag2'])
284
- assert.deepEqual(property.taxonomy, ['tax1', 'tax2'])
285
+ assert.deepEqual(property.semantics, [{ id: SemanticType.CreatedTimestamp }])
285
286
  assert.deepEqual(property.schema, { minimum: 0 })
286
287
  assert.deepEqual(property.bindings, [{ type: 'web', schema: { format: 'float' } }])
287
288
  assert.equal(property['parent'], parent)
@@ -404,7 +405,7 @@ test.group('DomainProperty.toJSON()', () => {
404
405
  assert.isUndefined(json.writeOnly)
405
406
  assert.isUndefined(json.deprecated)
406
407
  assert.isUndefined(json.tags)
407
- assert.isUndefined(json.taxonomy)
408
+ assert.isUndefined(json.semantics)
408
409
  assert.isUndefined(json.schema)
409
410
  assert.isUndefined(json.bindings)
410
411
  })
@@ -423,7 +424,7 @@ test.group('DomainProperty.toJSON()', () => {
423
424
  writeOnly: true,
424
425
  deprecated: true,
425
426
  tags: ['tag1', 'tag2'],
426
- taxonomy: ['tax1', 'tax2'],
427
+ semantics: [{ id: SemanticType.CreatedTimestamp }],
427
428
  type: 'number',
428
429
  schema: { minimum: 0 },
429
430
  bindings: [{ type: 'web', schema: { format: 'float' } }],
@@ -442,7 +443,7 @@ test.group('DomainProperty.toJSON()', () => {
442
443
  assert.isTrue(json.writeOnly)
443
444
  assert.isTrue(json.deprecated)
444
445
  assert.deepEqual(json.tags, ['tag1', 'tag2'])
445
- assert.deepEqual(json.taxonomy, ['tax1', 'tax2'])
446
+ assert.deepEqual(json.semantics, [{ id: SemanticType.CreatedTimestamp }])
446
447
  assert.deepEqual(json.schema, { minimum: 0 })
447
448
  assert.deepEqual(json.bindings, [{ type: 'web', schema: { format: 'float' } }])
448
449
  })
@@ -452,13 +453,13 @@ test.group('DomainProperty.toJSON()', () => {
452
453
  const parent = 'test-parent'
453
454
  const property = new DomainProperty(root, parent, {
454
455
  tags: [],
455
- taxonomy: [],
456
+ semantics: [],
456
457
  bindings: [],
457
458
  })
458
459
  const json = property.toJSON()
459
460
 
460
461
  assert.isUndefined(json.tags)
461
- assert.isUndefined(json.taxonomy)
462
+ assert.isUndefined(json.semantics)
462
463
  assert.isUndefined(json.bindings)
463
464
  })
464
465
 
@@ -474,7 +475,7 @@ test.group('DomainProperty.toJSON()', () => {
474
475
  writeOnly: undefined,
475
476
  deprecated: undefined,
476
477
  tags: undefined,
477
- taxonomy: undefined,
478
+ semantics: undefined,
478
479
  schema: undefined,
479
480
  bindings: undefined,
480
481
  })
@@ -488,7 +489,7 @@ test.group('DomainProperty.toJSON()', () => {
488
489
  assert.isUndefined(json.writeOnly)
489
490
  assert.isUndefined(json.deprecated)
490
491
  assert.isUndefined(json.tags)
491
- assert.isUndefined(json.taxonomy)
492
+ assert.isUndefined(json.semantics)
492
493
  assert.isUndefined(json.schema)
493
494
  assert.isUndefined(json.bindings)
494
495
  })
@@ -820,3 +821,118 @@ test.group('DomainProperty.toApiShape()', () => {
820
821
  assert.isDefined(result)
821
822
  })
822
823
  })
824
+
825
+ test.group('DomainProperty.addSemantic()', () => {
826
+ test('adds a new semantic to the property', ({ assert }) => {
827
+ const dataDomain = new DataDomain()
828
+ const property = new DomainProperty(dataDomain, 'test-parent', { type: 'datetime' })
829
+ const semantic = { id: SemanticType.CreatedTimestamp }
830
+ property.addSemantic(semantic)
831
+ assert.deepInclude(property.semantics, semantic)
832
+ })
833
+
834
+ test('updates an existing semantic', ({ assert }) => {
835
+ const dataDomain = new DataDomain()
836
+ const property = new DomainProperty(dataDomain, 'test-parent', { type: 'datetime' })
837
+ const semantic1 = { id: SemanticType.CreatedTimestamp, config: { value: 'old' } }
838
+ const semantic2 = { id: SemanticType.CreatedTimestamp, config: { value: 'new' } }
839
+ property.addSemantic(semantic1)
840
+ property.addSemantic(semantic2)
841
+ assert.lengthOf(property.semantics, 1)
842
+ assert.deepInclude(property.semantics, semantic2)
843
+ })
844
+
845
+ test('throws an error if the semantic is not a property semantic', ({ assert }) => {
846
+ const dataDomain = new DataDomain()
847
+ const property = new DomainProperty(dataDomain, 'test-parent')
848
+ const semantic = { id: SemanticType.User } // User is an Entity semantic
849
+ assert.throws(() => {
850
+ property.addSemantic(semantic)
851
+ }, `Invalid semantic type: ${SemanticType.User}. Expected a property semantic.`)
852
+ })
853
+
854
+ test('notifies change when adding a new semantic', async ({ assert }) => {
855
+ const dataDomain = new DataDomain()
856
+ const property = new DomainProperty(dataDomain, 'test-parent', { type: 'datetime' })
857
+ const semantic = { id: SemanticType.CreatedTimestamp }
858
+ property.addSemantic(semantic)
859
+ await assert.dispatches(dataDomain, 'change', { timeout: 20 })
860
+ })
861
+
862
+ test('notifies change when updating an existing semantic', async ({ assert }) => {
863
+ const dataDomain = new DataDomain()
864
+ const property = new DomainProperty(dataDomain, 'test-parent', { type: 'datetime' })
865
+ const semantic1 = { id: SemanticType.CreatedTimestamp, config: { value: 'old' } }
866
+ const semantic2 = { id: SemanticType.CreatedTimestamp, config: { value: 'new' } }
867
+ property.addSemantic(semantic1)
868
+ // Clear the event queue before the second add
869
+ await new Promise((resolve) => setTimeout(resolve, 0))
870
+ property.addSemantic(semantic2)
871
+ await assert.dispatches(dataDomain, 'change', { timeout: 20 })
872
+ })
873
+ })
874
+
875
+ test.group('DomainProperty.removeSemantic()', () => {
876
+ test('removes an existing semantic from the property', ({ assert }) => {
877
+ const dataDomain = new DataDomain()
878
+ const property = new DomainProperty(dataDomain, 'test-parent', { type: 'datetime' })
879
+ const semantic = { id: SemanticType.CreatedTimestamp }
880
+ property.addSemantic(semantic)
881
+ assert.deepInclude(property.semantics, semantic)
882
+ property.removeSemantic(SemanticType.CreatedTimestamp)
883
+ assert.notDeepInclude(property.semantics, semantic)
884
+ assert.lengthOf(property.semantics, 0)
885
+ })
886
+
887
+ test('does nothing if the semantic to remove does not exist', ({ assert }) => {
888
+ const dataDomain = new DataDomain()
889
+ const property = new DomainProperty(dataDomain, 'test-parent', { type: 'datetime' })
890
+ const semantic = { id: SemanticType.CreatedTimestamp }
891
+ property.addSemantic(semantic)
892
+ const initialSemantics = [...property.semantics]
893
+ property.removeSemantic('non-existent-semantic-id' as SemanticType)
894
+ assert.deepEqual(property.semantics, initialSemantics)
895
+ })
896
+
897
+ test('notifies change when a semantic is removed', async ({ assert }) => {
898
+ const dataDomain = new DataDomain()
899
+ const property = new DomainProperty(dataDomain, 'test-parent', { type: 'datetime' })
900
+ const semantic = { id: SemanticType.CreatedTimestamp }
901
+ property.addSemantic(semantic)
902
+ // Clear the event queue before removal
903
+ await new Promise((resolve) => setTimeout(resolve, 0))
904
+ property.removeSemantic(SemanticType.CreatedTimestamp)
905
+ await assert.dispatches(dataDomain, 'change', { timeout: 20 })
906
+ })
907
+
908
+ test('does not notify change if the semantic to remove does not exist', async ({ assert }) => {
909
+ const dataDomain = new DataDomain()
910
+ const property = new DomainProperty(dataDomain, 'test-parent')
911
+ // Clear the event queue before removal
912
+ await new Promise((resolve) => setTimeout(resolve, 0))
913
+ property.removeSemantic('non-existent-semantic-id' as SemanticType)
914
+ await assert.notDispatches(dataDomain, 'change', { timeout: 20 })
915
+ })
916
+ })
917
+
918
+ test.group('DomainProperty.hasSemantic()', () => {
919
+ test('returns true if the property has the specified semantic', ({ assert }) => {
920
+ const dataDomain = new DataDomain()
921
+ const property = new DomainProperty(dataDomain, 'test-parent', { type: 'datetime' })
922
+ const semantic = { id: SemanticType.CreatedTimestamp }
923
+ property.addSemantic(semantic)
924
+ assert.isTrue(property.hasSemantic(SemanticType.CreatedTimestamp))
925
+ })
926
+
927
+ test('returns false if the property does not have the specified semantic', ({ assert }) => {
928
+ const dataDomain = new DataDomain()
929
+ const property = new DomainProperty(dataDomain, 'test-parent')
930
+ assert.isFalse(property.hasSemantic(SemanticType.CreatedTimestamp))
931
+ })
932
+
933
+ test('returns false for an empty semantics array', ({ assert }) => {
934
+ const dataDomain = new DataDomain()
935
+ const property = new DomainProperty(dataDomain, 'test-parent')
936
+ assert.isFalse(property.hasSemantic(SemanticType.CreatedTimestamp))
937
+ })
938
+ })
@@ -1,103 +0,0 @@
1
- import { type PropertyWebBindings } from '../modeling/Bindings.js';
2
- import { DataAssociation } from '../modeling/legacy/DataAssociation.js';
3
- import { DataEntity } from '../modeling/legacy/DataEntity.js';
4
- import { DataProperty, type DataPropertySchema } from '../modeling/legacy/DataProperty.js';
5
- import { IApiAnyShape, IApiArrayShape, IApiDataExample, IApiFileShape, IApiNodeShape, IApiPropertyShape, IApiRecursiveShape, IApiScalarShape, IApiShape, IShapeUnion } from './definitions/Shapes.js';
6
- import { DataValueGenerator } from './DataValueGenerator.js';
7
- /**
8
- * Serializes Data shapes (DataEntity, DataProperty, DataAssociation) to AMF-related shapes.
9
- *
10
- * This is used when defining entities (according to the `DataEntity` schema)
11
- * and then we want to translate this into AMF shapes.
12
- *
13
- * @deprecated This class refers to the deprecated old data domain model.
14
- * Use the `ShapeGenerator` with the new domain model.
15
- */
16
- export declare class AmfShapeGenerator {
17
- #private;
18
- /**
19
- * Used with data domain value generation for entity properties.
20
- * Lazily loaded class only when functions are used.
21
- * This needs to be a class instances because some functions are incremental
22
- */
23
- get valueGenerator(): DataValueGenerator;
24
- /**
25
- * Serializes the Entity to the AMF node shape.
26
- *
27
- * @param input The Property to serialize.
28
- * @param generatedEntities The list keys of already generated entities. This prohibits recursive shape generation.
29
- */
30
- entity(input: DataEntity, generatedEntities?: string[]): IApiNodeShape | IApiRecursiveShape;
31
- /**
32
- * Serializes an Entity Property to the AMF property shape.
33
- *
34
- * @param input The Property to serialize.
35
- */
36
- property(input: DataProperty): IApiPropertyShape;
37
- /**
38
- * Serializes an Entity property to the AMF property shape with association
39
- * targets as defined in the schema configuration.
40
- *
41
- * @param input The Property to serialize.
42
- */
43
- associationProperty(input: DataAssociation, generatedEntities?: string[]): IApiPropertyShape;
44
- /**
45
- * Generates a shape for an association. Most likely you want to use the `associationProperty()` method instead.
46
- *
47
- * @param input The data association instance.
48
- * @returns The range value for the PropertyShape.
49
- */
50
- associationShape(input: DataAssociation, generatedEntities?: string[]): IShapeUnion | undefined;
51
- /**
52
- * Generates a shape list for an union. Most likely you want to use the `associationProperty()` method instead.
53
- *
54
- * @param input The data association instance.
55
- * @returns The range value for the PropertyShape.
56
- */
57
- associationUnion(input: DataAssociation, generatedEntities?: string[]): IShapeUnion | IShapeUnion[] | undefined;
58
- /**
59
- * The DataProperty may have both the `schema` and the `bindings`. For AMF shape we read `schema` for
60
- * default value, examples, and enum values. We also look for the `web`
61
- * bindings for more detailed definition of a shape.
62
- *
63
- * @param input
64
- * @returns
65
- */
66
- protected _readPropertyRange(input: DataProperty): IApiArrayShape | IApiFileShape | IApiScalarShape;
67
- protected _createAmfSchema(input: DataProperty, schema?: DataPropertySchema, bindings?: PropertyWebBindings): IApiArrayShape | IApiFileShape | IApiScalarShape;
68
- /**
69
- * Normally this would be part of generating a scalar schema but the the property is an array this
70
- * is generated on the array and not on the range.
71
- *
72
- * @param result The scalar or array shape.
73
- * @param schema The property schema
74
- * @param type The data type of the parent property as set on the `range`
75
- * @param isArray Whether the DataProperty is multiple
76
- */
77
- protected _setShapeSchema(input: DataProperty, result: IApiAnyShape, schema: DataPropertySchema, type: string, isArray?: boolean): void;
78
- protected _generateArrayShape(input: DataProperty, schema?: DataPropertySchema, bindings?: PropertyWebBindings): IApiArrayShape;
79
- protected _generateScalarShape(input: DataProperty, schema?: DataPropertySchema, bindings?: PropertyWebBindings): IApiScalarShape;
80
- protected _generateExamples(examples: string[], type: string): IApiDataExample[];
81
- protected _generateArrayExamples(examples: string[], type: string): IApiDataExample[];
82
- protected _generateFileShape(input: DataProperty, schema?: DataPropertySchema, bindings?: PropertyWebBindings): IApiFileShape;
83
- protected _fillScalarShapeCommonProperties(result: IApiFileShape | IApiScalarShape, input: DataProperty, bindings?: PropertyWebBindings): void;
84
- protected _updateBaseProperties(input: DataProperty | DataAssociation | DataEntity, target: IApiShape): void;
85
- protected _recursiveShape(input: DataEntity): IApiRecursiveShape;
86
- /**
87
- * Translates generated schema from an array shape to the shape defined in the `items` of the array.
88
- *
89
- * @param array The source array.
90
- * @returns The definition of the `items` of the array.
91
- */
92
- refactorArrayToShape(array: IApiArrayShape): IShapeUnion;
93
- /**
94
- * Translates the shape to an array shape. This happens when data model property
95
- * is changed from 'multiple' to not-multiple and back.
96
- *
97
- * @param id The key of the parameter or an association
98
- * @param shape The shape to wrap as an array.
99
- * @returns Array shape.
100
- */
101
- refactorShapeToArray(id: string, shape: IShapeUnion): IApiArrayShape;
102
- }
103
- //# sourceMappingURL=AmfShapeGenerator.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"AmfShapeGenerator.d.ts","sourceRoot":"","sources":["../../../src/amf/AmfShapeGenerator.ts"],"names":[],"mappings":"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"}