@api-client/core 0.11.11 → 0.12.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.
Files changed (252) hide show
  1. package/Testing.md +1 -1
  2. package/bin/plugins/events/EventPlugin.ts +61 -0
  3. package/bin/plugins/events/assert.ts +193 -0
  4. package/bin/plugins/events/types.ts +6 -0
  5. package/bin/test.ts +8 -1
  6. package/build/src/amf/AmfShapeGenerator.d.ts +6 -3
  7. package/build/src/amf/AmfShapeGenerator.d.ts.map +1 -1
  8. package/build/src/amf/AmfShapeGenerator.js +4 -1
  9. package/build/src/amf/AmfShapeGenerator.js.map +1 -1
  10. package/build/src/amf/AmfTypes.d.ts +2 -2
  11. package/build/src/amf/AmfTypes.d.ts.map +1 -1
  12. package/build/src/amf/AmfTypes.js.map +1 -1
  13. package/build/src/amf/DataValueGenerator.d.ts +15 -15
  14. package/build/src/amf/DataValueGenerator.d.ts.map +1 -1
  15. package/build/src/amf/DataValueGenerator.js +14 -14
  16. package/build/src/amf/DataValueGenerator.js.map +1 -1
  17. package/build/src/browser.d.ts +12 -9
  18. package/build/src/browser.d.ts.map +1 -1
  19. package/build/src/browser.js +11 -8
  20. package/build/src/browser.js.map +1 -1
  21. package/build/src/exceptions/attach_exception.d.ts +11 -0
  22. package/build/src/exceptions/attach_exception.d.ts.map +1 -0
  23. package/build/src/exceptions/attach_exception.js +11 -0
  24. package/build/src/exceptions/attach_exception.js.map +1 -0
  25. package/build/src/exceptions/detach_exception.d.ts +11 -0
  26. package/build/src/exceptions/detach_exception.d.ts.map +1 -0
  27. package/build/src/exceptions/detach_exception.js +11 -0
  28. package/build/src/exceptions/detach_exception.js.map +1 -0
  29. package/build/src/exceptions/remove_model_exception.d.ts +8 -0
  30. package/build/src/exceptions/remove_model_exception.d.ts.map +1 -0
  31. package/build/src/exceptions/remove_model_exception.js +8 -0
  32. package/build/src/exceptions/remove_model_exception.js.map +1 -0
  33. package/build/src/exceptions/remove_namespace_exception.d.ts +8 -0
  34. package/build/src/exceptions/remove_namespace_exception.d.ts.map +1 -0
  35. package/build/src/exceptions/remove_namespace_exception.js +8 -0
  36. package/build/src/exceptions/remove_namespace_exception.js.map +1 -0
  37. package/build/src/index.d.ts +12 -9
  38. package/build/src/index.d.ts.map +1 -1
  39. package/build/src/index.js +11 -8
  40. package/build/src/index.js.map +1 -1
  41. package/build/src/legacy.d.ts +8 -0
  42. package/build/src/legacy.d.ts.map +1 -1
  43. package/build/src/legacy.js +9 -0
  44. package/build/src/legacy.js.map +1 -1
  45. package/build/src/modeling/Bindings.d.ts +2 -2
  46. package/build/src/modeling/Bindings.d.ts.map +1 -1
  47. package/build/src/modeling/Bindings.js.map +1 -1
  48. package/build/src/modeling/DataDomain.d.ts +601 -0
  49. package/build/src/modeling/DataDomain.d.ts.map +1 -0
  50. package/build/src/modeling/DataDomain.js +1142 -0
  51. package/build/src/modeling/DataDomain.js.map +1 -0
  52. package/build/src/modeling/DataFormat.d.ts +42 -41
  53. package/build/src/modeling/DataFormat.d.ts.map +1 -1
  54. package/build/src/modeling/DataFormat.js +30 -131
  55. package/build/src/modeling/DataFormat.js.map +1 -1
  56. package/build/src/modeling/DomainAssociation.d.ts +281 -0
  57. package/build/src/modeling/DomainAssociation.d.ts.map +1 -0
  58. package/build/src/modeling/DomainAssociation.js +440 -0
  59. package/build/src/modeling/DomainAssociation.js.map +1 -0
  60. package/build/src/modeling/DomainElement.d.ts +33 -0
  61. package/build/src/modeling/DomainElement.d.ts.map +1 -0
  62. package/build/src/modeling/DomainElement.js +32 -0
  63. package/build/src/modeling/DomainElement.js.map +1 -0
  64. package/build/src/modeling/DomainEntity.d.ts +383 -0
  65. package/build/src/modeling/DomainEntity.d.ts.map +1 -0
  66. package/build/src/modeling/DomainEntity.js +718 -0
  67. package/build/src/modeling/DomainEntity.js.map +1 -0
  68. package/build/src/modeling/DomainFile.d.ts +25 -0
  69. package/build/src/modeling/DomainFile.d.ts.map +1 -0
  70. package/build/src/modeling/DomainFile.js +86 -0
  71. package/build/src/modeling/DomainFile.js.map +1 -0
  72. package/build/src/modeling/DomainImpactAnalysis.d.ts +60 -47
  73. package/build/src/modeling/DomainImpactAnalysis.d.ts.map +1 -1
  74. package/build/src/modeling/DomainImpactAnalysis.js +201 -132
  75. package/build/src/modeling/DomainImpactAnalysis.js.map +1 -1
  76. package/build/src/modeling/DomainModel.d.ts +226 -0
  77. package/build/src/modeling/DomainModel.d.ts.map +1 -0
  78. package/build/src/modeling/DomainModel.js +401 -0
  79. package/build/src/modeling/DomainModel.js.map +1 -0
  80. package/build/src/modeling/DomainNamespace.d.ts +268 -0
  81. package/build/src/modeling/DomainNamespace.d.ts.map +1 -0
  82. package/build/src/modeling/DomainNamespace.js +512 -0
  83. package/build/src/modeling/DomainNamespace.js.map +1 -0
  84. package/build/src/modeling/DomainProperty.d.ts +281 -0
  85. package/build/src/modeling/DomainProperty.d.ts.map +1 -0
  86. package/build/src/modeling/DomainProperty.js +560 -0
  87. package/build/src/modeling/DomainProperty.js.map +1 -0
  88. package/build/src/modeling/DomainSerialization.d.ts +40 -0
  89. package/build/src/modeling/DomainSerialization.d.ts.map +1 -0
  90. package/build/src/modeling/DomainSerialization.js +288 -0
  91. package/build/src/modeling/DomainSerialization.js.map +1 -0
  92. package/build/src/modeling/DomainVersioning.d.ts +17 -0
  93. package/build/src/modeling/DomainVersioning.d.ts.map +1 -0
  94. package/build/src/modeling/DomainVersioning.js +124 -0
  95. package/build/src/modeling/DomainVersioning.js.map +1 -0
  96. package/build/src/modeling/GraphUtils.d.ts +8 -0
  97. package/build/src/modeling/GraphUtils.d.ts.map +1 -0
  98. package/build/src/modeling/GraphUtils.js +26 -0
  99. package/build/src/modeling/GraphUtils.js.map +1 -0
  100. package/build/src/modeling/amf/ShapeGenerator.d.ts +164 -0
  101. package/build/src/modeling/amf/ShapeGenerator.d.ts.map +1 -0
  102. package/build/src/modeling/amf/ShapeGenerator.js +492 -0
  103. package/build/src/modeling/amf/ShapeGenerator.js.map +1 -0
  104. package/build/src/modeling/{DataAssociation.d.ts → legacy/DataAssociation.d.ts} +10 -5
  105. package/build/src/modeling/legacy/DataAssociation.d.ts.map +1 -0
  106. package/build/src/modeling/{DataAssociation.js → legacy/DataAssociation.js} +9 -6
  107. package/build/src/modeling/legacy/DataAssociation.js.map +1 -0
  108. package/build/src/modeling/{DataEntity.d.ts → legacy/DataEntity.d.ts} +12 -7
  109. package/build/src/modeling/legacy/DataEntity.d.ts.map +1 -0
  110. package/build/src/modeling/{DataEntity.js → legacy/DataEntity.js} +19 -18
  111. package/build/src/modeling/legacy/DataEntity.js.map +1 -0
  112. package/build/src/modeling/{DataEntityBuilder.d.ts → legacy/DataEntityBuilder.d.ts} +3 -2
  113. package/build/src/modeling/legacy/DataEntityBuilder.d.ts.map +1 -0
  114. package/build/src/modeling/{DataEntityBuilder.js → legacy/DataEntityBuilder.js} +3 -2
  115. package/build/src/modeling/legacy/DataEntityBuilder.js.map +1 -0
  116. package/build/src/modeling/legacy/DataImpactAnalysis.d.ts +298 -0
  117. package/build/src/modeling/legacy/DataImpactAnalysis.d.ts.map +1 -0
  118. package/build/src/modeling/legacy/DataImpactAnalysis.js +441 -0
  119. package/build/src/modeling/legacy/DataImpactAnalysis.js.map +1 -0
  120. package/build/src/modeling/{DataModel.d.ts → legacy/DataModel.d.ts} +6 -4
  121. package/build/src/modeling/legacy/DataModel.d.ts.map +1 -0
  122. package/build/src/modeling/{DataModel.js → legacy/DataModel.js} +7 -6
  123. package/build/src/modeling/legacy/DataModel.js.map +1 -0
  124. package/build/src/modeling/{DataNamespace.d.ts → legacy/DataNamespace.d.ts} +22 -3
  125. package/build/src/modeling/legacy/DataNamespace.d.ts.map +1 -0
  126. package/build/src/modeling/{DataNamespace.js → legacy/DataNamespace.js} +7 -3
  127. package/build/src/modeling/legacy/DataNamespace.js.map +1 -0
  128. package/build/src/modeling/{DataProperty.d.ts → legacy/DataProperty.d.ts} +13 -5
  129. package/build/src/modeling/legacy/DataProperty.d.ts.map +1 -0
  130. package/build/src/modeling/{DataProperty.js → legacy/DataProperty.js} +8 -5
  131. package/build/src/modeling/legacy/DataProperty.js.map +1 -0
  132. package/build/src/modeling/observed.d.ts +67 -0
  133. package/build/src/modeling/observed.d.ts.map +1 -0
  134. package/build/src/modeling/observed.js +230 -0
  135. package/build/src/modeling/observed.js.map +1 -0
  136. package/build/src/modeling/types.d.ts +165 -1
  137. package/build/src/modeling/types.d.ts.map +1 -1
  138. package/build/src/modeling/types.js.map +1 -1
  139. package/build/src/models/Thing.d.ts +26 -5
  140. package/build/src/models/Thing.d.ts.map +1 -1
  141. package/build/src/models/Thing.js +193 -91
  142. package/build/src/models/Thing.js.map +1 -1
  143. package/build/src/models/kinds.d.ts +31 -6
  144. package/build/src/models/kinds.d.ts.map +1 -1
  145. package/build/src/models/kinds.js +31 -6
  146. package/build/src/models/kinds.js.map +1 -1
  147. package/build/src/models/store/DataFile.d.ts +3 -1
  148. package/build/src/models/store/DataFile.d.ts.map +1 -1
  149. package/build/src/models/store/DataFile.js +2 -0
  150. package/build/src/models/store/DataFile.js.map +1 -1
  151. package/build/src/models/types.d.ts +12 -0
  152. package/build/src/models/types.d.ts.map +1 -0
  153. package/build/src/models/types.js +2 -0
  154. package/build/src/models/types.js.map +1 -0
  155. package/build/src/runtime/store/FilesSdk.d.ts +2 -2
  156. package/build/src/runtime/store/FilesSdk.d.ts.map +1 -1
  157. package/build/src/runtime/store/FilesSdk.js.map +1 -1
  158. package/data/models/example-generator-api.json +16 -16
  159. package/package.json +20 -6
  160. package/readme.md +1 -1
  161. package/src/amf/AmfShapeGenerator.ts +7 -4
  162. package/src/amf/AmfTypes.ts +2 -2
  163. package/src/amf/DataValueGenerator.ts +21 -21
  164. package/src/exceptions/attach_exception.ts +11 -0
  165. package/src/exceptions/detach_exception.ts +11 -0
  166. package/src/exceptions/remove_model_exception.ts +8 -0
  167. package/src/exceptions/remove_namespace_exception.ts +8 -0
  168. package/src/modeling/Bindings.ts +2 -2
  169. package/src/modeling/DataDomain.ts +1221 -0
  170. package/src/modeling/DataFormat.ts +54 -163
  171. package/src/modeling/DomainAssociation.ts +476 -0
  172. package/src/modeling/DomainElement.ts +50 -0
  173. package/src/modeling/DomainEntity.ts +769 -0
  174. package/src/modeling/DomainFile.ts +94 -0
  175. package/src/modeling/DomainImpactAnalysis.ts +218 -144
  176. package/src/modeling/DomainModel.ts +421 -0
  177. package/src/modeling/DomainNamespace.ts +537 -0
  178. package/src/modeling/DomainProperty.ts +548 -0
  179. package/src/modeling/DomainSerialization.ts +312 -0
  180. package/src/modeling/DomainVersioning.ts +144 -0
  181. package/src/modeling/GraphUtils.ts +28 -0
  182. package/src/modeling/amf/ShapeGenerator.ts +552 -0
  183. package/src/modeling/graph.md +115 -0
  184. package/src/modeling/{DataAssociation.ts → legacy/DataAssociation.ts} +13 -8
  185. package/src/modeling/{DataEntity.ts → legacy/DataEntity.ts} +28 -23
  186. package/src/modeling/{DataEntityBuilder.ts → legacy/DataEntityBuilder.ts} +4 -3
  187. package/src/modeling/legacy/DataImpactAnalysis.ts +530 -0
  188. package/src/modeling/{DataModel.ts → legacy/DataModel.ts} +10 -8
  189. package/src/modeling/{DataNamespace.ts → legacy/DataNamespace.ts} +23 -5
  190. package/src/modeling/{DataProperty.ts → legacy/DataProperty.ts} +15 -7
  191. package/src/modeling/observed.ts +267 -0
  192. package/src/modeling/types.ts +174 -1
  193. package/src/models/Thing.ts +70 -5
  194. package/src/models/kinds.ts +32 -6
  195. package/src/models/store/DataFile.ts +3 -1
  196. package/src/models/types.ts +11 -0
  197. package/src/runtime/store/FilesSdk.ts +2 -2
  198. package/tests/unit/amf/data_value_generator.spec.ts +15 -15
  199. package/tests/unit/legacy-transformers/ARC-legacy-import.spec.ts +1 -1
  200. package/tests/unit/modeling/amf/shape_generator.spec.ts +1174 -0
  201. package/tests/unit/modeling/data_domain.spec.ts +444 -0
  202. package/tests/unit/modeling/data_domain_associations.spec.ts +279 -0
  203. package/tests/unit/modeling/data_domain_change_observers.spec.ts +681 -0
  204. package/tests/unit/modeling/data_domain_entities.spec.ts +449 -0
  205. package/tests/unit/modeling/data_domain_foreign.spec.ts +355 -0
  206. package/tests/unit/modeling/data_domain_models.spec.ts +658 -0
  207. package/tests/unit/modeling/data_domain_namespaces.spec.ts +668 -0
  208. package/tests/unit/modeling/data_domain_property.spec.ts +264 -0
  209. package/tests/unit/modeling/data_domain_serialization.spec.ts +294 -0
  210. package/tests/unit/modeling/domain.property.spec.ts +822 -0
  211. package/tests/unit/modeling/domain_asociation.spec.ts +643 -0
  212. package/tests/unit/modeling/domain_asociation_targets.spec.ts +350 -0
  213. package/tests/unit/modeling/domain_entity.spec.ts +730 -0
  214. package/tests/unit/modeling/domain_entity_associations.spec.ts +330 -0
  215. package/tests/unit/modeling/domain_entity_example_generator_json.spec.ts +988 -0
  216. package/tests/unit/modeling/domain_entity_example_generator_xml.spec.ts +1451 -0
  217. package/tests/unit/modeling/domain_entity_fields.spec.ts +113 -0
  218. package/tests/unit/modeling/domain_entity_generators.spec.ts +20 -0
  219. package/tests/unit/modeling/domain_entity_parents.spec.ts +291 -0
  220. package/tests/unit/modeling/domain_entity_properties.spec.ts +305 -0
  221. package/tests/unit/modeling/{data_file.spec.ts → domain_file.spec.ts} +29 -85
  222. package/tests/unit/modeling/domain_impact_analysis.spec.ts +452 -0
  223. package/tests/unit/modeling/domain_model.spec.ts +568 -0
  224. package/tests/unit/modeling/domain_model_entities.spec.ts +408 -0
  225. package/tests/unit/modeling/domain_namespace.spec.ts +514 -0
  226. package/tests/unit/modeling/domain_namespace_models.spec.ts +324 -0
  227. package/tests/unit/modeling/domain_namespace_namespaces.spec.ts +404 -0
  228. package/tests/unit/modeling/domain_versioning.spec.ts +140 -0
  229. package/tests/unit/{amf → modeling/legacy}/amf_shape_generator.spec.ts +11 -11
  230. package/tests/unit/modeling/{data_association.spec.ts → legacy/data_association.spec.ts} +3 -11
  231. package/tests/unit/modeling/{data_entity.spec.ts → legacy/data_entity.spec.ts} +10 -8
  232. package/tests/unit/modeling/{data_entity_generator_json.spec.ts → legacy/data_entity_generator_json.spec.ts} +1 -1
  233. package/tests/unit/modeling/{data_entity_generator_xml.spec.ts → legacy/data_entity_generator_xml.spec.ts} +1 -1
  234. package/tests/unit/modeling/{data_model.spec.ts → legacy/data_model.spec.ts} +3 -3
  235. package/tests/unit/modeling/{data_namespace.spec.ts → legacy/data_namespace.spec.ts} +3 -10
  236. package/tests/unit/modeling/{data_property.spec.ts → legacy/data_property.spec.ts} +3 -6
  237. package/tests/unit/modeling/{impact_analysis.spec.ts → legacy/impact_analysis.spec.ts} +9 -9
  238. package/tests/unit/models/File/new.spec.ts +1 -1
  239. package/tests/unit/models/HttpProject.spec.ts +3 -3
  240. package/tsconfig.node.json +35 -0
  241. package/build/src/modeling/DataAssociation.d.ts.map +0 -1
  242. package/build/src/modeling/DataAssociation.js.map +0 -1
  243. package/build/src/modeling/DataEntity.d.ts.map +0 -1
  244. package/build/src/modeling/DataEntity.js.map +0 -1
  245. package/build/src/modeling/DataEntityBuilder.d.ts.map +0 -1
  246. package/build/src/modeling/DataEntityBuilder.js.map +0 -1
  247. package/build/src/modeling/DataModel.d.ts.map +0 -1
  248. package/build/src/modeling/DataModel.js.map +0 -1
  249. package/build/src/modeling/DataNamespace.d.ts.map +0 -1
  250. package/build/src/modeling/DataNamespace.js.map +0 -1
  251. package/build/src/modeling/DataProperty.d.ts.map +0 -1
  252. package/build/src/modeling/DataProperty.js.map +0 -1
@@ -0,0 +1,404 @@
1
+ import { test } from '@japa/runner'
2
+ import { DataDomain, DomainNamespace } from '../../../src/index.js'
3
+
4
+ test.group('DomainNamespace.addNamespace()', () => {
5
+ test('adds a namespace to the data domain', ({ assert }) => {
6
+ const dataDomain = new DataDomain()
7
+ const namespace = dataDomain.addNamespace()
8
+ const childNamespace = namespace.addNamespace()
9
+ assert.instanceOf(childNamespace, DomainNamespace)
10
+ assert.isTrue(dataDomain.graph.hasNode(childNamespace.key))
11
+ assert.equal(dataDomain.graph.parent(childNamespace.key), namespace.key)
12
+ })
13
+
14
+ test('adds a namespace with default values', ({ assert }) => {
15
+ const dataDomain = new DataDomain()
16
+ const namespace = dataDomain.addNamespace()
17
+ const childNamespace = namespace.addNamespace()
18
+ assert.instanceOf(childNamespace, DomainNamespace)
19
+ assert.isTrue(dataDomain.graph.hasNode(childNamespace.key))
20
+ assert.equal(childNamespace.info.name, 'New namespace')
21
+ })
22
+
23
+ test('throws an error if a namespace with the same key already exists', ({ assert }) => {
24
+ const dataDomain = new DataDomain()
25
+ const namespace = dataDomain.addNamespace()
26
+ assert.throws(() => {
27
+ namespace.addNamespace({ key: namespace.key })
28
+ }, `Trying to add a namespace to ${namespace.key}, but it already exists`)
29
+ })
30
+
31
+ test('notifies change', async ({ assert }) => {
32
+ const dataDomain = new DataDomain()
33
+ const namespace = dataDomain.addNamespace()
34
+ namespace.addNamespace()
35
+ await assert.dispatches(dataDomain, 'change', { timeout: 20 })
36
+ })
37
+
38
+ test('adds a namespace to the root of the graph', ({ assert }) => {
39
+ const dataDomain = new DataDomain()
40
+ const namespace = dataDomain.addNamespace()
41
+ const childNamespace = namespace.addNamespace()
42
+ assert.instanceOf(childNamespace, DomainNamespace)
43
+ assert.isTrue(dataDomain.graph.hasNode(childNamespace.key))
44
+ assert.equal(dataDomain.graph.parent(childNamespace.key), namespace.key)
45
+ })
46
+
47
+ test('adds a namespace to a parent namespace - checks parent-child relationship', ({ assert }) => {
48
+ const dataDomain = new DataDomain()
49
+ const parentNamespace = dataDomain.addNamespace()
50
+ const childNamespace = parentNamespace.addNamespace()
51
+ assert.isTrue(dataDomain.graph.hasParent(childNamespace.key, parentNamespace.key))
52
+ })
53
+
54
+ test('adds a namespace to a parent namespace - checks items list', ({ assert }) => {
55
+ const dataDomain = new DataDomain()
56
+ const parentNamespace = dataDomain.addNamespace()
57
+ const childNamespace = parentNamespace.addNamespace()
58
+ assert.deepInclude([...parentNamespace.listNamespaces()], childNamespace)
59
+ })
60
+ })
61
+
62
+ test.group('DomainNamespace.removeNamespace()', () => {
63
+ test('removes a child namespace', ({ assert }) => {
64
+ const dataDomain = new DataDomain()
65
+ const namespace = dataDomain.addNamespace()
66
+ const childNamespace = namespace.addNamespace()
67
+ namespace.removeNamespace(childNamespace.key)
68
+ assert.isUndefined(dataDomain.findNamespace(childNamespace.key))
69
+ assert.isFalse(dataDomain.graph.hasNode(childNamespace.key))
70
+ assert.deepEqual([...namespace.listNamespaces()], [])
71
+ })
72
+
73
+ test('throws an error if the namespace does not exist', ({ assert }) => {
74
+ const dataDomain = new DataDomain()
75
+ const namespace = dataDomain.addNamespace()
76
+ assert.throws(() => {
77
+ namespace.removeNamespace('non-existent-ns')
78
+ }, "Trying to remove the non-existent-ns namespace, but it doesn't exist")
79
+ })
80
+
81
+ test('throws an error when deleting not a namespace', ({ assert }) => {
82
+ const root = new DataDomain()
83
+ const n1 = root.addNamespace()
84
+ const m1 = n1.addModel()
85
+ assert.throws(() => {
86
+ n1.removeNamespace(m1.key)
87
+ }, `Trying to remove the ${m1.key} namespace, but it is not a namespace`)
88
+ })
89
+
90
+ test('removes a namespace with children', ({ assert }) => {
91
+ const root = new DataDomain()
92
+ const n1 = root.addNamespace()
93
+ const n2 = n1.addNamespace()
94
+ const m1 = n2.addModel()
95
+ n1.removeNamespace(n2.key)
96
+ assert.isUndefined(root.findNamespace(n2.key))
97
+ assert.isFalse(root.graph.hasNode(n2.key))
98
+ assert.isFalse(root.graph.hasNode(m1.key))
99
+ assert.deepEqual([...n1.listNamespaces()], [])
100
+ })
101
+
102
+ test('removes a namespace with models', ({ assert }) => {
103
+ const root = new DataDomain()
104
+ const n1 = root.addNamespace()
105
+ const n2 = n1.addNamespace()
106
+ const m1 = n2.addModel()
107
+ n1.removeNamespace(n2.key)
108
+ assert.isUndefined(root.findModel(m1.key))
109
+ assert.isFalse(root.graph.hasNode(m1.key))
110
+ })
111
+
112
+ test('removes a namespace with entities', ({ assert }) => {
113
+ const root = new DataDomain()
114
+ const n1 = root.addNamespace()
115
+ const n2 = n1.addNamespace()
116
+ const m1 = n2.addModel()
117
+ const entity = m1.addEntity()
118
+ n1.removeNamespace(n2.key)
119
+ assert.isUndefined(root.findEntity(entity.key))
120
+ assert.isFalse(root.graph.hasNode(entity.key))
121
+ })
122
+
123
+ test('removes a namespace with properties', ({ assert }) => {
124
+ const root = new DataDomain()
125
+ const n1 = root.addNamespace()
126
+ const n2 = n1.addNamespace()
127
+ const m1 = n2.addModel()
128
+ const e1 = m1.addEntity()
129
+ const property = e1.addProperty()
130
+ n1.removeNamespace(n2.key)
131
+ assert.isUndefined(root.findProperty(property.key))
132
+ assert.isFalse(root.graph.hasNode(property.key))
133
+ })
134
+
135
+ test('removes a namespace with associations', ({ assert }) => {
136
+ const root = new DataDomain()
137
+ const n1 = root.addNamespace()
138
+ const n2 = n1.addNamespace()
139
+ const m1 = n2.addModel()
140
+ const e1 = m1.addEntity()
141
+ const a1 = e1.addAssociation()
142
+ n1.removeNamespace(n2.key)
143
+ assert.isUndefined(root.findAssociation(a1.key))
144
+ assert.isFalse(root.graph.hasNode(a1.key))
145
+ })
146
+
147
+ test('removes a namespace with children - checks parent-child relationship', ({ assert }) => {
148
+ const root = new DataDomain()
149
+ const n1 = root.addNamespace()
150
+ const n2 = n1.addNamespace()
151
+ n1.removeNamespace(n2.key)
152
+ assert.isFalse(root.graph.hasParent(n2.key, n1.key))
153
+ })
154
+
155
+ test('removes a namespace with children - checks items list', ({ assert }) => {
156
+ const root = new DataDomain()
157
+ const n1 = root.addNamespace()
158
+ const n2 = n1.addNamespace()
159
+ n1.removeNamespace(n2.key)
160
+ assert.notDeepInclude([...n1.listNamespaces()], n2)
161
+ })
162
+
163
+ test('removes a namespace with models - checks parent-child relationship', ({ assert }) => {
164
+ const root = new DataDomain()
165
+ const n1 = root.addNamespace()
166
+ const n2 = n1.addNamespace()
167
+ const m1 = n2.addModel()
168
+ n1.removeNamespace(n2.key)
169
+ assert.isFalse(root.graph.hasParent(m1.key, n2.key))
170
+ })
171
+
172
+ test('removes a namespace with models - checks items list', ({ assert }) => {
173
+ const root = new DataDomain()
174
+ const n1 = root.addNamespace()
175
+ const n2 = n1.addNamespace()
176
+ const m1 = n2.addModel()
177
+ n1.removeNamespace(n2.key)
178
+ assert.notDeepInclude([...n2.listModels()], m1)
179
+ })
180
+ })
181
+
182
+ test.group('DomainNamespace.attachNamespace()', () => {
183
+ test('attaches a child namespace', ({ assert }) => {
184
+ const root = new DataDomain()
185
+ const n1 = root.addNamespace()
186
+ const n2 = root.addNamespace()
187
+ n1.attachNamespace(n2.key)
188
+ assert.deepInclude([...n1.listNamespaces()], n2)
189
+ })
190
+
191
+ test('throws an error if the namespace does not exist', ({ assert }) => {
192
+ const root = new DataDomain()
193
+ const n1 = root.addNamespace()
194
+ assert.throws(() => {
195
+ n1.attachNamespace('non-existent-ns')
196
+ }, "Trying to attach the non-existent-ns namespace, but it doesn't exist")
197
+ })
198
+
199
+ test('attaches a namespace - checks parent-child relationship', ({ assert }) => {
200
+ const root = new DataDomain()
201
+ const n1 = root.addNamespace()
202
+ const n2 = root.addNamespace()
203
+ n1.attachNamespace(n2.key)
204
+ assert.isTrue(root.graph.hasParent(n2.key, n1.key))
205
+ })
206
+
207
+ test('attaches a namespace - checks items list', ({ assert }) => {
208
+ const root = new DataDomain()
209
+ const n1 = root.addNamespace()
210
+ const n2 = root.addNamespace()
211
+ n1.attachNamespace(n2.key)
212
+ assert.deepInclude([...n1.listNamespaces()], n2)
213
+ })
214
+
215
+ test('attaches a namespace - does notify change', async ({ assert, sleep }) => {
216
+ const root = new DataDomain()
217
+ const n1 = root.addNamespace()
218
+ const n2 = root.addNamespace()
219
+ // addNamespace dispatches the change event
220
+ await sleep(0)
221
+ n1.attachNamespace(n2.key)
222
+ await assert.dispatches(root, 'change', { timeout: 20 })
223
+ })
224
+
225
+ test('throws an error when attaching not a namespace', ({ assert }) => {
226
+ const root = new DataDomain()
227
+ const n1 = root.addNamespace()
228
+ const m1 = n1.addModel()
229
+ assert.throws(() => {
230
+ n1.attachNamespace(m1.key)
231
+ }, `Trying to attach the ${m1.key} namespace, but it is not a namespace`)
232
+ })
233
+
234
+ test('attaches a namespace and removes it from the previous parent', ({ assert }) => {
235
+ const root = new DataDomain()
236
+ const n1 = root.addNamespace()
237
+ const n2 = n1.addNamespace()
238
+ const n3 = root.addNamespace()
239
+ n3.attachNamespace(n2.key)
240
+ assert.deepEqual(n1.fields, [])
241
+ })
242
+
243
+ test('attaches a namespace from root', ({ assert }) => {
244
+ const root = new DataDomain()
245
+ const n1 = root.addNamespace()
246
+ const n2 = root.addNamespace()
247
+ n1.attachNamespace(n2.key)
248
+ assert.deepEqual(n1.fields, [{ key: n2.key, type: 'namespace' }])
249
+ })
250
+ })
251
+
252
+ test.group('DomainNamespace.detachNamespace()', () => {
253
+ test('detaches a child namespace', ({ assert }) => {
254
+ const root = new DataDomain()
255
+ const n1 = root.addNamespace()
256
+ const n2 = n1.addNamespace()
257
+ n1.detachNamespace(n2.key)
258
+ assert.ok(root.findNamespace(n2.key))
259
+ assert.isTrue(root.graph.hasNode(n2.key))
260
+ assert.deepEqual([...n1.listNamespaces()], [])
261
+ })
262
+
263
+ test('throws an error if the namespace does not exist', ({ assert }) => {
264
+ const root = new DataDomain()
265
+ const n1 = root.addNamespace()
266
+ assert.throws(() => {
267
+ n1.detachNamespace('non-existent-ns')
268
+ }, `Trying to detach the non-existent-ns namespace, but it doesn't exist`)
269
+ })
270
+
271
+ test('detaches a namespace - checks parent-child relationship', ({ assert }) => {
272
+ const root = new DataDomain()
273
+ const n1 = root.addNamespace()
274
+ const n2 = n1.addNamespace()
275
+ n1.detachNamespace(n2.key)
276
+ assert.isFalse(root.graph.hasParent(n2.key, n1.key))
277
+ })
278
+
279
+ test('detaches a namespace - checks items list', ({ assert }) => {
280
+ const root = new DataDomain()
281
+ const n1 = root.addNamespace()
282
+ const n2 = n1.addNamespace()
283
+ n1.detachNamespace(n2.key)
284
+ assert.notDeepInclude([...n1.listNamespaces()], n2)
285
+ })
286
+
287
+ test('detaches a namespace - does not notify change', async ({ assert, sleep }) => {
288
+ const root = new DataDomain()
289
+ const n1 = root.addNamespace()
290
+ const n2 = n1.addNamespace()
291
+ await sleep(0)
292
+ await assert.notDispatches(root, 'change', { timeout: 20 })
293
+ n1.detachNamespace(n2.key)
294
+ })
295
+
296
+ test('throws an error when detaching not a namespace', ({ assert }) => {
297
+ const root = new DataDomain()
298
+ const n1 = root.addNamespace()
299
+ const m1 = n1.addModel()
300
+ assert.throws(() => {
301
+ n1.detachNamespace(m1.key)
302
+ }, `Trying to detach the ${m1.key} namespace, but it is not a namespace`)
303
+ })
304
+ })
305
+
306
+ test.group('DomainNamespace.listNamespaces()', () => {
307
+ test('lists all child namespaces', ({ assert }) => {
308
+ const dataDomain = new DataDomain()
309
+ const namespace = dataDomain.addNamespace()
310
+ const childNamespace1 = namespace.addNamespace()
311
+ const childNamespace2 = namespace.addNamespace()
312
+ const namespaces = [...namespace.listNamespaces()]
313
+ assert.lengthOf(namespaces, 2)
314
+ assert.deepInclude(namespaces, childNamespace1)
315
+ assert.deepInclude(namespaces, childNamespace2)
316
+ })
317
+
318
+ test('returns an empty array if there are no child namespaces', ({ assert }) => {
319
+ const dataDomain = new DataDomain()
320
+ const namespace = dataDomain.addNamespace()
321
+ const namespaces = [...namespace.listNamespaces()]
322
+ assert.lengthOf(namespaces, 0)
323
+ })
324
+
325
+ test('returns only namespaces', ({ assert }) => {
326
+ const dataDomain = new DataDomain()
327
+ const namespace = dataDomain.addNamespace()
328
+ const childNamespace = namespace.addNamespace()
329
+ namespace.addModel()
330
+ const namespaces = [...namespace.listNamespaces()]
331
+ assert.lengthOf(namespaces, 1)
332
+ assert.deepInclude(namespaces, childNamespace)
333
+ })
334
+
335
+ test('namespaces in the list are of type DomainNamespace', ({ assert }) => {
336
+ const dataDomain = new DataDomain()
337
+ const namespace = dataDomain.addNamespace()
338
+ namespace.addNamespace()
339
+ const namespaces = [...namespace.listNamespaces()]
340
+ assert.instanceOf(namespaces[0], DomainNamespace)
341
+ })
342
+
343
+ test('lists namespaces in the order they were added', ({ assert }) => {
344
+ const dataDomain = new DataDomain()
345
+ const namespace = dataDomain.addNamespace()
346
+ const childNamespace1 = namespace.addNamespace()
347
+ const childNamespace2 = namespace.addNamespace()
348
+ const namespaces = [...namespace.listNamespaces()]
349
+ assert.deepEqual(namespaces, [childNamespace1, childNamespace2])
350
+ })
351
+
352
+ test('lists namespaces when there are no namespaces', ({ assert }) => {
353
+ const dataDomain = new DataDomain()
354
+ const namespace = dataDomain.addNamespace()
355
+ const namespaces = [...namespace.listNamespaces()]
356
+ assert.deepEqual(namespaces, [])
357
+ })
358
+
359
+ test('lists namespaces when there are other domain elements', ({ assert }) => {
360
+ const dataDomain = new DataDomain()
361
+ const namespace = dataDomain.addNamespace()
362
+ const childNamespace = namespace.addNamespace()
363
+ namespace.addModel()
364
+ const namespaces = [...namespace.listNamespaces()]
365
+ assert.deepEqual(namespaces, [childNamespace])
366
+ })
367
+ })
368
+
369
+ test.group('DomainNamespace.hasNamespaces()', () => {
370
+ test('returns true if there are child namespaces', ({ assert }) => {
371
+ const dataDomain = new DataDomain()
372
+ const namespace = dataDomain.addNamespace()
373
+ namespace.addNamespace()
374
+ assert.isTrue(namespace.hasNamespaces())
375
+ })
376
+
377
+ test('returns false if there are no child namespaces', ({ assert }) => {
378
+ const dataDomain = new DataDomain()
379
+ const namespace = dataDomain.addNamespace()
380
+ assert.isFalse(namespace.hasNamespaces())
381
+ })
382
+
383
+ test('returns false if there are only models', ({ assert }) => {
384
+ const dataDomain = new DataDomain()
385
+ const namespace = dataDomain.addNamespace()
386
+ namespace.addModel()
387
+ assert.isFalse(namespace.hasNamespaces())
388
+ })
389
+
390
+ test('returns true if there are both namespaces and models', ({ assert }) => {
391
+ const dataDomain = new DataDomain()
392
+ const namespace = dataDomain.addNamespace()
393
+ namespace.addNamespace()
394
+ namespace.addModel()
395
+ assert.isTrue(namespace.hasNamespaces())
396
+ })
397
+
398
+ test('returns false if the namespace has no fields', ({ assert }) => {
399
+ const dataDomain = new DataDomain()
400
+ const namespace = dataDomain.addNamespace()
401
+ namespace.fields = []
402
+ assert.isFalse(namespace.hasNamespaces())
403
+ })
404
+ })
@@ -0,0 +1,140 @@
1
+ import { test } from '@japa/runner'
2
+ import { DataDomain, DomainVersioning } from '../../../src/index.js'
3
+
4
+ test.group('DomainVersioning', () => {
5
+ test('should serialize a domain with only local nodes', ({ assert }) => {
6
+ const root = new DataDomain()
7
+ const ns1 = root.addNamespace({ key: 'ns1' })
8
+ const m1 = ns1.addModel({ key: 'm1' })
9
+ m1.addEntity({ key: 'e1' })
10
+
11
+ const serialized = DomainVersioning.serializeForVersionRelease(root)
12
+
13
+ assert.lengthOf(serialized.nodes, 3)
14
+ assert.lengthOf(serialized.edges, 0)
15
+ })
16
+
17
+ test('should include connected foreign nodes', ({ assert }) => {
18
+ const root = new DataDomain()
19
+ const ns1 = root.addNamespace({ key: 'ns1' })
20
+ const m1 = ns1.addModel({ key: 'm1' })
21
+ const e1 = m1.addEntity({ key: 'e1' })
22
+
23
+ const fd = new DataDomain()
24
+ const fm1 = fd.addModel({ key: 'fm1' })
25
+ const fe1 = fm1.addEntity({ key: 'fe1' })
26
+ fd.info.version = '1.0.0'
27
+ root.registerForeignDomain(fd)
28
+
29
+ e1.addAssociation({ domain: fd.key, key: fe1.key }, { key: 'a1' })
30
+
31
+ const serialized = DomainVersioning.serializeForVersionRelease(root)
32
+
33
+ assert.lengthOf(serialized.nodes, 5)
34
+ assert.lengthOf(serialized.edges, 2)
35
+ const foreignNode = serialized.nodes.find((n) => n.v === `${fd.key}:${fe1.key}`)
36
+ assert.isDefined(foreignNode)
37
+ })
38
+
39
+ test('should exclude unconnected foreign nodes', ({ assert }) => {
40
+ const root = new DataDomain()
41
+ const ns1 = root.addNamespace({ key: 'ns1' })
42
+ ns1.addModel({ key: 'm1' })
43
+
44
+ const fd = new DataDomain()
45
+ const fm1 = fd.addModel({ key: 'fm1' })
46
+ const fe1 = fm1.addEntity({ key: 'fe1' })
47
+ fd.info.version = '1.0.0'
48
+ root.registerForeignDomain(fd)
49
+
50
+ const serialized = DomainVersioning.serializeForVersionRelease(root)
51
+
52
+ assert.lengthOf(serialized.nodes, 2)
53
+ assert.lengthOf(serialized.edges, 0)
54
+ const foreignNode = serialized.nodes.find((n) => n.v === `${fd.key}:${fe1.key}`)
55
+ assert.isUndefined(foreignNode)
56
+ })
57
+
58
+ test('should handle indirect connections', ({ assert }) => {
59
+ const root = new DataDomain()
60
+ const n1 = root.addNamespace({ key: 'n1' })
61
+ const m1 = n1.addModel({ key: 'm1' })
62
+ const e1 = m1.addEntity({ key: 'e1' })
63
+
64
+ const fd1 = new DataDomain()
65
+ const fm1 = fd1.addModel({ key: 'fm1' })
66
+ const fe1 = fm1.addEntity({ key: 'fe1' })
67
+ const fe2 = fm1.addEntity({ key: 'fe2' }) // This should be included
68
+ fe1.addAssociation({ key: fe2.key }, { key: 'a1' })
69
+ fd1.info.version = '1.0.0'
70
+ root.registerForeignDomain(fd1)
71
+
72
+ e1.addAssociation({ domain: fd1.key, key: fe1.key }, { key: 'a2' })
73
+
74
+ const serialized = DomainVersioning.serializeForVersionRelease(root)
75
+
76
+ assert.lengthOf(serialized.nodes, 7)
77
+ assert.lengthOf(serialized.edges, 4)
78
+ const foreignNode1 = serialized.nodes.find((n) => n.v === `${fd1.key}:${fe1.key}`)
79
+ assert.isDefined(foreignNode1)
80
+ const foreignNode2 = serialized.nodes.find((n) => n.v === `${fd1.key}:${fe2.key}`)
81
+ assert.isDefined(foreignNode2)
82
+ })
83
+
84
+ test('should serialize nested dependencies', ({ assert }) => {
85
+ const root = new DataDomain()
86
+ root.key = 'root'
87
+ const n1 = root.addNamespace({ key: 'n1' }) // serialized
88
+ const m1 = n1.addModel({ key: 'm1' }) // serialized
89
+ const e1 = m1.addEntity({ key: 'e1' }) // serialized
90
+
91
+ const fd1 = new DataDomain()
92
+ fd1.key = 'fd1'
93
+ const fm1 = fd1.addModel({ key: 'fm1' }) // not serialized
94
+ const fe1 = fm1.addEntity({ key: 'fe1' }) // serialized
95
+ fd1.info.version = '1.0.0'
96
+
97
+ const fd2 = new DataDomain()
98
+ fd2.key = 'fd2'
99
+ fd2.registerForeignDomain(fd1)
100
+ const fm2 = fd2.addModel({ key: 'fm2' }) // not serialized
101
+ const fe2 = fm2.addEntity({ key: 'fe2' }) // serialized
102
+ const fa1 = fe2.addAssociation({ domain: fd1.key, key: fe1.key }, { key: 'a1' })
103
+ fd2.info.version = '1.0.0'
104
+ root.registerForeignDomain(fd2) // serialized
105
+
106
+ const a2 = e1.addAssociation({ domain: fd2.key, key: fe2.key }, { key: 'a2' }) // serialized
107
+
108
+ const serialized = DomainVersioning.serializeForVersionRelease(root)
109
+
110
+ assert.lengthOf(serialized.nodes, 7)
111
+ assert.lengthOf(serialized.edges, 4)
112
+ const sa1 = serialized.edges.find((e) => e.v === e1.key && e.w === a2.key)
113
+ assert.isDefined(sa1)
114
+ assert.deepEqual(sa1!.value, { type: 'association' })
115
+ const sa2 = serialized.edges.find((e) => e.v === a2.key && e.w === `${fd2.key}:${fe2.key}`)
116
+ assert.isDefined(sa2)
117
+ assert.deepEqual(sa2!.value, { type: 'association', domain: fd2.key, foreign: true })
118
+ const sa3 = serialized.edges.find((e) => e.v === `${fd2.key}:${fe2.key}` && e.w === `${fd2.key}:${fa1.key}`)
119
+ assert.isDefined(sa3)
120
+ assert.deepEqual(sa3!.value, { type: 'association', domain: fd2.key, foreign: true })
121
+ const sa4 = serialized.edges.find(
122
+ (e) => e.v === `${fd2.key}:${fa1.key}` && e.w === `${fd2.key}:${fd1.key}:${fe1.key}`
123
+ )
124
+ assert.isDefined(sa4)
125
+ assert.deepEqual(sa4!.value, { type: 'association', domain: fd1.key, foreign: true })
126
+ const sfe1 = serialized.nodes.find((n) => n.v === `${fd2.key}:${fd1.key}:${fe1.key}`)
127
+ assert.isDefined(sfe1)
128
+ const sfe2 = serialized.nodes.find((n) => n.v === `${fd2.key}:${fe2.key}`)
129
+ assert.isDefined(sfe2)
130
+ const sfa1 = serialized.nodes.find((n) => n.v === `${fd2.key}:${fa1.key}`)
131
+ assert.isDefined(sfa1)
132
+ })
133
+
134
+ test('should serialize an empty graph', ({ assert }) => {
135
+ const dataDomain = new DataDomain()
136
+ const serialized = DomainVersioning.serializeForVersionRelease(dataDomain)
137
+ assert.lengthOf(serialized.nodes, 0)
138
+ assert.lengthOf(serialized.edges, 0)
139
+ })
140
+ })
@@ -1,8 +1,8 @@
1
1
  import { test } from '@japa/runner'
2
- import { DataProperty } from '../../../src/modeling/DataProperty.js'
3
- import { DataEntity } from '../../../src/modeling/DataEntity.js'
4
- import { DataNamespace } from '../../../src/modeling/DataNamespace.js'
5
- import { DataModel } from '../../../src/modeling/DataModel.js'
2
+ import { DataProperty } from '../../../../src/modeling/legacy/DataProperty.js'
3
+ import { DataEntity } from '../../../../src/modeling/legacy/DataEntity.js'
4
+ import { DataNamespace } from '../../../../src/modeling/legacy/DataNamespace.js'
5
+ import { DataModel } from '../../../../src/modeling/legacy/DataModel.js'
6
6
  import {
7
7
  IApiArrayShape,
8
8
  IApiDataExample,
@@ -13,7 +13,7 @@ import {
13
13
  IApiUnionShape,
14
14
  IApiXmlSerializer,
15
15
  IShapeUnion,
16
- } from '../../../src/amf/definitions/Shapes.js'
16
+ } from '../../../../src/amf/definitions/Shapes.js'
17
17
  import {
18
18
  IAmfAnyTypes,
19
19
  IAmfArrayTypes,
@@ -23,11 +23,11 @@ import {
23
23
  IAmfPropertyTypes,
24
24
  IAmfScalarTypes,
25
25
  IAmfUnionTypes,
26
- } from '../../../src/amf/AmfTypes.js'
27
- import { AmfNamespace } from '../../../src/amf/definitions/Namespace.js'
28
- import { AmfShapeGenerator } from '../../../src/amf/AmfShapeGenerator.js'
29
- import { DataAssociation } from '../../../src/modeling/DataAssociation.js'
30
- import type { PropertyWebBindings } from '../../../src/index.js'
26
+ } from '../../../../src/amf/AmfTypes.js'
27
+ import { AmfNamespace } from '../../../../src/amf/definitions/Namespace.js'
28
+ import { AmfShapeGenerator } from '../../../../src/amf/AmfShapeGenerator.js'
29
+ import { DataAssociation } from '../../../../src/modeling/legacy/DataAssociation.js'
30
+ import type { PropertyWebBindings } from '../../../../src/index.js'
31
31
 
32
32
  test.group('entity()', (group) => {
33
33
  let root: DataNamespace
@@ -708,7 +708,7 @@ test.group('property() / default value functions', (group) => {
708
708
  assert.match(value.value as string, /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}$/)
709
709
  })
710
710
 
711
- test('returns novalue for unsupported function', ({ assert }) => {
711
+ test('returns noValue for unsupported function', ({ assert }) => {
712
712
  p1.schema = { defaultValue: { value: 'unsupported', type: 'function' } }
713
713
  const generator = new AmfShapeGenerator()
714
714
  const result = generator.property(p1)
@@ -1,14 +1,6 @@
1
1
  import { test } from '@japa/runner'
2
- import {
3
- DataNamespace,
4
- DataModel,
5
- DataAssociation,
6
- IDataAssociation,
7
- DataAssociationKind,
8
- DataEntity,
9
- Thing,
10
- ValidationError,
11
- } from '../../../src/index.js'
2
+ import { DataAssociationKind, Thing, ValidationError } from '../../../../src/index.js'
3
+ import { DataNamespace, DataModel, DataAssociation, IDataAssociation, DataEntity } from '../../../../src/legacy.js'
12
4
 
13
5
  test.group('constructor() with defaults', (g) => {
14
6
  let root: DataNamespace
@@ -29,7 +21,7 @@ test.group('constructor() with defaults', (g) => {
29
21
 
30
22
  test('sets the default "info"', ({ assert }) => {
31
23
  const assoc = new DataAssociation(root)
32
- assert.typeOf(assoc.info, 'object')
24
+ assert.typeOf(assoc.info, 'EventTarget')
33
25
  assert.equal(assoc.info.name, 'Unnamed association')
34
26
  })
35
27
 
@@ -1,19 +1,21 @@
1
1
  import { test } from '@japa/runner'
2
2
  import {
3
- DataNamespace,
4
- DataEntity,
5
3
  DataEntityKind,
6
- DataProperty,
7
- IDataEntity,
8
4
  Thing,
9
- DataModel,
10
- DataAssociation,
11
5
  ValidationError,
12
6
  RemovePropertyException,
13
7
  RemoveAssociationException,
14
8
  RemoveEntityException,
15
9
  ForeignAssociationException,
16
- } from '../../../src/index.js'
10
+ } from '../../../../src/index.js'
11
+ import {
12
+ DataNamespace,
13
+ DataEntity,
14
+ DataProperty,
15
+ IDataEntity,
16
+ DataModel,
17
+ DataAssociation,
18
+ } from '../../../../src/legacy.js'
17
19
 
18
20
  test.group('constructor() with defaults', (group) => {
19
21
  let root: DataNamespace
@@ -34,7 +36,7 @@ test.group('constructor() with defaults', (group) => {
34
36
 
35
37
  test('sets the default "info"', ({ assert }) => {
36
38
  const assoc = new DataEntity(root)
37
- assert.typeOf(assoc.info, 'object')
39
+ assert.typeOf(assoc.info, 'EventTarget')
38
40
  assert.equal(assoc.info.name, '')
39
41
  })
40
42
 
@@ -1,6 +1,6 @@
1
1
  /* eslint-disable max-len */
2
2
  import { test } from '@japa/runner'
3
- import { DataNamespace, DataEntity, DataModel, DataProperty } from '../../../src/index.js'
3
+ import { DataNamespace, DataEntity, DataModel, DataProperty } from '../../../../src/legacy.js'
4
4
 
5
5
  // const rfc2616Re =
6
6
  // /^(Mon|Tue|Wed|Thu|Fri|Sat|Sun), ([0-3][0-9]) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) ([0-9]{4}) ([01][0-9]|2[0-3])(:[0-5][0-9]){2} GMT$/
@@ -1,6 +1,6 @@
1
1
  import { test } from '@japa/runner'
2
2
  import { JSDOM } from 'jsdom'
3
- import { DataNamespace, DataEntity, DataModel, DataProperty } from '../../../src/index.js'
3
+ import { DataNamespace, DataEntity, DataModel, DataProperty } from '../../../../src/legacy.js'
4
4
 
5
5
  const rfc3339Re = /^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}\.[0-9]{3}Z$/
6
6
  const dateRe = /^[0-9]{4}-[0-9]{2}-[0-9]{2}$/