@api-client/core 0.17.0 → 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.
- package/bin/test.ts +0 -4
- package/build/src/index.d.ts +72 -72
- package/build/src/index.d.ts.map +1 -1
- package/build/src/index.js +3 -3
- package/build/src/index.js.map +1 -1
- package/build/src/modeling/GraphUtils.d.ts.map +1 -1
- package/build/src/modeling/GraphUtils.js +16 -4
- package/build/src/modeling/GraphUtils.js.map +1 -1
- package/build/tsconfig.tsbuildinfo +1 -1
- package/data/models/example-generator-api.json +15 -15
- package/package.json +1 -1
- package/src/modeling/GraphUtils.ts +15 -4
- package/tests/unit/modeling/api_model.spec.ts +25 -6
- package/tests/unit/modeling/data_domain.spec.ts +47 -47
- package/tests/unit/modeling/data_domain_associations.spec.ts +41 -30
- package/tests/unit/modeling/data_domain_change_observers.spec.ts +30 -6
- package/tests/unit/modeling/data_domain_entities.spec.ts +62 -62
- package/tests/unit/modeling/data_domain_foreign.spec.ts +59 -59
- package/tests/unit/modeling/data_domain_models.spec.ts +80 -82
- package/tests/unit/modeling/data_domain_namespaces.spec.ts +76 -76
- package/tests/unit/modeling/data_domain_property.spec.ts +29 -29
- package/tests/unit/modeling/data_domain_serialization.spec.ts +9 -9
- package/tests/unit/modeling/domain_asociation_targets.spec.ts +26 -26
|
@@ -42062,16 +42062,16 @@
|
|
|
42062
42062
|
"@id": "#209"
|
|
42063
42063
|
},
|
|
42064
42064
|
{
|
|
42065
|
-
"@id": "#
|
|
42065
|
+
"@id": "#194"
|
|
42066
42066
|
},
|
|
42067
42067
|
{
|
|
42068
42068
|
"@id": "#191"
|
|
42069
42069
|
},
|
|
42070
42070
|
{
|
|
42071
|
-
"@id": "#
|
|
42071
|
+
"@id": "#197"
|
|
42072
42072
|
},
|
|
42073
42073
|
{
|
|
42074
|
-
"@id": "#
|
|
42074
|
+
"@id": "#200"
|
|
42075
42075
|
},
|
|
42076
42076
|
{
|
|
42077
42077
|
"@id": "#203"
|
|
@@ -42816,10 +42816,10 @@
|
|
|
42816
42816
|
"@id": "#213"
|
|
42817
42817
|
},
|
|
42818
42818
|
{
|
|
42819
|
-
"@id": "#
|
|
42819
|
+
"@id": "#219"
|
|
42820
42820
|
},
|
|
42821
42821
|
{
|
|
42822
|
-
"@id": "#
|
|
42822
|
+
"@id": "#216"
|
|
42823
42823
|
}
|
|
42824
42824
|
],
|
|
42825
42825
|
"doc:root": false,
|
|
@@ -43457,7 +43457,7 @@
|
|
|
43457
43457
|
"doc:ExternalDomainElement",
|
|
43458
43458
|
"doc:DomainElement"
|
|
43459
43459
|
],
|
|
43460
|
-
"doc:raw": "
|
|
43460
|
+
"doc:raw": "countryCode: \"BE\"\ngraydonEnterpriseId: 1057155523\nregistrationId: \"0422319093\"\nvatNumber: \"BE0422319093\"\ngraydonCompanyId: \"0422319093\"\nisBranchOffice: false\n",
|
|
43461
43461
|
"core:mediaType": "application/yaml",
|
|
43462
43462
|
"sourcemaps:sources": [
|
|
43463
43463
|
{
|
|
@@ -43478,7 +43478,7 @@
|
|
|
43478
43478
|
"doc:ExternalDomainElement",
|
|
43479
43479
|
"doc:DomainElement"
|
|
43480
43480
|
],
|
|
43481
|
-
"doc:raw": "
|
|
43481
|
+
"doc:raw": "code: '5'\ndescription: 'Limited company'\n",
|
|
43482
43482
|
"core:mediaType": "application/yaml",
|
|
43483
43483
|
"sourcemaps:sources": [
|
|
43484
43484
|
{
|
|
@@ -43499,7 +43499,7 @@
|
|
|
43499
43499
|
"doc:ExternalDomainElement",
|
|
43500
43500
|
"doc:DomainElement"
|
|
43501
43501
|
],
|
|
43502
|
-
"doc:raw": "
|
|
43502
|
+
"doc:raw": "class: '3'\ndescription: '150 - 300'\nnumberOfFte: 5500\nnumberOfEmployees: 5232\n",
|
|
43503
43503
|
"core:mediaType": "application/yaml",
|
|
43504
43504
|
"sourcemaps:sources": [
|
|
43505
43505
|
{
|
|
@@ -44274,7 +44274,7 @@
|
|
|
44274
44274
|
"doc:ExternalDomainElement",
|
|
44275
44275
|
"doc:DomainElement"
|
|
44276
44276
|
],
|
|
44277
|
-
"doc:raw": "
|
|
44277
|
+
"doc:raw": "type: \"GENERAL\"\nvalue: \"www.company.be\"\n",
|
|
44278
44278
|
"core:mediaType": "application/yaml",
|
|
44279
44279
|
"sourcemaps:sources": [
|
|
44280
44280
|
{
|
|
@@ -44295,7 +44295,7 @@
|
|
|
44295
44295
|
"doc:ExternalDomainElement",
|
|
44296
44296
|
"doc:DomainElement"
|
|
44297
44297
|
],
|
|
44298
|
-
"doc:raw": "type:
|
|
44298
|
+
"doc:raw": "-\n type: 'GENERAL'\n value: 'info@company.be'\n-\n type: 'IT_DEPT'\n value: 'it-service@company.be'\n",
|
|
44299
44299
|
"core:mediaType": "application/yaml",
|
|
44300
44300
|
"sourcemaps:sources": [
|
|
44301
44301
|
{
|
|
@@ -44761,17 +44761,17 @@
|
|
|
44761
44761
|
{
|
|
44762
44762
|
"@id": "#196/source-map/lexical/element_0",
|
|
44763
44763
|
"sourcemaps:element": "amf://id#196",
|
|
44764
|
-
"sourcemaps:value": "[(1,0)-(
|
|
44764
|
+
"sourcemaps:value": "[(1,0)-(7,0)]"
|
|
44765
44765
|
},
|
|
44766
44766
|
{
|
|
44767
44767
|
"@id": "#199/source-map/lexical/element_0",
|
|
44768
44768
|
"sourcemaps:element": "amf://id#199",
|
|
44769
|
-
"sourcemaps:value": "[(1,0)-(
|
|
44769
|
+
"sourcemaps:value": "[(1,0)-(3,0)]"
|
|
44770
44770
|
},
|
|
44771
44771
|
{
|
|
44772
44772
|
"@id": "#202/source-map/lexical/element_0",
|
|
44773
44773
|
"sourcemaps:element": "amf://id#202",
|
|
44774
|
-
"sourcemaps:value": "[(1,0)-(
|
|
44774
|
+
"sourcemaps:value": "[(1,0)-(5,0)]"
|
|
44775
44775
|
},
|
|
44776
44776
|
{
|
|
44777
44777
|
"@id": "#205/source-map/lexical/element_0",
|
|
@@ -45126,12 +45126,12 @@
|
|
|
45126
45126
|
{
|
|
45127
45127
|
"@id": "#218/source-map/lexical/element_0",
|
|
45128
45128
|
"sourcemaps:element": "amf://id#218",
|
|
45129
|
-
"sourcemaps:value": "[(1,0)-(
|
|
45129
|
+
"sourcemaps:value": "[(1,0)-(3,0)]"
|
|
45130
45130
|
},
|
|
45131
45131
|
{
|
|
45132
45132
|
"@id": "#221/source-map/lexical/element_0",
|
|
45133
45133
|
"sourcemaps:element": "amf://id#221",
|
|
45134
|
-
"sourcemaps:value": "[(1,0)-(
|
|
45134
|
+
"sourcemaps:value": "[(1,0)-(7,0)]"
|
|
45135
45135
|
},
|
|
45136
45136
|
{
|
|
45137
45137
|
"@id": "#338/source-map/synthesized-field/element_1",
|
package/package.json
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { Graph } from '@api-client/graph/graph/Graph.js'
|
|
2
2
|
import type { DomainGraphEdge, DomainGraphNodeType } from './types.js'
|
|
3
|
+
import { DomainAssociationKind } from '../models/kinds.js'
|
|
3
4
|
|
|
4
5
|
/**
|
|
5
6
|
* Recursively removes a node and all its children from the graph.
|
|
@@ -9,18 +10,28 @@ export function removeGraphNode(graph: Graph<unknown, DomainGraphNodeType, Domai
|
|
|
9
10
|
if (!graph.hasNode(key)) {
|
|
10
11
|
return
|
|
11
12
|
}
|
|
13
|
+
const node = graph.node(key)
|
|
14
|
+
if (!node) {
|
|
15
|
+
return
|
|
16
|
+
}
|
|
17
|
+
if (node.kind === DomainAssociationKind) {
|
|
18
|
+
// If the node is an association, remove the association from the graph,
|
|
19
|
+
// but do not follow its children, as it would remove entities associated with it.
|
|
20
|
+
graph.removeNode(key)
|
|
21
|
+
return
|
|
22
|
+
}
|
|
12
23
|
for (const child of graph.children(key)) {
|
|
13
24
|
removeGraphNode(graph, child)
|
|
14
25
|
}
|
|
26
|
+
// Remove all edges from the node.
|
|
15
27
|
for (const edge of graph.outEdges(key)) {
|
|
16
28
|
const label = graph.edge(edge)
|
|
17
29
|
if (!label) {
|
|
18
30
|
continue
|
|
19
31
|
}
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
if (['property', 'association'].includes(label.type)) {
|
|
32
|
+
if (label.type === 'association') {
|
|
33
|
+
removeGraphNode(graph, edge.w)
|
|
34
|
+
} else if (label.type === 'property') {
|
|
24
35
|
removeGraphNode(graph, edge.w)
|
|
25
36
|
}
|
|
26
37
|
}
|
|
@@ -8,7 +8,10 @@ import {
|
|
|
8
8
|
type ExposedEntity,
|
|
9
9
|
} from '../../../src/index.js'
|
|
10
10
|
|
|
11
|
-
test.group('ApiModel.createSchema()', () => {
|
|
11
|
+
test.group('ApiModel.createSchema()', (g) => {
|
|
12
|
+
g.tests.forEach((test) => {
|
|
13
|
+
test.tags(['@modeling', '@api', '@schema'])
|
|
14
|
+
})
|
|
12
15
|
test('creates a schema with default values', ({ assert }) => {
|
|
13
16
|
const schema = ApiModel.createSchema()
|
|
14
17
|
assert.equal(schema.kind, ApiModelKind)
|
|
@@ -64,7 +67,11 @@ test.group('ApiModel.createSchema()', () => {
|
|
|
64
67
|
})
|
|
65
68
|
})
|
|
66
69
|
|
|
67
|
-
test.group('ApiModel.constructor()', () => {
|
|
70
|
+
test.group('ApiModel.constructor()', (g) => {
|
|
71
|
+
g.tests.forEach((test) => {
|
|
72
|
+
test.tags(['@modeling', '@api', '@creation'])
|
|
73
|
+
})
|
|
74
|
+
|
|
68
75
|
test('creates an instance with default values', ({ assert }) => {
|
|
69
76
|
const model = new ApiModel()
|
|
70
77
|
assert.equal(model.kind, ApiModelKind)
|
|
@@ -133,7 +140,10 @@ test.group('ApiModel.constructor()', () => {
|
|
|
133
140
|
})
|
|
134
141
|
})
|
|
135
142
|
|
|
136
|
-
test.group('ApiModel.toJSON()', () => {
|
|
143
|
+
test.group('ApiModel.toJSON()', (g) => {
|
|
144
|
+
g.tests.forEach((test) => {
|
|
145
|
+
test.tags(['@modeling', '@api', '@serialization'])
|
|
146
|
+
})
|
|
137
147
|
test('serializes default values', ({ assert }) => {
|
|
138
148
|
const model = new ApiModel()
|
|
139
149
|
const json = model.toJSON()
|
|
@@ -181,7 +191,10 @@ test.group('ApiModel.toJSON()', () => {
|
|
|
181
191
|
})
|
|
182
192
|
})
|
|
183
193
|
|
|
184
|
-
test.group('ApiModel.exposeEntity()', () => {
|
|
194
|
+
test.group('ApiModel.exposeEntity()', (g) => {
|
|
195
|
+
g.tests.forEach((test) => {
|
|
196
|
+
test.tags(['@modeling', '@api'])
|
|
197
|
+
})
|
|
185
198
|
test('exposes a new entity', ({ assert }) => {
|
|
186
199
|
const model = new ApiModel()
|
|
187
200
|
const entityKey = 'new-entity'
|
|
@@ -228,7 +241,10 @@ test.group('ApiModel.exposeEntity()', () => {
|
|
|
228
241
|
})
|
|
229
242
|
})
|
|
230
243
|
|
|
231
|
-
test.group('ApiModel.removeEntity()', () => {
|
|
244
|
+
test.group('ApiModel.removeEntity()', (g) => {
|
|
245
|
+
g.tests.forEach((test) => {
|
|
246
|
+
test.tags(['@modeling', '@api'])
|
|
247
|
+
})
|
|
232
248
|
test('removes an existing entity', ({ assert }) => {
|
|
233
249
|
const model = new ApiModel()
|
|
234
250
|
const entityKey = 'entity-to-remove'
|
|
@@ -274,7 +290,10 @@ test.group('ApiModel.removeEntity()', () => {
|
|
|
274
290
|
})
|
|
275
291
|
})
|
|
276
292
|
|
|
277
|
-
test.group('ApiModel.getExposedEntity()', () => {
|
|
293
|
+
test.group('ApiModel.getExposedEntity()', (g) => {
|
|
294
|
+
g.tests.forEach((test) => {
|
|
295
|
+
test.tags(['@modeling', '@api'])
|
|
296
|
+
})
|
|
278
297
|
test('returns an existing exposed entity', ({ assert }) => {
|
|
279
298
|
const model = new ApiModel()
|
|
280
299
|
const entityKey = 'get-entity'
|
|
@@ -17,13 +17,13 @@ test.group('DataDomain', () => {
|
|
|
17
17
|
assert.isNotEmpty(dataDomain.key)
|
|
18
18
|
assert.isDefined(dataDomain.graph)
|
|
19
19
|
assert.deepEqual(dataDomain.fields, [])
|
|
20
|
-
})
|
|
20
|
+
}).tags(['@modeling', '@datadomain', '@core', '@unit', '@fast'])
|
|
21
21
|
|
|
22
22
|
test('notifyChange dispatches a change event', async ({ assert }) => {
|
|
23
23
|
const dataDomain = new DataDomain()
|
|
24
24
|
dataDomain.notifyChange()
|
|
25
25
|
await assert.dispatches(dataDomain, 'change', { timeout: 20 })
|
|
26
|
-
})
|
|
26
|
+
}).tags(['@modeling', '@datadomain', '@core', '@unit', '@events', '@async'])
|
|
27
27
|
})
|
|
28
28
|
|
|
29
29
|
test.group('DataDomain.removeDomainElement()', () => {
|
|
@@ -33,7 +33,7 @@ test.group('DataDomain.removeDomainElement()', () => {
|
|
|
33
33
|
dataDomain.removeDomainElement(namespace.key, DomainNamespaceKind)
|
|
34
34
|
assert.isUndefined(dataDomain.findNamespace(namespace.key))
|
|
35
35
|
assert.isFalse(dataDomain.graph.hasNode(namespace.key))
|
|
36
|
-
})
|
|
36
|
+
}).tags(['@modeling', '@datadomain', '@crud', '@removal'])
|
|
37
37
|
|
|
38
38
|
test('removes a data model', ({ assert }) => {
|
|
39
39
|
const dataDomain = new DataDomain()
|
|
@@ -41,7 +41,7 @@ test.group('DataDomain.removeDomainElement()', () => {
|
|
|
41
41
|
dataDomain.removeDomainElement(model.key, DomainModelKind)
|
|
42
42
|
assert.isUndefined(dataDomain.findModel(model.key))
|
|
43
43
|
assert.isFalse(dataDomain.graph.hasNode(model.key))
|
|
44
|
-
})
|
|
44
|
+
}).tags(['@modeling', '@datadomain', '@crud', '@removal'])
|
|
45
45
|
|
|
46
46
|
test('removes an entity', ({ assert }) => {
|
|
47
47
|
const dataDomain = new DataDomain()
|
|
@@ -50,7 +50,7 @@ test.group('DataDomain.removeDomainElement()', () => {
|
|
|
50
50
|
dataDomain.removeDomainElement(entity.key, DomainEntityKind)
|
|
51
51
|
assert.isUndefined(dataDomain.findEntity(entity.key))
|
|
52
52
|
assert.isFalse(dataDomain.graph.hasNode(entity.key))
|
|
53
|
-
})
|
|
53
|
+
}).tags(['@modeling', '@datadomain', '@crud', '@removal'])
|
|
54
54
|
|
|
55
55
|
test('removes a property', ({ assert }) => {
|
|
56
56
|
const dataDomain = new DataDomain()
|
|
@@ -60,7 +60,7 @@ test.group('DataDomain.removeDomainElement()', () => {
|
|
|
60
60
|
dataDomain.removeDomainElement(property.key, DomainPropertyKind)
|
|
61
61
|
assert.isUndefined(dataDomain.findProperty(property.key))
|
|
62
62
|
assert.isFalse(dataDomain.graph.hasNode(property.key))
|
|
63
|
-
})
|
|
63
|
+
}).tags(['@modeling', '@datadomain', '@crud', '@removal'])
|
|
64
64
|
|
|
65
65
|
test('removes an association', ({ assert }) => {
|
|
66
66
|
const dataDomain = new DataDomain()
|
|
@@ -70,49 +70,49 @@ test.group('DataDomain.removeDomainElement()', () => {
|
|
|
70
70
|
dataDomain.removeDomainElement(association.key, DomainAssociationKind)
|
|
71
71
|
assert.isUndefined(dataDomain.findAssociation(association.key))
|
|
72
72
|
assert.isFalse(dataDomain.graph.hasNode(association.key))
|
|
73
|
-
})
|
|
73
|
+
}).tags(['@modeling', '@datadomain', '@crud', '@removal'])
|
|
74
74
|
|
|
75
75
|
test('throws an error for an unknown kind', ({ assert }) => {
|
|
76
76
|
const dataDomain = new DataDomain()
|
|
77
77
|
assert.throws(() => {
|
|
78
78
|
dataDomain.removeDomainElement('test-unknown', 'unknown-kind')
|
|
79
79
|
}, 'Unknown kind unknown-kind for the object test-unknown')
|
|
80
|
-
})
|
|
80
|
+
}).tags(['@modeling', '@datadomain', '@crud', '@removal'])
|
|
81
81
|
|
|
82
82
|
test('throws an error when removing a non-existing namespace', ({ assert }) => {
|
|
83
83
|
const dataDomain = new DataDomain()
|
|
84
84
|
assert.throws(() => {
|
|
85
85
|
dataDomain.removeDomainElement('non-existent-namespace', DomainNamespaceKind)
|
|
86
86
|
}, `Namespace non-existent-namespace does not exist`)
|
|
87
|
-
})
|
|
87
|
+
}).tags(['@modeling', '@datadomain', '@crud', '@removal'])
|
|
88
88
|
|
|
89
89
|
test('throws an error when removing a non-existing model', ({ assert }) => {
|
|
90
90
|
const dataDomain = new DataDomain()
|
|
91
91
|
assert.throws(() => {
|
|
92
92
|
dataDomain.removeDomainElement('non-existent-model', DomainModelKind)
|
|
93
93
|
}, `Data model non-existent-model does not exist`)
|
|
94
|
-
})
|
|
94
|
+
}).tags(['@modeling', '@datadomain', '@crud', '@removal'])
|
|
95
95
|
|
|
96
96
|
test('throws an error when removing a non-existing entity', ({ assert }) => {
|
|
97
97
|
const dataDomain = new DataDomain()
|
|
98
98
|
assert.throws(() => {
|
|
99
99
|
dataDomain.removeDomainElement('non-existent-entity', DomainEntityKind)
|
|
100
100
|
}, `Entity non-existent-entity does not exist`)
|
|
101
|
-
})
|
|
101
|
+
}).tags(['@modeling', '@datadomain', '@crud', '@removal'])
|
|
102
102
|
|
|
103
103
|
test('throws an error when removing a non-existing property', ({ assert }) => {
|
|
104
104
|
const dataDomain = new DataDomain()
|
|
105
105
|
assert.throws(() => {
|
|
106
106
|
dataDomain.removeDomainElement('non-existent-property', DomainPropertyKind)
|
|
107
107
|
}, `Property non-existent-property does not exist`)
|
|
108
|
-
})
|
|
108
|
+
}).tags(['@modeling', '@datadomain', '@crud', '@removal'])
|
|
109
109
|
|
|
110
110
|
test('throws an error when removing a non-existing association', ({ assert }) => {
|
|
111
111
|
const dataDomain = new DataDomain()
|
|
112
112
|
assert.throws(() => {
|
|
113
113
|
dataDomain.removeDomainElement('non-existent-association', DomainAssociationKind)
|
|
114
114
|
}, `Association non-existent-association does not exist`)
|
|
115
|
-
})
|
|
115
|
+
}).tags(['@modeling', '@datadomain', '@crud', '@removal'])
|
|
116
116
|
|
|
117
117
|
test('removes a namespace with children', ({ assert }) => {
|
|
118
118
|
const dataDomain = new DataDomain()
|
|
@@ -138,7 +138,7 @@ test.group('DataDomain.removeDomainElement()', () => {
|
|
|
138
138
|
assert.isFalse(dataDomain.graph.hasNode(entity.key))
|
|
139
139
|
assert.isFalse(dataDomain.graph.hasNode(property.key))
|
|
140
140
|
assert.isFalse(dataDomain.graph.hasNode(association.key))
|
|
141
|
-
})
|
|
141
|
+
}).tags(['@modeling', '@datadomain', '@crud', '@removal'])
|
|
142
142
|
})
|
|
143
143
|
|
|
144
144
|
test.group('DataDomain.createSchema()', () => {
|
|
@@ -151,7 +151,7 @@ test.group('DataDomain.createSchema()', () => {
|
|
|
151
151
|
assert.isUndefined(schema.graph)
|
|
152
152
|
assert.isUndefined(schema.dependencyList)
|
|
153
153
|
assert.isUndefined(schema.fields)
|
|
154
|
-
})
|
|
154
|
+
}).tags(['@modeling', '@datadomain', '@schema', '@factory'])
|
|
155
155
|
|
|
156
156
|
test('creates a schema with provided values', ({ assert }) => {
|
|
157
157
|
const schema = DataDomain.createSchema({
|
|
@@ -167,7 +167,7 @@ test.group('DataDomain.createSchema()', () => {
|
|
|
167
167
|
assert.deepEqual(schema.graph, { nodes: [], edges: [], options: {} })
|
|
168
168
|
assert.deepEqual(schema.dependencyList, [{ key: 'dep1', version: '1.0.0' }])
|
|
169
169
|
assert.deepEqual(schema.fields, [{ key: 'field1', type: 'namespace' }])
|
|
170
|
-
})
|
|
170
|
+
}).tags(['@modeling', '@datadomain', '@schema', '@factory'])
|
|
171
171
|
|
|
172
172
|
test('creates a schema with partial info', ({ assert }) => {
|
|
173
173
|
const schema = DataDomain.createSchema({
|
|
@@ -177,7 +177,7 @@ test.group('DataDomain.createSchema()', () => {
|
|
|
177
177
|
assert.typeOf(schema.key, 'string')
|
|
178
178
|
assert.isNotEmpty(schema.key)
|
|
179
179
|
assert.deepInclude(schema.info, { name: 'Test Domain' })
|
|
180
|
-
})
|
|
180
|
+
}).tags(['@modeling', '@datadomain', '@schema', '@factory'])
|
|
181
181
|
|
|
182
182
|
test('creates a schema with empty info', ({ assert }) => {
|
|
183
183
|
const schema = DataDomain.createSchema({
|
|
@@ -187,7 +187,7 @@ test.group('DataDomain.createSchema()', () => {
|
|
|
187
187
|
assert.typeOf(schema.key, 'string')
|
|
188
188
|
assert.isNotEmpty(schema.key)
|
|
189
189
|
assert.deepInclude(schema.info, { name: 'Unnamed domain' })
|
|
190
|
-
})
|
|
190
|
+
}).tags(['@modeling', '@datadomain', '@schema', '@factory'])
|
|
191
191
|
|
|
192
192
|
test('creates a schema with dependencyList', ({ assert }) => {
|
|
193
193
|
const schema = DataDomain.createSchema({
|
|
@@ -198,7 +198,7 @@ test.group('DataDomain.createSchema()', () => {
|
|
|
198
198
|
assert.isNotEmpty(schema.key)
|
|
199
199
|
assert.deepInclude(schema.info, { name: 'Unnamed domain' })
|
|
200
200
|
assert.deepEqual(schema.dependencyList, [{ key: 'dep1', version: '1.0.0' }])
|
|
201
|
-
})
|
|
201
|
+
}).tags(['@modeling', '@datadomain', '@schema', '@factory'])
|
|
202
202
|
|
|
203
203
|
test('creates a schema with graph', ({ assert }) => {
|
|
204
204
|
const schema = DataDomain.createSchema({
|
|
@@ -209,7 +209,7 @@ test.group('DataDomain.createSchema()', () => {
|
|
|
209
209
|
assert.isNotEmpty(schema.key)
|
|
210
210
|
assert.deepInclude(schema.info, { name: 'Unnamed domain' })
|
|
211
211
|
assert.deepEqual(schema.graph, { nodes: [], edges: [], options: {} })
|
|
212
|
-
})
|
|
212
|
+
}).tags(['@modeling', '@datadomain', '@schema', '@factory'])
|
|
213
213
|
|
|
214
214
|
test('creates a schema with fields', ({ assert }) => {
|
|
215
215
|
const schema = DataDomain.createSchema({
|
|
@@ -220,7 +220,7 @@ test.group('DataDomain.createSchema()', () => {
|
|
|
220
220
|
assert.isNotEmpty(schema.key)
|
|
221
221
|
assert.deepInclude(schema.info, { name: 'Unnamed domain' })
|
|
222
222
|
assert.deepEqual(schema.fields, [{ key: 'field1', type: 'namespace' }])
|
|
223
|
-
})
|
|
223
|
+
}).tags(['@modeling', '@datadomain', '@schema', '@factory'])
|
|
224
224
|
})
|
|
225
225
|
|
|
226
226
|
test.group('DataDomain.constructor()', () => {
|
|
@@ -233,7 +233,7 @@ test.group('DataDomain.constructor()', () => {
|
|
|
233
233
|
assert.deepInclude(dataDomain.info.toJSON(), { name: 'Unnamed domain' })
|
|
234
234
|
assert.isDefined(dataDomain.graph)
|
|
235
235
|
assert.deepEqual(dataDomain.dependencyList, [])
|
|
236
|
-
})
|
|
236
|
+
}).tags(['@modeling', '@datadomain', '@constructor', '@initialization'])
|
|
237
237
|
|
|
238
238
|
test('creates a new DataDomain with provided values', ({ assert }) => {
|
|
239
239
|
const dataDomain = new DataDomain({
|
|
@@ -247,7 +247,7 @@ test.group('DataDomain.constructor()', () => {
|
|
|
247
247
|
assert.deepInclude(dataDomain.info.toJSON(), { name: 'Test Domain', description: 'A test domain' })
|
|
248
248
|
assert.isDefined(dataDomain.graph)
|
|
249
249
|
assert.deepEqual(dataDomain.dependencyList, [{ key: 'dep1', version: '1.0.0' }])
|
|
250
|
-
})
|
|
250
|
+
}).tags(['@modeling', '@datadomain', '@constructor', '@initialization'])
|
|
251
251
|
|
|
252
252
|
test('creates a new DataDomain with partial info', ({ assert }) => {
|
|
253
253
|
const dataDomain = new DataDomain({
|
|
@@ -258,7 +258,7 @@ test.group('DataDomain.constructor()', () => {
|
|
|
258
258
|
assert.isNotEmpty(dataDomain.key)
|
|
259
259
|
assert.instanceOf(dataDomain.info, Thing)
|
|
260
260
|
assert.deepInclude(dataDomain.info.toJSON(), { name: 'Test Domain' })
|
|
261
|
-
})
|
|
261
|
+
}).tags(['@modeling', '@datadomain', '@constructor', '@initialization'])
|
|
262
262
|
|
|
263
263
|
test('creates a new DataDomain with empty info', ({ assert }) => {
|
|
264
264
|
const dataDomain = new DataDomain({
|
|
@@ -269,7 +269,7 @@ test.group('DataDomain.constructor()', () => {
|
|
|
269
269
|
assert.isNotEmpty(dataDomain.key)
|
|
270
270
|
assert.instanceOf(dataDomain.info, Thing)
|
|
271
271
|
assert.deepInclude(dataDomain.info.toJSON(), { name: 'Unnamed domain' })
|
|
272
|
-
})
|
|
272
|
+
}).tags(['@modeling', '@datadomain', '@constructor', '@initialization'])
|
|
273
273
|
|
|
274
274
|
test('creates a new DataDomain with dependencyList', ({ assert }) => {
|
|
275
275
|
const dataDomain = new DataDomain({
|
|
@@ -281,40 +281,40 @@ test.group('DataDomain.constructor()', () => {
|
|
|
281
281
|
assert.instanceOf(dataDomain.info, Thing)
|
|
282
282
|
assert.deepInclude(dataDomain.info.toJSON(), { name: 'Unnamed domain' })
|
|
283
283
|
assert.deepEqual(dataDomain.dependencyList, [{ key: 'dep1', version: '1.0.0' }])
|
|
284
|
-
})
|
|
284
|
+
}).tags(['@modeling', '@datadomain', '@constructor', '@initialization'])
|
|
285
285
|
|
|
286
286
|
test('creates a new DataDomain with a custom key', ({ assert }) => {
|
|
287
287
|
const dataDomain = new DataDomain({ key: 'custom-key' })
|
|
288
288
|
assert.equal(dataDomain.key, 'custom-key')
|
|
289
|
-
})
|
|
289
|
+
}).tags(['@modeling', '@datadomain', '@constructor', '@initialization'])
|
|
290
290
|
|
|
291
291
|
test('creates a new DataDomain with custom info', ({ assert }) => {
|
|
292
292
|
const customInfo = { name: 'Custom Name', description: 'Custom Description' }
|
|
293
293
|
const dataDomain = new DataDomain({ info: customInfo })
|
|
294
294
|
assert.deepInclude(dataDomain.info.toJSON(), customInfo)
|
|
295
|
-
})
|
|
295
|
+
}).tags(['@modeling', '@datadomain', '@constructor', '@initialization'])
|
|
296
296
|
|
|
297
297
|
test('initializes the graph', ({ assert }) => {
|
|
298
298
|
const dataDomain = new DataDomain()
|
|
299
299
|
assert.isDefined(dataDomain.graph)
|
|
300
|
-
})
|
|
300
|
+
}).tags(['@modeling', '@datadomain', '@constructor', '@initialization'])
|
|
301
301
|
|
|
302
302
|
test('initializes the dependencies map', ({ assert }) => {
|
|
303
303
|
const dataDomain = new DataDomain()
|
|
304
304
|
assert.instanceOf(dataDomain.dependencies, Map)
|
|
305
305
|
assert.equal(dataDomain.dependencies.size, 0)
|
|
306
|
-
})
|
|
306
|
+
}).tags(['@modeling', '@datadomain', '@constructor', '@initialization'])
|
|
307
307
|
|
|
308
308
|
test('initializes the dependencyList array', ({ assert }) => {
|
|
309
309
|
const dataDomain = new DataDomain()
|
|
310
310
|
assert.isArray(dataDomain.dependencyList)
|
|
311
311
|
assert.equal(dataDomain.dependencyList.length, 0)
|
|
312
|
-
})
|
|
312
|
+
}).tags(['@modeling', '@datadomain', '@constructor', '@initialization'])
|
|
313
313
|
|
|
314
314
|
test('does not notify change during initialization', async ({ assert }) => {
|
|
315
315
|
const dataDomain = new DataDomain()
|
|
316
316
|
await assert.notDispatches(dataDomain, 'change', { timeout: 20 })
|
|
317
|
-
})
|
|
317
|
+
}).tags(['@modeling', '@datadomain', '@constructor', '@initialization'])
|
|
318
318
|
|
|
319
319
|
test('restores the graph from a serialized state', ({ assert }) => {
|
|
320
320
|
const dataDomain1 = new DataDomain()
|
|
@@ -326,7 +326,7 @@ test.group('DataDomain.constructor()', () => {
|
|
|
326
326
|
const restoredEntity = dataDomain2.findEntity(entity.key)
|
|
327
327
|
assert.isDefined(restoredEntity)
|
|
328
328
|
assert.equal(restoredEntity!.key, entity.key)
|
|
329
|
-
})
|
|
329
|
+
}).tags(['@modeling', '@datadomain', '@constructor', '@initialization'])
|
|
330
330
|
|
|
331
331
|
test('restores the graph with dependencies', ({ assert }) => {
|
|
332
332
|
const dataDomain1 = new DataDomain()
|
|
@@ -338,7 +338,7 @@ test.group('DataDomain.constructor()', () => {
|
|
|
338
338
|
const dataDomain2 = new DataDomain(serialized, [dataDomain1])
|
|
339
339
|
const restoredEntity = dataDomain2.findForeignEntity(entity.key, dataDomain1.key)
|
|
340
340
|
assert.ok(restoredEntity)
|
|
341
|
-
})
|
|
341
|
+
}).tags(['@modeling', '@datadomain', '@constructor', '@initialization'])
|
|
342
342
|
})
|
|
343
343
|
|
|
344
344
|
test.group('DataDomain.hasFields()', () => {
|
|
@@ -346,31 +346,31 @@ test.group('DataDomain.hasFields()', () => {
|
|
|
346
346
|
const dataDomain = new DataDomain()
|
|
347
347
|
dataDomain.addNamespace()
|
|
348
348
|
assert.isTrue(dataDomain.hasFields())
|
|
349
|
-
})
|
|
349
|
+
}).tags(['@modeling', '@datadomain', '@fields', '@query'])
|
|
350
350
|
|
|
351
351
|
test('returns true if there are child models', ({ assert }) => {
|
|
352
352
|
const dataDomain = new DataDomain()
|
|
353
353
|
dataDomain.addModel()
|
|
354
354
|
assert.isTrue(dataDomain.hasFields())
|
|
355
|
-
})
|
|
355
|
+
}).tags(['@modeling', '@datadomain', '@fields', '@query'])
|
|
356
356
|
|
|
357
357
|
test('returns true if there are both namespaces and models', ({ assert }) => {
|
|
358
358
|
const dataDomain = new DataDomain()
|
|
359
359
|
dataDomain.addNamespace()
|
|
360
360
|
dataDomain.addModel()
|
|
361
361
|
assert.isTrue(dataDomain.hasFields())
|
|
362
|
-
})
|
|
362
|
+
}).tags(['@modeling', '@datadomain', '@fields', '@query'])
|
|
363
363
|
|
|
364
364
|
test('returns false if there are no child namespaces or models', ({ assert }) => {
|
|
365
365
|
const dataDomain = new DataDomain()
|
|
366
366
|
assert.isFalse(dataDomain.hasFields())
|
|
367
|
-
})
|
|
367
|
+
}).tags(['@modeling', '@datadomain', '@fields', '@query'])
|
|
368
368
|
|
|
369
369
|
test('returns false if the data domain has no fields', ({ assert }) => {
|
|
370
370
|
const dataDomain = new DataDomain()
|
|
371
371
|
dataDomain.fields = []
|
|
372
372
|
assert.isFalse(dataDomain.hasFields())
|
|
373
|
-
})
|
|
373
|
+
}).tags(['@modeling', '@datadomain', '@fields', '@query'])
|
|
374
374
|
|
|
375
375
|
test('returns true if there are only foreign namespaces or models', ({ assert }) => {
|
|
376
376
|
const dataDomain = new DataDomain()
|
|
@@ -379,7 +379,7 @@ test.group('DataDomain.hasFields()', () => {
|
|
|
379
379
|
dataDomain.registerForeignDomain(foreignDomain)
|
|
380
380
|
foreignDomain.addNamespace()
|
|
381
381
|
assert.isFalse(dataDomain.hasFields())
|
|
382
|
-
})
|
|
382
|
+
}).tags(['@modeling', '@datadomain', '@fields', '@query'])
|
|
383
383
|
})
|
|
384
384
|
|
|
385
385
|
test.group('DataDomain.listFields()', () => {
|
|
@@ -391,13 +391,13 @@ test.group('DataDomain.listFields()', () => {
|
|
|
391
391
|
assert.lengthOf(fields, 2)
|
|
392
392
|
assert.deepInclude(fields, namespace)
|
|
393
393
|
assert.deepInclude(fields, model)
|
|
394
|
-
})
|
|
394
|
+
}).tags(['@modeling', '@datadomain', '@fields', '@listing'])
|
|
395
395
|
|
|
396
396
|
test('returns an empty array if there are no child namespaces or models', ({ assert }) => {
|
|
397
397
|
const dataDomain = new DataDomain()
|
|
398
398
|
const fields = [...dataDomain.listFields()]
|
|
399
399
|
assert.lengthOf(fields, 0)
|
|
400
|
-
})
|
|
400
|
+
}).tags(['@modeling', '@datadomain', '@fields', '@listing'])
|
|
401
401
|
|
|
402
402
|
test('returns only namespaces and models', ({ assert }) => {
|
|
403
403
|
const dataDomain = new DataDomain()
|
|
@@ -408,7 +408,7 @@ test.group('DataDomain.listFields()', () => {
|
|
|
408
408
|
assert.lengthOf(fields, 2)
|
|
409
409
|
assert.deepInclude(fields, namespace)
|
|
410
410
|
assert.deepInclude(fields, model)
|
|
411
|
-
})
|
|
411
|
+
}).tags(['@modeling', '@datadomain', '@fields', '@listing'])
|
|
412
412
|
|
|
413
413
|
test('namespaces and models in the list are of type DomainNamespace and DomainModel', ({ assert }) => {
|
|
414
414
|
const dataDomain = new DataDomain()
|
|
@@ -417,7 +417,7 @@ test.group('DataDomain.listFields()', () => {
|
|
|
417
417
|
const fields = [...dataDomain.listFields()]
|
|
418
418
|
assert.instanceOf(fields[0], DomainNamespace)
|
|
419
419
|
assert.instanceOf(fields[1], DomainModel)
|
|
420
|
-
})
|
|
420
|
+
}).tags(['@modeling', '@datadomain', '@fields', '@listing'])
|
|
421
421
|
|
|
422
422
|
test('lists namespaces and models in the order they were added', ({ assert }) => {
|
|
423
423
|
const dataDomain = new DataDomain()
|
|
@@ -425,13 +425,13 @@ test.group('DataDomain.listFields()', () => {
|
|
|
425
425
|
const model = dataDomain.addModel()
|
|
426
426
|
const fields = [...dataDomain.listFields()]
|
|
427
427
|
assert.deepEqual(fields, [namespace, model])
|
|
428
|
-
})
|
|
428
|
+
}).tags(['@modeling', '@datadomain', '@fields', '@listing'])
|
|
429
429
|
|
|
430
430
|
test('lists namespaces and models when there are no namespaces or models', ({ assert }) => {
|
|
431
431
|
const dataDomain = new DataDomain()
|
|
432
432
|
const fields = [...dataDomain.listFields()]
|
|
433
433
|
assert.deepEqual(fields, [])
|
|
434
|
-
})
|
|
434
|
+
}).tags(['@modeling', '@datadomain', '@fields', '@listing'])
|
|
435
435
|
|
|
436
436
|
test('lists namespaces and models when there are other domain elements', ({ assert }) => {
|
|
437
437
|
const dataDomain = new DataDomain()
|
|
@@ -440,5 +440,5 @@ test.group('DataDomain.listFields()', () => {
|
|
|
440
440
|
dataDomain.addEntity(model.key) // Add an entity to make sure it's not included
|
|
441
441
|
const fields = [...dataDomain.listFields()]
|
|
442
442
|
assert.deepEqual(fields, [namespace, model])
|
|
443
|
-
})
|
|
443
|
+
}).tags(['@modeling', '@datadomain', '@fields', '@listing'])
|
|
444
444
|
})
|