@toa.io/extensions.exposition 1.0.0-alpha.271 → 1.0.0-alpha.272
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/CHANGELOG.md +26 -0
- package/components/{exposition.stash → exposition.atom}/manifest.toa.yaml +1 -3
- package/components/{exposition.stash → exposition.atom}/operations/meter.js +1 -1
- package/components/identity.basic/operations/tsconfig.tsbuildinfo +1 -1
- package/components/identity.credentials/operations/tsconfig.tsbuildinfo +1 -1
- package/components/identity.federation/operations/tsconfig.tsbuildinfo +1 -1
- package/components/identity.keys/operations/tsconfig.tsbuildinfo +1 -1
- package/components/identity.otp/operations/tsconfig.tsbuildinfo +1 -1
- package/components/identity.passkeys/operations/tsconfig.tsbuildinfo +1 -1
- package/components/identity.roles/operations/tsconfig.tsbuildinfo +1 -1
- package/components/identity.tokens/operations/tsconfig.tsbuildinfo +1 -1
- package/documentation/notes/throttling.md +1 -1
- package/features/introspection.feature +27 -34
- package/features/query.feature +27 -0
- package/features/steps/Database.ts +9 -0
- package/package.json +6 -6
- package/schemas/querystring.cos.yaml +2 -0
- package/source/Gateway.ts +9 -1
- package/source/Tenant.ts +12 -1
- package/source/directives/io/IO.ts +2 -2
- package/source/directives/io/lib/throttle/Sync.ts +4 -4
- package/transpiled/Gateway.d.ts +7 -0
- package/transpiled/Gateway.js +9 -1
- package/transpiled/Gateway.js.map +1 -1
- package/transpiled/Tenant.d.ts +7 -1
- package/transpiled/Tenant.js +11 -1
- package/transpiled/Tenant.js.map +1 -1
- package/transpiled/directives/io/IO.d.ts +1 -1
- package/transpiled/directives/io/IO.js +2 -2
- package/transpiled/directives/io/IO.js.map +1 -1
- package/transpiled/directives/io/lib/throttle/Sync.d.ts +2 -2
- package/transpiled/directives/io/lib/throttle/Sync.js +4 -4
- package/transpiled/directives/io/lib/throttle/Sync.js.map +1 -1
- package/transpiled/tsconfig.tsbuildinfo +1 -1
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
> **Superseded.** The design below was never implemented. `io:throttle` is now a
|
|
4
4
|
> [GCRA](https://en.wikipedia.org/wiki/Generic_cell_rate_algorithm) deciding in each process, with
|
|
5
|
-
> its state periodically reconciled through Redis by way of the `
|
|
5
|
+
> its state periodically reconciled through Redis by way of the `atom` aspect's `meter`. It
|
|
6
6
|
> answers the same forces the same way — decide locally, reconcile in the background, never fail the
|
|
7
7
|
> request path — and the section below records what it does instead. The problem statement and the
|
|
8
8
|
> forces have not changed.
|
|
@@ -21,55 +21,48 @@ Feature: Introspection
|
|
|
21
21
|
Allow: GET, POST
|
|
22
22
|
|
|
23
23
|
GET:
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
24
|
+
output:
|
|
25
|
+
type: array
|
|
26
|
+
items:
|
|
27
|
+
properties:
|
|
28
|
+
id:
|
|
29
|
+
type: string
|
|
30
|
+
pattern: ^[a-fA-F0-9]{32}$
|
|
31
|
+
title:
|
|
32
|
+
type: string
|
|
33
|
+
maxLength: 64
|
|
34
|
+
volume:
|
|
35
|
+
type: number
|
|
36
|
+
exclusiveMinimum: 0
|
|
37
|
+
maximum: 1000
|
|
38
|
+
temperature:
|
|
39
|
+
type: number
|
|
40
|
+
exclusiveMinimum: 0
|
|
41
|
+
maximum: 300
|
|
42
|
+
type: object
|
|
43
|
+
required:
|
|
44
|
+
- id
|
|
45
|
+
- title
|
|
46
|
+
- volume
|
|
47
|
+
POST:
|
|
48
|
+
input:
|
|
27
49
|
properties:
|
|
28
|
-
id:
|
|
29
|
-
type: string
|
|
30
|
-
pattern: ^[a-fA-F0-9]{32}$
|
|
31
|
-
title:
|
|
32
|
-
type: string
|
|
33
|
-
maxLength: 64
|
|
34
|
-
volume:
|
|
35
|
-
type: number
|
|
36
|
-
exclusiveMinimum: 0
|
|
37
|
-
maximum: 1000
|
|
38
50
|
temperature:
|
|
39
51
|
type: number
|
|
40
52
|
exclusiveMinimum: 0
|
|
41
53
|
maximum: 300
|
|
42
|
-
additionalProperties: false
|
|
43
|
-
required:
|
|
44
|
-
- id
|
|
45
|
-
- title
|
|
46
|
-
- volume
|
|
47
|
-
POST:
|
|
48
|
-
input:
|
|
49
|
-
type: object
|
|
50
|
-
properties:
|
|
51
54
|
title:
|
|
52
55
|
type: string
|
|
53
56
|
maxLength: 64
|
|
54
|
-
temperature:
|
|
55
|
-
type: number
|
|
56
|
-
exclusiveMinimum: 0
|
|
57
|
-
maximum: 300
|
|
58
57
|
volume:
|
|
59
58
|
type: number
|
|
60
59
|
exclusiveMinimum: 0
|
|
61
60
|
maximum: 1000
|
|
62
|
-
|
|
61
|
+
type: object
|
|
63
62
|
required:
|
|
64
63
|
- title
|
|
65
64
|
- volume
|
|
66
|
-
output:
|
|
67
|
-
type: object
|
|
68
|
-
properties:
|
|
69
|
-
id:
|
|
70
|
-
type: string
|
|
71
|
-
pattern: ^[a-fA-F0-9]{32}$
|
|
72
|
-
additionalProperties: false
|
|
65
|
+
output: {}
|
|
73
66
|
errors:
|
|
74
67
|
- NO_WAY
|
|
75
68
|
- WONT_CREATE
|
package/features/query.feature
CHANGED
|
@@ -283,6 +283,33 @@ Feature: Queries
|
|
|
283
283
|
|
|
284
284
|
Hello John
|
|
285
285
|
"""
|
|
286
|
+
|
|
287
|
+
# a declared parameter is taken out of the query string before what is left of it is
|
|
288
|
+
# answered for. A route that declares nothing but parameters is not queryable, so what
|
|
289
|
+
# is left has to be nothing at all
|
|
290
|
+
Scenario: Query parameters beside an undeclared one
|
|
291
|
+
Given the `echo` is running with the following manifest:
|
|
292
|
+
"""yaml
|
|
293
|
+
exposition:
|
|
294
|
+
/:
|
|
295
|
+
GET:
|
|
296
|
+
io:output: true
|
|
297
|
+
query:
|
|
298
|
+
parameters: [name]
|
|
299
|
+
endpoint: compute
|
|
300
|
+
"""
|
|
301
|
+
When the following request is received:
|
|
302
|
+
"""
|
|
303
|
+
GET /echo/?name=John&foo=bar HTTP/1.1
|
|
304
|
+
host: nex.toa.io
|
|
305
|
+
accept: text/plain
|
|
306
|
+
"""
|
|
307
|
+
Then the following reply is sent:
|
|
308
|
+
"""
|
|
309
|
+
400 Bad Request
|
|
310
|
+
|
|
311
|
+
Query parameter 'foo' is not allowed
|
|
312
|
+
"""
|
|
286
313
|
When the following request is received:
|
|
287
314
|
"""
|
|
288
315
|
GET /echo/?foo=bar HTTP/1.1
|
|
@@ -32,6 +32,15 @@ export class Database {
|
|
|
32
32
|
: str
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
+
/*
|
|
36
|
+
* A record that has never been written carries no timestamps, and the entity stamps
|
|
37
|
+
* the ones it is missing as it is read — with the time it was read. The same row then
|
|
38
|
+
* enumerates differently on every request, which is a moving `etag` and a collection
|
|
39
|
+
* that is never unmodified.
|
|
40
|
+
*/
|
|
41
|
+
document._created ??= Date.now()
|
|
42
|
+
document._updated ??= document._created
|
|
43
|
+
|
|
35
44
|
documents.push(document)
|
|
36
45
|
}
|
|
37
46
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@toa.io/extensions.exposition",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.272",
|
|
4
4
|
"description": "Toa Exposition",
|
|
5
5
|
"author": "temich <tema.gurtovoy@gmail.com>",
|
|
6
6
|
"homepage": "https://github.com/toa-io/toa#readme",
|
|
@@ -18,9 +18,9 @@
|
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
20
|
"@simplewebauthn/server": "13.3.3",
|
|
21
|
-
"@toa.io/core": "1.0.0-alpha.
|
|
22
|
-
"@toa.io/generic": "1.0.0-alpha.
|
|
23
|
-
"@toa.io/schemas": "1.0.0-alpha.
|
|
21
|
+
"@toa.io/core": "1.0.0-alpha.272",
|
|
22
|
+
"@toa.io/generic": "1.0.0-alpha.272",
|
|
23
|
+
"@toa.io/schemas": "1.0.0-alpha.272",
|
|
24
24
|
"bcryptjs": "3.0.3",
|
|
25
25
|
"content-type": "2.1.0",
|
|
26
26
|
"error-value": "0.4.4",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"minimatch": "10.2.6",
|
|
32
32
|
"msgpackr": "2.1.0",
|
|
33
33
|
"negotiator": "1.1.0",
|
|
34
|
-
"openspan": "1.0.0-alpha.
|
|
34
|
+
"openspan": "1.0.0-alpha.272",
|
|
35
35
|
"paseto": "3.1.4"
|
|
36
36
|
},
|
|
37
37
|
"scripts": {
|
|
@@ -62,5 +62,5 @@
|
|
|
62
62
|
},
|
|
63
63
|
"testEnvironment": "node"
|
|
64
64
|
},
|
|
65
|
-
"gitHead": "
|
|
65
|
+
"gitHead": "1a451755445935c04cf5b373bcc73942cac0bb10"
|
|
66
66
|
}
|
package/source/Gateway.ts
CHANGED
|
@@ -70,11 +70,19 @@ export class Gateway extends Connector {
|
|
|
70
70
|
console.info('Gateway started')
|
|
71
71
|
}
|
|
72
72
|
|
|
73
|
-
|
|
73
|
+
/**
|
|
74
|
+
* Both of these reach into components, and a dependency is torn down only once this has
|
|
75
|
+
* returned — where `dispose` runs after every one of them already has. The throttling
|
|
76
|
+
* ticker firing in between calls an endpoint that has just been unbound, and reports the
|
|
77
|
+
* refusal as a failure to reconcile.
|
|
78
|
+
*/
|
|
79
|
+
protected override async close (): Promise<void> {
|
|
74
80
|
this.stopped = true
|
|
75
81
|
|
|
76
82
|
this.tree.dispose()
|
|
83
|
+
}
|
|
77
84
|
|
|
85
|
+
protected override dispose (): void {
|
|
78
86
|
console.info('Gateway is closed')
|
|
79
87
|
}
|
|
80
88
|
|
package/source/Tenant.ts
CHANGED
|
@@ -29,7 +29,13 @@ export class Tenant extends Connector {
|
|
|
29
29
|
void this.announce()
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
-
|
|
32
|
+
/**
|
|
33
|
+
* Announcing is stopped where the teardown begins, not in `dispose`, which a connector
|
|
34
|
+
* runs after every one of its dependencies has gone. A component on its way out that
|
|
35
|
+
* announces itself once more has its routes held open by whoever is listening, and the
|
|
36
|
+
* requests that follow reach nothing.
|
|
37
|
+
*/
|
|
38
|
+
protected override async close (): Promise<void> {
|
|
33
39
|
this.stopped = true
|
|
34
40
|
}
|
|
35
41
|
|
|
@@ -47,6 +53,11 @@ export class Tenant extends Connector {
|
|
|
47
53
|
}
|
|
48
54
|
|
|
49
55
|
private async expose (): Promise<void> {
|
|
56
|
+
// the ping subscription outlives the announcing loop, and answering one on the way out
|
|
57
|
+
// is the same announcement by another route
|
|
58
|
+
if (this.stopped)
|
|
59
|
+
return
|
|
60
|
+
|
|
50
61
|
await this.broadcast.transmit('expose', this.branch)
|
|
51
62
|
}
|
|
52
63
|
}
|
|
@@ -11,7 +11,7 @@ export class IO implements DirectiveFamily<Directive> {
|
|
|
11
11
|
public readonly name = 'io'
|
|
12
12
|
public readonly mandatory = true
|
|
13
13
|
|
|
14
|
-
/** Throttling reconciles through a component, because only a component has
|
|
14
|
+
/** Throttling reconciles through a component, because only a component has an atom aspect. */
|
|
15
15
|
private sync: Sync | null = null
|
|
16
16
|
|
|
17
17
|
// eslint-disable-next-line max-params
|
|
@@ -25,7 +25,7 @@ export class IO implements DirectiveFamily<Directive> {
|
|
|
25
25
|
|
|
26
26
|
// discovering boots the component, so nothing is discovered until something throttles
|
|
27
27
|
if (name === 'throttle')
|
|
28
|
-
this.sync ??= new Sync(remotes.discover('exposition', '
|
|
28
|
+
this.sync ??= new Sync(remotes.discover('exposition', 'atom'))
|
|
29
29
|
|
|
30
30
|
return new Directive(value, this.sync!, route)
|
|
31
31
|
}
|
|
@@ -11,7 +11,7 @@ import type { Remote } from '@toa.io/core'
|
|
|
11
11
|
* the debt the whole group has reached, which the quotas then decide on locally.
|
|
12
12
|
*/
|
|
13
13
|
export class Sync {
|
|
14
|
-
private readonly
|
|
14
|
+
private readonly atom: Promise<Remote>
|
|
15
15
|
private readonly quotas: Quotas[] = []
|
|
16
16
|
private remote: Remote | null = null
|
|
17
17
|
private timer: NodeJS.Timeout | null = null
|
|
@@ -20,8 +20,8 @@ export class Sync {
|
|
|
20
20
|
/** Ticks do not overlap: a slow round trip delays reconciling, it does not double it. */
|
|
21
21
|
private reconciling = false
|
|
22
22
|
|
|
23
|
-
public constructor (
|
|
24
|
-
this.
|
|
23
|
+
public constructor (atom: Promise<Remote>) {
|
|
24
|
+
this.atom = atom
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
public register (quotas: Quotas): void {
|
|
@@ -74,7 +74,7 @@ export class Sync {
|
|
|
74
74
|
|
|
75
75
|
private async reconcile (batch: Batch[]): Promise<void> {
|
|
76
76
|
try {
|
|
77
|
-
this.remote ??= await this.
|
|
77
|
+
this.remote ??= await this.atom
|
|
78
78
|
|
|
79
79
|
const keys = batch.map((entry) => entry.quotas.name(entry.key))
|
|
80
80
|
const deltas = batch.map((entry) => entry.delta)
|
package/transpiled/Gateway.d.ts
CHANGED
|
@@ -16,6 +16,13 @@ export declare class Gateway extends Connector {
|
|
|
16
16
|
constructor(broadcast: Broadcast, tree: Tree, interception: Interception);
|
|
17
17
|
process(context: http.Context): Promise<http.OutgoingMessage>;
|
|
18
18
|
protected open(): Promise<void>;
|
|
19
|
+
/**
|
|
20
|
+
* Both of these reach into components, and a dependency is torn down only once this has
|
|
21
|
+
* returned — where `dispose` runs after every one of them already has. The throttling
|
|
22
|
+
* ticker firing in between calls an endpoint that has just been unbound, and reports the
|
|
23
|
+
* refusal as a failure to reconcile.
|
|
24
|
+
*/
|
|
25
|
+
protected close(): Promise<void>;
|
|
19
26
|
protected dispose(): void;
|
|
20
27
|
private match;
|
|
21
28
|
private call;
|
package/transpiled/Gateway.js
CHANGED
|
@@ -73,9 +73,17 @@ class Gateway extends core_1.Connector {
|
|
|
73
73
|
await this.discover();
|
|
74
74
|
openspan_1.console.info('Gateway started');
|
|
75
75
|
}
|
|
76
|
-
|
|
76
|
+
/**
|
|
77
|
+
* Both of these reach into components, and a dependency is torn down only once this has
|
|
78
|
+
* returned — where `dispose` runs after every one of them already has. The throttling
|
|
79
|
+
* ticker firing in between calls an endpoint that has just been unbound, and reports the
|
|
80
|
+
* refusal as a failure to reconcile.
|
|
81
|
+
*/
|
|
82
|
+
async close() {
|
|
77
83
|
this.stopped = true;
|
|
78
84
|
this.tree.dispose();
|
|
85
|
+
}
|
|
86
|
+
dispose() {
|
|
79
87
|
openspan_1.console.info('Gateway is closed');
|
|
80
88
|
}
|
|
81
89
|
match(context) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Gateway.js","sourceRoot":"","sources":["../source/Gateway.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,8DAAgC;AAChC,mDAAiD;AACjD,uCAAkC;AAClC,uCAAuD;AACvD,6CAA8B;AAC9B,6CAAsC;AAMtC,MAAa,OAAQ,SAAQ,gBAAS;IACnB,SAAS,CAAW;IACpB,IAAI,CAAM;IACV,WAAW,CAAc;IACzB,QAAQ,GAAG,IAAI,GAAG,EAAmB,CAAA;IAC9C,SAAS,GAAG,CAAC,CAAA;IACb,SAAS,GAAG,CAAC,CAAA;IACb,QAAQ,GAAG,CAAC,CAAA;IACZ,OAAO,GAAG,KAAK,CAAA;IACf,iBAAiB,GAAwB,IAAI,CAAA;IAErD,YAAoB,SAAoB,EAAE,IAAU,EAAE,YAA0B;QAC9E,KAAK,EAAE,CAAA;QAEP,IAAI,CAAC,SAAS,GAAG,SAAS,CAAA;QAC1B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAA;QAChB,IAAI,CAAC,WAAW,GAAG,YAAY,CAAA;QAE/B,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,CAAA;IACzB,CAAC;IAEM,KAAK,CAAC,OAAO,CAAE,OAAqB;QACzC,MAAM,YAAY,GAAG,MAAM,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,WAAW,EAC3D,IAAI,CAAC,WAAW,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAA;QAEtC,IAAI,YAAY,KAAK,IAAI;YACvB,OAAO,Y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AAK,CAAA"}
|
package/transpiled/Tenant.d.ts
CHANGED
|
@@ -9,7 +9,13 @@ export declare class Tenant extends Connector {
|
|
|
9
9
|
private stopped;
|
|
10
10
|
constructor(broadcast: Broadcast, branch: Branch);
|
|
11
11
|
open(): Promise<void>;
|
|
12
|
-
|
|
12
|
+
/**
|
|
13
|
+
* Announcing is stopped where the teardown begins, not in `dispose`, which a connector
|
|
14
|
+
* runs after every one of its dependencies has gone. A component on its way out that
|
|
15
|
+
* announces itself once more has its routes held open by whoever is listening, and the
|
|
16
|
+
* requests that follow reach nothing.
|
|
17
|
+
*/
|
|
18
|
+
protected close(): Promise<void>;
|
|
13
19
|
private announce;
|
|
14
20
|
private expose;
|
|
15
21
|
}
|
package/transpiled/Tenant.js
CHANGED
|
@@ -21,7 +21,13 @@ class Tenant extends core_1.Connector {
|
|
|
21
21
|
await this.broadcast.receive('ping', this.expose.bind(this));
|
|
22
22
|
void this.announce();
|
|
23
23
|
}
|
|
24
|
-
|
|
24
|
+
/**
|
|
25
|
+
* Announcing is stopped where the teardown begins, not in `dispose`, which a connector
|
|
26
|
+
* runs after every one of its dependencies has gone. A component on its way out that
|
|
27
|
+
* announces itself once more has its routes held open by whoever is listening, and the
|
|
28
|
+
* requests that follow reach nothing.
|
|
29
|
+
*/
|
|
30
|
+
async close() {
|
|
25
31
|
this.stopped = true;
|
|
26
32
|
}
|
|
27
33
|
async announce() {
|
|
@@ -34,6 +40,10 @@ class Tenant extends core_1.Connector {
|
|
|
34
40
|
}
|
|
35
41
|
}
|
|
36
42
|
async expose() {
|
|
43
|
+
// the ping subscription outlives the announcing loop, and answering one on the way out
|
|
44
|
+
// is the same announcement by another route
|
|
45
|
+
if (this.stopped)
|
|
46
|
+
return;
|
|
37
47
|
await this.broadcast.transmit('expose', this.branch);
|
|
38
48
|
}
|
|
39
49
|
}
|
package/transpiled/Tenant.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tenant.js","sourceRoot":"","sources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C,CAAA;AAC/C,MAAM,UAAU,GAAG,OAAO,CAAA"}
|
|
@@ -5,7 +5,7 @@ import type { Directive } from './Directive';
|
|
|
5
5
|
export declare class IO implements DirectiveFamily<Directive> {
|
|
6
6
|
readonly name = "io";
|
|
7
7
|
readonly mandatory = true;
|
|
8
|
-
/** Throttling reconciles through a component, because only a component has
|
|
8
|
+
/** Throttling reconciles through a component, because only a component has an atom aspect. */
|
|
9
9
|
private sync;
|
|
10
10
|
create(name: string, value: unknown, remotes: Remotes, route: string): Directive;
|
|
11
11
|
preflight(directives: Directive[], context: http.Context, parameters: Parameter[]): null;
|
|
@@ -8,7 +8,7 @@ const throttle_1 = require("./lib/throttle");
|
|
|
8
8
|
class IO {
|
|
9
9
|
name = 'io';
|
|
10
10
|
mandatory = true;
|
|
11
|
-
/** Throttling reconciles through a component, because only a component has
|
|
11
|
+
/** Throttling reconciles through a component, because only a component has an atom aspect. */
|
|
12
12
|
sync = null;
|
|
13
13
|
// eslint-disable-next-line max-params
|
|
14
14
|
create(name, value, remotes, route) {
|
|
@@ -18,7 +18,7 @@ class IO {
|
|
|
18
18
|
Directive.validate(value);
|
|
19
19
|
// discovering boots the component, so nothing is discovered until something throttles
|
|
20
20
|
if (name === 'throttle')
|
|
21
|
-
this.sync ??= new throttle_1.Sync(remotes.discover('exposition', '
|
|
21
|
+
this.sync ??= new throttle_1.Sync(remotes.discover('exposition', 'atom'));
|
|
22
22
|
return new Directive(value, this.sync, route);
|
|
23
23
|
}
|
|
24
24
|
preflight(directives, context, parameters) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IO.js","sourceRoot":"","sources":["../../../source/directives/io/IO.ts"],"names":[],"mappings":";;;AAAA,qCAAiC;AACjC,mCAA+B;AAC/B,yCAAqC;AACrC,6CAAqC;AAMrC,MAAa,EAAE;IACG,IAAI,GAAG,IAAI,CAAA;IACX,SAAS,GAAG,IAAI,CAAA;IAEhC,8FAA8F;IACtF,IAAI,GAAgB,IAAI,C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,CAAA;IAChD,CAAC;IAEM,SAAS,CAAE,UAAuB,EAAE,OAAqB,EAC9D,UAAuB;QACvB,IAAI,UAAU,GAAG,KAAK,CAAA;QAEtB,KAAK,MAAM,SAAS,IAAI,UAAU,EAAE,CAAC;YACnC,UAAU,KAAK,SAAS,YAAY,eAAM,CAAA;YAE1C,SAAS,CAAC,SAAS,CAAC,OAAO,EAAE,UAAU,CAAC,CAAA;QAC1C,CAAC;QAED,IAAI,CAAC,UAAU;YACb,MAAM,CAAC,SAAS,CAAC,OAAO,EAAE,UAAU,CAAC,CAAA;QAEvC,OAAO,IAAI,CAAA;IACb,CAAC;IAEM,MAAM,CAAE,UAAuB,EAAE,OAAqB,EAC3D,MAA4B;QAC5B,KAAK,MAAM,SAAS,IAAI,UAAU;YAChC,SAAS,CAAC,MAAM,EAAE,CAAC,OAAO,EAAE,MAAM,CAAC,CAAA;IACvC,CAAC;IAED;;;;OAIG;IACI,OAAO;QACZ,IAAI,CAAC,IAAI,EAAE,OAAO,EAAE,CAAA;IACtB,CAAC;CACF;AArDD,gBAqDC;AAED,MAAM,YAAY,GAAgC;IAChD,KAAK,EAAE,aAAK;IACZ,MAAM,EAAE,eAAM;IACd,QAAQ,EAAE,mBAAQ;CACnB,CAAA;AAED,MAAM,MAAM,GAAc,IAAI,eAAM,CAAC,EAAE,CAAC,CAAA"}
|
|
@@ -9,14 +9,14 @@ import type { Remote } from '@toa.io/core';
|
|
|
9
9
|
* the debt the whole group has reached, which the quotas then decide on locally.
|
|
10
10
|
*/
|
|
11
11
|
export declare class Sync {
|
|
12
|
-
private readonly
|
|
12
|
+
private readonly atom;
|
|
13
13
|
private readonly quotas;
|
|
14
14
|
private remote;
|
|
15
15
|
private timer;
|
|
16
16
|
private period;
|
|
17
17
|
/** Ticks do not overlap: a slow round trip delays reconciling, it does not double it. */
|
|
18
18
|
private reconciling;
|
|
19
|
-
constructor(
|
|
19
|
+
constructor(atom: Promise<Remote>);
|
|
20
20
|
register(quotas: Quotas): void;
|
|
21
21
|
dispose(): void;
|
|
22
22
|
private start;
|
|
@@ -11,15 +11,15 @@ const openspan_1 = require("openspan");
|
|
|
11
11
|
* the debt the whole group has reached, which the quotas then decide on locally.
|
|
12
12
|
*/
|
|
13
13
|
class Sync {
|
|
14
|
-
|
|
14
|
+
atom;
|
|
15
15
|
quotas = [];
|
|
16
16
|
remote = null;
|
|
17
17
|
timer = null;
|
|
18
18
|
period = Infinity;
|
|
19
19
|
/** Ticks do not overlap: a slow round trip delays reconciling, it does not double it. */
|
|
20
20
|
reconciling = false;
|
|
21
|
-
constructor(
|
|
22
|
-
this.
|
|
21
|
+
constructor(atom) {
|
|
22
|
+
this.atom = atom;
|
|
23
23
|
}
|
|
24
24
|
register(quotas) {
|
|
25
25
|
this.quotas.push(quotas);
|
|
@@ -57,7 +57,7 @@ class Sync {
|
|
|
57
57
|
};
|
|
58
58
|
async reconcile(batch) {
|
|
59
59
|
try {
|
|
60
|
-
this.remote ??= await this.
|
|
60
|
+
this.remote ??= await this.atom;
|
|
61
61
|
const keys = batch.map((entry) => entry.quotas.name(entry.key));
|
|
62
62
|
const deltas = batch.map((entry) => entry.delta);
|
|
63
63
|
const debts = await this.remote.invoke('meter', { input: { keys, deltas } });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Sync.js","sourceRoot":"","sources":["../../../../../source/directives/io/lib/throttle/Sync.ts"],"names":[],"mappings":";;;AAAA,uCAAkC;AAIlC;;;;;;;GAOG;AACH,MAAa,IAAI;IACE,
|
|
1
|
+
{"version":3,"file":"Sync.js","sourceRoot":"","sources":["../../../../../source/directives/io/lib/throttle/Sync.ts"],"names":[],"mappings":";;;AAAA,uCAAkC;AAIlC;;;;;;;GAOG;AACH,MAAa,IAAI;IACE,IAAI,CAAiB;IACrB,MAAM,GAAa,EAAE,CAAA;IAC9B,MAAM,GAAkB,IAAI,CAAA;IAC5B,KAAK,GAA0B,IAAI,CAAA;IACnC,MAAM,GAAG,QAAQ,CAAA;IAEz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