@toa.io/extensions.configuration 1.1.0-dev.0 → 1.1.0-dev.10
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 +6 -6
- package/source/.manifest/.normalize/verbose.js +1 -1
- package/source/.manifest/schema.yaml +1 -0
- package/source/.provider/form.js +1 -1
- package/source/annotation.fixtures.js +1 -0
- package/source/aspect.fixtures.js +2 -3
- package/source/aspect.test.js +1 -2
- package/source/factory.js +3 -3
- package/source/manifest.test.js +0 -6
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@toa.io/extensions.configuration",
|
|
3
|
-
"version": "1.1.0-dev.
|
|
3
|
+
"version": "1.1.0-dev.10",
|
|
4
4
|
"description": "Toa Configuration",
|
|
5
5
|
"author": "temich <tema.gurtovoy@gmail.com>",
|
|
6
6
|
"homepage": "https://github.com/toa-io/toa#readme",
|
|
@@ -16,11 +16,11 @@
|
|
|
16
16
|
"access": "public"
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
19
|
-
"@toa.io/core": "1.1.0-dev.
|
|
20
|
-
"@toa.io/generic": "0.11.0-dev.
|
|
21
|
-
"@toa.io/schema": "0.7.6-dev.
|
|
22
|
-
"@toa.io/yaml": "0.7.6-dev.
|
|
19
|
+
"@toa.io/core": "1.1.0-dev.10",
|
|
20
|
+
"@toa.io/generic": "0.11.0-dev.10",
|
|
21
|
+
"@toa.io/schema": "0.7.6-dev.10",
|
|
22
|
+
"@toa.io/yaml": "0.7.6-dev.10",
|
|
23
23
|
"clone-deep": "4.0.1"
|
|
24
24
|
},
|
|
25
|
-
"gitHead": "
|
|
25
|
+
"gitHead": "df6df35ff3e9f2d9416118a979d3885a8a1cd897"
|
|
26
26
|
}
|
|
@@ -21,7 +21,7 @@ const convert = (node) => {
|
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
function property (node) {
|
|
24
|
-
if (node === null)
|
|
24
|
+
if (node === null) return { type: 'null', default: null }
|
|
25
25
|
|
|
26
26
|
const type = Array.isArray(node) ? 'array' : typeof node
|
|
27
27
|
|
package/source/.provider/form.js
CHANGED
|
@@ -8,7 +8,7 @@ const { traverse } = require('@toa.io/generic')
|
|
|
8
8
|
*/
|
|
9
9
|
const form = (schema) => {
|
|
10
10
|
const defaults = (node) => {
|
|
11
|
-
if (node.properties !== undefined) return { ...node.properties }
|
|
11
|
+
if (node.type === 'object' && node.properties !== undefined) return { ...node.properties }
|
|
12
12
|
if (node.default !== undefined) return node.default
|
|
13
13
|
|
|
14
14
|
return null
|
|
@@ -3,21 +3,20 @@
|
|
|
3
3
|
const { generate } = require('randomstring')
|
|
4
4
|
|
|
5
5
|
const schema = {
|
|
6
|
+
type: 'object',
|
|
6
7
|
properties: {
|
|
7
8
|
foo: {
|
|
8
9
|
type: 'string',
|
|
9
10
|
default: generate()
|
|
10
11
|
},
|
|
11
12
|
bar: {
|
|
13
|
+
type: 'object',
|
|
12
14
|
properties: {
|
|
13
15
|
baz: {
|
|
14
16
|
type: 'number',
|
|
15
17
|
default: 1
|
|
16
18
|
}
|
|
17
19
|
}
|
|
18
|
-
},
|
|
19
|
-
quu: {
|
|
20
|
-
type: 'number'
|
|
21
20
|
}
|
|
22
21
|
}
|
|
23
22
|
}
|
package/source/aspect.test.js
CHANGED
package/source/factory.js
CHANGED
|
@@ -11,11 +11,11 @@ const { Provider } = require('./provider')
|
|
|
11
11
|
class Factory {
|
|
12
12
|
/**
|
|
13
13
|
* @param {toa.core.Locator} locator
|
|
14
|
-
* @param {toa.schema.JSON | Object}
|
|
14
|
+
* @param {toa.schema.JSON | Object} annotation
|
|
15
15
|
* @return {toa.extensions.configuration.Aspect}
|
|
16
16
|
*/
|
|
17
|
-
aspect (locator,
|
|
18
|
-
const schema = new Schema(
|
|
17
|
+
aspect (locator, annotation) {
|
|
18
|
+
const schema = new Schema(annotation)
|
|
19
19
|
const provider = new Provider(locator, schema)
|
|
20
20
|
const configuration = new Configuration(provider)
|
|
21
21
|
|
package/source/manifest.test.js
CHANGED
|
@@ -120,10 +120,4 @@ describe('normalization', () => {
|
|
|
120
120
|
|
|
121
121
|
expect(() => manifest(concise)).toThrow(/array items type because it's empty/)
|
|
122
122
|
})
|
|
123
|
-
|
|
124
|
-
it('should throw on null', () => {
|
|
125
|
-
const concise = { foo: null }
|
|
126
|
-
|
|
127
|
-
expect(() => manifest(concise)).toThrow(/type of null/)
|
|
128
|
-
})
|
|
129
123
|
})
|