@toa.io/norm 1.0.0-alpha.3 → 1.0.0-alpha.4

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": "1.0.0-alpha.3",
3
+ "version": "1.0.0-alpha.4",
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.3",
24
- "@toa.io/generic": "1.0.0-alpha.3",
25
- "@toa.io/schema": "1.0.0-alpha.3",
26
- "@toa.io/schemas": "1.0.0-alpha.3",
27
- "@toa.io/yaml": "1.0.0-alpha.3"
23
+ "@toa.io/core": "1.0.0-alpha.4",
24
+ "@toa.io/generic": "1.0.0-alpha.4",
25
+ "@toa.io/schema": "1.0.0-alpha.4",
26
+ "@toa.io/schemas": "1.0.0-alpha.4",
27
+ "@toa.io/yaml": "1.0.0-alpha.4"
28
28
  },
29
- "gitHead": "e36ac7871fc14d15863aaf8f9bbdeace8bdfa9f0"
29
+ "gitHead": "80a91c0d9c167484247a91e69a0c0a3c344f90d0"
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) {
@@ -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
- if (connectors[component.entity.storage] === undefined) {
14
- connectors[component.entity.storage] = []
15
+ let storage = component.entity.storage
16
+
17
+ if (storage[0] === '.') {
18
+ storage = resolve(component.path, storage)
15
19
  }
16
20
 
17
- connectors[component.entity.storage].push(component)
21
+ connectors[storage] ??= []
22
+ connectors[storage].push(component)
18
23
  }
19
24
 
20
25
  const bindings = new Set()
@@ -1,6 +1,7 @@
1
1
  'use strict'
2
2
 
3
3
  const source = {
4
+ path: '',
4
5
  entity: {
5
6
  schema: {
6
7
  properties: {