@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.addModel()', () => {
8
8
  const model = dataDomain.addModel({ key: 'test-model' })
9
9
  assert.instanceOf(model, DomainModel)
10
10
  assert.isTrue(dataDomain.graph.hasNode(model.key))
11
- })
11
+ }).tags(['@modeling', '@model', '@add'])
12
12
 
13
13
  test('addModel adds a model to the graph with a parent', ({ assert }) => {
14
14
  const dataDomain = new DataDomain()
@@ -17,14 +17,14 @@ test.group('DataDomain.addModel()', () => {
17
17
  assert.instanceOf(model, DomainModel)
18
18
  assert.isTrue(dataDomain.graph.hasNode(model.key))
19
19
  assert.equal(dataDomain.graph.parent(model.key), parentNamespace.key)
20
- })
20
+ }).tags(['@modeling', '@model', '@add'])
21
21
 
22
22
  test('addModel throws an error if parent namespace does not exist', ({ assert }) => {
23
23
  const dataDomain = new DataDomain()
24
24
  assert.throws(() => {
25
25
  dataDomain.addModel({ key: 'test-model' }, 'non-existent-parent')
26
26
  }, 'Parent non-existent-parent does not exist')
27
- })
27
+ }).tags(['@modeling', '@model', '@add'])
28
28
 
29
29
  test('addModel adds a model with default values', ({ assert }) => {
30
30
  const dataDomain = new DataDomain()
@@ -32,7 +32,7 @@ test.group('DataDomain.addModel()', () => {
32
32
  assert.instanceOf(model, DomainModel)
33
33
  assert.isTrue(dataDomain.graph.hasNode(model.key))
34
34
  assert.isUndefined(dataDomain.graph.parent(model.key))
35
- })
35
+ }).tags(['@modeling', '@model', '@add'])
36
36
 
37
37
  test('addModel adds a model to a parent namespace', ({ assert }) => {
38
38
  const dataDomain = new DataDomain()
@@ -41,13 +41,13 @@ test.group('DataDomain.addModel()', () => {
41
41
  assert.instanceOf(model, DomainModel)
42
42
  assert.isTrue(dataDomain.graph.hasNode(model.key))
43
43
  assert.equal(dataDomain.graph.parent(model.key), parentNamespace.key)
44
- })
44
+ }).tags(['@modeling', '@model', '@add'])
45
45
 
46
46
  test('addModel notifies change', async ({ assert }) => {
47
47
  const dataDomain = new DataDomain()
48
48
  dataDomain.addModel({ key: 'test-model' })
49
49
  await assert.dispatches(dataDomain, 'change', { timeout: 20 })
50
- })
50
+ }).tags(['@modeling', '@model', '@add'])
51
51
 
52
52
  test('addModel adds a model to the root of the graph', ({ assert }) => {
53
53
  const dataDomain = new DataDomain()
@@ -55,20 +55,20 @@ test.group('DataDomain.addModel()', () => {
55
55
  assert.instanceOf(model, DomainModel)
56
56
  assert.isTrue(dataDomain.graph.hasNode(model.key))
57
57
  assert.isUndefined(dataDomain.graph.parent(model.key))
58
- })
58
+ }).tags(['@modeling', '@model', '@add'])
59
59
 
60
60
  test('addModel adds a model to a parent namespace - checks parent-child relationship', ({ assert }) => {
61
61
  const dataDomain = new DataDomain()
62
62
  const parentNamespace = dataDomain.addNamespace({ key: 'parent-ns' })
63
63
  const model = dataDomain.addModel({ key: 'test-model' }, parentNamespace.key)
64
64
  assert.isTrue(dataDomain.graph.hasParent(model.key, parentNamespace.key))
65
- })
65
+ }).tags(['@modeling', '@model', '@add'])
66
66
 
67
67
  test('addModel adds a model to the root of the graph - checks parent-child relationship', ({ assert }) => {
68
68
  const dataDomain = new DataDomain()
69
69
  const model = dataDomain.addModel({ key: 'test-model' })
70
70
  assert.isFalse(dataDomain.graph.hasParent(model.key, dataDomain.key))
71
- })
71
+ }).tags(['@modeling', '@model', '@add'])
72
72
 
73
73
  test('addModel adds a model to a parent namespace - checks items list', ({ assert }) => {
74
74
  const dataDomain = new DataDomain()
@@ -76,13 +76,13 @@ test.group('DataDomain.addModel()', () => {
76
76
  const model = dataDomain.addModel({ key: 'test-model' }, parentNamespace.key)
77
77
  const parentNs = dataDomain.findNamespace(parentNamespace.key)
78
78
  assert.deepInclude([...parentNs!.listModels()], model)
79
- })
79
+ }).tags(['@modeling', '@model', '@add'])
80
80
 
81
81
  test('addModel adds a model to the root of the graph - checks items list', ({ assert }) => {
82
82
  const dataDomain = new DataDomain()
83
83
  const model = dataDomain.addModel({ key: 'test-model' })
84
84
  assert.deepInclude([...dataDomain.listGraphModels()], model)
85
- })
85
+ }).tags(['@modeling', '@model', '@add'])
86
86
 
87
87
  test('addModel throws an error if parent is not a namespace', ({ assert }) => {
88
88
  const dataDomain = new DataDomain()
@@ -90,7 +90,7 @@ test.group('DataDomain.addModel()', () => {
90
90
  assert.throws(() => {
91
91
  dataDomain.addModel({ key: 'child-model' }, model.key)
92
92
  }, `Parent namespace ${model.key} is not a valid namespace`)
93
- })
93
+ }).tags(['@modeling', '@model', '@add'])
94
94
 
95
95
  test('addModel adds to the fields list', ({ assert }) => {
96
96
  const root = new DataDomain()
@@ -99,7 +99,7 @@ test.group('DataDomain.addModel()', () => {
99
99
  const [field] = root.fields
100
100
  assert.equal(field.key, m1.key)
101
101
  assert.equal(field.type, 'model')
102
- })
102
+ }).tags(['@modeling', '@model', '@add'])
103
103
  })
104
104
 
105
105
  test.group('DataDomain.removeModel()', () => {
@@ -108,21 +108,21 @@ test.group('DataDomain.removeModel()', () => {
108
108
  const model = dataDomain.addModel({ key: 'test-model' })
109
109
  dataDomain.removeModel(model.key)
110
110
  assert.isFalse(dataDomain.graph.hasNode(model.key))
111
- })
111
+ }).tags(['@modeling', '@model', '@remove'])
112
112
 
113
113
  test('removeModel throws an error if model does not exist', ({ assert }) => {
114
114
  const dataDomain = new DataDomain()
115
115
  assert.throws(() => {
116
116
  dataDomain.removeModel('non-existent-model')
117
117
  }, 'Data model non-existent-model does not exist')
118
- })
118
+ }).tags(['@modeling', '@model', '@remove'])
119
119
 
120
120
  test('removeModel notifies change', async ({ assert }) => {
121
121
  const dataDomain = new DataDomain()
122
122
  const model = dataDomain.addModel({ key: 'test-model' })
123
123
  dataDomain.removeModel(model.key)
124
124
  await assert.dispatches(dataDomain, 'change', { timeout: 20 })
125
- })
125
+ }).tags(['@modeling', '@model', '@remove'])
126
126
 
127
127
  test('removeModel removes a model from the root of the graph', ({ assert }) => {
128
128
  const dataDomain = new DataDomain()
@@ -130,7 +130,7 @@ test.group('DataDomain.removeModel()', () => {
130
130
  dataDomain.removeModel(model.key)
131
131
  assert.isFalse(dataDomain.graph.hasNode(model.key))
132
132
  assert.isUndefined(dataDomain.graph.parent(model.key))
133
- })
133
+ }).tags(['@modeling', '@model', '@remove'])
134
134
 
135
135
  test('removeModel removes a model from a parent namespace', ({ assert }) => {
136
136
  const dataDomain = new DataDomain()
@@ -139,7 +139,7 @@ test.group('DataDomain.removeModel()', () => {
139
139
  dataDomain.removeModel(model.key)
140
140
  assert.isFalse(dataDomain.graph.hasNode(model.key))
141
141
  assert.equal(dataDomain.graph.parent(model.key), undefined)
142
- })
142
+ }).tags(['@modeling', '@model', '@remove'])
143
143
 
144
144
  test('removeModel removes a model with entities', ({ assert }) => {
145
145
  const dataDomain = new DataDomain()
@@ -148,7 +148,7 @@ test.group('DataDomain.removeModel()', () => {
148
148
  dataDomain.removeModel(model.key)
149
149
  assert.isFalse(dataDomain.graph.hasNode(model.key))
150
150
  assert.isFalse(dataDomain.graph.hasNode(entity.key))
151
- })
151
+ }).tags(['@modeling', '@model', '@remove'])
152
152
 
153
153
  test('removeModel removes a model from a parent namespace - checks parent-child relationship', ({ assert }) => {
154
154
  const dataDomain = new DataDomain()
@@ -156,14 +156,14 @@ test.group('DataDomain.removeModel()', () => {
156
156
  const model = dataDomain.addModel({ key: 'test-model' }, parentNamespace.key)
157
157
  dataDomain.removeModel(model.key)
158
158
  assert.isFalse(dataDomain.graph.hasParent(model.key, parentNamespace.key))
159
- })
159
+ }).tags(['@modeling', '@model', '@remove'])
160
160
 
161
161
  test('removeModel removes a model from the root of the graph - checks parent-child relationship', ({ assert }) => {
162
162
  const dataDomain = new DataDomain()
163
163
  const model = dataDomain.addModel({ key: 'test-model' })
164
164
  dataDomain.removeModel(model.key)
165
165
  assert.isFalse(dataDomain.graph.hasParent(model.key, dataDomain.key))
166
- })
166
+ }).tags(['@modeling', '@model', '@remove'])
167
167
 
168
168
  test('removeModel removes a model from a parent namespace - checks items list', ({ assert }) => {
169
169
  const dataDomain = new DataDomain()
@@ -172,14 +172,14 @@ test.group('DataDomain.removeModel()', () => {
172
172
  dataDomain.removeModel(model.key)
173
173
  const parentNs = dataDomain.findNamespace(parentNamespace.key)
174
174
  assert.notDeepInclude([...parentNs!.listModels()], model)
175
- })
175
+ }).tags(['@modeling', '@model', '@remove'])
176
176
 
177
177
  test('removeModel removes a model from the root of the graph - checks items list', ({ assert }) => {
178
178
  const dataDomain = new DataDomain()
179
179
  const model = dataDomain.addModel({ key: 'test-model' })
180
180
  dataDomain.removeModel(model.key)
181
181
  assert.notDeepInclude([...dataDomain.listGraphModels()], model)
182
- })
182
+ }).tags(['@modeling', '@model', '@remove'])
183
183
 
184
184
  test('removeModel throws an error if key is not a model', ({ assert }) => {
185
185
  const dataDomain = new DataDomain()
@@ -187,14 +187,14 @@ test.group('DataDomain.removeModel()', () => {
187
187
  assert.throws(() => {
188
188
  dataDomain.removeModel(namespace.key)
189
189
  }, `Data model ${namespace.key} not found`)
190
- })
190
+ }).tags(['@modeling', '@model', '@remove'])
191
191
 
192
192
  test('removeModel removes from fields', ({ assert }) => {
193
193
  const root = new DataDomain()
194
194
  const m1 = root.addModel()
195
195
  root.removeModel(m1.key)
196
196
  assert.deepEqual(root.fields, [])
197
- })
197
+ }).tags(['@modeling', '@model', '@remove'])
198
198
  })
199
199
 
200
200
  test.group('DataDomain.listModels()', () => {
@@ -206,13 +206,13 @@ test.group('DataDomain.listModels()', () => {
206
206
  assert.lengthOf(models, 2)
207
207
  assert.deepInclude(models, model1)
208
208
  assert.deepInclude(models, model2)
209
- })
209
+ }).tags(['@modeling', '@model', '@list'])
210
210
 
211
211
  test('returns an empty array if there are no models', ({ assert }) => {
212
212
  const dataDomain = new DataDomain()
213
213
  const models = [...dataDomain.listModels()]
214
214
  assert.lengthOf(models, 0)
215
- })
215
+ }).tags(['@modeling', '@model', '@list'])
216
216
 
217
217
  test('returns only models', ({ assert }) => {
218
218
  const dataDomain = new DataDomain()
@@ -221,14 +221,14 @@ test.group('DataDomain.listModels()', () => {
221
221
  const models = [...dataDomain.listModels()]
222
222
  assert.lengthOf(models, 1)
223
223
  assert.deepInclude(models, model1)
224
- })
224
+ }).tags(['@modeling', '@model', '@list'])
225
225
 
226
226
  test('models in the list are of type DomainModel', ({ assert }) => {
227
227
  const dataDomain = new DataDomain()
228
228
  dataDomain.addModel()
229
229
  const models = [...dataDomain.listModels()]
230
230
  assert.instanceOf(models[0], DomainModel)
231
- })
231
+ }).tags(['@modeling', '@model', '@list'])
232
232
 
233
233
  test('lists models in the order they were added', ({ assert }) => {
234
234
  const dataDomain = new DataDomain()
@@ -236,13 +236,13 @@ test.group('DataDomain.listModels()', () => {
236
236
  const model2 = dataDomain.addModel()
237
237
  const models = [...dataDomain.listModels()]
238
238
  assert.deepEqual(models, [model1, model2])
239
- })
239
+ }).tags(['@modeling', '@model', '@list'])
240
240
 
241
241
  test('lists models when there are no models', ({ assert }) => {
242
242
  const dataDomain = new DataDomain()
243
243
  const models = [...dataDomain.listModels()]
244
244
  assert.deepEqual(models, [])
245
- })
245
+ }).tags(['@modeling', '@model', '@list'])
246
246
 
247
247
  test('lists models when there are other domain elements', ({ assert }) => {
248
248
  const dataDomain = new DataDomain()
@@ -250,7 +250,7 @@ test.group('DataDomain.listModels()', () => {
250
250
  dataDomain.addNamespace()
251
251
  const models = [...dataDomain.listModels()]
252
252
  assert.deepEqual(models, [model1])
253
- })
253
+ }).tags(['@modeling', '@model', '@list'])
254
254
  })
255
255
 
256
256
  test.group('DataDomain.hasModels()', () => {
@@ -258,31 +258,31 @@ test.group('DataDomain.hasModels()', () => {
258
258
  const dataDomain = new DataDomain()
259
259
  dataDomain.addModel()
260
260
  assert.isTrue(dataDomain.hasModels())
261
- })
261
+ }).tags(['@modeling', '@model', '@has'])
262
262
 
263
263
  test('returns false if there are no child models', ({ assert }) => {
264
264
  const dataDomain = new DataDomain()
265
265
  assert.isFalse(dataDomain.hasModels())
266
- })
266
+ }).tags(['@modeling', '@model', '@has'])
267
267
 
268
268
  test('returns false if there are only namespaces', ({ assert }) => {
269
269
  const dataDomain = new DataDomain()
270
270
  dataDomain.addNamespace()
271
271
  assert.isFalse(dataDomain.hasModels())
272
- })
272
+ }).tags(['@modeling', '@model', '@has'])
273
273
 
274
274
  test('returns true if there are both models and namespaces', ({ assert }) => {
275
275
  const dataDomain = new DataDomain()
276
276
  dataDomain.addModel()
277
277
  dataDomain.addNamespace()
278
278
  assert.isTrue(dataDomain.hasModels())
279
- })
279
+ }).tags(['@modeling', '@model', '@has'])
280
280
 
281
281
  test('returns false if the data domain has no fields', ({ assert }) => {
282
282
  const dataDomain = new DataDomain()
283
283
  dataDomain.fields = []
284
284
  assert.isFalse(dataDomain.hasModels())
285
- })
285
+ }).tags(['@modeling', '@model', '@has'])
286
286
  })
287
287
 
288
288
  test.group('DataDomain.listGraphModels()', () => {
@@ -294,7 +294,7 @@ test.group('DataDomain.listGraphModels()', () => {
294
294
  assert.lengthOf(models, 2)
295
295
  assert.deepInclude(models, model1)
296
296
  assert.deepInclude(models, model2)
297
- })
297
+ }).tags(['@modeling', '@model', '@list'])
298
298
 
299
299
  test('lists all models in the graph with a parent', ({ assert }) => {
300
300
  const dataDomain = new DataDomain()
@@ -304,19 +304,19 @@ test.group('DataDomain.listGraphModels()', () => {
304
304
  const models = [...dataDomain.listGraphModels(parentNamespace.key)]
305
305
  assert.lengthOf(models, 1)
306
306
  assert.deepInclude(models, model1)
307
- })
307
+ }).tags(['@modeling', '@model', '@list'])
308
308
 
309
309
  test('returns an empty array if there are no models', ({ assert }) => {
310
310
  const dataDomain = new DataDomain()
311
311
  const models = [...dataDomain.listGraphModels()]
312
312
  assert.lengthOf(models, 0)
313
- })
313
+ }).tags(['@modeling', '@model', '@list'])
314
314
 
315
315
  test('returns an empty array if the parent does not exist', ({ assert }) => {
316
316
  const dataDomain = new DataDomain()
317
317
  const models = [...dataDomain.listGraphModels('non-existent-parent')]
318
318
  assert.lengthOf(models, 0)
319
- })
319
+ }).tags(['@modeling', '@model', '@list'])
320
320
 
321
321
  test('returns only models', ({ assert }) => {
322
322
  const dataDomain = new DataDomain()
@@ -325,7 +325,7 @@ test.group('DataDomain.listGraphModels()', () => {
325
325
  const models = [...dataDomain.listGraphModels()]
326
326
  assert.lengthOf(models, 1)
327
327
  assert.deepInclude(models, model1)
328
- })
328
+ }).tags(['@modeling', '@model', '@list'])
329
329
 
330
330
  test('returns only models for the given parent', ({ assert }) => {
331
331
  const dataDomain = new DataDomain()
@@ -337,14 +337,14 @@ test.group('DataDomain.listGraphModels()', () => {
337
337
  const models = [...dataDomain.listGraphModels(parentNamespace.key)]
338
338
  assert.lengthOf(models, 1)
339
339
  assert.deepInclude(models, model1)
340
- })
340
+ }).tags(['@modeling', '@model', '@list'])
341
341
 
342
342
  test('models in the list are of type DomainModel', ({ assert }) => {
343
343
  const dataDomain = new DataDomain()
344
344
  dataDomain.addModel({ key: 'model1' })
345
345
  const models = [...dataDomain.listGraphModels()]
346
346
  assert.instanceOf(models[0], DomainModel)
347
- })
347
+ }).tags(['@modeling', '@model', '@list'])
348
348
 
349
349
  test('lists models from the root when no parent is provided', ({ assert }) => {
350
350
  const dataDomain = new DataDomain()
@@ -357,7 +357,7 @@ test.group('DataDomain.listGraphModels()', () => {
357
357
  assert.lengthOf(models, 2)
358
358
  assert.deepInclude(models, model1)
359
359
  assert.deepInclude(models, model2)
360
- })
360
+ }).tags(['@modeling', '@model', '@list'])
361
361
 
362
362
  test('lists models from a parent namespace', ({ assert }) => {
363
363
  const dataDomain = new DataDomain()
@@ -368,7 +368,7 @@ test.group('DataDomain.listGraphModels()', () => {
368
368
  const models = [...dataDomain.listGraphModels(parentNamespace.key)]
369
369
  assert.lengthOf(models, 1)
370
370
  assert.deepInclude(models, model1)
371
- })
371
+ }).tags(['@modeling', '@model', '@list'])
372
372
 
373
373
  test('lists models from a parent namespace and the parent has no models', ({ assert }) => {
374
374
  const dataDomain = new DataDomain()
@@ -376,7 +376,7 @@ test.group('DataDomain.listGraphModels()', () => {
376
376
 
377
377
  const models = [...dataDomain.listGraphModels(parentNamespace.key)]
378
378
  assert.lengthOf(models, 0)
379
- })
379
+ }).tags(['@modeling', '@model', '@list'])
380
380
 
381
381
  test('lists models from a parent namespace and the parent is not a namespace', ({ assert }) => {
382
382
  const dataDomain = new DataDomain()
@@ -384,14 +384,14 @@ test.group('DataDomain.listGraphModels()', () => {
384
384
 
385
385
  const models = [...dataDomain.listGraphModels(model.key)]
386
386
  assert.lengthOf(models, 0)
387
- })
387
+ }).tags(['@modeling', '@model', '@list'])
388
388
 
389
389
  test('lists models from a parent namespace and the parent is not in the graph', ({ assert }) => {
390
390
  const dataDomain = new DataDomain()
391
391
 
392
392
  const models = [...dataDomain.listGraphModels('non-existent-parent')]
393
393
  assert.lengthOf(models, 0)
394
- })
394
+ }).tags(['@modeling', '@model', '@list'])
395
395
 
396
396
  test('lists all children for the root, excluding foreign models', ({ assert }) => {
397
397
  const domain1 = new DataDomain()
@@ -405,22 +405,20 @@ test.group('DataDomain.listGraphModels()', () => {
405
405
  const children = [...domain1.listGraphModels()]
406
406
  assert.lengthOf(children, 1)
407
407
  assert.deepInclude(children, m1)
408
- })
408
+ }).tags(['@modeling', '@model', '@list'])
409
409
 
410
410
  test('lists all children for a namespace, excluding foreign models', ({ assert }) => {
411
411
  const domain1 = new DataDomain()
412
412
  const ns1 = domain1.addNamespace({ key: 'ns1' })
413
413
  const m1 = domain1.addModel({ key: 'model1' }, ns1.key)
414
-
415
414
  const domain2 = new DataDomain()
416
415
  domain2.addModel({ key: 'model2' })
417
416
  domain2.info.version = '1.0.0'
418
417
  domain1.registerForeignDomain(domain2)
419
-
420
418
  const children = [...domain1.listGraphModels(ns1.key)]
421
419
  assert.lengthOf(children, 1)
422
420
  assert.deepInclude(children, m1)
423
- })
421
+ }).tags(['@modeling', '@model', '@list'])
424
422
  })
425
423
 
426
424
  test.group('DataDomain.findModel()', () => {
@@ -429,75 +427,75 @@ test.group('DataDomain.findModel()', () => {
429
427
  const model = dataDomain.addModel({ key: 'test-model' })
430
428
  const foundModel = dataDomain.findModel('test-model')
431
429
  assert.deepEqual(foundModel, model)
432
- })
430
+ }).tags(['@modeling', '@model', '@find'])
433
431
 
434
432
  test('returns undefined if model does not exist', ({ assert }) => {
435
433
  const dataDomain = new DataDomain()
436
434
  const foundModel = dataDomain.findModel('non-existent-model')
437
435
  assert.isUndefined(foundModel)
438
- })
436
+ }).tags(['@modeling', '@model', '@find'])
439
437
 
440
438
  test('returns undefined if key is not a model', ({ assert }) => {
441
439
  const dataDomain = new DataDomain()
442
440
  const namespace = dataDomain.addNamespace({ key: 'test-ns' })
443
441
  const foundModel = dataDomain.findModel(namespace.key)
444
442
  assert.isUndefined(foundModel)
445
- })
443
+ }).tags(['@modeling', '@model', '@find'])
446
444
 
447
445
  test('returns undefined if key is undefined', ({ assert }) => {
448
446
  const dataDomain = new DataDomain()
449
447
  // @ts-expect-error For testing purposes
450
448
  const foundModel = dataDomain.findModel(undefined)
451
449
  assert.isUndefined(foundModel)
452
- })
450
+ }).tags(['@modeling', '@model', '@find'])
453
451
 
454
452
  test('returns undefined if key is null', ({ assert }) => {
455
453
  const dataDomain = new DataDomain()
456
454
  // @ts-expect-error For testing purposes
457
455
  const foundModel = dataDomain.findModel(null)
458
456
  assert.isUndefined(foundModel)
459
- })
457
+ }).tags(['@modeling', '@model', '@find'])
460
458
 
461
459
  test('returns undefined if key is an empty string', ({ assert }) => {
462
460
  const dataDomain = new DataDomain()
463
461
  const foundModel = dataDomain.findModel('')
464
462
  assert.isUndefined(foundModel)
465
- })
463
+ }).tags(['@modeling', '@model', '@find'])
466
464
 
467
465
  test('returns undefined if key is a number', ({ assert }) => {
468
466
  const dataDomain = new DataDomain()
469
467
  // @ts-expect-error For testing purposes
470
468
  const foundModel = dataDomain.findModel(123)
471
469
  assert.isUndefined(foundModel)
472
- })
470
+ }).tags(['@modeling', '@model', '@find'])
473
471
 
474
472
  test('returns undefined if key is a boolean', ({ assert }) => {
475
473
  const dataDomain = new DataDomain()
476
474
  // @ts-expect-error For testing purposes
477
475
  const foundModel = dataDomain.findModel(true)
478
476
  assert.isUndefined(foundModel)
479
- })
477
+ }).tags(['@modeling', '@model', '@find'])
480
478
 
481
479
  test('returns undefined if key is an object', ({ assert }) => {
482
480
  const dataDomain = new DataDomain()
483
481
  // @ts-expect-error For testing purposes
484
482
  const foundModel = dataDomain.findModel({})
485
483
  assert.isUndefined(foundModel)
486
- })
484
+ }).tags(['@modeling', '@model', '@find'])
487
485
 
488
486
  test('returns undefined if key is an array', ({ assert }) => {
489
487
  const dataDomain = new DataDomain()
490
488
  // @ts-expect-error For testing purposes
491
489
  const foundModel = dataDomain.findModel([])
492
490
  assert.isUndefined(foundModel)
493
- })
491
+ }).tags(['@modeling', '@model', '@find'])
494
492
 
495
493
  test('returns undefined if key is a function', ({ assert }) => {
496
494
  const dataDomain = new DataDomain()
497
495
  // @ts-expect-error For testing purposes
498
496
  const foundModel = dataDomain.findModel(() => {})
499
497
  assert.isUndefined(foundModel)
500
- })
498
+ }).tags(['@modeling', '@model', '@find'])
501
499
  })
502
500
 
503
501
  test.group('DataDomain.moveModel()', () => {
@@ -507,7 +505,7 @@ test.group('DataDomain.moveModel()', () => {
507
505
  const parentNamespace = dataDomain.addNamespace({ key: 'parent-ns' })
508
506
  dataDomain.moveModel(model.key, parentNamespace.key)
509
507
  assert.equal(dataDomain.graph.parent(model.key), parentNamespace.key)
510
- })
508
+ }).tags(['@modeling', '@model', '@move'])
511
509
 
512
510
  test('moves a model from a parent namespace to the root', ({ assert }) => {
513
511
  const dataDomain = new DataDomain()
@@ -515,7 +513,7 @@ test.group('DataDomain.moveModel()', () => {
515
513
  const model = dataDomain.addModel({ key: 'test-model' }, parentNamespace.key)
516
514
  dataDomain.moveModel(model.key)
517
515
  assert.equal(dataDomain.graph.parent(model.key), undefined)
518
- })
516
+ }).tags(['@modeling', '@model', '@move'])
519
517
 
520
518
  test('moves a model from one parent namespace to another', ({ assert }) => {
521
519
  const dataDomain = new DataDomain()
@@ -524,14 +522,14 @@ test.group('DataDomain.moveModel()', () => {
524
522
  const model = dataDomain.addModel({ key: 'test-model' }, parentNamespace1.key)
525
523
  dataDomain.moveModel(model.key, parentNamespace2.key)
526
524
  assert.equal(dataDomain.graph.parent(model.key), parentNamespace2.key)
527
- })
525
+ }).tags(['@modeling', '@model', '@move'])
528
526
 
529
527
  test('throws an error if model does not exist', ({ assert }) => {
530
528
  const dataDomain = new DataDomain()
531
529
  assert.throws(() => {
532
530
  dataDomain.moveModel('non-existent-model', 'parent-ns')
533
531
  }, 'Data model non-existent-model does not exist')
534
- })
532
+ }).tags(['@modeling', '@model', '@move'])
535
533
 
536
534
  test('throws an error if parent namespace does not exist', ({ assert }) => {
537
535
  const dataDomain = new DataDomain()
@@ -539,7 +537,7 @@ test.group('DataDomain.moveModel()', () => {
539
537
  assert.throws(() => {
540
538
  dataDomain.moveModel(model.key, 'non-existent-parent')
541
539
  }, 'Parent namespace non-existent-parent does not exist')
542
- })
540
+ }).tags(['@modeling', '@model', '@move'])
543
541
 
544
542
  test('throws an error if model is moved to itself', ({ assert }) => {
545
543
  const dataDomain = new DataDomain()
@@ -547,7 +545,7 @@ test.group('DataDomain.moveModel()', () => {
547
545
  assert.throws(() => {
548
546
  dataDomain.moveModel(model.key, model.key)
549
547
  }, 'Parent namespace test-model does not exist')
550
- })
548
+ }).tags(['@modeling', '@model', '@move'])
551
549
 
552
550
  test('moveModel notifies change', async ({ assert }) => {
553
551
  const dataDomain = new DataDomain()
@@ -555,7 +553,7 @@ test.group('DataDomain.moveModel()', () => {
555
553
  const parentNamespace = dataDomain.addNamespace({ key: 'parent-ns' })
556
554
  dataDomain.moveModel(model.key, parentNamespace.key)
557
555
  await assert.dispatches(dataDomain, 'change', { timeout: 20 })
558
- })
556
+ }).tags(['@modeling', '@model', '@move'])
559
557
 
560
558
  test('moves a model from the root to a parent namespace - checks parent-child relationship', ({ assert }) => {
561
559
  const dataDomain = new DataDomain()
@@ -563,7 +561,7 @@ test.group('DataDomain.moveModel()', () => {
563
561
  const parentNamespace = dataDomain.addNamespace({ key: 'parent-ns' })
564
562
  dataDomain.moveModel(model.key, parentNamespace.key)
565
563
  assert.isTrue(dataDomain.graph.hasParent(model.key, parentNamespace.key))
566
- })
564
+ }).tags(['@modeling', '@model', '@move'])
567
565
 
568
566
  test('moves a model from a parent namespace to the root - checks parent-child relationship', ({ assert }) => {
569
567
  const dataDomain = new DataDomain()
@@ -571,7 +569,7 @@ test.group('DataDomain.moveModel()', () => {
571
569
  const model = dataDomain.addModel({ key: 'test-model' }, parentNamespace.key)
572
570
  dataDomain.moveModel(model.key)
573
571
  assert.isFalse(dataDomain.graph.hasParent(model.key, parentNamespace.key))
574
- })
572
+ }).tags(['@modeling', '@model', '@move'])
575
573
 
576
574
  test('moves a model from one parent namespace to another - checks parent-child relationship', ({ assert }) => {
577
575
  const dataDomain = new DataDomain()
@@ -581,7 +579,7 @@ test.group('DataDomain.moveModel()', () => {
581
579
  dataDomain.moveModel(model.key, parentNamespace2.key)
582
580
  assert.isFalse(dataDomain.graph.hasParent(model.key, parentNamespace1.key))
583
581
  assert.isTrue(dataDomain.graph.hasParent(model.key, parentNamespace2.key))
584
- })
582
+ }).tags(['@modeling', '@model', '@move'])
585
583
 
586
584
  test('moves a model from the root to a parent namespace - checks items list', ({ assert }) => {
587
585
  const dataDomain = new DataDomain()
@@ -590,7 +588,7 @@ test.group('DataDomain.moveModel()', () => {
590
588
  dataDomain.moveModel(model.key, parentNamespace.key)
591
589
  const parentNs = dataDomain.findNamespace(parentNamespace.key)
592
590
  assert.deepInclude([...parentNs!.listModels()], model)
593
- })
591
+ }).tags(['@modeling', '@model', '@move'])
594
592
 
595
593
  test('moves a model from a parent namespace to the root - checks items list', ({ assert }) => {
596
594
  const dataDomain = new DataDomain()
@@ -598,7 +596,7 @@ test.group('DataDomain.moveModel()', () => {
598
596
  const model = dataDomain.addModel({ key: 'test-model' }, parentNamespace.key)
599
597
  dataDomain.moveModel(model.key)
600
598
  assert.deepInclude([...dataDomain.listGraphModels()], model)
601
- })
599
+ }).tags(['@modeling', '@model', '@move'])
602
600
 
603
601
  test('moves a model from one parent namespace to another - checks items list', ({ assert }) => {
604
602
  const dataDomain = new DataDomain()
@@ -610,7 +608,7 @@ test.group('DataDomain.moveModel()', () => {
610
608
  const parentNs2 = dataDomain.findNamespace(parentNamespace2.key)
611
609
  assert.notDeepInclude([...parentNs1!.listModels()], model)
612
610
  assert.deepInclude([...parentNs2!.listModels()], model)
613
- })
611
+ }).tags(['@modeling', '@model', '@move'])
614
612
 
615
613
  test('throws an error if the target is not a namespace', ({ assert }) => {
616
614
  const dataDomain = new DataDomain()
@@ -619,7 +617,7 @@ test.group('DataDomain.moveModel()', () => {
619
617
  assert.throws(() => {
620
618
  dataDomain.moveModel(model1.key, model2.key)
621
619
  }, 'Parent namespace other-model does not exist')
622
- })
620
+ }).tags(['@modeling', '@model', '@move'])
623
621
 
624
622
  test('moves a model from the root to a parent namespace - updates fields array', ({ assert }) => {
625
623
  const dataDomain = new DataDomain()
@@ -627,7 +625,7 @@ test.group('DataDomain.moveModel()', () => {
627
625
  const parentNamespace = dataDomain.addNamespace({ key: 'parent-ns' })
628
626
  dataDomain.moveModel(model.key, parentNamespace.key)
629
627
  assert.notDeepInclude(dataDomain.fields, { key: model.key, type: 'model' })
630
- })
628
+ }).tags(['@modeling', '@model', '@move'])
631
629
 
632
630
  test('moves a model from a parent namespace to the root - updates fields array', ({ assert }) => {
633
631
  const dataDomain = new DataDomain()
@@ -635,7 +633,7 @@ test.group('DataDomain.moveModel()', () => {
635
633
  const model = dataDomain.addModel({ key: 'test-model' }, parentNamespace.key)
636
634
  dataDomain.moveModel(model.key)
637
635
  assert.deepInclude(dataDomain.fields, { key: model.key, type: 'model' })
638
- })
636
+ }).tags(['@modeling', '@model', '@move'])
639
637
 
640
638
  test('moves a model from one parent namespace to another - updates fields array', ({ assert }) => {
641
639
  const dataDomain = new DataDomain()
@@ -644,7 +642,7 @@ test.group('DataDomain.moveModel()', () => {
644
642
  const model = dataDomain.addModel({ key: 'test-model' }, parentNamespace1.key)
645
643
  dataDomain.moveModel(model.key, parentNamespace2.key)
646
644
  assert.notDeepInclude(dataDomain.fields, { key: model.key, type: 'model' })
647
- })
645
+ }).tags(['@modeling', '@model', '@move'])
648
646
 
649
647
  test('moves a model from one parent namespace to another - updates fields array when moving to root', ({
650
648
  assert,
@@ -654,5 +652,5 @@ test.group('DataDomain.moveModel()', () => {
654
652
  const model = dataDomain.addModel({ key: 'test-model' }, parentNamespace1.key)
655
653
  dataDomain.moveModel(model.key)
656
654
  assert.deepInclude(dataDomain.fields, { key: model.key, type: 'model' })
657
- })
655
+ }).tags(['@modeling', '@model', '@move'])
658
656
  })