@toa.io/core 1.0.0-alpha.283 → 1.0.0-alpha.286
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 +19 -7
- package/source/assignment.ts +27 -0
- package/{src/call.js → source/call.ts} +16 -21
- package/{src/cascade.js → source/cascade.ts} +6 -8
- package/{src/component.js → source/component.ts} +27 -25
- package/{src/composition.js → source/composition.ts} +9 -3
- package/{src/connector.js → source/connector.ts} +36 -55
- package/source/context.ts +67 -0
- package/source/contract/contract.ts +23 -0
- package/{src/contract/reply.js → source/contract/reply.ts} +26 -19
- package/source/contract/request.ts +85 -0
- package/source/contract/schemas.ts +39 -0
- package/{src/discovery.js → source/discovery.ts} +15 -8
- package/source/effect.ts +14 -0
- package/{src/emission.js → source/emission.ts} +5 -3
- package/source/entities/changeset.ts +37 -0
- package/source/entities/entity.ts +137 -0
- package/source/entities/factory.ts +52 -0
- package/source/entities/index.ts +4 -0
- package/{src/entities/newid.js → source/entities/newid.ts} +1 -1
- package/{src/entities/set.js → source/entities/set.ts} +8 -5
- package/source/event.ts +57 -0
- package/{src/exceptions.js → source/exceptions.ts} +52 -33
- package/source/exposition.ts +33 -0
- package/source/guard.ts +16 -0
- package/{src/index.js → source/index.ts} +8 -0
- package/{src/locator.js → source/locator.ts} +17 -30
- package/source/observation.ts +16 -0
- package/source/operation.ts +138 -0
- package/{src/outbox/outbox.js → source/outbox/outbox.ts} +95 -51
- package/source/query/criteria.ts +90 -0
- package/source/query/options.ts +35 -0
- package/{src/query.js → source/query.ts} +14 -17
- package/source/receiver.ts +120 -0
- package/source/reflection.ts +20 -0
- package/source/remote.ts +20 -0
- package/source/state.ts +179 -0
- package/source/transition.ts +79 -0
- package/{src/transmission.js → source/transmission.ts} +8 -8
- package/source/types/atomicity.ts +63 -0
- package/source/types/bindings.ts +59 -0
- package/source/types/bridges.ts +54 -0
- package/source/types/extensions.ts +89 -0
- package/{types → source/types}/index.ts +9 -16
- package/{types/message.d.ts → source/types/message.ts} +2 -1
- package/source/types/operations.ts +31 -0
- package/source/types/outbox.ts +35 -0
- package/source/types/receiver.ts +10 -0
- package/{types/request.d.ts → source/types/request.ts} +8 -9
- package/source/types/state.ts +9 -0
- package/source/types/storages.ts +129 -0
- package/source/unmanaged.ts +8 -0
- package/test/call.fixtures.js +3 -1
- package/test/call.test.js +28 -7
- package/test/component.test.js +10 -5
- package/test/connector.fixtures.js +7 -7
- package/test/connector.test.js +15 -2
- package/test/context.fixtures.js +1 -1
- package/test/context.test.js +4 -4
- package/test/contract/conditions.test.js +6 -2
- package/test/contract/contract.fixtures.js +3 -4
- package/test/contract/request.test.js +68 -34
- package/test/discovery.test.js +10 -3
- package/test/emission.test.js +16 -8
- package/test/entities/entity.fixtures.js +5 -6
- package/test/entities/entity.test.js +54 -20
- package/test/entities/factory.fixtures.js +11 -10
- package/test/entities/factory.test.js +47 -10
- package/test/entities/set.test.js +1 -1
- package/test/event.test.js +29 -11
- package/test/locator.test.js +10 -4
- package/test/outbox.test.js +95 -14
- package/test/query.test.js +76 -7
- package/test/receiver.fixtures.js +2 -2
- package/test/receiver.test.js +53 -27
- package/test/reflection.test.js +3 -3
- package/test/state.fixtures.js +10 -3
- package/test/state.test.js +77 -14
- package/test/transmission.test.js +25 -12
- package/transpiled/assignment.d.ts +6 -0
- package/transpiled/assignment.js +20 -0
- package/transpiled/assignment.js.map +1 -0
- package/transpiled/call.d.ts +10 -0
- package/transpiled/call.js +52 -0
- package/transpiled/call.js.map +1 -0
- package/transpiled/cascade.d.ts +7 -0
- package/transpiled/cascade.js +28 -0
- package/transpiled/cascade.js.map +1 -0
- package/transpiled/component.d.ts +15 -0
- package/transpiled/component.js +61 -0
- package/transpiled/component.js.map +1 -0
- package/transpiled/composition.d.ts +6 -0
- package/transpiled/composition.js +23 -0
- package/transpiled/composition.js.map +1 -0
- package/transpiled/connector.d.ts +47 -0
- package/transpiled/connector.js +143 -0
- package/transpiled/connector.js.map +1 -0
- package/transpiled/context.d.ts +18 -0
- package/transpiled/context.js +41 -0
- package/transpiled/context.js.map +1 -0
- package/transpiled/contract/contract.d.ts +10 -0
- package/transpiled/contract/contract.js +14 -0
- package/transpiled/contract/contract.js.map +1 -0
- package/transpiled/contract/index.d.ts +2 -0
- package/transpiled/contract/index.js +3 -0
- package/transpiled/contract/index.js.map +1 -0
- package/transpiled/contract/reply.d.ts +7 -0
- package/transpiled/contract/reply.js +48 -0
- package/transpiled/contract/reply.js.map +1 -0
- package/transpiled/contract/request.d.ts +24 -0
- package/transpiled/contract/request.js +59 -0
- package/transpiled/contract/request.js.map +1 -0
- package/transpiled/contract/schemas.d.ts +4 -0
- package/transpiled/contract/schemas.js +36 -0
- package/transpiled/contract/schemas.js.map +1 -0
- package/transpiled/discovery.d.ts +12 -0
- package/transpiled/discovery.js +34 -0
- package/transpiled/discovery.js.map +1 -0
- package/transpiled/effect.d.ts +5 -0
- package/transpiled/effect.js +11 -0
- package/transpiled/effect.js.map +1 -0
- package/transpiled/emission.d.ts +8 -0
- package/transpiled/emission.js +14 -0
- package/transpiled/emission.js.map +1 -0
- package/transpiled/entities/changeset.d.ts +10 -0
- package/transpiled/entities/changeset.js +27 -0
- package/transpiled/entities/changeset.js.map +1 -0
- package/transpiled/entities/entity.d.ts +19 -0
- package/transpiled/entities/entity.js +109 -0
- package/transpiled/entities/entity.js.map +1 -0
- package/transpiled/entities/factory.d.ts +22 -0
- package/transpiled/entities/factory.js +34 -0
- package/transpiled/entities/factory.js.map +1 -0
- package/transpiled/entities/index.d.ts +4 -0
- package/transpiled/entities/index.js +5 -0
- package/transpiled/entities/index.js.map +1 -0
- package/transpiled/entities/newid.d.ts +1 -0
- package/transpiled/entities/newid.js +7 -0
- package/transpiled/entities/newid.js.map +1 -0
- package/transpiled/entities/set.d.ts +10 -0
- package/transpiled/entities/set.js +19 -0
- package/transpiled/entities/set.js.map +1 -0
- package/transpiled/event.d.ts +14 -0
- package/transpiled/event.js +38 -0
- package/transpiled/event.js.map +1 -0
- package/transpiled/exceptions.d.ts +61 -0
- package/transpiled/exceptions.js +93 -0
- package/transpiled/exceptions.js.map +1 -0
- package/transpiled/exposition.d.ts +18 -0
- package/transpiled/exposition.js +18 -0
- package/transpiled/exposition.js.map +1 -0
- package/transpiled/guard.d.ts +7 -0
- package/transpiled/guard.js +12 -0
- package/transpiled/guard.js.map +1 -0
- package/transpiled/index.d.ts +35 -0
- package/transpiled/index.js +29 -0
- package/transpiled/index.js.map +1 -0
- package/transpiled/locator.d.ts +12 -0
- package/transpiled/locator.js +32 -0
- package/transpiled/locator.js.map +1 -0
- package/transpiled/observation.d.ts +5 -0
- package/transpiled/observation.js +12 -0
- package/transpiled/observation.js.map +1 -0
- package/transpiled/operation.d.ts +49 -0
- package/transpiled/operation.js +77 -0
- package/transpiled/operation.js.map +1 -0
- package/transpiled/outbox/index.d.ts +1 -0
- package/transpiled/outbox/index.js +2 -0
- package/transpiled/outbox/index.js.map +1 -0
- package/transpiled/outbox/outbox.d.ts +46 -0
- package/transpiled/outbox/outbox.js +267 -0
- package/transpiled/outbox/outbox.js.map +1 -0
- package/transpiled/query/criteria.d.ts +6 -0
- package/transpiled/query/criteria.js +74 -0
- package/transpiled/query/criteria.js.map +1 -0
- package/transpiled/query/options.d.ts +3 -0
- package/transpiled/query/options.js +27 -0
- package/transpiled/query/options.js.map +1 -0
- package/transpiled/query.d.ts +9 -0
- package/transpiled/query.js +57 -0
- package/transpiled/query.js.map +1 -0
- package/transpiled/receiver.d.ts +20 -0
- package/transpiled/receiver.js +92 -0
- package/transpiled/receiver.js.map +1 -0
- package/transpiled/reflection.d.ts +9 -0
- package/transpiled/reflection.js +13 -0
- package/transpiled/reflection.js.map +1 -0
- package/transpiled/remote.d.ts +10 -0
- package/transpiled/remote.js +12 -0
- package/transpiled/remote.js.map +1 -0
- package/transpiled/state.d.ts +33 -0
- package/transpiled/state.js +126 -0
- package/transpiled/state.js.map +1 -0
- package/transpiled/transition.d.ts +14 -0
- package/transpiled/transition.js +51 -0
- package/transpiled/transition.js.map +1 -0
- package/transpiled/transmission.d.ts +8 -0
- package/transpiled/transmission.js +30 -0
- package/transpiled/transmission.js.map +1 -0
- package/transpiled/types/atomicity.d.ts +56 -0
- package/transpiled/types/atomicity.js +2 -0
- package/transpiled/types/atomicity.js.map +1 -0
- package/transpiled/types/bindings.d.ts +42 -0
- package/transpiled/types/bindings.js +2 -0
- package/transpiled/types/bindings.js.map +1 -0
- package/transpiled/types/bridges.d.ts +38 -0
- package/transpiled/types/bridges.js +2 -0
- package/transpiled/types/bridges.js.map +1 -0
- package/transpiled/types/extensions.d.ts +62 -0
- package/transpiled/types/extensions.js +2 -0
- package/transpiled/types/extensions.js.map +1 -0
- package/transpiled/types/index.d.ts +13 -0
- package/transpiled/types/index.js +8 -0
- package/transpiled/types/index.js.map +1 -0
- package/transpiled/types/message.d.ts +5 -0
- package/transpiled/types/message.js +2 -0
- package/transpiled/types/message.js.map +1 -0
- package/transpiled/types/operations.d.ts +15 -0
- package/transpiled/types/operations.js +2 -0
- package/transpiled/types/operations.js.map +1 -0
- package/transpiled/types/outbox.d.ts +28 -0
- package/transpiled/types/outbox.js +2 -0
- package/transpiled/types/outbox.js.map +1 -0
- package/transpiled/types/receiver.d.ts +9 -0
- package/transpiled/types/receiver.js +2 -0
- package/transpiled/types/receiver.js.map +1 -0
- package/transpiled/types/request.d.ts +55 -0
- package/transpiled/types/request.js +2 -0
- package/transpiled/types/request.js.map +1 -0
- package/transpiled/types/state.d.ts +9 -0
- package/transpiled/types/state.js +2 -0
- package/transpiled/types/state.js.map +1 -0
- package/transpiled/types/storages.d.ts +106 -0
- package/transpiled/types/storages.js +2 -0
- package/transpiled/types/storages.js.map +1 -0
- package/transpiled/unmanaged.d.ts +5 -0
- package/transpiled/unmanaged.js +7 -0
- package/transpiled/unmanaged.js.map +1 -0
- package/tsconfig.json +10 -0
- package/tsconfig.tsbuildinfo +1 -0
- package/CHANGELOG.md +0 -180
- package/src/assignment.js +0 -28
- package/src/context.js +0 -57
- package/src/contract/contract.js +0 -18
- package/src/contract/request.js +0 -77
- package/src/contract/schemas/error.yaml +0 -9
- package/src/contract/schemas/index.js +0 -11
- package/src/contract/schemas/query.yaml +0 -43
- package/src/contract/schemas/source.yaml +0 -23
- package/src/effect.js +0 -15
- package/src/entities/changeset.js +0 -36
- package/src/entities/entity.js +0 -119
- package/src/entities/factory.js +0 -40
- package/src/entities/index.js +0 -1
- package/src/event.js +0 -54
- package/src/exposition.js +0 -24
- package/src/guard.js +0 -13
- package/src/observation.js +0 -8
- package/src/operation.js +0 -95
- package/src/query/criteria.js +0 -37
- package/src/query/options.js +0 -37
- package/src/receiver.js +0 -123
- package/src/reflection.js +0 -24
- package/src/remote.js +0 -14
- package/src/state.js +0 -138
- package/src/transition.js +0 -61
- package/src/unmanaged.js +0 -7
- package/types/atomicity.d.ts +0 -58
- package/types/bindings.d.ts +0 -42
- package/types/bridges.ts +0 -33
- package/types/call.d.ts +0 -13
- package/types/component.d.ts +0 -12
- package/types/connector.d.ts +0 -18
- package/types/context.d.ts +0 -24
- package/types/entity.d.ts +0 -46
- package/types/event.d.ts +0 -11
- package/types/exception.d.ts +0 -4
- package/types/extensions.d.ts +0 -73
- package/types/guard.d.ts +0 -5
- package/types/locator.d.ts +0 -13
- package/types/operations.d.ts +0 -8
- package/types/outbox.d.ts +0 -53
- package/types/query.d.ts +0 -17
- package/types/receiver.d.ts +0 -12
- package/types/reflection.d.ts +0 -14
- package/types/remote.d.ts +0 -18
- package/types/state.d.ts +0 -38
- package/types/storages.d.ts +0 -96
- /package/{src/contract/index.js → source/contract/index.ts} +0 -0
- /package/{src/outbox/index.js → source/outbox/index.ts} +0 -0
package/types/query.d.ts
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
declare namespace toa.core {
|
|
2
|
-
|
|
3
|
-
type Query = {
|
|
4
|
-
id?: string
|
|
5
|
-
version?: number
|
|
6
|
-
criteria?: Object
|
|
7
|
-
search?: string
|
|
8
|
-
sample?: number
|
|
9
|
-
omit?: number
|
|
10
|
-
limit?: number
|
|
11
|
-
sort?: string[]
|
|
12
|
-
projection?: string[]
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
export type Query = toa.core.Query
|
package/types/receiver.d.ts
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import * as _message from './message.js'
|
|
2
|
-
import * as _connector from './connector.js'
|
|
3
|
-
|
|
4
|
-
declare namespace toa.core {
|
|
5
|
-
|
|
6
|
-
interface Receiver extends _connector.Connector {
|
|
7
|
-
receive(message: _message.Message): Promise<void>
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export type Receiver = toa.core.Receiver
|
package/types/reflection.d.ts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import * as _core from './connector.js'
|
|
2
|
-
|
|
3
|
-
declare namespace toa.core {
|
|
4
|
-
|
|
5
|
-
namespace reflection {
|
|
6
|
-
type Source = () => Promise<any>
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
interface Reflection<T> extends _core.Connector {
|
|
10
|
-
value: T
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export type Source = toa.core.reflection.Source
|
package/types/remote.d.ts
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { Component } from './component.js'
|
|
2
|
-
|
|
3
|
-
export class Remote extends Component {
|
|
4
|
-
explain (endpoint: string): Promise<Explanation>
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
interface Explanation {
|
|
8
|
-
input: Schema | null
|
|
9
|
-
output: Schema | null
|
|
10
|
-
errors?: string[]
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
interface Schema {
|
|
14
|
-
type: string
|
|
15
|
-
properties: {
|
|
16
|
-
[key: string]: Schema
|
|
17
|
-
}
|
|
18
|
-
}
|
package/types/state.d.ts
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import * as _entity from './entity.js'
|
|
2
|
-
import * as _storages from './storages.js'
|
|
3
|
-
|
|
4
|
-
declare namespace toa.core {
|
|
5
|
-
|
|
6
|
-
namespace transition {
|
|
7
|
-
|
|
8
|
-
type Event<State = Object, Trailers = Object> = {
|
|
9
|
-
/** the pre-image; null when the entity did not exist before */
|
|
10
|
-
origin: State | null
|
|
11
|
-
state: State
|
|
12
|
-
/** out-of-band values an algorithm wrote into `state._trailers`; must be serializable */
|
|
13
|
-
trailers?: Trailers
|
|
14
|
-
input?: Object
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
interface State {
|
|
20
|
-
init(id: string): _entity.Entity
|
|
21
|
-
|
|
22
|
-
object(query: _storages.Query, mutable?: boolean): Promise<_entity.Entity>
|
|
23
|
-
|
|
24
|
-
objects(query: _storages.Query, mutable?: boolean): Promise<_entity.Entity[]>
|
|
25
|
-
|
|
26
|
-
changeset(query: _storages.Query): _entity.Changeset
|
|
27
|
-
|
|
28
|
-
none(): null
|
|
29
|
-
|
|
30
|
-
commit(entity: _entity.Entity, input?: Object): Promise<boolean>
|
|
31
|
-
|
|
32
|
-
apply(changeset: _entity.Changeset, input?: Object): Promise<_storages.Record>
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
export type State = toa.core.State
|
|
38
|
-
export type Event<State = Object, Trailers = Object> = toa.core.transition.Event<State, Trailers>
|
package/types/storages.d.ts
DELETED
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
// noinspection ES6UnusedImports
|
|
2
|
-
|
|
3
|
-
import { Locator } from './locator.js'
|
|
4
|
-
import { Connector } from './connector.js'
|
|
5
|
-
import * as outbox from './outbox.js'
|
|
6
|
-
|
|
7
|
-
declare namespace toa.core {
|
|
8
|
-
|
|
9
|
-
namespace storages {
|
|
10
|
-
namespace ast {
|
|
11
|
-
|
|
12
|
-
interface Node {
|
|
13
|
-
type: 'LOGIC' | 'COMPARISON' | 'SELECTOR' | 'VALUE'
|
|
14
|
-
left?: Node
|
|
15
|
-
right?: Node
|
|
16
|
-
operator?: string
|
|
17
|
-
selector?: string
|
|
18
|
-
value?: string
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
interface Record {
|
|
24
|
-
id: string
|
|
25
|
-
_version: number
|
|
26
|
-
|
|
27
|
-
[key: string]: any
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
interface Query {
|
|
31
|
-
id?: string
|
|
32
|
-
version?: number
|
|
33
|
-
criteria?: ast.Node
|
|
34
|
-
search?: string
|
|
35
|
-
sample?: number
|
|
36
|
-
options?: Object
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
interface Migration {
|
|
40
|
-
disconnect (): Promise<void>
|
|
41
|
-
|
|
42
|
-
database (name: string): Promise<void>
|
|
43
|
-
|
|
44
|
-
table (database: string, locator: Locator, schema: Object, reset?: boolean): Promise<string>
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
interface Options {
|
|
48
|
-
/** whether this component publishes anything, and so needs an outbox */
|
|
49
|
-
outbox?: boolean
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
interface Factory {
|
|
53
|
-
storage (locator: Locator, properties?: object, options?: Options): Storage
|
|
54
|
-
|
|
55
|
-
migration? (driver?: string): Migration
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
interface Storage extends Connector {
|
|
60
|
-
// object observation
|
|
61
|
-
get? (query: storages.Query): Promise<storages.Record | null>
|
|
62
|
-
|
|
63
|
-
// objects observation
|
|
64
|
-
find? (query: storages.Query): Promise<storages.Record[]>
|
|
65
|
-
|
|
66
|
-
// commit
|
|
67
|
-
store? (record: storages.Record, row?: outbox.Row): Promise<boolean>
|
|
68
|
-
|
|
69
|
-
// mass commit
|
|
70
|
-
massStore? (records: storages.Record[], rows?: outbox.Row[]): Promise<boolean>
|
|
71
|
-
|
|
72
|
-
// assignment
|
|
73
|
-
upsert? (query: storages.Query, changeset: Object, row?: outbox.Row): Promise<storages.Record>
|
|
74
|
-
|
|
75
|
-
// atomic get-or-create
|
|
76
|
-
ensure? (query: storages.Query, properties: Object, record: storages.Record, row?: outbox.Row): Promise<storages.Record>
|
|
77
|
-
|
|
78
|
-
/**
|
|
79
|
-
* Present only where a row can be committed atomically with the entity. Its absence is
|
|
80
|
-
* what makes the runtime fall back to publishing inline, so a storage that cannot do
|
|
81
|
-
* this must not offer it: a row written outside the transaction would be a second write
|
|
82
|
-
* with a crash window in front of it, which is the defect the outbox exists to close.
|
|
83
|
-
*
|
|
84
|
-
* The row schema is the connector's own — it also owns `pending` and `settle` — and
|
|
85
|
-
* never crosses this boundary.
|
|
86
|
-
*/
|
|
87
|
-
outbox?: outbox.Storage
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
export type Storage = toa.core.Storage
|
|
93
|
-
export type Record = toa.core.storages.Record
|
|
94
|
-
export type Factory = toa.core.storages.Factory
|
|
95
|
-
export type Query = toa.core.storages.Query
|
|
96
|
-
export type Migration = toa.core.storages.Migration
|
|
File without changes
|
|
File without changes
|