@api-client/core 0.16.1 → 0.17.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 (29) hide show
  1. package/bin/test.ts +0 -4
  2. package/build/src/index.d.ts +72 -72
  3. package/build/src/index.d.ts.map +1 -1
  4. package/build/src/index.js +3 -3
  5. package/build/src/index.js.map +1 -1
  6. package/build/src/modeling/GraphUtils.d.ts.map +1 -1
  7. package/build/src/modeling/GraphUtils.js +16 -4
  8. package/build/src/modeling/GraphUtils.js.map +1 -1
  9. package/build/src/modeling/Semantics.d.ts +52 -0
  10. package/build/src/modeling/Semantics.d.ts.map +1 -1
  11. package/build/src/modeling/Semantics.js +206 -97
  12. package/build/src/modeling/Semantics.js.map +1 -1
  13. package/build/tsconfig.tsbuildinfo +1 -1
  14. package/data/models/example-generator-api.json +12 -12
  15. package/package.json +1 -1
  16. package/src/modeling/GraphUtils.ts +15 -4
  17. package/src/modeling/Semantics.ts +226 -101
  18. package/tests/unit/modeling/api_model.spec.ts +25 -6
  19. package/tests/unit/modeling/data_domain.spec.ts +47 -47
  20. package/tests/unit/modeling/data_domain_associations.spec.ts +41 -30
  21. package/tests/unit/modeling/data_domain_change_observers.spec.ts +30 -6
  22. package/tests/unit/modeling/data_domain_entities.spec.ts +62 -62
  23. package/tests/unit/modeling/data_domain_foreign.spec.ts +59 -59
  24. package/tests/unit/modeling/data_domain_models.spec.ts +80 -82
  25. package/tests/unit/modeling/data_domain_namespaces.spec.ts +76 -76
  26. package/tests/unit/modeling/data_domain_property.spec.ts +29 -29
  27. package/tests/unit/modeling/data_domain_serialization.spec.ts +9 -9
  28. package/tests/unit/modeling/domain_asociation_targets.spec.ts +26 -26
  29. package/tests/unit/modeling/semantics.spec.ts +73 -1
@@ -8,7 +8,7 @@ test.group('DataDomain.addNamespace()', () => {
8
8
  const namespace = dataDomain.addNamespace({ key: 'test-ns' })
9
9
  assert.instanceOf(namespace, DomainNamespace)
10
10
  assert.isTrue(dataDomain.graph.hasNode(namespace.key))
11
- })
11
+ }).tags(['@modeling', '@namespace', '@add'])
12
12
 
13
13
  test('addNamespace adds a namespace to the graph with a parent', ({ assert }) => {
14
14
  const dataDomain = new DataDomain()
@@ -17,20 +17,20 @@ test.group('DataDomain.addNamespace()', () => {
17
17
  assert.instanceOf(cNs, DomainNamespace)
18
18
  assert.isTrue(dataDomain.graph.hasNode(cNs.key))
19
19
  assert.equal(dataDomain.graph.parent(cNs.key), pNs.key)
20
- })
20
+ }).tags(['@modeling', '@namespace', '@add'])
21
21
 
22
22
  test('addNamespace throws an error if parent namespace does not exist', ({ assert }) => {
23
23
  const dataDomain = new DataDomain()
24
24
  assert.throws(() => {
25
25
  dataDomain.addNamespace({ key: 'child-ns' }, 'non-existent-parent')
26
26
  }, 'Parent namespace non-existent-parent does not exist')
27
- })
27
+ }).tags(['@modeling', '@namespace', '@add'])
28
28
 
29
29
  test('addNamespace notifies change', async ({ assert }) => {
30
30
  const dataDomain = new DataDomain()
31
31
  dataDomain.addNamespace({ key: 'test-ns' })
32
32
  await assert.dispatches(dataDomain, 'change', { timeout: 20 })
33
- })
33
+ }).tags(['@modeling', '@namespace', '@add'])
34
34
 
35
35
  test('addNamespace adds a namespace to the root of the graph', ({ assert }) => {
36
36
  const dataDomain = new DataDomain()
@@ -38,7 +38,7 @@ test.group('DataDomain.addNamespace()', () => {
38
38
  assert.instanceOf(namespace, DomainNamespace)
39
39
  assert.isTrue(dataDomain.graph.hasNode(namespace.key))
40
40
  assert.isUndefined(dataDomain.graph.parent(namespace.key))
41
- })
41
+ }).tags(['@modeling', '@namespace', '@add'])
42
42
 
43
43
  test('addNamespace adds a namespace to a parent namespace', ({ assert }) => {
44
44
  const dataDomain = new DataDomain()
@@ -47,7 +47,7 @@ test.group('DataDomain.addNamespace()', () => {
47
47
  assert.instanceOf(childNamespace, DomainNamespace)
48
48
  assert.isTrue(dataDomain.graph.hasNode(childNamespace.key))
49
49
  assert.equal(dataDomain.graph.parent(childNamespace.key), parentNamespace.key)
50
- })
50
+ }).tags(['@modeling', '@namespace', '@add'])
51
51
 
52
52
  test('addNamespace adds a namespace with default values', ({ assert }) => {
53
53
  const dataDomain = new DataDomain()
@@ -55,7 +55,7 @@ test.group('DataDomain.addNamespace()', () => {
55
55
  assert.instanceOf(namespace, DomainNamespace)
56
56
  assert.isTrue(dataDomain.graph.hasNode(namespace.key))
57
57
  assert.isUndefined(dataDomain.graph.parent(namespace.key))
58
- })
58
+ }).tags(['@modeling', '@namespace', '@add'])
59
59
 
60
60
  test('addNamespace adds to the fields list', ({ assert }) => {
61
61
  const dataDomain = new DataDomain()
@@ -64,7 +64,7 @@ test.group('DataDomain.addNamespace()', () => {
64
64
  const [field] = dataDomain.fields
65
65
  assert.equal(field.key, namespace.key)
66
66
  assert.equal(field.type, 'namespace')
67
- })
67
+ }).tags(['@modeling', '@namespace', '@add'])
68
68
  })
69
69
 
70
70
  test.group('DataDomain.removeNamespace()', () => {
@@ -73,7 +73,7 @@ test.group('DataDomain.removeNamespace()', () => {
73
73
  const namespace = root.addNamespace({ key: 'test-ns' })
74
74
  root.removeNamespace(namespace.key)
75
75
  assert.isFalse(root.graph.hasNode(namespace.key))
76
- })
76
+ }).tags(['@modeling', '@namespace', '@remove'])
77
77
 
78
78
  test('removes a nested namespace from the graph', ({ assert }) => {
79
79
  const root = new DataDomain()
@@ -82,21 +82,21 @@ test.group('DataDomain.removeNamespace()', () => {
82
82
  root.removeNamespace(n2.key)
83
83
  assert.isFalse(root.graph.hasNode(n2.key))
84
84
  assert.isTrue(root.graph.hasNode(n1.key))
85
- })
85
+ }).tags(['@modeling', '@namespace', '@remove'])
86
86
 
87
87
  test('removeNamespace throws an error if namespace does not exist', ({ assert }) => {
88
88
  const root = new DataDomain()
89
89
  assert.throws(() => {
90
90
  root.removeNamespace('non-existent-ns')
91
91
  }, 'Namespace non-existent-ns does not exist')
92
- })
92
+ }).tags(['@modeling', '@namespace', '@remove'])
93
93
 
94
94
  test('removeNamespace notifies change', async ({ assert }) => {
95
95
  const root = new DataDomain()
96
96
  const n1 = root.addNamespace({ key: 'test-ns' })
97
97
  root.removeNamespace(n1.key)
98
98
  await assert.dispatches(root, 'change', { timeout: 20 })
99
- })
99
+ }).tags(['@modeling', '@namespace', '@remove'])
100
100
 
101
101
  test('removeNamespace removes a namespace from the root of the graph', ({ assert }) => {
102
102
  const root = new DataDomain()
@@ -104,7 +104,7 @@ test.group('DataDomain.removeNamespace()', () => {
104
104
  root.removeNamespace(n1.key)
105
105
  assert.isFalse(root.graph.hasNode(n1.key))
106
106
  assert.isUndefined(root.listGraphNamespaces().next().value)
107
- })
107
+ }).tags(['@modeling', '@namespace', '@remove'])
108
108
 
109
109
  test('removeNamespace removes a namespace from a parent namespace', ({ assert }) => {
110
110
  const root = new DataDomain()
@@ -113,7 +113,7 @@ test.group('DataDomain.removeNamespace()', () => {
113
113
  root.removeNamespace(n2.key)
114
114
  assert.isFalse(root.graph.hasNode(n2.key))
115
115
  assert.equal(root.graph.parent(n2.key), undefined)
116
- })
116
+ }).tags(['@modeling', '@namespace', '@remove'])
117
117
 
118
118
  test('removeNamespace removes a namespace with children', ({ assert }) => {
119
119
  const dataDomain = new DataDomain()
@@ -124,7 +124,7 @@ test.group('DataDomain.removeNamespace()', () => {
124
124
  assert.isFalse(dataDomain.graph.hasNode(parentNamespace.key))
125
125
  assert.isFalse(dataDomain.graph.hasNode(childNamespace.key))
126
126
  assert.isFalse(dataDomain.graph.hasNode(grandChildNamespace.key))
127
- })
127
+ }).tags(['@modeling', '@namespace', '@remove'])
128
128
 
129
129
  test('removeNamespace removes a namespace with models', ({ assert }) => {
130
130
  const dataDomain = new DataDomain()
@@ -133,7 +133,7 @@ test.group('DataDomain.removeNamespace()', () => {
133
133
  dataDomain.removeNamespace(parentNamespace.key)
134
134
  assert.isFalse(dataDomain.graph.hasNode(parentNamespace.key))
135
135
  assert.isFalse(dataDomain.graph.hasNode(model.key))
136
- })
136
+ }).tags(['@modeling', '@namespace', '@remove'])
137
137
 
138
138
  test('removeNamespace removes the whole domain structure', ({ assert }) => {
139
139
  const d1 = new DataDomain()
@@ -154,7 +154,7 @@ test.group('DataDomain.removeNamespace()', () => {
154
154
  assert.isFalse(d1.graph.hasNode(a1.key))
155
155
  assert.deepEqual([...d1.graph.edges()], [])
156
156
  assert.deepEqual([...d1.graph.nodes()], [])
157
- })
157
+ }).tags(['@modeling', '@namespace', '@remove'])
158
158
 
159
159
  test('removeNamespace throws an error if key is not a namespace', ({ assert }) => {
160
160
  const dataDomain = new DataDomain()
@@ -162,14 +162,14 @@ test.group('DataDomain.removeNamespace()', () => {
162
162
  assert.throws(() => {
163
163
  dataDomain.removeNamespace(model.key)
164
164
  }, `Namespace ${model.key} not found`)
165
- })
165
+ }).tags(['@modeling', '@namespace', '@remove'])
166
166
 
167
167
  test('removeNamespace removes from fields', ({ assert }) => {
168
168
  const root = new DataDomain()
169
169
  const n1 = root.addNamespace()
170
170
  root.removeNamespace(n1.key)
171
171
  assert.deepEqual(root.fields, [])
172
- })
172
+ }).tags(['@modeling', '@namespace', '@remove'])
173
173
  })
174
174
 
175
175
  test.group('DataDomain.listNamespaces()', () => {
@@ -181,13 +181,13 @@ test.group('DataDomain.listNamespaces()', () => {
181
181
  assert.lengthOf(namespaces, 2)
182
182
  assert.deepInclude(namespaces, namespace1)
183
183
  assert.deepInclude(namespaces, namespace2)
184
- })
184
+ }).tags(['@modeling', '@namespace', '@list'])
185
185
 
186
186
  test('returns an empty array if there are no namespaces', ({ assert }) => {
187
187
  const dataDomain = new DataDomain()
188
188
  const namespaces = [...dataDomain.listNamespaces()]
189
189
  assert.lengthOf(namespaces, 0)
190
- })
190
+ }).tags(['@modeling', '@namespace', '@list'])
191
191
 
192
192
  test('returns only namespaces', ({ assert }) => {
193
193
  const dataDomain = new DataDomain()
@@ -196,14 +196,14 @@ test.group('DataDomain.listNamespaces()', () => {
196
196
  const namespaces = [...dataDomain.listNamespaces()]
197
197
  assert.lengthOf(namespaces, 1)
198
198
  assert.deepInclude(namespaces, namespace1)
199
- })
199
+ }).tags(['@modeling', '@namespace', '@list'])
200
200
 
201
201
  test('namespaces in the list are of type DomainNamespace', ({ assert }) => {
202
202
  const dataDomain = new DataDomain()
203
203
  dataDomain.addNamespace()
204
204
  const namespaces = [...dataDomain.listNamespaces()]
205
205
  assert.instanceOf(namespaces[0], DomainNamespace)
206
- })
206
+ }).tags(['@modeling', '@namespace', '@list'])
207
207
 
208
208
  test('lists namespaces in the order they were added', ({ assert }) => {
209
209
  const dataDomain = new DataDomain()
@@ -211,13 +211,13 @@ test.group('DataDomain.listNamespaces()', () => {
211
211
  const namespace2 = dataDomain.addNamespace()
212
212
  const namespaces = [...dataDomain.listNamespaces()]
213
213
  assert.deepEqual(namespaces, [namespace1, namespace2])
214
- })
214
+ }).tags(['@modeling', '@namespace', '@list'])
215
215
 
216
216
  test('lists namespaces when there are no namespaces', ({ assert }) => {
217
217
  const dataDomain = new DataDomain()
218
218
  const namespaces = [...dataDomain.listNamespaces()]
219
219
  assert.deepEqual(namespaces, [])
220
- })
220
+ }).tags(['@modeling', '@namespace', '@list'])
221
221
 
222
222
  test('lists namespaces when there are other domain elements', ({ assert }) => {
223
223
  const dataDomain = new DataDomain()
@@ -225,7 +225,7 @@ test.group('DataDomain.listNamespaces()', () => {
225
225
  dataDomain.addModel()
226
226
  const namespaces = [...dataDomain.listNamespaces()]
227
227
  assert.deepEqual(namespaces, [namespace1])
228
- })
228
+ }).tags(['@modeling', '@namespace', '@list'])
229
229
  })
230
230
 
231
231
  test.group('DataDomain.hasNamespaces()', () => {
@@ -233,31 +233,31 @@ test.group('DataDomain.hasNamespaces()', () => {
233
233
  const dataDomain = new DataDomain()
234
234
  dataDomain.addNamespace()
235
235
  assert.isTrue(dataDomain.hasNamespaces())
236
- })
236
+ }).tags(['@modeling', '@namespace', '@has'])
237
237
 
238
238
  test('returns false if there are no child namespaces', ({ assert }) => {
239
239
  const dataDomain = new DataDomain()
240
240
  assert.isFalse(dataDomain.hasNamespaces())
241
- })
241
+ }).tags(['@modeling', '@namespace', '@has'])
242
242
 
243
243
  test('returns false if there are only models', ({ assert }) => {
244
244
  const dataDomain = new DataDomain()
245
245
  dataDomain.addModel()
246
246
  assert.isFalse(dataDomain.hasNamespaces())
247
- })
247
+ }).tags(['@modeling', '@namespace', '@has'])
248
248
 
249
249
  test('returns true if there are both models and namespaces', ({ assert }) => {
250
250
  const dataDomain = new DataDomain()
251
251
  dataDomain.addNamespace()
252
252
  dataDomain.addModel()
253
253
  assert.isTrue(dataDomain.hasNamespaces())
254
- })
254
+ }).tags(['@modeling', '@namespace', '@has'])
255
255
 
256
256
  test('returns false if the data domain has no fields', ({ assert }) => {
257
257
  const dataDomain = new DataDomain()
258
258
  dataDomain.fields = []
259
259
  assert.isFalse(dataDomain.hasNamespaces())
260
- })
260
+ }).tags(['@modeling', '@namespace', '@has'])
261
261
  })
262
262
 
263
263
  test.group('DataDomain.listGraphNamespaces()', () => {
@@ -269,7 +269,7 @@ test.group('DataDomain.listGraphNamespaces()', () => {
269
269
  assert.lengthOf(namespaces, 2)
270
270
  assert.deepInclude(namespaces, n1)
271
271
  assert.deepInclude(namespaces, n2)
272
- })
272
+ }).tags(['@modeling', '@namespace', '@list'])
273
273
 
274
274
  test('lists all namespaces in the graph with a parent', ({ assert }) => {
275
275
  const root = new DataDomain()
@@ -279,19 +279,19 @@ test.group('DataDomain.listGraphNamespaces()', () => {
279
279
  const namespaces = [...root.listGraphNamespaces(n1.key)]
280
280
  assert.lengthOf(namespaces, 1)
281
281
  assert.deepInclude(namespaces, n2)
282
- })
282
+ }).tags(['@modeling', '@namespace', '@list'])
283
283
 
284
284
  test('returns an empty array if there are no namespaces', ({ assert }) => {
285
285
  const root = new DataDomain()
286
286
  const namespaces = [...root.listGraphNamespaces()]
287
287
  assert.lengthOf(namespaces, 0)
288
- })
288
+ }).tags(['@modeling', '@namespace', '@list'])
289
289
 
290
290
  test('returns an empty array if the parent does not exist', ({ assert }) => {
291
291
  const root = new DataDomain()
292
292
  const namespaces = [...root.listGraphNamespaces('non-existent-parent')]
293
293
  assert.lengthOf(namespaces, 0)
294
- })
294
+ }).tags(['@modeling', '@namespace', '@list'])
295
295
 
296
296
  test('returns only namespaces', ({ assert }) => {
297
297
  const root = new DataDomain()
@@ -300,7 +300,7 @@ test.group('DataDomain.listGraphNamespaces()', () => {
300
300
  const namespaces = [...root.listGraphNamespaces()]
301
301
  assert.lengthOf(namespaces, 1)
302
302
  assert.deepInclude(namespaces, n1)
303
- })
303
+ }).tags(['@modeling', '@namespace', '@list'])
304
304
 
305
305
  test('returns only namespaces for the given parent', ({ assert }) => {
306
306
  const root = new DataDomain()
@@ -312,14 +312,14 @@ test.group('DataDomain.listGraphNamespaces()', () => {
312
312
  const namespaces = [...root.listGraphNamespaces(n1.key)]
313
313
  assert.lengthOf(namespaces, 1)
314
314
  assert.deepInclude(namespaces, n2)
315
- })
315
+ }).tags(['@modeling', '@namespace', '@list'])
316
316
 
317
317
  test('namespaces in the list are of type DomainNamespace', ({ assert }) => {
318
318
  const dataDomain = new DataDomain()
319
319
  dataDomain.addNamespace({ key: 'ns1' })
320
320
  const namespaces = [...dataDomain.listGraphNamespaces()]
321
321
  assert.instanceOf(namespaces[0], DomainNamespace)
322
- })
322
+ }).tags(['@modeling', '@namespace', '@list'])
323
323
 
324
324
  test('lists namespaces from the root when no parent is provided', ({ assert }) => {
325
325
  const root = new DataDomain()
@@ -332,7 +332,7 @@ test.group('DataDomain.listGraphNamespaces()', () => {
332
332
  assert.deepInclude(namespaces, n1)
333
333
  assert.deepInclude(namespaces, n2)
334
334
  assert.deepInclude(namespaces, n3)
335
- })
335
+ }).tags(['@modeling', '@namespace', '@list'])
336
336
 
337
337
  test('lists namespaces from a parent namespace when provided', ({ assert }) => {
338
338
  const dataDomain = new DataDomain()
@@ -343,7 +343,7 @@ test.group('DataDomain.listGraphNamespaces()', () => {
343
343
  const namespaces = [...dataDomain.listGraphNamespaces(parentNamespace.key)]
344
344
  assert.lengthOf(namespaces, 1)
345
345
  assert.deepInclude(namespaces, namespace1)
346
- })
346
+ }).tags(['@modeling', '@namespace', '@list'])
347
347
 
348
348
  test('lists namespaces from a parent namespace when provided and the parent has no namespaces', ({ assert }) => {
349
349
  const dataDomain = new DataDomain()
@@ -351,7 +351,7 @@ test.group('DataDomain.listGraphNamespaces()', () => {
351
351
 
352
352
  const namespaces = [...dataDomain.listGraphNamespaces(parentNamespace.key)]
353
353
  assert.lengthOf(namespaces, 0)
354
- })
354
+ }).tags(['@modeling', '@namespace', '@list'])
355
355
 
356
356
  test('lists namespaces from a parent namespace when provided and the parent is not a namespace', ({ assert }) => {
357
357
  const dataDomain = new DataDomain()
@@ -359,14 +359,14 @@ test.group('DataDomain.listGraphNamespaces()', () => {
359
359
 
360
360
  const namespaces = [...dataDomain.listGraphNamespaces(model.key)]
361
361
  assert.lengthOf(namespaces, 0)
362
- })
362
+ }).tags(['@modeling', '@namespace', '@list'])
363
363
 
364
364
  test('lists namespaces from a parent namespace when provided and the parent is not in the graph', ({ assert }) => {
365
365
  const dataDomain = new DataDomain()
366
366
 
367
367
  const namespaces = [...dataDomain.listGraphNamespaces('non-existent-parent')]
368
368
  assert.lengthOf(namespaces, 0)
369
- })
369
+ }).tags(['@modeling', '@namespace', '@list'])
370
370
 
371
371
  test('lists all children for the root, excluding foreign namespaces', ({ assert }) => {
372
372
  const domain1 = new DataDomain()
@@ -380,7 +380,7 @@ test.group('DataDomain.listGraphNamespaces()', () => {
380
380
  const children = [...domain1.listGraphNamespaces()]
381
381
  assert.lengthOf(children, 1)
382
382
  assert.deepInclude(children, ns1)
383
- })
383
+ }).tags(['@modeling', '@namespace', '@list'])
384
384
 
385
385
  test('lists all children for a namespace, excluding foreign namespaces', ({ assert }) => {
386
386
  const domain1 = new DataDomain()
@@ -395,7 +395,7 @@ test.group('DataDomain.listGraphNamespaces()', () => {
395
395
  const children = [...domain1.listGraphNamespaces(ns1.key)]
396
396
  assert.lengthOf(children, 1)
397
397
  assert.deepInclude(children, ns2)
398
- })
398
+ }).tags(['@modeling', '@namespace', '@list'])
399
399
  })
400
400
 
401
401
  test.group('DataDomain.findNamespace()', () => {
@@ -404,75 +404,75 @@ test.group('DataDomain.findNamespace()', () => {
404
404
  const namespace = dataDomain.addNamespace({ key: 'test-ns' })
405
405
  const foundNamespace = dataDomain.findNamespace('test-ns')
406
406
  assert.deepEqual(foundNamespace, namespace)
407
- })
407
+ }).tags(['@modeling', '@namespace', '@find'])
408
408
 
409
409
  test('returns undefined if namespace does not exist', ({ assert }) => {
410
410
  const dataDomain = new DataDomain()
411
411
  const foundNamespace = dataDomain.findNamespace('non-existent-ns')
412
412
  assert.isUndefined(foundNamespace)
413
- })
413
+ }).tags(['@modeling', '@namespace', '@find'])
414
414
 
415
415
  test('returns undefined if key is not a namespace', ({ assert }) => {
416
416
  const dataDomain = new DataDomain()
417
417
  const model = dataDomain.addModel({ key: 'test-model' })
418
418
  const foundNamespace = dataDomain.findNamespace(model.key)
419
419
  assert.isUndefined(foundNamespace)
420
- })
420
+ }).tags(['@modeling', '@namespace', '@find'])
421
421
 
422
422
  test('returns undefined if key is undefined', ({ assert }) => {
423
423
  const dataDomain = new DataDomain()
424
424
  // @ts-expect-error For testing purposes
425
425
  const foundNamespace = dataDomain.findNamespace(undefined)
426
426
  assert.isUndefined(foundNamespace)
427
- })
427
+ }).tags(['@modeling', '@namespace', '@find'])
428
428
 
429
429
  test('returns undefined if key is null', ({ assert }) => {
430
430
  const dataDomain = new DataDomain()
431
431
  // @ts-expect-error For testing purposes
432
432
  const foundNamespace = dataDomain.findNamespace(null)
433
433
  assert.isUndefined(foundNamespace)
434
- })
434
+ }).tags(['@modeling', '@namespace', '@find'])
435
435
 
436
436
  test('returns undefined if key is an empty string', ({ assert }) => {
437
437
  const dataDomain = new DataDomain()
438
438
  const foundNamespace = dataDomain.findNamespace('')
439
439
  assert.isUndefined(foundNamespace)
440
- })
440
+ }).tags(['@modeling', '@namespace', '@find'])
441
441
 
442
442
  test('returns undefined if key is a number', ({ assert }) => {
443
443
  const dataDomain = new DataDomain()
444
444
  // @ts-expect-error For testing purposes
445
445
  const foundNamespace = dataDomain.findNamespace(123)
446
446
  assert.isUndefined(foundNamespace)
447
- })
447
+ }).tags(['@modeling', '@namespace', '@find'])
448
448
 
449
449
  test('returns undefined if key is a boolean', ({ assert }) => {
450
450
  const dataDomain = new DataDomain()
451
451
  // @ts-expect-error For testing purposes
452
452
  const foundNamespace = dataDomain.findNamespace(true)
453
453
  assert.isUndefined(foundNamespace)
454
- })
454
+ }).tags(['@modeling', '@namespace', '@find'])
455
455
 
456
456
  test('returns undefined if key is an object', ({ assert }) => {
457
457
  const dataDomain = new DataDomain()
458
458
  // @ts-expect-error For testing purposes
459
459
  const foundNamespace = dataDomain.findNamespace({})
460
460
  assert.isUndefined(foundNamespace)
461
- })
461
+ }).tags(['@modeling', '@namespace', '@find'])
462
462
 
463
463
  test('returns undefined if key is an array', ({ assert }) => {
464
464
  const dataDomain = new DataDomain()
465
465
  // @ts-expect-error For testing purposes
466
466
  const foundNamespace = dataDomain.findNamespace([])
467
467
  assert.isUndefined(foundNamespace)
468
- })
468
+ }).tags(['@modeling', '@namespace', '@find'])
469
469
 
470
470
  test('returns undefined if key is a function', ({ assert }) => {
471
471
  const dataDomain = new DataDomain()
472
472
  // @ts-expect-error For testing purposes
473
473
  const foundNamespace = dataDomain.findNamespace(() => {})
474
474
  assert.isUndefined(foundNamespace)
475
- })
475
+ }).tags(['@modeling', '@namespace', '@find'])
476
476
  })
477
477
 
478
478
  test.group('DataDomain.moveNamespace()', () => {
@@ -484,7 +484,7 @@ test.group('DataDomain.moveNamespace()', () => {
484
484
  assert.equal(dataDomain.graph.parent(namespace.key), parentNamespace.key)
485
485
  const children = [...parentNamespace.listNamespaces()]
486
486
  assert.deepEqual(children, [namespace])
487
- })
487
+ }).tags(['@modeling', '@namespace', '@move'])
488
488
 
489
489
  test('moves a namespace from a parent namespace to the root', ({ assert }) => {
490
490
  const dataDomain = new DataDomain()
@@ -493,7 +493,7 @@ test.group('DataDomain.moveNamespace()', () => {
493
493
  dataDomain.moveNamespace(namespace.key)
494
494
  assert.equal(dataDomain.graph.parent(namespace.key), undefined)
495
495
  assert.deepEqual([...parentNamespace.listNamespaces()], [])
496
- })
496
+ }).tags(['@modeling', '@namespace', '@move'])
497
497
 
498
498
  test('moves a namespace from one parent namespace to another', ({ assert }) => {
499
499
  const dataDomain = new DataDomain()
@@ -504,14 +504,14 @@ test.group('DataDomain.moveNamespace()', () => {
504
504
  assert.equal(dataDomain.graph.parent(namespace.key), parentNamespace2.key)
505
505
  assert.deepEqual([...parentNamespace1.listNamespaces()], [])
506
506
  assert.deepEqual([...parentNamespace2.listNamespaces()], [namespace])
507
- })
507
+ }).tags(['@modeling', '@namespace', '@move'])
508
508
 
509
509
  test('throws an error if namespace does not exist', ({ assert }) => {
510
510
  const dataDomain = new DataDomain()
511
511
  assert.throws(() => {
512
512
  dataDomain.moveNamespace('non-existent-ns', 'parent-ns')
513
513
  }, 'Namespace non-existent-ns does not exist')
514
- })
514
+ }).tags(['@modeling', '@namespace', '@move'])
515
515
 
516
516
  test('throws an error if parent namespace does not exist', ({ assert }) => {
517
517
  const dataDomain = new DataDomain()
@@ -519,7 +519,7 @@ test.group('DataDomain.moveNamespace()', () => {
519
519
  assert.throws(() => {
520
520
  dataDomain.moveNamespace(namespace.key, 'non-existent-parent')
521
521
  }, 'Parent namespace non-existent-parent does not exist')
522
- })
522
+ }).tags(['@modeling', '@namespace', '@move'])
523
523
 
524
524
  test('throws an error if namespace is moved to itself', ({ assert }) => {
525
525
  const dataDomain = new DataDomain()
@@ -527,7 +527,7 @@ test.group('DataDomain.moveNamespace()', () => {
527
527
  assert.throws(() => {
528
528
  dataDomain.moveNamespace(namespace.key, namespace.key)
529
529
  }, 'Cannot move a namespace to itself')
530
- })
530
+ }).tags(['@modeling', '@namespace', '@move'])
531
531
 
532
532
  test('throws an error if namespace is moved to its own child', ({ assert }) => {
533
533
  const dataDomain = new DataDomain()
@@ -536,7 +536,7 @@ test.group('DataDomain.moveNamespace()', () => {
536
536
  assert.throws(() => {
537
537
  dataDomain.moveNamespace(parentNamespace.key, namespace.key)
538
538
  }, 'Cannot move a namespace to its own child')
539
- })
539
+ }).tags(['@modeling', '@namespace', '@move'])
540
540
 
541
541
  test('throws an error if namespace is moved to a foreign domain', ({ assert }) => {
542
542
  const dataDomain1 = new DataDomain()
@@ -551,7 +551,7 @@ test.group('DataDomain.moveNamespace()', () => {
551
551
  assert.throws(() => {
552
552
  dataDomain1.moveNamespace(namespace.key, `${dataDomain2.key}:${foreignNamespace.key}`)
553
553
  }, 'Cannot move a namespace to a foreign domain')
554
- })
554
+ }).tags(['@modeling', '@namespace', '@move'])
555
555
 
556
556
  test('throws an error if namespace is moved from a foreign domain', ({ assert }) => {
557
557
  const dataDomain1 = new DataDomain()
@@ -566,7 +566,7 @@ test.group('DataDomain.moveNamespace()', () => {
566
566
  assert.throws(() => {
567
567
  dataDomain1.moveNamespace(`${dataDomain2.key}:${foreignNamespace.key}`, namespace.key)
568
568
  }, 'Cannot move a namespace from a foreign domain')
569
- })
569
+ }).tags(['@modeling', '@namespace', '@move'])
570
570
 
571
571
  test('moveNamespace notifies change', async ({ assert }) => {
572
572
  const dataDomain = new DataDomain()
@@ -574,7 +574,7 @@ test.group('DataDomain.moveNamespace()', () => {
574
574
  const parentNamespace = dataDomain.addNamespace({ key: 'parent-ns' })
575
575
  dataDomain.moveNamespace(namespace.key, parentNamespace.key)
576
576
  await assert.dispatches(dataDomain, 'change', { timeout: 20 })
577
- })
577
+ }).tags(['@modeling', '@namespace', '@move'])
578
578
 
579
579
  test('moves a namespace from the root to a parent namespace - checks parent-child relationship', ({ assert }) => {
580
580
  const dataDomain = new DataDomain()
@@ -582,7 +582,7 @@ test.group('DataDomain.moveNamespace()', () => {
582
582
  const parentNamespace = dataDomain.addNamespace({ key: 'parent-ns' })
583
583
  dataDomain.moveNamespace(namespace.key, parentNamespace.key)
584
584
  assert.isTrue(dataDomain.graph.hasParent(namespace.key, parentNamespace.key))
585
- })
585
+ }).tags(['@modeling', '@namespace', '@move'])
586
586
 
587
587
  test('moves a namespace from a parent namespace to the root - checks parent-child relationship', ({ assert }) => {
588
588
  const dataDomain = new DataDomain()
@@ -590,7 +590,7 @@ test.group('DataDomain.moveNamespace()', () => {
590
590
  const namespace = dataDomain.addNamespace({ key: 'test-ns' }, parentNamespace.key)
591
591
  dataDomain.moveNamespace(namespace.key)
592
592
  assert.isFalse(dataDomain.graph.hasParent(namespace.key, parentNamespace.key))
593
- })
593
+ }).tags(['@modeling', '@namespace', '@move'])
594
594
 
595
595
  test('moves a namespace from one parent namespace to another - checks parent-child relationship', ({ assert }) => {
596
596
  const dataDomain = new DataDomain()
@@ -600,7 +600,7 @@ test.group('DataDomain.moveNamespace()', () => {
600
600
  dataDomain.moveNamespace(namespace.key, parentNamespace2.key)
601
601
  assert.isFalse(dataDomain.graph.hasParent(namespace.key, parentNamespace1.key))
602
602
  assert.isTrue(dataDomain.graph.hasParent(namespace.key, parentNamespace2.key))
603
- })
603
+ }).tags(['@modeling', '@namespace', '@move'])
604
604
 
605
605
  test('moves a namespace from the root to a parent namespace - checks items list', ({ assert }) => {
606
606
  const dataDomain = new DataDomain()
@@ -609,7 +609,7 @@ test.group('DataDomain.moveNamespace()', () => {
609
609
  dataDomain.moveNamespace(namespace.key, parentNamespace.key)
610
610
  const parentNs = dataDomain.findNamespace(parentNamespace.key)
611
611
  assert.deepInclude([...parentNs!.listNamespaces()], namespace)
612
- })
612
+ }).tags(['@modeling', '@namespace', '@move'])
613
613
 
614
614
  test('moves a namespace from a parent namespace to the root - checks items list', ({ assert }) => {
615
615
  const dataDomain = new DataDomain()
@@ -617,7 +617,7 @@ test.group('DataDomain.moveNamespace()', () => {
617
617
  const namespace = dataDomain.addNamespace({ key: 'test-ns' }, parentNamespace.key)
618
618
  dataDomain.moveNamespace(namespace.key)
619
619
  assert.deepInclude([...dataDomain.listGraphNamespaces()], namespace)
620
- })
620
+ }).tags(['@modeling', '@namespace', '@move'])
621
621
 
622
622
  test('moves a namespace from one parent namespace to another - checks items list', ({ assert }) => {
623
623
  const dataDomain = new DataDomain()
@@ -629,7 +629,7 @@ test.group('DataDomain.moveNamespace()', () => {
629
629
  const parentNs2 = dataDomain.findNamespace(parentNamespace2.key)
630
630
  assert.notDeepInclude([...parentNs1!.listNamespaces()], namespace)
631
631
  assert.deepInclude([...parentNs2!.listNamespaces()], namespace)
632
- })
632
+ }).tags(['@modeling', '@namespace', '@move'])
633
633
 
634
634
  test('moves a namespace from the root to a parent namespace - updates fields array', ({ assert }) => {
635
635
  const dataDomain = new DataDomain()
@@ -637,7 +637,7 @@ test.group('DataDomain.moveNamespace()', () => {
637
637
  const parentNamespace = dataDomain.addNamespace({ key: 'parent-ns' })
638
638
  dataDomain.moveNamespace(namespace.key, parentNamespace.key)
639
639
  assert.notDeepInclude(dataDomain.fields, { key: namespace.key, type: 'namespace' })
640
- })
640
+ }).tags(['@modeling', '@namespace', '@move'])
641
641
 
642
642
  test('moves a namespace from a parent namespace to the root - updates fields array', ({ assert }) => {
643
643
  const dataDomain = new DataDomain()
@@ -645,7 +645,7 @@ test.group('DataDomain.moveNamespace()', () => {
645
645
  const namespace = dataDomain.addNamespace({ key: 'test-ns' }, parentNamespace.key)
646
646
  dataDomain.moveNamespace(namespace.key)
647
647
  assert.deepInclude(dataDomain.fields, { key: namespace.key, type: 'namespace' })
648
- })
648
+ }).tags(['@modeling', '@namespace', '@move'])
649
649
 
650
650
  test('moves a namespace from one parent namespace to another - updates fields array', ({ assert }) => {
651
651
  const dataDomain = new DataDomain()
@@ -654,7 +654,7 @@ test.group('DataDomain.moveNamespace()', () => {
654
654
  const namespace = dataDomain.addNamespace({ key: 'test-ns' }, parentNamespace1.key)
655
655
  dataDomain.moveNamespace(namespace.key, parentNamespace2.key)
656
656
  assert.notDeepInclude(dataDomain.fields, { key: namespace.key, type: 'namespace' })
657
- })
657
+ }).tags(['@modeling', '@namespace', '@move'])
658
658
 
659
659
  test('moves a namespace from one parent namespace to another - updates fields array when moving to root', ({
660
660
  assert,
@@ -664,5 +664,5 @@ test.group('DataDomain.moveNamespace()', () => {
664
664
  const namespace = dataDomain.addNamespace({ key: 'test-ns' }, parentNamespace1.key)
665
665
  dataDomain.moveNamespace(namespace.key)
666
666
  assert.deepInclude(dataDomain.fields, { key: namespace.key, type: 'namespace' })
667
- })
667
+ }).tags(['@modeling', '@namespace', '@move'])
668
668
  })