@toa.io/norm 0.20.0-dev.17 → 0.20.0-dev.19

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": "0.20.0-dev.17",
3
+ "version": "0.20.0-dev.19",
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",
@@ -12,6 +12,7 @@
12
12
  "url": "https://github.com/toa-io/toa/issues"
13
13
  },
14
14
  "main": "src/index.js",
15
+ "types": "types/index.d.ts",
15
16
  "publishConfig": {
16
17
  "access": "public"
17
18
  },
@@ -19,11 +20,11 @@
19
20
  "test": "echo \"Error: run tests from root\" && exit 1"
20
21
  },
21
22
  "dependencies": {
22
- "@toa.io/core": "0.20.0-dev.17",
23
- "@toa.io/generic": "0.20.0-dev.17",
24
- "@toa.io/schema": "0.20.0-dev.17",
25
- "@toa.io/schemas": "0.20.0-dev.17",
26
- "@toa.io/yaml": "0.20.0-dev.17"
23
+ "@toa.io/core": "0.20.0-dev.19",
24
+ "@toa.io/generic": "0.20.0-dev.19",
25
+ "@toa.io/schema": "0.20.0-dev.19",
26
+ "@toa.io/schemas": "0.20.0-dev.19",
27
+ "@toa.io/yaml": "0.20.0-dev.19"
27
28
  },
28
- "gitHead": "cafb719d8e80d3e78a00904dc6ab6d6b0d5b568b"
29
+ "gitHead": "e10214f746cf4fc699af42dba90e099487177a43"
29
30
  }
@@ -10,7 +10,8 @@ function extensions (manifest) {
10
10
  const SHORTCUTS = {
11
11
  exposition: '@toa.io/extensions.exposition',
12
12
  origins: '@toa.io/extensions.origins',
13
- configuration: '@toa.io/extensions.configuration'
13
+ configuration: '@toa.io/extensions.configuration',
14
+ stash: '@toa.io/extensions.stash'
14
15
  }
15
16
 
16
17
  exports.extensions = extensions
@@ -1,10 +1,8 @@
1
1
  'use strict'
2
2
 
3
- const { convolve } = require('@toa.io/generic')
4
3
  const { events, operations, extensions, receivers } = require('./.normalize')
5
4
 
6
5
  const normalize = (component, environment) => {
7
- convolve(component, environment)
8
6
  operations(component)
9
7
  events(component)
10
8
  receivers(component)
package/src/shortcuts.js CHANGED
@@ -47,7 +47,8 @@ const SHORTCUTS = {
47
47
  queues: '@toa.io/storages.queues',
48
48
  exposition: '@toa.io/extensions.exposition',
49
49
  configuration: '@toa.io/extensions.configuration',
50
- origins: '@toa.io/extensions.origins'
50
+ origins: '@toa.io/extensions.origins',
51
+ stash: '@toa.io/extensions.stash'
51
52
  }
52
53
 
53
54
  exports.recognize = recognize
@@ -12,13 +12,6 @@ beforeEach(() => {
12
12
  manifest = clone(fixtures.operations)
13
13
  })
14
14
 
15
- describe('environment', () => {
16
- it('should convolve with environment argument', () => {
17
- normalize(manifest, 'local')
18
- expect(manifest.operations.add.bindings).toStrictEqual(['foo'])
19
- })
20
- })
21
-
22
15
  describe('operations', () => {
23
16
  it('should set default bindings', () => {
24
17
  normalize(manifest)
@@ -0,0 +1,17 @@
1
+ import { Composition, Registry, Runtime } from '../context'
2
+
3
+ interface Composition {
4
+ name: string,
5
+ components: string[]
6
+ }
7
+
8
+ export interface Declaration {
9
+ name: string
10
+ description?: string
11
+ version?: string
12
+ runtime?: Runtime | string
13
+ registry?: Registry | string
14
+ packages?: string
15
+ compositions?: Composition[]
16
+ annotations?: Record<string, object>
17
+ }
@@ -1,77 +1,40 @@
1
1
  import * as _component from './component'
2
2
  import { Locator } from '@toa.io/core/types'
3
+ import type { Declaration } from './context/declaration'
3
4
 
4
- declare namespace toa.norm {
5
-
6
- namespace context {
7
-
8
- interface Runtime {
9
- version: string
10
- registry?: string
11
- proxy?: string
12
- }
13
-
14
- interface Registry {
15
- base?: string
16
- platforms?: string[] | null
17
- build?: {
18
- arguments?: string[]
19
- run?: string
20
- },
21
- credentials: string
22
- }
23
-
24
- interface Composition {
25
- name: string,
26
- components: string[] | _component.Component[]
27
- }
28
-
29
- namespace dependencies {
30
-
31
- type Instance = {
32
- locator: Locator
33
- manifest?: Object
34
- }
35
-
36
- type References = {
37
- [reference: string]: _component.Component[]
38
- }
39
-
40
- }
41
-
42
- interface Dependencies {
43
- [reference: string]: dependencies.Instance[]
44
- }
45
-
46
- interface Declaration {
47
- name: string
48
- description?: string
49
- version?: string
50
- runtime?: Runtime | string
51
- registry?: Registry | string
52
- packages?: string
53
- compositions?: Composition[]
54
- annotations?: Record<string, object>
55
- }
56
-
57
- type Constructor = (path: string, environment?: string) => Promise<Context>
58
- }
5
+ interface Runtime {
6
+ version: string
7
+ registry?: string
8
+ proxy?: string
9
+ }
59
10
 
60
- interface Context extends context.Declaration {
61
- runtime?: context.Runtime
62
- environment?: string
63
- registry?: context.Registry
64
- components?: _component.Component[]
65
- dependencies?: context.Dependencies
66
- }
11
+ interface Registry {
12
+ base?: string
13
+ platforms?: string[] | null
14
+ build?: {
15
+ arguments?: string[]
16
+ run?: string
17
+ },
18
+ credentials: string
19
+ }
67
20
 
21
+ interface Composition {
22
+ name: string,
23
+ components: _component.Component[]
68
24
  }
69
25
 
70
- export type Composition = toa.norm.context.Composition
71
- export type Context = toa.norm.Context
26
+ export interface Dependency {
27
+ locator: Locator
28
+ manifest?: object
29
+ }
72
30
 
73
- export namespace dependencies {
74
- export type Instance = toa.norm.context.dependencies.Instance
31
+ interface Context extends Declaration {
32
+ runtime?: Runtime
33
+ environment?: string
34
+ registry?: Registry
35
+ compositions?: Composition[]
36
+ components?: _component.Component[]
37
+ dependencies?: Record<string, Dependency[]>
75
38
  }
76
39
 
77
- export const context: toa.norm.context.Constructor
40
+ export function context (path: string, environment?: string): Promise<Context>
package/types/index.d.ts CHANGED
@@ -1,5 +1 @@
1
- export { component } from './component'
2
- export { context } from './context'
3
-
4
- export type { Composition, dependencies } from './context'
5
- export type { Component, Operation } from './component'
1
+ export * as context from './context'