@toa.io/extensions.convergence 1.0.0-alpha.321 → 1.0.0-alpha.323
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 +5 -5
- package/readme.md +4 -0
- package/transpiled/Storage.d.ts +17 -5
- package/transpiled/Storage.js +13 -6
- package/transpiled/Storage.js.map +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@toa.io/extensions.convergence",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.323",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Toa Convergence extension",
|
|
6
6
|
"author": "temich <tema.gurtovoy@gmail.com>",
|
|
@@ -28,11 +28,11 @@
|
|
|
28
28
|
"transpile": "tsc"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@toa.io/core": "1.0.0-alpha.
|
|
32
|
-
"@toa.io/definitions": "1.0.0-alpha.
|
|
31
|
+
"@toa.io/core": "1.0.0-alpha.323",
|
|
32
|
+
"@toa.io/definitions": "1.0.0-alpha.323",
|
|
33
33
|
"@toa.io/generic": "1.0.0-alpha.311",
|
|
34
34
|
"@toa.io/pointer": "1.0.0-alpha.311",
|
|
35
|
-
"openspan": "1.0.0-alpha.
|
|
35
|
+
"openspan": "1.0.0-alpha.323"
|
|
36
36
|
},
|
|
37
|
-
"gitHead": "
|
|
37
|
+
"gitHead": "1d31b234602c9eda959d80bdca79b983ebf541ea"
|
|
38
38
|
}
|
package/readme.md
CHANGED
|
@@ -133,6 +133,10 @@ go is logged rather than dropped in silence.
|
|
|
133
133
|
value, and the record that arrives second cannot be stored at all. It is logged and dropped;
|
|
134
134
|
redelivery would not help.
|
|
135
135
|
|
|
136
|
+
**[`once`](/documentation/inbox.md) holds within a region.** A duplicate is answered with the
|
|
137
|
+
first reply where it arrives in the region that made the call, and made again where it arrives in
|
|
138
|
+
another, so a caller that retries against a different region is not deduplicated.
|
|
139
|
+
|
|
136
140
|
## What a record carries
|
|
137
141
|
|
|
138
142
|
[`REGION`](/documentation/component/declaration.md#entity) is which region wrote a record, as
|
package/transpiled/Storage.d.ts
CHANGED
|
@@ -1,7 +1,16 @@
|
|
|
1
1
|
import { Connector } from '@toa.io/core';
|
|
2
2
|
import type { Readable } from 'node:stream';
|
|
3
3
|
import type { Connector as Link, Locator } from '@toa.io/core';
|
|
4
|
-
import type { bindings, outbox, storages } from '@toa.io/core/types';
|
|
4
|
+
import type { bindings, inbox, outbox, storages } from '@toa.io/core/types';
|
|
5
|
+
/**
|
|
6
|
+
* Every member of `T`, the optional ones included, each as `T` types it. A member of the storage
|
|
7
|
+
* this does not delegate is lost to every component that converges, and nothing says so — an
|
|
8
|
+
* optional one is not required by `implements storages.Storage`, and the inbox went missing that
|
|
9
|
+
* way.
|
|
10
|
+
*/
|
|
11
|
+
type Whole<T> = {
|
|
12
|
+
[K in keyof Required<T>]: T[K];
|
|
13
|
+
};
|
|
5
14
|
/**
|
|
6
15
|
* A record from another region is written as it stands: its version, its timestamps, its
|
|
7
16
|
* region. That is neither a transition nor an assignment — it is not this region's version to
|
|
@@ -11,7 +20,7 @@ import type { bindings, outbox, storages } from '@toa.io/core/types';
|
|
|
11
20
|
* Everything else it delegates. It decorates the storage because that is where a handle to one
|
|
12
21
|
* is, not because it changes anything a component reads or writes.
|
|
13
22
|
*/
|
|
14
|
-
export declare class Converging extends Connector implements storages.Storage
|
|
23
|
+
export declare class Converging extends Connector implements Whole<storages.Storage>, bindings.Inbound {
|
|
15
24
|
private readonly storage;
|
|
16
25
|
private readonly locator;
|
|
17
26
|
private readonly subscribe;
|
|
@@ -27,14 +36,17 @@ export declare class Converging extends Connector implements storages.Storage, b
|
|
|
27
36
|
protected open(): Promise<void>;
|
|
28
37
|
get raw(): unknown;
|
|
29
38
|
get outbox(): storages.Storage['outbox'];
|
|
39
|
+
get inbox(): storages.Storage['inbox'];
|
|
40
|
+
get claims(): boolean | undefined;
|
|
30
41
|
get migrates(): boolean | undefined;
|
|
31
42
|
get converges(): boolean | undefined;
|
|
32
43
|
get(query: storages.Query): Promise<storages.Record | null>;
|
|
33
44
|
find(query: storages.Query): Promise<storages.Record[]>;
|
|
34
45
|
stream(query?: storages.Query): Promise<Readable>;
|
|
35
|
-
store(record: storages.Record, row?: outbox.Row): Promise<boolean>;
|
|
46
|
+
store(record: storages.Record, row?: outbox.Row, call?: inbox.Call): Promise<boolean>;
|
|
36
47
|
massStore(records: storages.Record[], rows?: outbox.Row[]): Promise<boolean>;
|
|
37
|
-
upsert(query: storages.Query, changeset: object, row?: outbox.Row): Promise<storages.Record | null>;
|
|
38
|
-
ensure(query: storages.Query | undefined, properties: object, record: storages.Record, row?: outbox.Row): Promise<storages.Record>;
|
|
48
|
+
upsert(query: storages.Query, changeset: object, row?: outbox.Row, call?: inbox.Call): Promise<storages.Record | null>;
|
|
49
|
+
ensure(query: storages.Query | undefined, properties: object, record: storages.Record, row?: outbox.Row, call?: inbox.Call): Promise<storages.Record>;
|
|
39
50
|
converge(record: storages.Record): Promise<boolean>;
|
|
40
51
|
}
|
|
52
|
+
export {};
|
package/transpiled/Storage.js
CHANGED
|
@@ -100,6 +100,12 @@ export class Converging extends Connector {
|
|
|
100
100
|
get outbox() {
|
|
101
101
|
return this.storage.outbox;
|
|
102
102
|
}
|
|
103
|
+
get inbox() {
|
|
104
|
+
return this.storage.inbox;
|
|
105
|
+
}
|
|
106
|
+
get claims() {
|
|
107
|
+
return this.storage.claims;
|
|
108
|
+
}
|
|
103
109
|
get migrates() {
|
|
104
110
|
return this.storage.migrates;
|
|
105
111
|
}
|
|
@@ -115,18 +121,19 @@ export class Converging extends Connector {
|
|
|
115
121
|
async stream(query) {
|
|
116
122
|
return this.storage.stream(query);
|
|
117
123
|
}
|
|
118
|
-
async store(record, row) {
|
|
119
|
-
return this.storage.store(record, row);
|
|
124
|
+
async store(record, row, call) {
|
|
125
|
+
return this.storage.store(record, row, call);
|
|
120
126
|
}
|
|
121
127
|
async massStore(records, rows) {
|
|
122
128
|
return this.storage.massStore(records, rows);
|
|
123
129
|
}
|
|
124
|
-
|
|
125
|
-
|
|
130
|
+
// eslint-disable-next-line max-params
|
|
131
|
+
async upsert(query, changeset, row, call) {
|
|
132
|
+
return this.storage.upsert(query, changeset, row, call);
|
|
126
133
|
}
|
|
127
134
|
// eslint-disable-next-line max-params
|
|
128
|
-
async ensure(query, properties, record, row) {
|
|
129
|
-
return this.storage.ensure(query, properties, record, row);
|
|
135
|
+
async ensure(query, properties, record, row, call) {
|
|
136
|
+
return this.storage.ensure(query, properties, record, row, call);
|
|
130
137
|
}
|
|
131
138
|
async converge(record) {
|
|
132
139
|
return this.storage.converge(record);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Storage.js","sourceRoot":"","sources":["../source/Storage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,EAAoB,MAAM,UAAU,CAAA;AACjE,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAA;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AACxC,OAAO,EAAE,OAAO,EAAE,MAAM,4CAA4C,CAAA;AAKpE,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAA;
|
|
1
|
+
{"version":3,"file":"Storage.js","sourceRoot":"","sources":["../source/Storage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,EAAoB,MAAM,UAAU,CAAA;AACjE,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAA;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AACxC,OAAO,EAAE,OAAO,EAAE,MAAM,4CAA4C,CAAA;AAKpE,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAA;AAU1C;;;;;;;;GAQG;AACH,MAAM,OAAO,UAAW,S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