@toa.io/norm 0.10.0-dev.3 → 0.10.1-dev.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@toa.io/norm",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.1-dev.0",
|
|
4
4
|
"description": "Toa declarations normalization and validation",
|
|
5
5
|
"author": "temich <tema.gurtovoy@gmail.com>",
|
|
6
6
|
"homepage": "https://github.com/toa-io/toa#readme",
|
|
@@ -19,14 +19,14 @@
|
|
|
19
19
|
"test": "echo \"Error: run tests from root\" && exit 1"
|
|
20
20
|
},
|
|
21
21
|
"devDependencies": {
|
|
22
|
-
"@toa.io/mock": "0.7.
|
|
22
|
+
"@toa.io/mock": "0.7.7-dev.0"
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@toa.io/core": "0.8.1
|
|
26
|
-
"@toa.io/generic": "0.9.0
|
|
27
|
-
"@toa.io/schema": "0.7.3
|
|
28
|
-
"@toa.io/schemas": "0.8.1
|
|
29
|
-
"@toa.io/yaml": "0.7.3
|
|
25
|
+
"@toa.io/core": "0.8.1",
|
|
26
|
+
"@toa.io/generic": "0.9.0",
|
|
27
|
+
"@toa.io/schema": "0.7.3",
|
|
28
|
+
"@toa.io/schemas": "0.8.1",
|
|
29
|
+
"@toa.io/yaml": "0.7.3"
|
|
30
30
|
},
|
|
31
|
-
"gitHead": "
|
|
31
|
+
"gitHead": "7f1fdbfe3aa33eb4a06cb1a33d15be18854bcd88"
|
|
32
32
|
}
|
|
@@ -7,8 +7,10 @@ function receivers (component) {
|
|
|
7
7
|
|
|
8
8
|
for (const [key, value] of Object.entries(receivers)) {
|
|
9
9
|
const segments = key.split('.')
|
|
10
|
+
const source = value.source ?? 'default'
|
|
10
11
|
|
|
11
|
-
if (
|
|
12
|
+
if (source !== 'default') continue
|
|
13
|
+
if (segments.length === 3) continue // already with a namespace
|
|
12
14
|
|
|
13
15
|
const newKey = 'default.' + key
|
|
14
16
|
|
|
@@ -36,9 +36,9 @@ const collapse = (manifest, prototype) => {
|
|
|
36
36
|
|
|
37
37
|
delete prototype.entity?.storage // ???
|
|
38
38
|
|
|
39
|
-
const { entity, events } = prototype
|
|
39
|
+
const { entity, events, extensions } = prototype
|
|
40
40
|
|
|
41
|
-
merge(manifest, { entity, events })
|
|
41
|
+
merge(manifest, { entity, events, extensions })
|
|
42
42
|
}
|
|
43
43
|
|
|
44
44
|
exports.collapse = collapse
|
|
@@ -56,4 +56,21 @@ describe('receivers', () => {
|
|
|
56
56
|
'default.messages.created': 'add'
|
|
57
57
|
})
|
|
58
58
|
})
|
|
59
|
+
|
|
60
|
+
it('should not substitute default namespace for foreign events', async () => {
|
|
61
|
+
const receiver = {
|
|
62
|
+
transition: 'add',
|
|
63
|
+
source: 'test'
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
manifest.receivers = {
|
|
67
|
+
'messages.created': receiver
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
normalize(manifest)
|
|
71
|
+
|
|
72
|
+
expect(manifest.receivers).toStrictEqual({
|
|
73
|
+
'messages.created': receiver
|
|
74
|
+
})
|
|
75
|
+
})
|
|
59
76
|
})
|