@toa.io/core 0.24.0-alpha.22 → 0.24.0-alpha.23

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/core",
3
- "version": "0.24.0-alpha.22",
3
+ "version": "0.24.0-alpha.23",
4
4
  "description": "Toa Core",
5
5
  "author": "temich <tema.gurtovoy@gmail.com>",
6
6
  "homepage": "https://github.com/toa-io/toa#readme",
@@ -12,7 +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
+ "types": "types/index.ts",
16
16
  "publishConfig": {
17
17
  "access": "public"
18
18
  },
@@ -21,13 +21,13 @@
21
21
  },
22
22
  "dependencies": {
23
23
  "@rsql/parser": "1.2.4",
24
- "@toa.io/console": "0.24.0-alpha.22",
25
- "@toa.io/generic": "0.24.0-alpha.22",
26
- "@toa.io/yaml": "0.24.0-alpha.22",
24
+ "@toa.io/console": "0.24.0-alpha.23",
25
+ "@toa.io/generic": "0.24.0-alpha.23",
26
+ "@toa.io/yaml": "0.24.0-alpha.23",
27
27
  "error-value": "0.3.0"
28
28
  },
29
29
  "devDependencies": {
30
30
  "clone-deep": "4.0.1"
31
31
  },
32
- "gitHead": "9680eca8da28019924a4c7cac5d803954d6c6936"
32
+ "gitHead": "df9de3cbb530e8f985a660bca0bf65bd027dbb01"
33
33
  }
@@ -0,0 +1,30 @@
1
+ import type { Request, Reply } from './request'
2
+ import type { Context } from './context'
3
+
4
+ export interface Algorithm {
5
+ mount: (context?: Context) => Promise<void>
6
+
7
+ execute: ((input: any, scope: object | object[]) => Promise<Reply>) |
8
+ ((input: any) => Promise<Reply>) |
9
+ (() => Promise<Reply>)
10
+ }
11
+
12
+ export interface Event {
13
+ condition: (object: object) => Promise<boolean>
14
+
15
+ payload: (object: object) => Promise<object>
16
+ }
17
+
18
+ export interface Receiver {
19
+ condition: (object: object) => Promise<boolean>
20
+
21
+ request: (object: object) => Promise<Request>
22
+ }
23
+
24
+ export interface Factory {
25
+ algorithm?: (path: string, name: string, context: Context) => Algorithm
26
+
27
+ event?: (path: string, label: string) => Event
28
+
29
+ receiver?: (path: string, label: string) => Receiver
30
+ }
@@ -3,25 +3,19 @@ import * as _reply from './reply'
3
3
  import * as _extensions from './extensions'
4
4
  import * as _connector from './connector'
5
5
 
6
- declare namespace toa.core {
6
+ export interface Context extends _connector.Connector{
7
+ aspects: _extensions.Aspect[]
7
8
 
8
- interface Context extends _connector.Connector {
9
- aspects: _extensions.Aspect[]
9
+ /**
10
+ * Calls local endpoint
11
+ */
12
+ apply (endpoint: string, request: _request.Request): Promise<_reply.Reply>
10
13
 
11
- /**
12
- * Calls local endpoint
13
- */
14
- apply(endpoint: string, request: _request.Request): Promise<_reply.Reply>
15
-
16
- /**
17
- * Calls remote endpoint
18
- */
19
- call(namespace: string, name: string, endpoint: string, request: _request.Request): Promise<_reply.Reply>
20
-
21
- // shortcuts
22
- [key: string]: any
23
- }
14
+ /**
15
+ * Calls remote endpoint
16
+ */
17
+ call (namespace: string, name: string, endpoint: string, request: _request.Request): Promise<_reply.Reply>
24
18
 
19
+ // shortcuts
20
+ [key: string]: any
25
21
  }
26
-
27
- export type Context = toa.core.Context
@@ -4,11 +4,11 @@ export * as storages from './storages'
4
4
  export * as bridges from './bridges'
5
5
  export * as operations from './operations'
6
6
 
7
- export { Component } from './component'
7
+ export type { Component } from './component'
8
8
  export { Connector } from './connector'
9
- export { Context } from './context'
10
- export { Exception } from './exception'
9
+ export type { Context } from './context'
10
+ export type { Exception } from './exception'
11
11
  export { Locator } from './locator'
12
- export { Receiver } from './receiver'
13
- export { Message } from './message'
14
- export { Request, Query, Reply } from './request'
12
+ export type { Receiver } from './receiver'
13
+ export type { Message } from './message'
14
+ export type { Request, Query, Reply } from './request'
@@ -1,41 +0,0 @@
1
- import * as _core from '@toa.io/core/types'
2
- import type * as reply from './reply'
3
- import type * as context from './context'
4
- import type * as connector from './connector'
5
-
6
- declare namespace toa.core.bridges {
7
-
8
- interface Algorithm extends connector.Connector {
9
- mount(context?: context.Context): Promise<void>
10
-
11
- execute(input: any, scope: object | object[]): Promise<reply.Reply>
12
-
13
- execute(input: any): Promise<reply.Reply>
14
-
15
- execute(): Promise<reply.Reply>
16
- }
17
-
18
- interface Event {
19
- condition(object): Promise<boolean>
20
-
21
- payload(object): Promise<object>
22
- }
23
-
24
- interface Receiver {
25
- condition(object): Promise<boolean>
26
-
27
- request(object): Promise<_core.Request>
28
- }
29
-
30
- interface Factory {
31
- algorithm(path: string, name: string, context: context.Context): Algorithm
32
-
33
- event(path: string, label: string): Event
34
-
35
- receiver(path: string, label: string): Receiver
36
- }
37
-
38
- }
39
-
40
- export type Algorithm = toa.core.bridges.Algorithm
41
- export type Factory = toa.core.bridges.Factory