@toa.io/core 0.1.1-dev.3 → 0.2.0-dev.3
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 +4 -4
- package/src/exceptions.js +1 -1
- package/src/locator.js +6 -4
- package/test/locator.test.js +0 -10
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@toa.io/core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0-dev.3+8334154",
|
|
4
4
|
"description": "Toa Core",
|
|
5
5
|
"author": "temich <tema.gurtovoy@gmail.com>",
|
|
6
6
|
"homepage": "https://github.com/toa-io/toa#readme",
|
|
@@ -20,9 +20,9 @@
|
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
22
|
"@rsql/parser": "1.2.4",
|
|
23
|
-
"@toa.io/gears": "0.
|
|
24
|
-
"@toa.io/schema": "0.
|
|
23
|
+
"@toa.io/gears": "0.2.0-dev.3+8334154",
|
|
24
|
+
"@toa.io/schema": "0.2.0-dev.3+8334154",
|
|
25
25
|
"clone-deep": "4.0.1"
|
|
26
26
|
},
|
|
27
|
-
"gitHead": "
|
|
27
|
+
"gitHead": "8334154c1b8a8268ad90adfb15b43a876459014f"
|
|
28
28
|
}
|
package/src/exceptions.js
CHANGED
|
@@ -38,7 +38,7 @@ class SystemException extends Exception {
|
|
|
38
38
|
constructor (error) {
|
|
39
39
|
super(codes.System, error.message)
|
|
40
40
|
|
|
41
|
-
if (error.stack !== undefined
|
|
41
|
+
if (error.stack !== undefined) this.stack = error.stack
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
44
|
|
package/src/locator.js
CHANGED
|
@@ -6,6 +6,7 @@ class Locator {
|
|
|
6
6
|
domain = 'system'
|
|
7
7
|
name
|
|
8
8
|
id
|
|
9
|
+
label
|
|
9
10
|
|
|
10
11
|
constructor (manifest) {
|
|
11
12
|
if (manifest !== undefined) {
|
|
@@ -18,6 +19,7 @@ class Locator {
|
|
|
18
19
|
}
|
|
19
20
|
|
|
20
21
|
this.id = `${this.domain}${concat('.', this.name)}`
|
|
22
|
+
this.label = `${this.domain}${concat('-', this.name)}`
|
|
21
23
|
}
|
|
22
24
|
|
|
23
25
|
host (type, level = 0) {
|
|
@@ -26,10 +28,12 @@ class Locator {
|
|
|
26
28
|
const segments = LEVELS.slice(0, level + 1)
|
|
27
29
|
|
|
28
30
|
for (const segment of segments) {
|
|
29
|
-
host += concat(segment(this),
|
|
31
|
+
host += concat(segment(this), '-')
|
|
30
32
|
}
|
|
31
33
|
|
|
32
|
-
|
|
34
|
+
if (type) host += type.toLowerCase()
|
|
35
|
+
|
|
36
|
+
return host
|
|
33
37
|
}
|
|
34
38
|
|
|
35
39
|
static parse (label) {
|
|
@@ -39,8 +43,6 @@ class Locator {
|
|
|
39
43
|
}
|
|
40
44
|
}
|
|
41
45
|
|
|
42
|
-
const SEPARATOR = '-'
|
|
43
|
-
|
|
44
46
|
const LEVELS = [
|
|
45
47
|
(locator) => locator.domain,
|
|
46
48
|
(locator) => locator.name
|
package/test/locator.test.js
CHANGED
|
@@ -15,16 +15,6 @@ const nameless = {
|
|
|
15
15
|
operations: [{ name: 'add' }, { name: 'get' }]
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
-
const env = process.env.TOA_ENV
|
|
19
|
-
|
|
20
|
-
beforeAll(() => {
|
|
21
|
-
delete process.env.TOA_ENV
|
|
22
|
-
})
|
|
23
|
-
|
|
24
|
-
afterAll(() => {
|
|
25
|
-
process.env.TOA_ENV = env
|
|
26
|
-
})
|
|
27
|
-
|
|
28
18
|
it('should provide host', () => {
|
|
29
19
|
expect(new Locator(manifest).host('db')).toBe('foo-db')
|
|
30
20
|
expect(new Locator(nameless).host('db')).toBe('foo-db')
|