@toa.io/norm 1.0.0-alpha.251 → 1.0.0-alpha.253

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.251",
3
+ "version": "1.0.0-alpha.253",
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,10 +20,10 @@
20
20
  "test": "echo \"Error: run tests from root\" && exit 1"
21
21
  },
22
22
  "dependencies": {
23
- "@toa.io/core": "1.0.0-alpha.251",
23
+ "@toa.io/core": "1.0.0-alpha.252",
24
24
  "@toa.io/generic": "1.0.0-alpha.225",
25
25
  "@toa.io/schemas": "1.0.0-alpha.246",
26
26
  "@toa.io/yaml": "1.0.0-alpha.246"
27
27
  },
28
- "gitHead": "c3857e14dde3a910fe28d41a5a97a960c15beba3"
28
+ "gitHead": "ca97991a1c8a6e770a51e0899b0c5dbeacbb89ed"
29
29
  }
@@ -10,12 +10,10 @@ function extensions (manifest) {
10
10
  const SHORTCUTS = {
11
11
  exposition: '@toa.io/extensions.exposition',
12
12
  realtime: '@toa.io/extensions.realtime',
13
- origins: '@toa.io/extensions.origins',
14
13
  configuration: '@toa.io/extensions.configuration',
15
14
  state: '@toa.io/extensions.state',
16
15
  stash: '@toa.io/extensions.stash',
17
- storages: '@toa.io/extensions.storages',
18
- mail: '@toa.io/extensions.mail'
16
+ storages: '@toa.io/extensions.storages'
19
17
  }
20
18
 
21
19
  exports.extensions = extensions
@@ -6,10 +6,7 @@ const { resolve } = require('../shortcuts')
6
6
  const cache = {}
7
7
 
8
8
  const extensions = (manifest) => {
9
- if (manifest.extensions === undefined)
10
- manifest.extensions = PREDEFINED
11
- else
12
- manifest.extensions = Object.assign({}, PREDEFINED, manifest.extensions)
9
+ manifest.extensions = Object.assign({}, PREDEFINED, manifest.extensions)
13
10
 
14
11
  const extensions = manifest.extensions
15
12
 
@@ -36,7 +33,8 @@ const extensions = (manifest) => {
36
33
  }
37
34
 
38
35
  const PREDEFINED = {
39
- '@toa.io/extensions.telemetry': null
36
+ '@toa.io/extensions.telemetry': null,
37
+ '@toa.io/extensions.fetch': null
40
38
  }
41
39
 
42
40
  exports.extensions = extensions
package/src/shortcuts.js CHANGED
@@ -48,11 +48,9 @@ const SHORTCUTS = {
48
48
  exposition: '@toa.io/extensions.exposition',
49
49
  realtime: '@toa.io/extensions.realtime',
50
50
  configuration: '@toa.io/extensions.configuration',
51
- origins: '@toa.io/extensions.origins',
52
51
  stash: '@toa.io/extensions.stash',
53
52
  storages: '@toa.io/extensions.storages',
54
- telemetry: '@toa.io/extensions.telemetry',
55
- mail: '@toa.io/extensions.mail'
53
+ telemetry: '@toa.io/extensions.telemetry'
56
54
  }
57
55
 
58
56
  exports.recognize = recognize
@@ -1,9 +1,7 @@
1
1
  'use strict'
2
-
3
- const { dirname } = require('node:path')
4
2
  const clone = require('clone-deep')
5
3
 
6
- const { normalize } = require('../../src/.component')
4
+ const { normalize, extensions } = require('../../src/.component')
7
5
  const fixtures = require('./normalize.fixtures')
8
6
 
9
7
  let manifest
@@ -21,13 +19,22 @@ describe('operations', () => {
21
19
  })
22
20
 
23
21
  describe('extensions', () => {
24
- it('should resolve absolute references', () => {
25
- const origins = manifest.extensions['@toa.io/extensions.origins']
26
- const path = dirname(require.resolve('@toa.io/extensions.origins/package.json'))
22
+ it('should add predefined extensions', () => {
23
+ extensions(manifest)
27
24
 
28
- normalize(manifest)
25
+ expect(manifest.extensions['@toa.io/extensions.telemetry']).toBeNull()
26
+ expect(manifest.extensions['@toa.io/extensions.fetch']).toBeNull()
27
+ })
29
28
 
30
- expect(manifest.extensions[path]).toStrictEqual(origins)
29
+ it('should add predefined extensions without explicit declarations', () => {
30
+ delete manifest.extensions
31
+
32
+ extensions(manifest)
33
+
34
+ expect(manifest.extensions).toStrictEqual({
35
+ '@toa.io/extensions.telemetry': null,
36
+ '@toa.io/extensions.fetch': null
37
+ })
31
38
  })
32
39
  })
33
40