@toa.io/core 1.0.0-alpha.32 → 1.0.0-alpha.321
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 +28 -12
- package/transpiled/abandon.d.ts +9 -0
- package/transpiled/abandon.js +37 -0
- package/transpiled/abandon.js.map +1 -0
- package/transpiled/assignment.d.ts +6 -0
- package/transpiled/assignment.js +25 -0
- package/transpiled/assignment.js.map +1 -0
- package/transpiled/call.d.ts +10 -0
- package/transpiled/call.js +187 -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 +17 -0
- package/transpiled/component.js +151 -0
- package/transpiled/component.js.map +1 -0
- package/transpiled/composition.d.ts +6 -0
- package/transpiled/composition.js +20 -0
- package/transpiled/composition.js.map +1 -0
- package/transpiled/connector.d.ts +71 -0
- package/transpiled/connector.js +248 -0
- package/transpiled/connector.js.map +1 -0
- package/transpiled/context.d.ts +25 -0
- package/transpiled/context.js +55 -0
- package/transpiled/context.js.map +1 -0
- package/transpiled/contract/component.d.ts +37 -0
- package/transpiled/contract/component.js +94 -0
- package/transpiled/contract/component.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 +4 -0
- package/transpiled/contract/index.js +5 -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 +49 -0
- package/transpiled/contract/request.js +152 -0
- package/transpiled/contract/request.js.map +1 -0
- package/transpiled/contract/schemas.d.ts +4 -0
- package/transpiled/contract/schemas.js +38 -0
- package/transpiled/contract/schemas.js.map +1 -0
- package/transpiled/contract/system.d.ts +33 -0
- package/transpiled/contract/system.js +76 -0
- package/transpiled/contract/system.js.map +1 -0
- package/transpiled/deliveries.d.ts +22 -0
- package/transpiled/deliveries.js +31 -0
- package/transpiled/deliveries.js.map +1 -0
- package/transpiled/effect.d.ts +7 -0
- package/transpiled/effect.js +13 -0
- package/transpiled/effect.js.map +1 -0
- package/transpiled/emission.d.ts +10 -0
- package/transpiled/emission.js +16 -0
- package/transpiled/emission.js.map +1 -0
- package/transpiled/encoded.d.ts +16 -0
- package/transpiled/encoded.js +25 -0
- package/transpiled/encoded.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 +137 -0
- package/transpiled/entities/entity.js.map +1 -0
- package/transpiled/entities/factory.d.ts +27 -0
- package/transpiled/entities/factory.js +38 -0
- package/transpiled/entities/factory.js.map +1 -0
- package/transpiled/entities/index.d.ts +5 -0
- package/transpiled/entities/index.js +6 -0
- package/transpiled/entities/index.js.map +1 -0
- package/transpiled/entities/newid.d.ts +11 -0
- package/transpiled/entities/newid.js +41 -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 +20 -0
- package/transpiled/event.js +65 -0
- package/transpiled/event.js.map +1 -0
- package/transpiled/exceptions.d.ts +110 -0
- package/transpiled/exceptions.js +215 -0
- package/transpiled/exceptions.js.map +1 -0
- package/transpiled/gate.d.ts +40 -0
- package/transpiled/gate.js +84 -0
- package/transpiled/gate.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/halting.d.ts +16 -0
- package/transpiled/halting.js +25 -0
- package/transpiled/halting.js.map +1 -0
- package/transpiled/index.d.ts +45 -0
- package/transpiled/index.js +37 -0
- package/transpiled/index.js.map +1 -0
- package/transpiled/instance.d.ts +10 -0
- package/transpiled/instance.js +30 -0
- package/transpiled/instance.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/measurements.d.ts +20 -0
- package/transpiled/measurements.js +40 -0
- package/transpiled/measurements.js.map +1 -0
- package/transpiled/observation.d.ts +7 -0
- package/transpiled/observation.js +14 -0
- package/transpiled/observation.js.map +1 -0
- package/transpiled/operation.d.ts +77 -0
- package/transpiled/operation.js +216 -0
- package/transpiled/operation.js.map +1 -0
- package/transpiled/outbox.d.ts +45 -0
- package/transpiled/outbox.js +448 -0
- package/transpiled/outbox.js.map +1 -0
- package/transpiled/outbox.measurements.d.ts +4 -0
- package/transpiled/outbox.measurements.js +38 -0
- package/transpiled/outbox.measurements.js.map +1 -0
- package/transpiled/parts.d.ts +20 -0
- package/transpiled/parts.js +23 -0
- package/transpiled/parts.js.map +1 -0
- package/transpiled/query/criteria.d.ts +6 -0
- package/transpiled/query/criteria.js +177 -0
- package/transpiled/query/criteria.js.map +1 -0
- package/transpiled/query/options.d.ts +3 -0
- package/transpiled/query/options.js +34 -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 +113 -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/regional.d.ts +22 -0
- package/transpiled/regional.js +55 -0
- package/transpiled/regional.js.map +1 -0
- package/transpiled/remote.d.ts +10 -0
- package/transpiled/remote.js +11 -0
- package/transpiled/remote.js.map +1 -0
- package/transpiled/rendering.d.ts +13 -0
- package/transpiled/rendering.js +21 -0
- package/transpiled/rendering.js.map +1 -0
- package/transpiled/safety.d.ts +5 -0
- package/transpiled/safety.js +26 -0
- package/transpiled/safety.js.map +1 -0
- package/transpiled/state.d.ts +36 -0
- package/transpiled/state.js +131 -0
- package/transpiled/state.js.map +1 -0
- package/transpiled/trail.d.ts +78 -0
- package/transpiled/trail.js +112 -0
- package/transpiled/trail.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 +58 -0
- package/transpiled/types/atomicity.js +2 -0
- package/transpiled/types/atomicity.js.map +1 -0
- package/transpiled/types/bindings.d.ts +82 -0
- package/transpiled/types/bindings.js +2 -0
- package/transpiled/types/bindings.js.map +1 -0
- package/transpiled/types/bridges.d.ts +41 -0
- package/transpiled/types/bridges.js +2 -0
- package/transpiled/types/bridges.js.map +1 -0
- package/transpiled/types/extensions.d.ts +121 -0
- package/transpiled/types/extensions.js +2 -0
- package/transpiled/types/extensions.js.map +1 -0
- package/transpiled/types/inbox.d.ts +27 -0
- package/transpiled/types/inbox.js +2 -0
- package/transpiled/types/inbox.js.map +1 -0
- package/transpiled/types/index.d.ts +14 -0
- package/transpiled/types/index.js +9 -0
- package/transpiled/types/index.js.map +1 -0
- package/transpiled/types/message.d.ts +16 -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 +93 -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 +119 -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 +158 -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/src/assignment.js +0 -31
- package/src/call.js +0 -42
- package/src/cascade.js +0 -35
- package/src/component.js +0 -41
- package/src/composition.js +0 -25
- package/src/connector.js +0 -183
- package/src/context.js +0 -55
- package/src/contract/conditions.js +0 -21
- package/src/contract/index.js +0 -7
- package/src/contract/reply.js +0 -25
- package/src/contract/request.js +0 -67
- package/src/contract/schemas/error.yaml +0 -9
- package/src/contract/schemas/index.js +0 -7
- package/src/contract/schemas/query.yaml +0 -30
- package/src/discovery.js +0 -44
- package/src/emission.js +0 -23
- package/src/entities/changeset.js +0 -38
- package/src/entities/entity.js +0 -74
- package/src/entities/factory.js +0 -33
- package/src/entities/index.js +0 -5
- package/src/entities/set.js +0 -15
- package/src/event.js +0 -40
- package/src/exceptions.js +0 -100
- package/src/exposition.js +0 -27
- package/src/index.js +0 -47
- package/src/locator.js +0 -54
- package/src/observation.js +0 -20
- package/src/operation.js +0 -69
- package/src/query/criteria.js +0 -41
- package/src/query/options.js +0 -40
- package/src/query.js +0 -41
- package/src/receiver.js +0 -61
- package/src/reflection.js +0 -28
- package/src/remote.js +0 -17
- package/src/state.js +0 -99
- package/src/transition.js +0 -67
- package/src/transmission.js +0 -33
- package/test/call.fixtures.js +0 -27
- package/test/call.test.js +0 -46
- package/test/component.fixtures.js +0 -21
- package/test/component.test.js +0 -40
- package/test/connector.fixtures.js +0 -40
- package/test/connector.test.js +0 -176
- package/test/context.fixtures.js +0 -18
- package/test/context.test.js +0 -29
- package/test/contract/conditions.test.js +0 -26
- package/test/contract/contract.fixtures.js +0 -33
- package/test/contract/request.test.js +0 -112
- package/test/emission.fixtures.js +0 -17
- package/test/emission.test.js +0 -35
- package/test/entities/entity.fixtures.js +0 -29
- package/test/entities/entity.test.js +0 -65
- package/test/entities/factory.fixtures.js +0 -18
- package/test/entities/factory.test.js +0 -48
- package/test/entities/set.fixtures.js +0 -11
- package/test/entities/set.test.js +0 -12
- package/test/event.fixtures.js +0 -29
- package/test/event.test.js +0 -118
- package/test/locator.test.js +0 -113
- package/test/query.fixtures.js +0 -100
- package/test/query.test.js +0 -86
- package/test/receiver.fixtures.js +0 -23
- package/test/receiver.test.js +0 -95
- package/test/reflection.test.js +0 -30
- package/test/state.fixtures.js +0 -47
- package/test/state.test.js +0 -46
- package/test/transmission.fixtures.js +0 -15
- package/test/transmission.test.js +0 -46
- package/types/bindings.d.ts +0 -40
- package/types/bridges.ts +0 -30
- package/types/component.d.ts +0 -9
- package/types/connector.d.ts +0 -18
- package/types/context.d.ts +0 -21
- 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 -29
- package/types/index.ts +0 -14
- package/types/locator.d.ts +0 -13
- package/types/message.d.ts +0 -3
- package/types/operations.d.ts +0 -2
- package/types/query.d.ts +0 -15
- package/types/receiver.d.ts +0 -12
- package/types/reflection.d.ts +0 -14
- package/types/request.d.ts +0 -23
- package/types/state.d.ts +0 -35
- package/types/storages.d.ts +0 -71
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import type { Readable } from 'node:stream';
|
|
2
|
+
import type { Connector } from '../connector.ts';
|
|
3
|
+
import type { Locator } from '../locator.ts';
|
|
4
|
+
import type { Component } from '../component.ts';
|
|
5
|
+
import type { Receiver } from './receiver.ts';
|
|
6
|
+
import type { Message } from './message.ts';
|
|
7
|
+
import type { Reply, Request } from './request.ts';
|
|
8
|
+
/** What a binding module exports beside its factory. */
|
|
9
|
+
export interface Properties {
|
|
10
|
+
/** delivers asynchronously; an event's binding must */
|
|
11
|
+
async?: boolean;
|
|
12
|
+
/** in-process: its producers are connected first and torn down last */
|
|
13
|
+
local?: boolean;
|
|
14
|
+
/** carries a call whose input holds a stream; an endpoint that takes one is offered to no other */
|
|
15
|
+
streams?: boolean;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* How a call is carried, as its caller settled it. None of it is part of the request, and none of
|
|
19
|
+
* it is sent as part of one.
|
|
20
|
+
*/
|
|
21
|
+
export interface Terms {
|
|
22
|
+
/** the process an addressed call goes to */
|
|
23
|
+
instance?: string;
|
|
24
|
+
/** milliseconds the caller of an addressed call waits */
|
|
25
|
+
timeout?: number;
|
|
26
|
+
/** aborts when the caller stops waiting */
|
|
27
|
+
signal?: AbortSignal;
|
|
28
|
+
}
|
|
29
|
+
export interface Consumer extends Connector {
|
|
30
|
+
/**
|
|
31
|
+
* `false` says this binding does not carry the endpoint, and the transmission tries the
|
|
32
|
+
* next one. A `Readable` is a streamed reply.
|
|
33
|
+
*/
|
|
34
|
+
request(request: Request, terms?: Terms): Promise<Reply | Readable | false>;
|
|
35
|
+
/**
|
|
36
|
+
* Absent where the binding cannot enqueue — a transmission skips a binding that offers
|
|
37
|
+
* no `task` rather than failing over it.
|
|
38
|
+
*/
|
|
39
|
+
task?(request: Request): Promise<void>;
|
|
40
|
+
}
|
|
41
|
+
export interface Emitter extends Connector {
|
|
42
|
+
emit(message: Message): Promise<void>;
|
|
43
|
+
}
|
|
44
|
+
export interface Broadcast<L extends string = string> extends Connector {
|
|
45
|
+
transmit<T>(label: L, payload: T): Promise<void>;
|
|
46
|
+
receive<T>(label: L, callback: (payload: T) => void | Promise<void>): Promise<void>;
|
|
47
|
+
}
|
|
48
|
+
export interface Factory {
|
|
49
|
+
/**
|
|
50
|
+
* `stateful` are the endpoints among `endpoints` that take addressed calls only, and
|
|
51
|
+
* `streamed` those that take one of their input properties as a stream.
|
|
52
|
+
*/
|
|
53
|
+
producer(locator: Locator, endpoints: string[], component: Component, stateful?: string[], streamed?: string[]): Connector;
|
|
54
|
+
consumer(locator: Locator, endpoint: string): Consumer;
|
|
55
|
+
/** only the binding an event declares is asked for one */
|
|
56
|
+
emitter?(locator: Locator, label: string): Emitter;
|
|
57
|
+
/** `group` is absent for an exclusive subscription */
|
|
58
|
+
receiver?(locator: Locator, label: string, group: string | undefined, receiver: Receiver): Connector;
|
|
59
|
+
broadcast?(name: string, group?: string): Broadcast;
|
|
60
|
+
/**
|
|
61
|
+
* A channel is a name the caller picks, from which the binding derives whatever its
|
|
62
|
+
* transport needs, and `uris` are the brokers to carry it over — so a second broker set
|
|
63
|
+
* costs the binding no configuration and no variable of its own.
|
|
64
|
+
*/
|
|
65
|
+
outbound?(channel: string, uris: string[]): Outbound;
|
|
66
|
+
/** what arrives on `channel` under `label` */
|
|
67
|
+
inbound?(channel: string, uris: string[], label: string, sink: Inbound): Connector;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Publishes to a channel, addressed by label. It forwards messages and nothing else: what
|
|
71
|
+
* `send` is handed is what is published, with no envelope, no field and no header of the
|
|
72
|
+
* binding's own, and none stripped — because a message shape is often somebody else's
|
|
73
|
+
* contract, and an extension shipping changes into another system must be able to send
|
|
74
|
+
* exactly what that system accepts.
|
|
75
|
+
*/
|
|
76
|
+
export interface Outbound extends Connector {
|
|
77
|
+
send(label: string, message: object): Promise<void>;
|
|
78
|
+
}
|
|
79
|
+
/** What a binding hands a message to. */
|
|
80
|
+
export interface Inbound {
|
|
81
|
+
accept(message: object): Promise<void>;
|
|
82
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bindings.js","sourceRoot":"","sources":["../../source/types/bindings.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { Readable } from 'node:stream';
|
|
2
|
+
import type { Connector } from '../connector.ts';
|
|
3
|
+
import type { Context } from '../context.ts';
|
|
4
|
+
import type { Event as StateEvent } from './state.ts';
|
|
5
|
+
import type { Reply, Request } from './request.ts';
|
|
6
|
+
/**
|
|
7
|
+
* What runs one endpoint. `mount` and `unmount` are the component author's, called by the
|
|
8
|
+
* bridge as it opens and closes; core only ever asks for `execute`.
|
|
9
|
+
*/
|
|
10
|
+
export interface Algorithm extends Connector {
|
|
11
|
+
execute(input: any, scope?: object | object[]): Promise<Reply | Readable>;
|
|
12
|
+
}
|
|
13
|
+
export interface Event extends Connector {
|
|
14
|
+
condition(event: StateEvent): Promise<boolean>;
|
|
15
|
+
payload(event: StateEvent): Promise<object>;
|
|
16
|
+
}
|
|
17
|
+
export interface Receiver extends Connector {
|
|
18
|
+
condition(payload: object): Promise<boolean>;
|
|
19
|
+
/** the trailing arguments are what the receiver declaration named */
|
|
20
|
+
request(payload: object, ...args: unknown[]): Promise<Request>;
|
|
21
|
+
}
|
|
22
|
+
/** Runs on every change to an entity's state, before the contract is applied. */
|
|
23
|
+
export interface Guard {
|
|
24
|
+
fit(state: object, origin: object | null): boolean;
|
|
25
|
+
}
|
|
26
|
+
/** Connectors whose lifecycle moments are the component's. */
|
|
27
|
+
export interface RunCommands {
|
|
28
|
+
preflight?: Connector;
|
|
29
|
+
settle?: Connector;
|
|
30
|
+
ready?: Connector;
|
|
31
|
+
dispose?: Connector;
|
|
32
|
+
/** what the component pauses while the process is halted, and takes again after */
|
|
33
|
+
quiescence?: Connector;
|
|
34
|
+
}
|
|
35
|
+
export interface Factory {
|
|
36
|
+
algorithm(path: string, endpoint: string, context: Context): Algorithm | Promise<Algorithm>;
|
|
37
|
+
event?(path: string, label: string, context: Context): Event | Promise<Event>;
|
|
38
|
+
receiver?(path: string, label: string): Receiver | Promise<Receiver>;
|
|
39
|
+
guard?(path: string, name: string, context: Context): Guard | Promise<Guard>;
|
|
40
|
+
rc?(path: string, context: Context): Promise<RunCommands | undefined>;
|
|
41
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bridges.js","sourceRoot":"","sources":["../../source/types/bridges.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import type { Connector } from '../connector.ts';
|
|
2
|
+
import type { Gate } from '../gate.ts';
|
|
3
|
+
import type { Locator } from '../locator.ts';
|
|
4
|
+
import type { Component } from '../component.ts';
|
|
5
|
+
import type { Contract } from '../contract/component.ts';
|
|
6
|
+
import type { Remote } from '../remote.ts';
|
|
7
|
+
import type { Receiver } from './receiver.ts';
|
|
8
|
+
import type { Context } from '../context.ts';
|
|
9
|
+
import type { Storage } from './storages.ts';
|
|
10
|
+
import type { Broadcast, Emitter, Inbound, Outbound } from './bindings.ts';
|
|
11
|
+
import type { Atom } from './atomicity.ts';
|
|
12
|
+
import type { Source } from './request.ts';
|
|
13
|
+
import type { Destination } from './outbox.ts';
|
|
14
|
+
/**
|
|
15
|
+
* What the process hosting an extension provides to it: the counterpart of a component's
|
|
16
|
+
* context. What is returned is a connector the extension depends on.
|
|
17
|
+
*/
|
|
18
|
+
export interface Host {
|
|
19
|
+
/** a component of the context, by locator */
|
|
20
|
+
/**
|
|
21
|
+
* @param contract what the component provides, where the caller has it; absent, what the
|
|
22
|
+
* process's map states.
|
|
23
|
+
*/
|
|
24
|
+
remote(locator: Locator, source?: Source, contract?: Contract): Promise<Remote>;
|
|
25
|
+
/** a channel of the messaging binding */
|
|
26
|
+
broadcast<L extends string = string>(channel: string, group?: string): Promise<Broadcast<L>>;
|
|
27
|
+
/** components to run inside the extension's own process */
|
|
28
|
+
composition(paths: string[]): Promise<Connector>;
|
|
29
|
+
/** a consumer of an event of the context, `namespace.component.event` */
|
|
30
|
+
receive(label: string, receiver: Receiver): Promise<Connector>;
|
|
31
|
+
/** what the replicas of one group decide together */
|
|
32
|
+
atom(group: string): Atom;
|
|
33
|
+
/** where this deployment publishes a channel, over the brokers named */
|
|
34
|
+
outbound(binding: string, channel: string, uris: string[]): Promise<Outbound>;
|
|
35
|
+
/** what arrives on a channel under one label */
|
|
36
|
+
inbound(binding: string, channel: string, uris: string[], label: string, sink: Inbound): Promise<Connector>;
|
|
37
|
+
/**
|
|
38
|
+
* A part of this tree a halt takes down and builds again. What is not behind one of these
|
|
39
|
+
* outlives a halt: the readiness probe does, and so does whatever answers on a port the
|
|
40
|
+
* process was already listening on.
|
|
41
|
+
*/
|
|
42
|
+
gate(build: () => Promise<Connector>): Gate;
|
|
43
|
+
/**
|
|
44
|
+
* Stops what this process does of its own accord — its gateway, its clocks, its run
|
|
45
|
+
* commands — and holds open everything it has. Nothing closes, so this is reversible.
|
|
46
|
+
*/
|
|
47
|
+
quiesce(): Promise<void>;
|
|
48
|
+
/** Undoes a quiesce: the process works again, having been rebuilt by nothing. */
|
|
49
|
+
cancel(): Promise<void>;
|
|
50
|
+
/** Stops this process for `seconds`, then builds it again. */
|
|
51
|
+
stop(seconds: number): void;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* `Manifest` is a type parameter rather than an import: `@toa.io/norm` depends on core, so
|
|
55
|
+
* core cannot name its types.
|
|
56
|
+
*/
|
|
57
|
+
export interface Factory<Manifest = unknown> {
|
|
58
|
+
/**
|
|
59
|
+
* What the package offers for each declaration it claims beside its main one: a manifest key
|
|
60
|
+
* that resolves to `package#key` is answered by `keys[key]`, and never by this.
|
|
61
|
+
*/
|
|
62
|
+
keys?: Record<string, Factory<Manifest>>;
|
|
63
|
+
tenant?(locator: Locator, declaration: any, manifest: Manifest): Connector | Promise<Connector>;
|
|
64
|
+
aspect?(locator: Locator, declaration: any): Aspect | Aspect[];
|
|
65
|
+
/**
|
|
66
|
+
* Where a committed state change of this component goes, beside its own events. Read before
|
|
67
|
+
* the storage is made, because one of these is what gives a component an outbox when it
|
|
68
|
+
* declares no event at all.
|
|
69
|
+
*/
|
|
70
|
+
destination?(locator: Locator, declaration: any, manifest: Manifest): Destination | Promise<Destination> | undefined;
|
|
71
|
+
/** what the extension runs as a process of its own; `null` where it is off here */
|
|
72
|
+
service?(): Connector | null | Promise<Connector | null>;
|
|
73
|
+
/**
|
|
74
|
+
* What the extension keeps in every process, whatever that process runs — the counterpart of
|
|
75
|
+
* `tenant` for a process rather than a component. Asked of every extension the process has
|
|
76
|
+
* loaded, and the predefined ones are loaded by every process for this.
|
|
77
|
+
*
|
|
78
|
+
* `null` where the extension keeps nothing here.
|
|
79
|
+
*/
|
|
80
|
+
resident?(host: Host): Resident | null | Promise<Resident | null>;
|
|
81
|
+
component?(component: Component): Component;
|
|
82
|
+
context?(context: Context): Context;
|
|
83
|
+
manage?(composition: Connector): Connector;
|
|
84
|
+
storage?(storage: Storage, locator: Locator): Storage;
|
|
85
|
+
emitter?(emitter: Emitter, label: string, locator: Locator): Emitter;
|
|
86
|
+
receiver?(receiver: Receiver, locator: Locator): Receiver;
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* A connector that lives as long as the process, whatever the process runs.
|
|
90
|
+
*
|
|
91
|
+
* It connects before what the process was built with and goes after it, which is what makes it
|
|
92
|
+
* the place for something that answers for the process rather than for anything in it — the
|
|
93
|
+
* readiness probe is the one this was written for.
|
|
94
|
+
*
|
|
95
|
+
* It outlives a halt. One that must not says so by being a `Host.gate`, which is a connector
|
|
96
|
+
* like any other: the gate stays, what it holds does not.
|
|
97
|
+
*/
|
|
98
|
+
export interface Resident extends Connector {
|
|
99
|
+
/** Everything the process was built with has connected. */
|
|
100
|
+
complete?: () => Promise<void>;
|
|
101
|
+
}
|
|
102
|
+
export interface Aspect extends Connector {
|
|
103
|
+
/** the key it takes on the context; a duplicate is a boot error */
|
|
104
|
+
readonly name: string;
|
|
105
|
+
invoke(...args: any[]): any;
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* What an extension puts on a component's context, as the extension states it. How it is
|
|
109
|
+
* presented there is the bridge's — a bash bridge has no context to put anything on — and
|
|
110
|
+
* what is declared here is the key and what it holds.
|
|
111
|
+
*/
|
|
112
|
+
export interface Contribution {
|
|
113
|
+
/** the key on the context */
|
|
114
|
+
name: string;
|
|
115
|
+
/** what the key holds, as TypeScript */
|
|
116
|
+
type?: string;
|
|
117
|
+
/** what `type` names, by the module it comes from */
|
|
118
|
+
imports?: Record<string, string[]>;
|
|
119
|
+
/** a JSON Schema to read the type from instead, where a component states one */
|
|
120
|
+
schema?: object;
|
|
121
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"extensions.js","sourceRoot":"","sources":["../../source/types/extensions.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What a call was, kept so that the same call arriving again is refused rather than made twice.
|
|
3
|
+
*
|
|
4
|
+
* Everything about it is core's, as the outbox row is: core builds it and hands it to the write,
|
|
5
|
+
* and the storage commits it in the transaction the entity is committed in. Written only for a
|
|
6
|
+
* call that changed something — an operation that refused, or that raised, leaves nothing, and a
|
|
7
|
+
* call that arrives again after one of those is made again and refuses again.
|
|
8
|
+
*/
|
|
9
|
+
export interface Call {
|
|
10
|
+
/** the identity of the request, which is the key it is refused on */
|
|
11
|
+
id: string;
|
|
12
|
+
/** what the call answered, so that a duplicate of it is answered rather than refused */
|
|
13
|
+
reply: object;
|
|
14
|
+
/**
|
|
15
|
+
* Seconds the call is remembered, where its operation states them. Absent, the storage keeps
|
|
16
|
+
* it for the deployment's window.
|
|
17
|
+
*/
|
|
18
|
+
retention?: number;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* The read side of an inbox. What writes a record is the storage's own: it happens inside the
|
|
22
|
+
* transaction the storage opened, which core never reaches into.
|
|
23
|
+
*/
|
|
24
|
+
export interface Inbox {
|
|
25
|
+
/** what the call under this identity answered, or `null` where it was never made */
|
|
26
|
+
recall(id: string): Promise<object | null>;
|
|
27
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inbox.js","sourceRoot":"","sources":["../../source/types/inbox.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export * as atomicity from './atomicity.ts';
|
|
2
|
+
export * as bindings from './bindings.ts';
|
|
3
|
+
export * as bridges from './bridges.ts';
|
|
4
|
+
export * as extensions from './extensions.ts';
|
|
5
|
+
export * as operations from './operations.ts';
|
|
6
|
+
export * as inbox from './inbox.ts';
|
|
7
|
+
export * as outbox from './outbox.ts';
|
|
8
|
+
export * as storages from './storages.ts';
|
|
9
|
+
export type { Contribution } from './extensions.ts';
|
|
10
|
+
export type { Event } from './state.ts';
|
|
11
|
+
export type { Message } from './message.ts';
|
|
12
|
+
export type { Receiver } from './receiver.ts';
|
|
13
|
+
export type { Call, Guard, Observation, Transition } from './operations.ts';
|
|
14
|
+
export type { Envelope, Maybe, Options, Query, Reply, RemoteError, Request, Source } from './request.ts';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export * as atomicity from './atomicity.js';
|
|
2
|
+
export * as bindings from './bindings.js';
|
|
3
|
+
export * as bridges from './bridges.js';
|
|
4
|
+
export * as extensions from './extensions.js';
|
|
5
|
+
export * as operations from './operations.js';
|
|
6
|
+
export * as inbox from './inbox.js';
|
|
7
|
+
export * as outbox from './outbox.js';
|
|
8
|
+
export * as storages from './storages.js';
|
|
9
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../source/types/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,SAAS,MAAM,gBAAgB,CAAA;AAC3C,OAAO,KAAK,QAAQ,MAAM,eAAe,CAAA;AACzC,OAAO,KAAK,OAAO,MAAM,cAAc,CAAA;AACvC,OAAO,KAAK,UAAU,MAAM,iBAAiB,CAAA;AAC7C,OAAO,KAAK,UAAU,MAAM,iBAAiB,CAAA;AAC7C,OAAO,KAAK,KAAK,MAAM,YAAY,CAAA;AACnC,OAAO,KAAK,MAAM,MAAM,aAAa,CAAA;AACrC,OAAO,KAAK,QAAQ,MAAM,eAAe,CAAA"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export interface Message<T = any> {
|
|
2
|
+
payload: T;
|
|
3
|
+
/**
|
|
4
|
+
* What this message is, so that a receiver's state change happens once however many times it
|
|
5
|
+
* arrives. Derived from the outbox row it was published from, which is committed once, so the
|
|
6
|
+
* immediate path, the pump and a redelivery all carry the one identity.
|
|
7
|
+
*/
|
|
8
|
+
id?: string;
|
|
9
|
+
/** W3C traceparent */
|
|
10
|
+
telemetry?: string;
|
|
11
|
+
/**
|
|
12
|
+
* The hops that led to the state change this is about, so a receiver of it continues the
|
|
13
|
+
* chain rather than starting one. See `core/source/trail.ts`.
|
|
14
|
+
*/
|
|
15
|
+
trail?: string[];
|
|
16
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"message.js","sourceRoot":"","sources":["../../source/types/message.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { Request } from './request.ts';
|
|
2
|
+
export type type = 'transition' | 'observation' | 'assignment' | 'computation' | 'effect' | 'unmanaged';
|
|
3
|
+
export type scope = 'entry' | 'entries' | 'changeset' | 'stream' | 'none';
|
|
4
|
+
/**
|
|
5
|
+
* How an endpoint is called. What it resolves to is what the operation declares — `toa types`
|
|
6
|
+
* writes that per operation, and these are what a hand-written context says instead.
|
|
7
|
+
*/
|
|
8
|
+
export type Call<Output = any, Input = any> = (request: Request<Input>) => Promise<Output>;
|
|
9
|
+
export type Observation<Output = any, Input = never, Entity = unknown> = (request: Request<Input, Entity>) => Promise<Output extends unknown[] ? Output : Output | null>;
|
|
10
|
+
export type Transition<Output = any, Input = never, Entity = unknown> = (request: Request<Input, Entity>) => Promise<Output | null>;
|
|
11
|
+
/**
|
|
12
|
+
* Runs on every change to an entity's state, before the contract is applied. `false` refuses
|
|
13
|
+
* the change as `EntityGuard`.
|
|
14
|
+
*/
|
|
15
|
+
export type Guard<T, C = unknown> = (state: T, origin: T | null, context: C) => boolean;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"operations.js","sourceRoot":"","sources":["../../source/types/operations.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import type { Connector } from '../connector.ts';
|
|
2
|
+
import type { Event } from './state.ts';
|
|
3
|
+
/**
|
|
4
|
+
* The intent to publish, committed with the state change it belongs to. Everything about it
|
|
5
|
+
* is core's: the storage writes it and, where the images are the write's own, fills
|
|
6
|
+
* `event.origin` and `event.state` in.
|
|
7
|
+
*/
|
|
8
|
+
export interface Row {
|
|
9
|
+
id: string;
|
|
10
|
+
/** which replica pumps this row; carries no other meaning, and no ordering */
|
|
11
|
+
lane: number;
|
|
12
|
+
/** settled for every destination */
|
|
13
|
+
published: boolean;
|
|
14
|
+
/** not before this */
|
|
15
|
+
pending: number;
|
|
16
|
+
/** the destinations it has not been sent to yet, by name */
|
|
17
|
+
outstanding: string[];
|
|
18
|
+
/**
|
|
19
|
+
* The hops that led to the change. Written onto the row rather than left in scope, because
|
|
20
|
+
* the pump publishes off the operation's path — possibly in another replica, an hour later.
|
|
21
|
+
* Absent on a row written before this existed, which reads as a chain that starts there.
|
|
22
|
+
*/
|
|
23
|
+
trail?: string[];
|
|
24
|
+
/** an assignment's images are absent until the storage fills them in */
|
|
25
|
+
event: Event;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Somewhere a committed state change goes. A component's `Emission` is one, under the name
|
|
29
|
+
* `events`; an extension may contribute others, and each is published and settled on its own,
|
|
30
|
+
* so one that is down delays nothing but itself.
|
|
31
|
+
*/
|
|
32
|
+
export interface Destination extends Connector {
|
|
33
|
+
/** what a row is outstanding for, as the row records it */
|
|
34
|
+
readonly name: string;
|
|
35
|
+
/** the row, not its event: what goes on the wire is the chain it carries too */
|
|
36
|
+
emit(row: Row): Promise<void>;
|
|
37
|
+
/**
|
|
38
|
+
* The events of the component this renders a row into, by their labels. A destination that
|
|
39
|
+
* names them is given a `Rendering` of them before it connects: the payload each would be
|
|
40
|
+
* published with, by the component's own condition and payload.
|
|
41
|
+
*/
|
|
42
|
+
readonly renders?: string[];
|
|
43
|
+
rendering?: Rendering;
|
|
44
|
+
/**
|
|
45
|
+
* What this would write for the row, where what it writes to is kept by each region for
|
|
46
|
+
* itself and converges nowhere: serializable, and needing nothing of this region to be
|
|
47
|
+
* written in another. `undefined` where it would write nothing. A destination that has this
|
|
48
|
+
* and `import` is regional.
|
|
49
|
+
*/
|
|
50
|
+
export?(row: Row): Promise<unknown>;
|
|
51
|
+
/** Writes what the destination of the same name exported in another region. */
|
|
52
|
+
import?(portable: unknown): Promise<void>;
|
|
53
|
+
/**
|
|
54
|
+
* Whether this carries a change to other regions. A destination that does is given
|
|
55
|
+
* `regional` before it connects: what the component's regional destinations export.
|
|
56
|
+
*/
|
|
57
|
+
readonly carries?: boolean;
|
|
58
|
+
regional?: Regional;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* The component's regional destinations, as a carrier sees them: what they export for a row,
|
|
62
|
+
* by their names, and the import of what arrives, without knowing what any of them is.
|
|
63
|
+
*/
|
|
64
|
+
export interface Regional {
|
|
65
|
+
/** `undefined` where none of them exported anything */
|
|
66
|
+
export(row: Row): Promise<Record<string, unknown> | undefined>;
|
|
67
|
+
/** each part to the destination of its name; a name this component has none of is dropped */
|
|
68
|
+
import(carried: Record<string, unknown>): Promise<void>;
|
|
69
|
+
}
|
|
70
|
+
/** What a row makes of the component's events: the payload of each that it raises. */
|
|
71
|
+
export interface Rendering {
|
|
72
|
+
/** `null` where the event's condition does not hold for the row */
|
|
73
|
+
render(label: string, row: Row): Promise<{
|
|
74
|
+
payload: unknown;
|
|
75
|
+
} | null>;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* The read side of an outbox. What writes a row is the storage's own: it happens inside the
|
|
79
|
+
* transaction the storage opened, which core never reaches into.
|
|
80
|
+
*/
|
|
81
|
+
export interface Storage {
|
|
82
|
+
/**
|
|
83
|
+
* One page of what is due, not settled for every destination, and in one of the given lanes,
|
|
84
|
+
* in the order the rows were written. `after` continues from the last id of the page before.
|
|
85
|
+
*/
|
|
86
|
+
pending(lanes: number[], now: number, limit: number, after?: string): Promise<Row[]>;
|
|
87
|
+
/**
|
|
88
|
+
* Takes `destinations` out of what those rows are outstanding for, and marks published the
|
|
89
|
+
* ones left outstanding for nothing. Several destinations at once, because the ordinary case
|
|
90
|
+
* is all of them landing in one window, and that is then one write.
|
|
91
|
+
*/
|
|
92
|
+
settle(ids: string[], destinations: string[]): Promise<void>;
|
|
93
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"outbox.js","sourceRoot":"","sources":["../../source/types/outbox.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Connector } from '../connector.ts';
|
|
2
|
+
import type { Message } from './message.ts';
|
|
3
|
+
/**
|
|
4
|
+
* What consumes an event of the context. Core ships one, and an extension may put its own
|
|
5
|
+
* in its place, so what a binding is handed is this rather than core's class.
|
|
6
|
+
*/
|
|
7
|
+
export interface Receiver extends Connector {
|
|
8
|
+
receive(message: Message): Promise<void>;
|
|
9
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"receiver.js","sourceRoot":"","sources":["../../source/types/receiver.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import type { Exception } from '../exceptions.ts';
|
|
2
|
+
/**
|
|
3
|
+
* What a call asks for. `Entity` is the record it is about, which narrows the projection;
|
|
4
|
+
* left out, any name is accepted.
|
|
5
|
+
*/
|
|
6
|
+
export interface Query<Entity = any> {
|
|
7
|
+
id?: string;
|
|
8
|
+
ids?: string[];
|
|
9
|
+
criteria?: string;
|
|
10
|
+
search?: string;
|
|
11
|
+
sample?: number;
|
|
12
|
+
omit?: number;
|
|
13
|
+
limit?: number;
|
|
14
|
+
sort?: string[];
|
|
15
|
+
projection?: Array<string & keyof Entity>;
|
|
16
|
+
version?: number;
|
|
17
|
+
deleted?: boolean;
|
|
18
|
+
token?: string;
|
|
19
|
+
stop?: boolean;
|
|
20
|
+
}
|
|
21
|
+
/** Origin of a call. Stamped by the framework; whoever reads it takes the keys it knows. */
|
|
22
|
+
export type Source = {
|
|
23
|
+
namespace: string;
|
|
24
|
+
component: string;
|
|
25
|
+
operation: string;
|
|
26
|
+
} | {
|
|
27
|
+
namespace: string;
|
|
28
|
+
component: string;
|
|
29
|
+
event: string;
|
|
30
|
+
} | {
|
|
31
|
+
service: string;
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* What a caller asks for, and what a caller may say about it — the identity of the call, where the
|
|
35
|
+
* caller has one to give, and whatever of the envelope whoever hands it over already knows. A
|
|
36
|
+
* receiver stamps the identity and the chain off the message the call came from.
|
|
37
|
+
*/
|
|
38
|
+
export interface Request<Input = any, Entity = any> {
|
|
39
|
+
input?: Input;
|
|
40
|
+
query?: Query<Entity>;
|
|
41
|
+
/** What the operation acquires, where the caller supplies it rather than the storage. */
|
|
42
|
+
entity?: Entity;
|
|
43
|
+
task?: boolean;
|
|
44
|
+
/**
|
|
45
|
+
* The process a call to a stateful operation goes to: that process's `context.instance`. Named
|
|
46
|
+
* for a stateful operation, and for no other.
|
|
47
|
+
*/
|
|
48
|
+
instance?: string;
|
|
49
|
+
/**
|
|
50
|
+
* What this call is, so that the same call arriving twice is written once. Left out, the caller
|
|
51
|
+
* stamps one: derived from the call it is itself serving, where there is one, and minted where
|
|
52
|
+
* there is not. See `core/source/entities/newid.ts` and the inbox.
|
|
53
|
+
*/
|
|
54
|
+
id?: string;
|
|
55
|
+
source?: Source;
|
|
56
|
+
/**
|
|
57
|
+
* The hops this call passed through, oldest first. Stamped by the framework; a call that has
|
|
58
|
+
* been where it is going already is refused rather than made. See `core/source/trail.ts`.
|
|
59
|
+
*/
|
|
60
|
+
trail?: string[];
|
|
61
|
+
/**
|
|
62
|
+
* The properties of the output this caller receives, of each object the operation answers. An
|
|
63
|
+
* empty list receives none of it, and a request that names none receives the output whole.
|
|
64
|
+
*/
|
|
65
|
+
output?: string[];
|
|
66
|
+
/**
|
|
67
|
+
* Whether this caller reads an output encoded rather than as values: a gateway writing it as a
|
|
68
|
+
* response body spends nothing on reading it. What answers one encodes it once.
|
|
69
|
+
*/
|
|
70
|
+
encoded?: boolean;
|
|
71
|
+
/**
|
|
72
|
+
* Whether this call, and every call made under it, may reach only a safe operation. Stamped by
|
|
73
|
+
* the framework and carried down the chain; set and never cleared, so a call made under one is
|
|
74
|
+
* readonly whatever it says of itself. See `core/source/safety.ts`.
|
|
75
|
+
*/
|
|
76
|
+
readonly?: boolean;
|
|
77
|
+
/** the sender validated against the contract, so the recipient does not */
|
|
78
|
+
authentic?: boolean;
|
|
79
|
+
/** W3C traceparent */
|
|
80
|
+
telemetry?: string;
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* How a caller waits for an addressed call, given beside the request: neither is part of what the
|
|
84
|
+
* call asks, and neither is sent with it. An ordinary call waits for as long as its reply takes, and
|
|
85
|
+
* is refused if it names either.
|
|
86
|
+
*/
|
|
87
|
+
export interface Options {
|
|
88
|
+
/** Milliseconds the caller waits for the reply. Without one, the context's default. */
|
|
89
|
+
timeout?: number;
|
|
90
|
+
/** Ends the wait when it aborts, within the timeout. */
|
|
91
|
+
signal?: AbortSignal;
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* What an operation receives: the request, in the envelope the framework put it in. The one
|
|
95
|
+
* difference from what a caller may hand over is that the identity is settled, which is why an
|
|
96
|
+
* operation may rely on it and a caller need not supply it.
|
|
97
|
+
*
|
|
98
|
+
* The envelope is the framework's own object rather than the caller's written over, because a
|
|
99
|
+
* caller may hand one object to several calls — `id` alone makes that fatal, as two calls cannot
|
|
100
|
+
* share an identity — and because what a caller wrote and what the runtime added are then two
|
|
101
|
+
* things rather than one.
|
|
102
|
+
*/
|
|
103
|
+
export interface Envelope<Input = any, Entity = any> extends Request<Input, Entity> {
|
|
104
|
+
id: string;
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* An error an operation declares and returns. A call resolves to it rather than throwing:
|
|
108
|
+
* only an exception is thrown.
|
|
109
|
+
*/
|
|
110
|
+
export interface RemoteError<Code extends string = string> extends Error {
|
|
111
|
+
code: Code;
|
|
112
|
+
}
|
|
113
|
+
/** What an operation returns where it may refuse: the value, or the error it refused with. */
|
|
114
|
+
export type Maybe<T> = T | Error;
|
|
115
|
+
export interface Reply {
|
|
116
|
+
output?: any;
|
|
117
|
+
error?: object;
|
|
118
|
+
exception?: Exception;
|
|
119
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"request.js","sourceRoot":"","sources":["../../source/types/request.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/** What a commit publishes: the images of one state change. */
|
|
2
|
+
export interface Event<State = object, Trailers = object> {
|
|
3
|
+
/** the pre-image; null when the entity did not exist before */
|
|
4
|
+
origin: State | null;
|
|
5
|
+
state: State;
|
|
6
|
+
/** out-of-band values an algorithm wrote into `state.TRAILERS`; must be serializable */
|
|
7
|
+
trailers?: Trailers;
|
|
8
|
+
input?: object;
|
|
9
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"state.js","sourceRoot":"","sources":["../../source/types/state.ts"],"names":[],"mappings":""}
|