@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
@@ -1,373 +0,0 @@
1
- import { test } from '@japa/runner'
2
- import { DataImpactAnalysis } from '../../../../src/modeling/legacy/DataImpactAnalysis.js'
3
- import {
4
- DataNamespaceKind,
5
- DataEntityKind,
6
- DataModelKind,
7
- DataPropertyKind,
8
- DataAssociationKind,
9
- } from '../../../../src/models/kinds.js'
10
- import { DataNamespace } from '../../../../src/modeling/legacy/DataNamespace.js'
11
- import { DataEntity } from '../../../../src/modeling/legacy/DataEntity.js'
12
- import { DataModel } from '../../../../src/modeling/legacy/DataModel.js'
13
- import { DataProperty } from '../../../../src/modeling/legacy/DataProperty.js'
14
- import { DataAssociation } from '../../../../src/modeling/legacy/DataAssociation.js'
15
-
16
- test.group('DomainImpactAnalysis', (group) => {
17
- let root: DataNamespace
18
- let analyzer: DataImpactAnalysis
19
- let n1: DataNamespace
20
- let n2: DataNamespace
21
- let m1: DataModel
22
- let m2: DataModel
23
- let m3: DataModel
24
- let e1: DataEntity
25
- let e2: DataEntity
26
- let e3: DataEntity
27
- let e4: DataEntity
28
- let p1: DataProperty
29
- let a1: DataAssociation
30
-
31
- group.each.setup(() => {
32
- root = new DataNamespace()
33
- analyzer = new DataImpactAnalysis(root)
34
- n1 = root.addNamespace('n1')
35
- m1 = root.addDataModel('m1')
36
- n2 = n1.addNamespace('n2')
37
- m2 = n1.addDataModel('m2')
38
- e1 = m1.addEntity('e1')
39
- e2 = m2.addEntity('e2')
40
- m3 = n2.addDataModel('m3')
41
- e3 = m3.addEntity('e3')
42
- p1 = e1.addNamedProperty('p1')
43
- a1 = e1.addNamedAssociation('a1')
44
- a1.addTarget(e2)
45
- e2.addParent(e3.key)
46
- e3.addParent(e1.key)
47
- e4 = root.addDataModel('m4').addEntity('e4')
48
- e4.addParent(e3.key)
49
- // DataNamespace (root)
50
- // ├── DataNamespace (n1)
51
- // │ ├── DataModel (m2)
52
- // │ │ └── DataEntity (e2)
53
- // │ │ └── parent: DataEntity (e3)
54
- // │ └── DataNamespace (n2)
55
- // │ └── DataModel (m3)
56
- // │ └── DataEntity (e3)
57
- // │ └── parent: DataEntity (e1)
58
- // ├── DataModel (m1)
59
- // │ └── DataEntity (e1)
60
- // │ ├── DataProperty (p1)
61
- // │ └── DataAssociation (a1)
62
- // │ └── target: DataEntity (e2)
63
- // └── DataModel (m4)
64
- // └── DataEntity (e4)
65
- // └── parent: DataEntity (e3)
66
- })
67
-
68
- test('returns a report for deleting a namespace', ({ assert }) => {
69
- const report = analyzer.deleteAnalysis(n1.key, DataNamespaceKind)
70
- assert.equal(report.key, n1.key)
71
- assert.equal(report.kind, DataNamespaceKind)
72
- assert.isFalse(report.canProceed, 'operation should not be able to proceed')
73
- // Affected items:
74
- // - n1 (self)
75
- // - m2 (child)
76
- // - e2 (child), note, e3 parent is not included because it is included in the deletion.
77
- // - n2 (child)
78
- // - m3 (child)
79
- // - e3 (child)
80
- // - a1 (target of e2)
81
- // - e4 (parent of e3)
82
- assert.lengthOf(report.impact, 8, 'has all items')
83
- const [n1r, n2r, m3r, e3r, e4r, m2r, e2r, a1r] = report.impact
84
-
85
- assert.ok(n1r)
86
- assert.equal(n1r.key, n1.key)
87
- assert.equal(n1r.kind, DataNamespaceKind)
88
- assert.equal(n1r.type, 'delete')
89
- assert.equal(n1r.impact, `The n1 namespace will be deleted.`)
90
- assert.isFalse(n1r.blocking)
91
-
92
- assert.ok(n2r)
93
- assert.equal(n2r.key, n2.key)
94
- assert.equal(n2r.kind, DataNamespaceKind)
95
- assert.equal(n2r.type, 'delete')
96
- assert.equal(n2r.impact, `The n2 namespace will be deleted.`)
97
- assert.isFalse(n2r.blocking)
98
-
99
- assert.ok(m3r)
100
- assert.equal(m3r.key, m3.key)
101
- assert.equal(m3r.kind, DataModelKind)
102
- assert.equal(m3r.type, 'delete')
103
- assert.equal(m3r.impact, `The m3 data model will be deleted.`)
104
- assert.isFalse(m3r.blocking)
105
-
106
- assert.ok(e3r)
107
- assert.equal(e3r.key, e3.key)
108
- assert.equal(e3r.kind, DataEntityKind)
109
- assert.equal(e3r.type, 'delete')
110
- assert.equal(e3r.impact, `The e3 entity will be deleted.`)
111
- assert.isFalse(e3r.blocking)
112
-
113
- assert.ok(e4r)
114
- assert.equal(e4r.key, e4.key)
115
- assert.equal(e4r.kind, DataEntityKind)
116
- assert.equal(e4r.type, 'delete')
117
- assert.equal(e4r.impact, `The "e4" entity will become an orphan because it is a child of the "e3" entity.`)
118
- assert.equal(e4r.resolution, `The "e3" entity will be removed as the parent of the "e4" entity.`)
119
- assert.isTrue(e4r.blocking)
120
- assert.equal(e4r.relationship, 'child')
121
-
122
- assert.ok(m2r)
123
- assert.equal(m2r.key, m2.key)
124
- assert.equal(m2r.kind, DataModelKind)
125
- assert.equal(m2r.type, 'delete')
126
- assert.equal(m2r.impact, `The m2 data model will be deleted.`)
127
- assert.isFalse(m2r.blocking)
128
-
129
- assert.ok(e2r)
130
- assert.equal(e2r.key, e2.key)
131
- assert.equal(e2r.kind, DataEntityKind)
132
- assert.equal(e2r.type, 'delete')
133
- assert.equal(e2r.impact, `The e2 entity will be deleted.`)
134
- assert.isFalse(e2r.blocking)
135
-
136
- assert.ok(a1r)
137
- assert.equal(a1r.key, a1.key)
138
- assert.equal(a1r.kind, DataAssociationKind)
139
- assert.equal(a1r.type, 'delete')
140
- assert.equal(a1r.impact, `The a1 association will be broken because it has a target to e2.`)
141
- assert.equal(a1r.resolution, `The a1 association will be removed from e2.`)
142
- assert.isTrue(a1r.blocking)
143
- })
144
-
145
- test('returns a report for deleting a data model', ({ assert }) => {
146
- const report = analyzer.deleteAnalysis(m1.key, DataModelKind)
147
- assert.equal(report.key, m1.key)
148
- assert.equal(report.kind, DataModelKind)
149
- assert.isFalse(report.canProceed, 'operation should not be able to proceed')
150
-
151
- // Affected items:
152
- // - m1 (self)
153
- // - e1 (child)
154
- // - p1 (child of e1)
155
- // - a1 (child of e1)
156
- // - e3 (parent of e4)
157
- assert.lengthOf(report.impact, 5, 'has all items')
158
- const [m1r, e1r, e3r, p1r, a1r] = report.impact
159
-
160
- assert.ok(m1r)
161
- assert.equal(m1r.key, m1.key)
162
- assert.equal(m1r.kind, DataModelKind)
163
- assert.equal(m1r.type, 'delete')
164
- assert.equal(m1r.impact, `The m1 data model will be deleted.`)
165
- assert.isFalse(m1r.blocking)
166
-
167
- assert.ok(e1r)
168
- assert.equal(e1r.key, e1.key)
169
- assert.equal(e1r.kind, DataEntityKind)
170
- assert.equal(e1r.type, 'delete')
171
- assert.equal(e1r.impact, `The e1 entity will be deleted.`)
172
- assert.isFalse(e1r.blocking)
173
-
174
- assert.ok(p1r)
175
- assert.equal(p1r.key, p1.key)
176
- assert.equal(p1r.kind, DataPropertyKind)
177
- assert.equal(p1r.type, 'delete')
178
- assert.equal(p1r.impact, `The p1 property will be deleted.`)
179
- assert.isFalse(p1r.blocking)
180
-
181
- assert.ok(a1r)
182
- assert.equal(a1r.key, a1.key)
183
- assert.equal(a1r.kind, DataAssociationKind)
184
- assert.equal(a1r.type, 'delete')
185
- assert.equal(a1r.impact, `The a1 association will be deleted.`)
186
- assert.isFalse(a1r.blocking)
187
-
188
- assert.ok(e3r)
189
- assert.equal(e3r.key, e3.key)
190
- assert.equal(e3r.kind, DataEntityKind)
191
- assert.equal(e3r.type, 'delete')
192
- assert.equal(e3r.impact, `The "e3" entity will become an orphan because it is a child of the "e1" entity.`)
193
- assert.equal(e3r.resolution, `The "e1" entity will be removed as the parent of the "e3" entity.`)
194
- assert.isTrue(e3r.blocking)
195
- assert.equal(e3r.relationship, 'child')
196
- })
197
-
198
- test('returns a report for deleting an entity', ({ assert }) => {
199
- const report = analyzer.deleteAnalysis(e1.key, DataEntityKind)
200
- assert.equal(report.key, e1.key)
201
- assert.equal(report.kind, DataEntityKind)
202
- assert.isFalse(report.canProceed, 'operation should not be able to proceed')
203
-
204
- // Affected items:
205
- // - e1 (self)
206
- // - e3 (parent)
207
- // - p1 (child)
208
- // - a1 (child)
209
- assert.lengthOf(report.impact, 4, 'has all items')
210
- const [e1r, e3r, p1r, a1r] = report.impact
211
-
212
- assert.ok(e1r)
213
- assert.equal(e1r.key, e1.key)
214
- assert.equal(e1r.kind, DataEntityKind)
215
- assert.equal(e1r.type, 'delete')
216
- assert.equal(e1r.impact, `The e1 entity will be deleted.`)
217
- assert.isFalse(e1r.blocking)
218
-
219
- assert.ok(p1r)
220
- assert.equal(p1r.key, p1.key)
221
- assert.equal(p1r.kind, DataPropertyKind)
222
- assert.equal(p1r.type, 'delete')
223
- assert.equal(p1r.impact, `The p1 property will be deleted.`)
224
- assert.isFalse(p1r.blocking)
225
-
226
- assert.ok(a1r)
227
- assert.equal(a1r.key, a1.key)
228
- assert.equal(a1r.kind, DataAssociationKind)
229
- assert.equal(a1r.type, 'delete')
230
- assert.equal(a1r.impact, `The a1 association will be deleted.`)
231
- assert.isFalse(a1r.blocking)
232
-
233
- assert.ok(e3r)
234
- assert.equal(e3r.key, e3.key)
235
- assert.equal(e3r.kind, DataEntityKind)
236
- assert.equal(e3r.type, 'delete')
237
- assert.equal(e3r.impact, `The "e3" entity will become an orphan because it is a child of the "e1" entity.`)
238
- assert.equal(e3r.resolution, `The "e1" entity will be removed as the parent of the "e3" entity.`)
239
- assert.isTrue(e3r.blocking)
240
- assert.equal(e3r.relationship, 'child')
241
- })
242
-
243
- test('returns a report for deleting a property', ({ assert }) => {
244
- p1.getWebBinding().hidden = true
245
- const report = analyzer.deleteAnalysis(p1.key, DataPropertyKind)
246
- assert.equal(report.key, p1.key)
247
- assert.equal(report.kind, DataPropertyKind)
248
- assert.isTrue(report.canProceed, 'operation should be able to proceed')
249
-
250
- // Affected items:
251
- // - p1 (self)
252
- assert.lengthOf(report.impact, 1, 'has all items')
253
- const [p1r] = report.impact
254
-
255
- assert.ok(p1r)
256
- assert.equal(p1r.key, p1.key)
257
- assert.equal(p1r.kind, DataPropertyKind)
258
- assert.equal(p1r.type, 'delete')
259
- assert.equal(p1r.impact, `The p1 property will be deleted.`)
260
- assert.isFalse(p1r.blocking)
261
- })
262
-
263
- test('returns a report for deleting an association', ({ assert }) => {
264
- a1.getWebBinding().hidden = true
265
- const report = analyzer.deleteAnalysis(a1.key, DataAssociationKind)
266
- assert.equal(report.key, a1.key)
267
- assert.equal(report.kind, DataAssociationKind)
268
- assert.isTrue(report.canProceed, 'operation should be able to proceed')
269
-
270
- // Affected items:
271
- // - a1 (self)
272
- assert.lengthOf(report.impact, 1, 'has all items')
273
- const [a1r] = report.impact
274
-
275
- assert.ok(a1r)
276
- assert.equal(a1r.key, a1.key)
277
- assert.equal(a1r.kind, DataAssociationKind)
278
- assert.equal(a1r.type, 'delete')
279
- assert.equal(a1r.impact, `The a1 association will be deleted.`)
280
- assert.isFalse(a1r.blocking)
281
- })
282
-
283
- test('handles circular dependencies', ({ assert }) => {
284
- const report = analyzer.deleteAnalysis(e3.key, DataEntityKind)
285
- assert.equal(report.key, e3.key)
286
- assert.equal(report.kind, DataEntityKind)
287
- assert.isFalse(report.canProceed, 'operation should not be able to proceed')
288
-
289
- // Affected items:
290
- // - e3 (self)
291
- // - e2 (target of a1)
292
- // - e4 (child)
293
- assert.lengthOf(report.impact, 3, 'has all items')
294
- const [e3r, e2r, e4r] = report.impact
295
-
296
- assert.ok(e3r)
297
- assert.equal(e3r.key, e3.key)
298
- assert.equal(e3r.kind, DataEntityKind)
299
- assert.equal(e3r.type, 'delete')
300
- assert.equal(e3r.impact, `The e3 entity will be deleted.`)
301
- assert.isFalse(e3r.blocking)
302
-
303
- assert.ok(e2r)
304
- assert.equal(e2r.key, e2.key)
305
- assert.equal(e2r.kind, DataEntityKind)
306
- assert.equal(e2r.type, 'delete')
307
- assert.equal(e2r.impact, `The "e2" entity will become an orphan because it is a child of the "e3" entity.`)
308
- assert.equal(e2r.resolution, `The "e3" entity will be removed as the parent of the "e2" entity.`)
309
- assert.isTrue(e2r.blocking)
310
- assert.equal(e2r.relationship, 'child')
311
-
312
- assert.ok(e4r)
313
- assert.equal(e4r.key, e4.key)
314
- assert.equal(e4r.kind, DataEntityKind)
315
- assert.equal(e4r.type, 'delete')
316
- assert.equal(e4r.impact, `The "e4" entity will become an orphan because it is a child of the "e3" entity.`)
317
- assert.equal(e4r.resolution, `The "e3" entity will be removed as the parent of the "e4" entity.`)
318
- assert.isTrue(e4r.blocking)
319
- assert.equal(e4r.relationship, 'child')
320
- })
321
-
322
- test('deleteAnalysis() handles foreign namespaces', ({ assert }) => {
323
- const f1 = new DataNamespace()
324
- const fm1 = f1.addDataModel('fm1')
325
- const fe1 = fm1.addEntity('fe1')
326
- root.addForeign(f1)
327
- a1.addTarget(fe1)
328
-
329
- const report = analyzer.deleteAnalysis(e1.key, DataEntityKind)
330
- // console.log(JSON.stringify(report.impact, null, 2))
331
- assert.equal(report.key, e1.key)
332
- assert.equal(report.kind, DataEntityKind)
333
- assert.isFalse(report.canProceed, 'operation should not be able to proceed')
334
-
335
- // Affected items:
336
- // - e1 (self)
337
- // - e3 (parent)
338
- // - p1 (child)
339
- // - a1 (child)
340
- assert.lengthOf(report.impact, 4, 'has all items')
341
- const [e1r, e3r, p1r, a1r] = report.impact
342
-
343
- assert.ok(e1r)
344
- assert.equal(e1r.key, e1.key)
345
- assert.equal(e1r.kind, DataEntityKind)
346
- assert.equal(e1r.type, 'delete')
347
- assert.equal(e1r.impact, `The e1 entity will be deleted.`)
348
- assert.isFalse(e1r.blocking)
349
-
350
- assert.ok(p1r)
351
- assert.equal(p1r.key, p1.key)
352
- assert.equal(p1r.kind, DataPropertyKind)
353
- assert.equal(p1r.type, 'delete')
354
- assert.equal(p1r.impact, `The p1 property will be deleted.`)
355
- assert.isFalse(p1r.blocking)
356
-
357
- assert.ok(a1r)
358
- assert.equal(a1r.key, a1.key)
359
- assert.equal(a1r.kind, DataAssociationKind)
360
- assert.equal(a1r.type, 'delete')
361
- assert.equal(a1r.impact, `The a1 association will be deleted.`)
362
- assert.isFalse(a1r.blocking)
363
-
364
- assert.ok(e3r)
365
- assert.equal(e3r.key, e3.key)
366
- assert.equal(e3r.kind, DataEntityKind)
367
- assert.equal(e3r.type, 'delete')
368
- assert.equal(e3r.impact, `The "e3" entity will become an orphan because it is a child of the "e1" entity.`)
369
- assert.equal(e3r.resolution, `The "e1" entity will be removed as the parent of the "e3" entity.`)
370
- assert.isTrue(e3r.blocking)
371
- assert.equal(e3r.relationship, 'child')
372
- })
373
- })