@toa.io/norm 1.0.0-alpha.3 → 1.0.0-alpha.5
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 +7 -7
- package/src/.component/.expand/index.js +2 -0
- package/src/.component/.expand/version.js +19 -0
- package/src/.component/defaults.js +0 -15
- package/src/.component/expand.js +3 -1
- package/src/.context/.dependencies/connectors.js +8 -3
- package/test/component/expand.fixtures.js +1 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@toa.io/norm",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.5",
|
|
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",
|
|
@@ -20,11 +20,11 @@
|
|
|
20
20
|
"test": "echo \"Error: run tests from root\" && exit 1"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@toa.io/core": "1.0.0-alpha.
|
|
24
|
-
"@toa.io/generic": "1.0.0-alpha.
|
|
25
|
-
"@toa.io/schema": "1.0.0-alpha.
|
|
26
|
-
"@toa.io/schemas": "1.0.0-alpha.
|
|
27
|
-
"@toa.io/yaml": "1.0.0-alpha.
|
|
23
|
+
"@toa.io/core": "1.0.0-alpha.5",
|
|
24
|
+
"@toa.io/generic": "1.0.0-alpha.5",
|
|
25
|
+
"@toa.io/schema": "1.0.0-alpha.5",
|
|
26
|
+
"@toa.io/schemas": "1.0.0-alpha.5",
|
|
27
|
+
"@toa.io/yaml": "1.0.0-alpha.5"
|
|
28
28
|
},
|
|
29
|
-
"gitHead": "
|
|
29
|
+
"gitHead": "1e4bb4ac28a6dddff1f4b8c5be7224fcdc47b847"
|
|
30
30
|
}
|
|
@@ -7,6 +7,7 @@ const { extensions } = require('./extensions')
|
|
|
7
7
|
const { operations } = require('./operations')
|
|
8
8
|
const { properties } = require('./properties')
|
|
9
9
|
const { receivers } = require('./receivers')
|
|
10
|
+
const { version } = require('./version')
|
|
10
11
|
|
|
11
12
|
exports.bridge = bridge
|
|
12
13
|
exports.entity = entity
|
|
@@ -15,3 +16,4 @@ exports.extensions = extensions
|
|
|
15
16
|
exports.operations = operations
|
|
16
17
|
exports.properties = properties
|
|
17
18
|
exports.receivers = receivers
|
|
19
|
+
exports.version = version
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
function version (manifest) {
|
|
4
|
+
if (manifest.version === undefined) {
|
|
5
|
+
const bridge = require(manifest.bridge)
|
|
6
|
+
|
|
7
|
+
if ('version' in bridge)
|
|
8
|
+
manifest.version = bridge.version(manifest)
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
if (manifest.version === undefined) {
|
|
12
|
+
console.warn(`Component '${manifest.namespace ? manifest.namespace + '.' : ''}${manifest.name}' has no version`)
|
|
13
|
+
|
|
14
|
+
manifest.version = Math.random().toString(36).slice(2)
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
exports.version = version
|
|
@@ -18,21 +18,6 @@ const defaults = (manifest) => {
|
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
if (manifest.prototype === undefined) manifest.prototype = '@toa.io/prototype'
|
|
21
|
-
|
|
22
|
-
// TODO: bridge.version()
|
|
23
|
-
|
|
24
|
-
if (manifest.version === undefined) {
|
|
25
|
-
const bridge = require(manifest.bridge)
|
|
26
|
-
|
|
27
|
-
if ('version' in bridge)
|
|
28
|
-
manifest.version = bridge.version(manifest)
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
if (manifest.version === undefined) {
|
|
32
|
-
console.warn(`Component '${manifest.namespace ? manifest.namespace + '.' : ''}${manifest.name}' has no version`)
|
|
33
|
-
|
|
34
|
-
manifest.version = Math.random().toString(36).slice(2)
|
|
35
|
-
}
|
|
36
21
|
}
|
|
37
22
|
|
|
38
23
|
function protoName (manifest) {
|
package/src/.component/expand.js
CHANGED
|
@@ -7,7 +7,8 @@ const {
|
|
|
7
7
|
events,
|
|
8
8
|
receivers,
|
|
9
9
|
extensions,
|
|
10
|
-
properties
|
|
10
|
+
properties,
|
|
11
|
+
version
|
|
11
12
|
} = require('./.expand')
|
|
12
13
|
|
|
13
14
|
const expand = (manifest) => {
|
|
@@ -18,6 +19,7 @@ const expand = (manifest) => {
|
|
|
18
19
|
receivers(manifest)
|
|
19
20
|
properties(manifest)
|
|
20
21
|
extensions(manifest)
|
|
22
|
+
version(manifest)
|
|
21
23
|
}
|
|
22
24
|
|
|
23
25
|
exports.expand = expand
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
|
+
const { resolve } = require('node:path')
|
|
4
|
+
|
|
3
5
|
const connectors = (context, extracted) => {
|
|
4
6
|
const connectors = {}
|
|
5
7
|
|
|
@@ -10,11 +12,14 @@ const connectors = (context, extracted) => {
|
|
|
10
12
|
|
|
11
13
|
for (const component of components) {
|
|
12
14
|
if (component.entity !== undefined) {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
+
let storage = component.entity.storage
|
|
16
|
+
|
|
17
|
+
if (storage[0] === '.') {
|
|
18
|
+
storage = resolve(component.path, storage)
|
|
15
19
|
}
|
|
16
20
|
|
|
17
|
-
connectors[
|
|
21
|
+
connectors[storage] ??= []
|
|
22
|
+
connectors[storage].push(component)
|
|
18
23
|
}
|
|
19
24
|
|
|
20
25
|
const bindings = new Set()
|