@interop/wallet-core 0.88.0 → 0.89.0
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/dist/menders/derive.d.ts +16 -7
- package/dist/menders/derive.d.ts.map +1 -1
- package/dist/menders/derive.js +21 -10
- package/dist/menders/derive.js.map +1 -1
- package/dist/menders/index.d.ts +10 -6
- package/dist/menders/index.d.ts.map +1 -1
- package/dist/menders/index.js +10 -6
- package/dist/menders/index.js.map +1 -1
- package/dist/menders/registry.d.ts +13 -6
- package/dist/menders/registry.d.ts.map +1 -1
- package/dist/menders/registry.js +18 -3
- package/dist/menders/registry.js.map +1 -1
- package/dist/menders/runner.d.ts +45 -2
- package/dist/menders/runner.d.ts.map +1 -1
- package/dist/menders/runner.js +73 -29
- package/dist/menders/runner.js.map +1 -1
- package/dist/menders/types.d.ts +17 -3
- package/dist/menders/types.d.ts.map +1 -1
- package/dist/menders/vocabulary.d.ts +3 -1
- package/dist/menders/vocabulary.d.ts.map +1 -1
- package/dist/menders/vocabulary.js +3 -1
- package/dist/menders/vocabulary.js.map +1 -1
- package/package.json +1 -1
package/dist/menders/derive.d.ts
CHANGED
|
@@ -20,12 +20,19 @@ type DerivedGap = Pick<InvariantGap, 'invariant' | 'kind'>;
|
|
|
20
20
|
* The invariants a transient visit on a standing credential reaches. The
|
|
21
21
|
* two chain triggers are read through `dueAt` over the ladder held set; a
|
|
22
22
|
* `login-routing` site counts unless the client-key-record probe guards it;
|
|
23
|
-
* an `encounter` site counts
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
23
|
+
* an `encounter` site counts when its `reachedBy` names `transient` and the
|
|
24
|
+
* ladder held set admits every invariant it reports, the test a chain
|
|
25
|
+
* registration meets; a `ceremony-tail` entry counts, every such ceremony
|
|
26
|
+
* running on any session type; and a detector no site reports (a
|
|
27
|
+
* declaration carrying `holdsWhen`) counts when it is checked at routing or,
|
|
28
|
+
* on the transient chain, under an authority the ladder held set carries.
|
|
29
|
+
* An unreported declaration with no detector is reached by nothing. No
|
|
30
|
+
* unreported declaration lists `encounter`, since `menderRegistry` refuses
|
|
31
|
+
* one at construction.
|
|
32
|
+
*
|
|
33
|
+
* The rule trusts each declaration's `authority`. A declaration claiming a
|
|
34
|
+
* wider authority than what converges it on a transient visit would count
|
|
35
|
+
* an encounter site as reachable and hide a real `unreachable` gap.
|
|
29
36
|
*
|
|
30
37
|
* @param options {object}
|
|
31
38
|
* @param options.registry {MenderRegistry}
|
|
@@ -43,7 +50,9 @@ export declare function transientReachableInvariants({ registry }: {
|
|
|
43
50
|
* a gap. A declaration naming a chain or routing trigger no site backs
|
|
44
51
|
* derives `none` whatever else it names. An invariant reported only at sites
|
|
45
52
|
* a transient visit cannot reach, on an account shape the violation can
|
|
46
|
-
* stand on, derives `unreachable`.
|
|
53
|
+
* stand on, derives `unreachable`. That includes an invariant reported
|
|
54
|
+
* only at encounter sites a transient visit does not reach: the ceremony-tail
|
|
55
|
+
* exemption does not extend to `encounter`. Nothing else derives a gap.
|
|
47
56
|
*
|
|
48
57
|
* @param options {object}
|
|
49
58
|
* @param options.registry {MenderRegistry}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"derive.d.ts","sourceRoot":"","sources":["../../src/menders/derive.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;GAOG;AACH,OAAO,EAAiB,KAAK,WAAW,EAAE,MAAM,UAAU,CAAA;AAC1D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AAEnD,OAAO,KAAK,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAA;AAEhE;;GAEG;AACH,KAAK,UAAU,GAAG,IAAI,CAAC,YAAY,EAAE,WAAW,GAAG,MAAM,CAAC,CAAA;AAW1D
|
|
1
|
+
{"version":3,"file":"derive.d.ts","sourceRoot":"","sources":["../../src/menders/derive.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;GAOG;AACH,OAAO,EAAiB,KAAK,WAAW,EAAE,MAAM,UAAU,CAAA;AAC1D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AAEnD,OAAO,KAAK,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAA;AAEhE;;GAEG;AACH,KAAK,UAAU,GAAG,IAAI,CAAC,YAAY,EAAE,WAAW,GAAG,MAAM,CAAC,CAAA;AAW1D;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,4BAA4B,CAAC,EAC3C,QAAQ,EACT,EAAE;IACD,QAAQ,EAAE,cAAc,CAAC,gBAAgB,EAAE,KAAK,CAAC,CAAA;CAClD,GAAG,aAAa,CAAC,WAAW,CAAC,CA4C7B;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,UAAU,CAAC,EACzB,QAAQ,EACT,EAAE;IACD,QAAQ,EAAE,cAAc,CAAC,gBAAgB,EAAE,KAAK,CAAC,CAAA;CAClD,GAAG,aAAa,CAAC,UAAU,CAAC,CAoB5B;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,cAAc,CAAC,EAC7B,OAAO,EACP,QAAQ,EACT,EAAE;IACD,OAAO,EAAE,aAAa,CAAC,UAAU,CAAC,CAAA;IAClC,QAAQ,EAAE,aAAa,CAAC,YAAY,CAAC,CAAA;CACtC,GAAG,aAAa,CAAC,UAAU,CAAC,CAS5B;AAED;;;;;;;;GAQG;AACH,wBAAgB,oBAAoB,CAAC,EACnC,QAAQ,EACT,EAAE;IACD,QAAQ,EAAE,cAAc,CAAC,gBAAgB,EAAE,KAAK,CAAC,CAAA;CAClD,GAAG,aAAa,CAAC,WAAW,CAAC,CAG7B"}
|
package/dist/menders/derive.js
CHANGED
|
@@ -21,12 +21,19 @@ function reportedIds(registry) {
|
|
|
21
21
|
* The invariants a transient visit on a standing credential reaches. The
|
|
22
22
|
* two chain triggers are read through `dueAt` over the ladder held set; a
|
|
23
23
|
* `login-routing` site counts unless the client-key-record probe guards it;
|
|
24
|
-
* an `encounter` site counts
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
24
|
+
* an `encounter` site counts when its `reachedBy` names `transient` and the
|
|
25
|
+
* ladder held set admits every invariant it reports, the test a chain
|
|
26
|
+
* registration meets; a `ceremony-tail` entry counts, every such ceremony
|
|
27
|
+
* running on any session type; and a detector no site reports (a
|
|
28
|
+
* declaration carrying `holdsWhen`) counts when it is checked at routing or,
|
|
29
|
+
* on the transient chain, under an authority the ladder held set carries.
|
|
30
|
+
* An unreported declaration with no detector is reached by nothing. No
|
|
31
|
+
* unreported declaration lists `encounter`, since `menderRegistry` refuses
|
|
32
|
+
* one at construction.
|
|
33
|
+
*
|
|
34
|
+
* The rule trusts each declaration's `authority`. A declaration claiming a
|
|
35
|
+
* wider authority than what converges it on a transient visit would count
|
|
36
|
+
* an encounter site as reachable and hide a real `unreachable` gap.
|
|
30
37
|
*
|
|
31
38
|
* @param options {object}
|
|
32
39
|
* @param options.registry {MenderRegistry}
|
|
@@ -44,8 +51,11 @@ export function transientReachableInvariants({ registry }) {
|
|
|
44
51
|
}
|
|
45
52
|
}
|
|
46
53
|
for (const site of registry.sites()) {
|
|
47
|
-
|
|
48
|
-
|
|
54
|
+
const routed = site.trigger === 'login-routing' && !site.guardedBy;
|
|
55
|
+
const encountered = site.trigger === 'encounter' &&
|
|
56
|
+
site.reachedBy.includes('transient') &&
|
|
57
|
+
registry.admits({ site, held });
|
|
58
|
+
if (routed || encountered) {
|
|
49
59
|
for (const id of site.reports) {
|
|
50
60
|
reached.add(id);
|
|
51
61
|
}
|
|
@@ -61,7 +71,6 @@ export function transientReachableInvariants({ registry }) {
|
|
|
61
71
|
continue;
|
|
62
72
|
}
|
|
63
73
|
const checkedOnVisit = decl.triggers.includes('login-routing') ||
|
|
64
|
-
decl.triggers.includes('encounter') ||
|
|
65
74
|
(decl.triggers.includes('transient-login-chain') &&
|
|
66
75
|
held.includes(decl.authority));
|
|
67
76
|
if (checkedOnVisit) {
|
|
@@ -82,7 +91,9 @@ export function transientReachableInvariants({ registry }) {
|
|
|
82
91
|
* a gap. A declaration naming a chain or routing trigger no site backs
|
|
83
92
|
* derives `none` whatever else it names. An invariant reported only at sites
|
|
84
93
|
* a transient visit cannot reach, on an account shape the violation can
|
|
85
|
-
* stand on, derives `unreachable`.
|
|
94
|
+
* stand on, derives `unreachable`. That includes an invariant reported
|
|
95
|
+
* only at encounter sites a transient visit does not reach: the ceremony-tail
|
|
96
|
+
* exemption does not extend to `encounter`. Nothing else derives a gap.
|
|
86
97
|
*
|
|
87
98
|
* @param options {object}
|
|
88
99
|
* @param options.registry {MenderRegistry}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"derive.js","sourceRoot":"","sources":["../../src/menders/derive.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;GAOG;AACH,OAAO,EAAE,aAAa,EAAoB,MAAM,UAAU,CAAA;AAE1D,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAA;AAQ/C;;GAEG;AACH,SAAS,WAAW,CAClB,QAAiD;IAEjD,OAAO,IAAI,GAAG,CAAC,QAAQ,CAAC,KAAK,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAA;AAChE,CAAC;AAED
|
|
1
|
+
{"version":3,"file":"derive.js","sourceRoot":"","sources":["../../src/menders/derive.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;GAOG;AACH,OAAO,EAAE,aAAa,EAAoB,MAAM,UAAU,CAAA;AAE1D,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAA;AAQ/C;;GAEG;AACH,SAAS,WAAW,CAClB,QAAiD;IAEjD,OAAO,IAAI,GAAG,CAAC,QAAQ,CAAC,KAAK,EAAE,CAAC,OAAO,CAAC,I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CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAA;AACtD,CAAC"}
|
package/dist/menders/index.d.ts
CHANGED
|
@@ -14,11 +14,15 @@
|
|
|
14
14
|
* `MendOutcome`, `MendReportEntry`, `MendReport`, `InvariantGap`,
|
|
15
15
|
* `LoginRoute`
|
|
16
16
|
* - the readers: `menderRegistry` (`all`, `byId`, `sites`, `admits`,
|
|
17
|
-
* `dueAt`), which refuses a duplicated id, an undeclared report,
|
|
18
|
-
* guard on a non-routing site
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
17
|
+
* `dueAt`), which refuses a duplicated id, an undeclared report, a
|
|
18
|
+
* guard on a non-routing site, an encounter site with no reach, or an
|
|
19
|
+
* encounter trigger no encounter site backs at construction, and
|
|
20
|
+
* `heldAuthorities`, the held set a session's account-ceremony context
|
|
21
|
+
* derives
|
|
22
|
+
* - the runner: `runMenderRegistration`, one try, warn, and skip
|
|
23
|
+
* discipline over one registration, shared by the chain runner and a
|
|
24
|
+
* wallet's encounter sites; `runMenderBlock`, that discipline over one
|
|
25
|
+
* chain trigger's registrations; `mendReportAccumulator`, the
|
|
22
26
|
* pre-session report collector its `onOutcome` feeds, and `errorNameOf`,
|
|
23
27
|
* the name a report carries for a thrown value of any shape
|
|
24
28
|
* - the derived sets a wallet's audit tests pin:
|
|
@@ -35,7 +39,7 @@ export type { InvariantId } from './ids.js';
|
|
|
35
39
|
export { heldAuthorities, menderRegistry } from './registry.js';
|
|
36
40
|
export type { MenderRegistry, ResolvedAuthority } from './registry.js';
|
|
37
41
|
export { errorNameOf } from '../errorName.js';
|
|
38
|
-
export { MEND_REPORT_SHAPE_ERROR, mendReportAccumulator, runMenderBlock } from './runner.js';
|
|
42
|
+
export { MEND_REPORT_SHAPE_ERROR, mendReportAccumulator, runMenderBlock, runMenderRegistration } from './runner.js';
|
|
39
43
|
export type { MendReportAccumulator } from './runner.js';
|
|
40
44
|
export type { InvariantDeclaration, InvariantGap, LoginRoute, MendOutcome, MendReport, MendReportEntry, Registration, RegistrationSite } from './types.js';
|
|
41
45
|
export { ACCOUNT_SHAPES, AUTHORITIES, CHAIN_TRIGGERS, EVIDENCE, GAP_KINDS, MEND_OUTCOMES, TRIGGERS } from './vocabulary.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/menders/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/menders/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,OAAO,EACL,UAAU,EACV,4BAA4B,EAC5B,cAAc,EACd,oBAAoB,EACrB,MAAM,aAAa,CAAA;AACpB,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AACxC,YAAY,EAAE,WAAW,EAAE,MAAM,UAAU,CAAA;AAC3C,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AAC/D,YAAY,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAA;AACtE,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAA;AAC7C,OAAO,EACL,uBAAuB,EACvB,qBAAqB,EACrB,cAAc,EACd,qBAAqB,EACtB,MAAM,aAAa,CAAA;AACpB,YAAY,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAA;AACxD,YAAY,EACV,oBAAoB,EACpB,YAAY,EACZ,UAAU,EACV,WAAW,EACX,UAAU,EACV,eAAe,EACf,YAAY,EACZ,gBAAgB,EACjB,MAAM,YAAY,CAAA;AACnB,OAAO,EACL,cAAc,EACd,WAAW,EACX,cAAc,EACd,QAAQ,EACR,SAAS,EACT,aAAa,EACb,QAAQ,EACT,MAAM,iBAAiB,CAAA;AACxB,YAAY,EACV,YAAY,EACZ,SAAS,EACT,YAAY,EACZ,QAAQ,EACR,OAAO,EACP,eAAe,EACf,OAAO,EACR,MAAM,iBAAiB,CAAA"}
|
package/dist/menders/index.js
CHANGED
|
@@ -14,11 +14,15 @@
|
|
|
14
14
|
* `MendOutcome`, `MendReportEntry`, `MendReport`, `InvariantGap`,
|
|
15
15
|
* `LoginRoute`
|
|
16
16
|
* - the readers: `menderRegistry` (`all`, `byId`, `sites`, `admits`,
|
|
17
|
-
* `dueAt`), which refuses a duplicated id, an undeclared report,
|
|
18
|
-
* guard on a non-routing site
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
17
|
+
* `dueAt`), which refuses a duplicated id, an undeclared report, a
|
|
18
|
+
* guard on a non-routing site, an encounter site with no reach, or an
|
|
19
|
+
* encounter trigger no encounter site backs at construction, and
|
|
20
|
+
* `heldAuthorities`, the held set a session's account-ceremony context
|
|
21
|
+
* derives
|
|
22
|
+
* - the runner: `runMenderRegistration`, one try, warn, and skip
|
|
23
|
+
* discipline over one registration, shared by the chain runner and a
|
|
24
|
+
* wallet's encounter sites; `runMenderBlock`, that discipline over one
|
|
25
|
+
* chain trigger's registrations; `mendReportAccumulator`, the
|
|
22
26
|
* pre-session report collector its `onOutcome` feeds, and `errorNameOf`,
|
|
23
27
|
* the name a report carries for a thrown value of any shape
|
|
24
28
|
* - the derived sets a wallet's audit tests pin:
|
|
@@ -33,6 +37,6 @@ export { deriveGaps, transientReachableInvariants, undeclaredGaps, undeclaredInv
|
|
|
33
37
|
export { INVARIANT_IDS } from './ids.js';
|
|
34
38
|
export { heldAuthorities, menderRegistry } from './registry.js';
|
|
35
39
|
export { errorNameOf } from '../errorName.js';
|
|
36
|
-
export { MEND_REPORT_SHAPE_ERROR, mendReportAccumulator, runMenderBlock } from './runner.js';
|
|
40
|
+
export { MEND_REPORT_SHAPE_ERROR, mendReportAccumulator, runMenderBlock, runMenderRegistration } from './runner.js';
|
|
37
41
|
export { ACCOUNT_SHAPES, AUTHORITIES, CHAIN_TRIGGERS, EVIDENCE, GAP_KINDS, MEND_OUTCOMES, TRIGGERS } from './vocabulary.js';
|
|
38
42
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/menders/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/menders/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,OAAO,EACL,UAAU,EACV,4BAA4B,EAC5B,cAAc,EACd,oBAAoB,EACrB,MAAM,aAAa,CAAA;AACpB,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AAExC,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AAE/D,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAA;AAC7C,OAAO,EACL,uBAAuB,EACvB,qBAAqB,EACrB,cAAc,EACd,qBAAqB,EACtB,MAAM,aAAa,CAAA;AAYpB,OAAO,EACL,cAAc,EACd,WAAW,EACX,cAAc,EACd,QAAQ,EACR,SAAS,EACT,aAAa,EACb,QAAQ,EACT,MAAM,iBAAiB,CAAA"}
|
|
@@ -9,9 +9,12 @@
|
|
|
9
9
|
* listed under one chain trigger that `admits` passes, in list order.
|
|
10
10
|
* Registration order is execution order; there is no dependency graph and
|
|
11
11
|
* no priority. The table and the sites are checked once, at construction: a
|
|
12
|
-
* duplicated declaration id, a site reporting an undeclared invariant,
|
|
13
|
-
* guard on a non-routing site
|
|
14
|
-
*
|
|
12
|
+
* duplicated declaration id, a site reporting an undeclared invariant, a
|
|
13
|
+
* guard on a non-routing site, an encounter site with no reach, or a
|
|
14
|
+
* declaration listing `encounter` that no encounter site reports is a
|
|
15
|
+
* `TypeError` there, so no reader meets the defect later, depending on what
|
|
16
|
+
* a login happens to hold. Both wallets build their registries at import, so
|
|
17
|
+
* the error surfaces at module load.
|
|
15
18
|
*/
|
|
16
19
|
import type { InvariantId } from './ids.js';
|
|
17
20
|
import type { InvariantDeclaration, LoginRoute, RegistrationSite } from './types.js';
|
|
@@ -35,7 +38,8 @@ export interface MenderRegistry<Site extends RegistrationSite, Deps, Ceremony ex
|
|
|
35
38
|
/**
|
|
36
39
|
* Whether a site's every reported invariant declares an authority in
|
|
37
40
|
* `held` and, when a route is given, admits it. The one admission test,
|
|
38
|
-
* shared by `dueAt
|
|
41
|
+
* shared by `dueAt`, by a runner admitting a site the caller supplies, and
|
|
42
|
+
* by the derivation's encounter reach rule, which gives no route.
|
|
39
43
|
*
|
|
40
44
|
* @throws {TypeError} when the site reports an undeclared invariant,
|
|
41
45
|
* reachable only for a site the registry does not index
|
|
@@ -67,7 +71,9 @@ export declare function heldAuthorities({ kind }: {
|
|
|
67
71
|
/**
|
|
68
72
|
* Builds the readers over one wallet's declarations and sites, checking
|
|
69
73
|
* both once: every declaration id is unique, every reported id is declared,
|
|
70
|
-
*
|
|
74
|
+
* only a `login-routing` site carries `guardedBy`, every `encounter` site
|
|
75
|
+
* names at least one session kind in `reachedBy`, and every declaration
|
|
76
|
+
* listing `encounter` among its triggers is reported by an encounter site.
|
|
71
77
|
*
|
|
72
78
|
* @param options {object}
|
|
73
79
|
* @param options.declarations {ReadonlyArray<InvariantDeclaration>}
|
|
@@ -75,7 +81,8 @@ export declare function heldAuthorities({ kind }: {
|
|
|
75
81
|
* registration site, any trigger, in execution order within a trigger
|
|
76
82
|
* @returns {MenderRegistry}
|
|
77
83
|
* @throws {TypeError} on a duplicated declaration id, an undeclared
|
|
78
|
-
* report,
|
|
84
|
+
* report, a guard on a non-routing site, an encounter site with no reach,
|
|
85
|
+
* or an encounter trigger no encounter site backs
|
|
79
86
|
*/
|
|
80
87
|
export declare function menderRegistry<Site extends RegistrationSite, Deps, Ceremony extends string = string>({ declarations, sites }: {
|
|
81
88
|
declarations: ReadonlyArray<InvariantDeclaration<Deps, Ceremony>>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../src/menders/registry.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH
|
|
1
|
+
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../src/menders/registry.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;GAcG;AACH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAA;AAC3C,OAAO,KAAK,EACV,oBAAoB,EACpB,UAAU,EACV,gBAAgB,EACjB,MAAM,YAAY,CAAA;AACnB,OAAO,KAAK,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AAE9D;;;;;GAKG;AACH,MAAM,MAAM,iBAAiB,GAAG,OAAO,CAAC,SAAS,EAAE,MAAM,GAAG,SAAS,CAAC,CAAA;AAEtE;;;;GAIG;AACH,MAAM,WAAW,cAAc,CAC7B,IAAI,SAAS,gBAAgB,EAC7B,IAAI,EACJ,QAAQ,SAAS,MAAM,GAAG,MAAM;IAEhC,GAAG,IAAI,aAAa,CAAC,oBAAoB,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC,CAAA;IAC1D,IAAI,CAAC,EAAE,EAAE,WAAW,GAAG,oBAAoB,CAAC,IAAI,EAAE,QAAQ,CAAC,GAAG,SAAS,CAAA;IACvE,KAAK,IAAI,aAAa,CAAC,IAAI,CAAC,CAAA;IAC5B;;;;;;;;OAQG;IACH,MAAM,CAAC,OAAO,EAAE;QACd,IAAI,EAAE,gBAAgB,CAAA;QACtB,IAAI,EAAE,aAAa,CAAC,SAAS,CAAC,CAAA;QAC9B,KAAK,CAAC,EAAE,UAAU,CAAA;KACnB,GAAG,OAAO,CAAA;IACX,KAAK,CAAC,OAAO,EAAE;QACb,IAAI,EAAE,aAAa,CAAC,SAAS,CAAC,CAAA;QAC9B,OAAO,EAAE,YAAY,CAAA;QACrB,KAAK,CAAC,EAAE,UAAU,CAAA;KACnB,GAAG,aAAa,CAAC,IAAI,CAAC,CAAA;CACxB;AAED;;;;;;;;;GASG;AACH,wBAAgB,eAAe,CAAC,EAC9B,IAAI,EACL,EAAE;IACD,IAAI,CAAC,EAAE,iBAAiB,CAAA;CACzB,GAAG,aAAa,CAAC,SAAS,CAAC,CAE3B;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,cAAc,CAC5B,IAAI,SAAS,gBAAgB,EAC7B,IAAI,EACJ,QAAQ,SAAS,MAAM,GAAG,MAAM,EAChC,EACA,YAAY,EACZ,KAAK,EACN,EAAE;IACD,YAAY,EAAE,aAAa,CAAC,oBAAoB,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC,CAAA;IACjE,KAAK,EAAE,aAAa,CAAC,IAAI,CAAC,CAAA;CAC3B,GAAG,cAAc,CAAC,IAAI,EAAE,IAAI,EAAE,QAAQ,CAAC,CAsEvC"}
|
package/dist/menders/registry.js
CHANGED
|
@@ -14,7 +14,9 @@ export function heldAuthorities({ kind }) {
|
|
|
14
14
|
/**
|
|
15
15
|
* Builds the readers over one wallet's declarations and sites, checking
|
|
16
16
|
* both once: every declaration id is unique, every reported id is declared,
|
|
17
|
-
*
|
|
17
|
+
* only a `login-routing` site carries `guardedBy`, every `encounter` site
|
|
18
|
+
* names at least one session kind in `reachedBy`, and every declaration
|
|
19
|
+
* listing `encounter` among its triggers is reported by an encounter site.
|
|
18
20
|
*
|
|
19
21
|
* @param options {object}
|
|
20
22
|
* @param options.declarations {ReadonlyArray<InvariantDeclaration>}
|
|
@@ -22,7 +24,8 @@ export function heldAuthorities({ kind }) {
|
|
|
22
24
|
* registration site, any trigger, in execution order within a trigger
|
|
23
25
|
* @returns {MenderRegistry}
|
|
24
26
|
* @throws {TypeError} on a duplicated declaration id, an undeclared
|
|
25
|
-
* report,
|
|
27
|
+
* report, a guard on a non-routing site, an encounter site with no reach,
|
|
28
|
+
* or an encounter trigger no encounter site backs
|
|
26
29
|
*/
|
|
27
30
|
export function menderRegistry({ declarations, sites }) {
|
|
28
31
|
const index = new Map();
|
|
@@ -39,12 +42,24 @@ export function menderRegistry({ declarations, sites }) {
|
|
|
39
42
|
}
|
|
40
43
|
return decl;
|
|
41
44
|
};
|
|
45
|
+
const encountered = new Set();
|
|
42
46
|
for (const site of sites) {
|
|
43
47
|
site.reports.forEach(requireDeclared);
|
|
44
|
-
const { trigger, guardedBy } = site;
|
|
48
|
+
const { trigger, guardedBy, reachedBy } = site;
|
|
45
49
|
if (guardedBy !== undefined && trigger !== 'login-routing') {
|
|
46
50
|
throw new TypeError(`A ${trigger} site carries a guard; only a login-routing site may`);
|
|
47
51
|
}
|
|
52
|
+
if (trigger === 'encounter') {
|
|
53
|
+
if (!reachedBy || reachedBy.length === 0) {
|
|
54
|
+
throw new TypeError(`An encounter site names no session kind that reaches it: ${site.reports.join(', ')}`);
|
|
55
|
+
}
|
|
56
|
+
site.reports.forEach(id => encountered.add(id));
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
for (const decl of declarations) {
|
|
60
|
+
if (decl.triggers.includes('encounter') && !encountered.has(decl.id)) {
|
|
61
|
+
throw new TypeError(`An invariant lists the encounter trigger but no encounter site reports it: ${decl.id}`);
|
|
62
|
+
}
|
|
48
63
|
}
|
|
49
64
|
const admits = ({ site, held, route }) => site.reports.every(id => {
|
|
50
65
|
const decl = requireDeclared(id);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registry.js","sourceRoot":"","sources":["../../src/menders/registry.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"registry.js","sourceRoot":"","sources":["../../src/menders/registry.ts"],"names":[],"mappings":"AAoEA;;;;;;;;;GASG;AACH,MAAM,UAAU,eAAe,CAAC,EAC9B,IAAI,EAGL;IACC,OAAO,IAAI,CAAC,CAAC,CAAC,CAAC,MAAM,EAAE,SAAS,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAA;AACpD,CAAC;AAED;;;;;;;;;;;;;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AI,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAClE;KACJ,CAAA;AACH,CAAC"}
|
package/dist/menders/runner.d.ts
CHANGED
|
@@ -66,7 +66,8 @@ export declare function mendReportAccumulator<Ceremony extends string = string>(
|
|
|
66
66
|
* whose every reported invariant declares an authority the session holds
|
|
67
67
|
* and admits this login route, in list order.
|
|
68
68
|
*
|
|
69
|
-
*
|
|
69
|
+
* Each step runs through {@link runMenderRegistration}, which holds the
|
|
70
|
+
* discipline in one place. An optional `seed` registration runs first,
|
|
70
71
|
* and its failure aborts the block: nothing behind it runs, which is what a
|
|
71
72
|
* rejected chain seed does today. Past the seed, a registration that throws
|
|
72
73
|
* warns once per reported invariant with that declaration's own `warn`
|
|
@@ -86,7 +87,8 @@ export declare function mendReportAccumulator<Ceremony extends string = string>(
|
|
|
86
87
|
* the block reports each entry into that accumulator, and the accumulator's
|
|
87
88
|
* own logger emits the event; the block does not emit it again. Without
|
|
88
89
|
* `mends`, the block emits the event through `logger` itself. A `noop`
|
|
89
|
-
* entry emits at debug. `onOutcome` runs after
|
|
90
|
+
* entry emits at debug. `onOutcome` runs after a registration's entries are
|
|
91
|
+
* reported, once per entry.
|
|
90
92
|
*
|
|
91
93
|
* `trigger` is one of the two chain values, so a `ceremony-tail` entry is
|
|
92
94
|
* out of reach here. Such an entry has no registration at all: its body
|
|
@@ -147,4 +149,45 @@ export declare function runMenderBlock<Deps, Ceremony extends string = string, S
|
|
|
147
149
|
mends?: MendReportAccumulator<Ceremony>;
|
|
148
150
|
onOutcome?: (entry: MendReportEntry<Ceremony>) => void;
|
|
149
151
|
}): Promise<MendReport<Ceremony>>;
|
|
152
|
+
/**
|
|
153
|
+
* Runs one registration under the runner's discipline and reports its
|
|
154
|
+
* entries. `runMenderBlock` calls it for each step, and a wallet calls it
|
|
155
|
+
* for a registration its own call site fires, such as an encounter site. It
|
|
156
|
+
* admits nothing: the caller has already checked the authority and any
|
|
157
|
+
* route.
|
|
158
|
+
*
|
|
159
|
+
* A registration that throws warns once per reported invariant with that
|
|
160
|
+
* declaration's own `warn` string, carrying the error, and yields one
|
|
161
|
+
* `failed` entry per reported id with the error's name alone
|
|
162
|
+
* (`errorNameOf`). A registration that resolves with entries that do not
|
|
163
|
+
* name its reported invariants, in order, warns once and yields `failed`
|
|
164
|
+
* entries carrying {@link MEND_REPORT_SHAPE_ERROR}. The run never rejects.
|
|
165
|
+
*
|
|
166
|
+
* Each entry emits exactly one `'ceremony mender'` event. Given `mends`,
|
|
167
|
+
* each entry is reported into that accumulator, whose own logger emits the
|
|
168
|
+
* event. Without `mends`, the event goes through `logger`. The event carries
|
|
169
|
+
* no `err`; the declared warn keeps the error.
|
|
170
|
+
*
|
|
171
|
+
* @param options {object}
|
|
172
|
+
* @param options.registry {MenderRegistry} the wallet's declarations,
|
|
173
|
+
* read for each reported invariant's `warn` and ceremonies
|
|
174
|
+
* @param options.registration {Registration} the registration to run
|
|
175
|
+
* @param options.deps {Deps} passed to `converge` unread
|
|
176
|
+
* @param options.logger {Logger} the wallet's own sink for the warn copy,
|
|
177
|
+
* and for the mender events when no `mends` is given
|
|
178
|
+
* @param [options.mends] {MendReportAccumulator} the accumulator each
|
|
179
|
+
* entry is reported into
|
|
180
|
+
* @returns {Promise<{ entries: MendReport, threw: boolean }>} the entries,
|
|
181
|
+
* one per reported id in order, and whether `converge` threw
|
|
182
|
+
*/
|
|
183
|
+
export declare function runMenderRegistration<Deps, Ceremony extends string = string, Site extends RegistrationSite = Registration<Deps, Ceremony>>({ registry, registration, deps, logger, mends }: {
|
|
184
|
+
registry: MenderRegistry<Site, Deps, Ceremony>;
|
|
185
|
+
registration: Registration<Deps, Ceremony>;
|
|
186
|
+
deps: Deps;
|
|
187
|
+
logger: Logger;
|
|
188
|
+
mends?: MendReportAccumulator<Ceremony>;
|
|
189
|
+
}): Promise<{
|
|
190
|
+
entries: MendReport<Ceremony>;
|
|
191
|
+
threw: boolean;
|
|
192
|
+
}>;
|
|
150
193
|
//# sourceMappingURL=runner.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runner.d.ts","sourceRoot":"","sources":["../../src/menders/runner.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"runner.d.ts","sourceRoot":"","sources":["../../src/menders/runner.ts"],"names":[],"mappings":"AAoBA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,WAAW,CAAA;AACvC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AACnD,OAAO,KAAK,EACV,UAAU,EACV,UAAU,EACV,eAAe,EACf,YAAY,EACZ,gBAAgB,EACjB,MAAM,YAAY,CAAA;AACnB,OAAO,KAAK,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AAE9D;;;GAGG;AACH,eAAO,MAAM,uBAAuB,yBAAyB,CAAA;AAE7D;;;;;;;GAOG;AACH,MAAM,WAAW,qBAAqB,CAAC,QAAQ,SAAS,MAAM,GAAG,MAAM;IACrE;;;;;;;;;;OAUG;IACH,MAAM,CAAC,KAAK,EAAE,eAAe,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC,EAAE;QAAE,GAAG,CAAC,EAAE,OAAO,CAAA;KAAE,GAAG,IAAI,CAAA;IAC3E;;OAEG;IACH,OAAO,IAAI,UAAU,CAAC,QAAQ,CAAC,CAAA;IAC/B;;;;OAIG;IACH,MAAM,IAAI,UAAU,CAAC,QAAQ,CAAC,CAAA;IAC9B;;OAEG;IACH,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC,CAAA;CAChD;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,qBAAqB,CAAC,QAAQ,SAAS,MAAM,GAAG,MAAM,EAAE,EACtE,MAAM,EACP,GAAE;IAAE,MAAM,CAAC,EAAE,MAAM,CAAA;CAAO,GAAG,qBAAqB,CAAC,QAAQ,CAAC,CAyB5D;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;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AI,EAAE,IAAI,EAAE,QAAQ,CAAC,CAAA;IAC9C,YAAY,EAAE,YAAY,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAA;IAC1C,IAAI,EAAE,IAAI,CAAA;IACV,MAAM,EAAE,MAAM,CAAA;IACd,KAAK,CAAC,EAAE,qBAAqB,CAAC,QAAQ,CAAC,CAAA;CACxC,GAAG,OAAO,CAAC;IAAE,OAAO,EAAE,UAAU,CAAC,QAAQ,CAAC,CAAC;IAAC,KAAK,EAAE,OAAO,CAAA;CAAE,CAAC,CAiB7D"}
|
package/dist/menders/runner.js
CHANGED
|
@@ -3,11 +3,13 @@
|
|
|
3
3
|
*/
|
|
4
4
|
/**
|
|
5
5
|
* The mender runner: one try, warn, and skip discipline over the
|
|
6
|
-
* registrations listed under one chain trigger. `
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
6
|
+
* registrations listed under one chain trigger. `runMenderRegistration` is
|
|
7
|
+
* that discipline for one registration, exported so a wallet's encounter
|
|
8
|
+
* sites run under the same copy. `runMenderBlock` runs a chain's
|
|
9
|
+
* registrations through it in list order, since registration order is
|
|
10
|
+
* execution order and there is no dependency graph. A seed step's failure
|
|
11
|
+
* aborts the block; a registration's failure warns through the wallet's own
|
|
12
|
+
* `Logger` and the block continues. Beside them sits `mendReportAccumulator`, the report
|
|
11
13
|
* collector a wallet creates before a `Session` exists, so the entries a
|
|
12
14
|
* routing site reports and the entries this runner reports assemble into
|
|
13
15
|
* one `MendReport`. An accumulator given a logger emits each entry's
|
|
@@ -65,7 +67,8 @@ export function mendReportAccumulator({ logger } = {}) {
|
|
|
65
67
|
* whose every reported invariant declares an authority the session holds
|
|
66
68
|
* and admits this login route, in list order.
|
|
67
69
|
*
|
|
68
|
-
*
|
|
70
|
+
* Each step runs through {@link runMenderRegistration}, which holds the
|
|
71
|
+
* discipline in one place. An optional `seed` registration runs first,
|
|
69
72
|
* and its failure aborts the block: nothing behind it runs, which is what a
|
|
70
73
|
* rejected chain seed does today. Past the seed, a registration that throws
|
|
71
74
|
* warns once per reported invariant with that declaration's own `warn`
|
|
@@ -85,7 +88,8 @@ export function mendReportAccumulator({ logger } = {}) {
|
|
|
85
88
|
* the block reports each entry into that accumulator, and the accumulator's
|
|
86
89
|
* own logger emits the event; the block does not emit it again. Without
|
|
87
90
|
* `mends`, the block emits the event through `logger` itself. A `noop`
|
|
88
|
-
* entry emits at debug. `onOutcome` runs after
|
|
91
|
+
* entry emits at debug. `onOutcome` runs after a registration's entries are
|
|
92
|
+
* reported, once per entry.
|
|
89
93
|
*
|
|
90
94
|
* `trigger` is one of the two chain values, so a `ceremony-tail` entry is
|
|
91
95
|
* out of reach here. Such an entry has no registration at all: its body
|
|
@@ -136,22 +140,6 @@ export function mendReportAccumulator({ logger } = {}) {
|
|
|
136
140
|
*/
|
|
137
141
|
export async function runMenderBlock({ registry, trigger, held, route, deps, logger, registrations, seed, mends, onOutcome }) {
|
|
138
142
|
const report = [];
|
|
139
|
-
const collect = (entries) => {
|
|
140
|
-
for (const entry of entries) {
|
|
141
|
-
report.push(entry);
|
|
142
|
-
// The diagnostics twin of the report entry, emitted once: by the
|
|
143
|
-
// accumulator when one is given, by the block otherwise. The entry
|
|
144
|
-
// carries `errorName` alone, so the event carries no `err`; the
|
|
145
|
-
// registration's declared warn keeps the error.
|
|
146
|
-
if (mends) {
|
|
147
|
-
mends.report(entry);
|
|
148
|
-
}
|
|
149
|
-
else {
|
|
150
|
-
menderEvent({ log: logger, entry });
|
|
151
|
-
}
|
|
152
|
-
onOutcome?.(entry);
|
|
153
|
-
}
|
|
154
|
-
};
|
|
155
143
|
for (const supplied of [...(seed ? [seed] : []), ...(registrations ?? [])]) {
|
|
156
144
|
if (supplied.trigger !== trigger) {
|
|
157
145
|
throw new TypeError(`A ${supplied.trigger} registration was handed to the ${trigger} block`);
|
|
@@ -163,14 +151,19 @@ export async function runMenderBlock({ registry, trigger, held, route, deps, log
|
|
|
163
151
|
// ends the block.
|
|
164
152
|
const steps = seed && admitted(seed) ? [seed, ...listed] : listed;
|
|
165
153
|
for (const registration of steps) {
|
|
166
|
-
|
|
154
|
+
// Reports each entry into `mends`, or emits its mender event, before
|
|
155
|
+
// `onOutcome` sees it.
|
|
156
|
+
const outcome = await runMenderRegistration({
|
|
167
157
|
registry,
|
|
168
158
|
registration,
|
|
169
159
|
deps,
|
|
170
160
|
logger,
|
|
171
|
-
|
|
161
|
+
mends
|
|
172
162
|
});
|
|
173
|
-
|
|
163
|
+
for (const entry of outcome.entries) {
|
|
164
|
+
report.push(entry);
|
|
165
|
+
onOutcome?.(entry);
|
|
166
|
+
}
|
|
174
167
|
if (outcome.threw && registration === seed) {
|
|
175
168
|
return report;
|
|
176
169
|
}
|
|
@@ -178,10 +171,61 @@ export async function runMenderBlock({ registry, trigger, held, route, deps, log
|
|
|
178
171
|
return report;
|
|
179
172
|
}
|
|
180
173
|
/**
|
|
181
|
-
* Runs one registration under the
|
|
182
|
-
* and
|
|
174
|
+
* Runs one registration under the runner's discipline and reports its
|
|
175
|
+
* entries. `runMenderBlock` calls it for each step, and a wallet calls it
|
|
176
|
+
* for a registration its own call site fires, such as an encounter site. It
|
|
177
|
+
* admits nothing: the caller has already checked the authority and any
|
|
178
|
+
* route.
|
|
179
|
+
*
|
|
180
|
+
* A registration that throws warns once per reported invariant with that
|
|
181
|
+
* declaration's own `warn` string, carrying the error, and yields one
|
|
182
|
+
* `failed` entry per reported id with the error's name alone
|
|
183
|
+
* (`errorNameOf`). A registration that resolves with entries that do not
|
|
184
|
+
* name its reported invariants, in order, warns once and yields `failed`
|
|
185
|
+
* entries carrying {@link MEND_REPORT_SHAPE_ERROR}. The run never rejects.
|
|
186
|
+
*
|
|
187
|
+
* Each entry emits exactly one `'ceremony mender'` event. Given `mends`,
|
|
188
|
+
* each entry is reported into that accumulator, whose own logger emits the
|
|
189
|
+
* event. Without `mends`, the event goes through `logger`. The event carries
|
|
190
|
+
* no `err`; the declared warn keeps the error.
|
|
191
|
+
*
|
|
192
|
+
* @param options {object}
|
|
193
|
+
* @param options.registry {MenderRegistry} the wallet's declarations,
|
|
194
|
+
* read for each reported invariant's `warn` and ceremonies
|
|
195
|
+
* @param options.registration {Registration} the registration to run
|
|
196
|
+
* @param options.deps {Deps} passed to `converge` unread
|
|
197
|
+
* @param options.logger {Logger} the wallet's own sink for the warn copy,
|
|
198
|
+
* and for the mender events when no `mends` is given
|
|
199
|
+
* @param [options.mends] {MendReportAccumulator} the accumulator each
|
|
200
|
+
* entry is reported into
|
|
201
|
+
* @returns {Promise<{ entries: MendReport, threw: boolean }>} the entries,
|
|
202
|
+
* one per reported id in order, and whether `converge` threw
|
|
203
|
+
*/
|
|
204
|
+
export async function runMenderRegistration({ registry, registration, deps, logger, mends }) {
|
|
205
|
+
const outcome = await convergeUnderDiscipline({
|
|
206
|
+
registry,
|
|
207
|
+
registration,
|
|
208
|
+
deps,
|
|
209
|
+
logger
|
|
210
|
+
});
|
|
211
|
+
for (const entry of outcome.entries) {
|
|
212
|
+
// The diagnostics twin of the report entry, emitted once: by the
|
|
213
|
+
// accumulator when one is given, through `logger` otherwise.
|
|
214
|
+
if (mends) {
|
|
215
|
+
mends.report(entry);
|
|
216
|
+
}
|
|
217
|
+
else {
|
|
218
|
+
menderEvent({ log: logger, entry });
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
return outcome;
|
|
222
|
+
}
|
|
223
|
+
/**
|
|
224
|
+
* Calls one registration's `converge`, normalizing a throw or a malformed
|
|
225
|
+
* return to `failed` entries.
|
|
183
226
|
*/
|
|
184
|
-
async function
|
|
227
|
+
async function convergeUnderDiscipline({ registry, registration, deps, logger }) {
|
|
228
|
+
const { trigger } = registration;
|
|
185
229
|
try {
|
|
186
230
|
const entries = await registration.converge(deps);
|
|
187
231
|
if (!matchesReports({ registration, entries })) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runner.js","sourceRoot":"","sources":["../../src/menders/runner.ts"],"names":[],"mappings":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C,SAAS,KAAK,YAAY,CAAC,OAAO,CAAC,KAAK,CAAC,CAClE,CACF,CAAA;AACH,CAAC;AAED;;;GAGG;AACH,SAAS,aAAa,CAIpB,EACA,QAAQ,EACR,YAAY,EACZ,SAAS,EAKV;IACC,OAAO,YAAY,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE;QACnC,MAAM,UAAU,GAAG,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,UAAU,CAAA;QAChD,OAAO;YACL,SAAS,EAAE,EAAE;YACb,OAAO,EAAE,QAAiB;YAC1B,SAAS;YACT,GAAG,CAAC,UAAU,IAAI,UAAU,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,UAAU,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;SAC/D,CAAA;IACH,CAAC,CAAC,CAAA;AACJ,CAAC"}
|
package/dist/menders/types.d.ts
CHANGED
|
@@ -67,7 +67,8 @@ export interface InvariantDeclaration<Deps, Ceremony extends string = string> {
|
|
|
67
67
|
warn: string;
|
|
68
68
|
/**
|
|
69
69
|
* The popup axis: whether the entry runs on this login route. Absent
|
|
70
|
-
* means every route.
|
|
70
|
+
* means every route. It filters chain registrations alone; an encounter
|
|
71
|
+
* site is not given a route, so it never evaluates this.
|
|
71
72
|
*/
|
|
72
73
|
when?(route: LoginRoute): boolean;
|
|
73
74
|
/**
|
|
@@ -83,20 +84,33 @@ export interface InvariantDeclaration<Deps, Ceremony extends string = string> {
|
|
|
83
84
|
* client-key-record probe says so, since only a browser holding such a
|
|
84
85
|
* record reaches it; the guard is a routing-site member alone, so a chain
|
|
85
86
|
* or ceremony-tail site cannot carry one and the chain readers never have
|
|
86
|
-
* to honor it.
|
|
87
|
+
* to honor it. An encounter site says which session kinds reach the read or
|
|
88
|
+
* write it rides, in `reachedBy`, since an encounter on a page a transient
|
|
89
|
+
* session never renders mends nothing on a credential-anchored account. One
|
|
90
|
+
* site carries one reach: a call converging two invariants with different
|
|
91
|
+
* reach is declared as two sites.
|
|
87
92
|
*/
|
|
88
93
|
export type RegistrationSite = {
|
|
89
|
-
trigger: Exclude<Trigger, 'login-routing'>;
|
|
94
|
+
trigger: Exclude<Trigger, 'login-routing' | 'encounter'>;
|
|
90
95
|
reports: ReadonlyArray<InvariantId>;
|
|
91
96
|
guardedBy?: undefined;
|
|
97
|
+
reachedBy?: undefined;
|
|
92
98
|
} | {
|
|
93
99
|
trigger: 'login-routing';
|
|
94
100
|
reports: ReadonlyArray<InvariantId>;
|
|
95
101
|
guardedBy?: 'client-key-record';
|
|
102
|
+
reachedBy?: undefined;
|
|
103
|
+
} | {
|
|
104
|
+
trigger: 'encounter';
|
|
105
|
+
reports: ReadonlyArray<InvariantId>;
|
|
106
|
+
guardedBy?: undefined;
|
|
107
|
+
reachedBy: ReadonlyArray<'remembered' | 'transient'>;
|
|
96
108
|
};
|
|
97
109
|
/**
|
|
98
110
|
* A registration: the code that converges the invariants it reports.
|
|
99
111
|
* `converge` returns exactly one entry per id in `reports`, in that order.
|
|
112
|
+
* An encounter site may be one, run from its own call site through
|
|
113
|
+
* `runMenderRegistration`, or report-only like a routing site.
|
|
100
114
|
*/
|
|
101
115
|
export type Registration<Deps, Ceremony extends string = string> = RegistrationSite & {
|
|
102
116
|
converge(deps: Deps): Promise<ReadonlyArray<MendReportEntry<Ceremony>>>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/menders/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;GASG;AACH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAA;AAC3C,OAAO,KAAK,EACV,YAAY,EACZ,SAAS,EACT,QAAQ,EACR,OAAO,EACP,eAAe,EACf,OAAO,EACR,MAAM,iBAAiB,CAAA;AAExB;;;;GAIG;AACH,MAAM,WAAW,UAAU;IACzB,KAAK,EAAE,OAAO,CAAA;CACf;AAED;;;;;;GAMG;AACH,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,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,SAAS,CAAC,CAAA;IAC9D;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAED;;GAEG;AACH,MAAM,WAAW,eAAe,CAC9B,QAAQ,SAAS,MAAM,GAAG,MAAM,CAChC,SAAQ,WAAW;IACnB,SAAS,EAAE,WAAW,CAAA;IACtB,UAAU,CAAC,EAAE,aAAa,CAAC,QAAQ,CAAC,CAAA;CACrC;AAED;;GAEG;AACH,MAAM,MAAM,UAAU,CAAC,QAAQ,SAAS,MAAM,GAAG,MAAM,IAAI,aAAa,CACtE,eAAe,CAAC,QAAQ,CAAC,CAC1B,CAAA;AAED;;;GAGG;AACH,MAAM,WAAW,YAAY;IAC3B,SAAS,EAAE,WAAW,CAAA;IACtB;;OAEG;IACH,SAAS,EAAE,MAAM,CAAA;IACjB,QAAQ,EAAE,aAAa,CAAC,YAAY,CAAC,CAAA;IACrC;;OAEG;IACH,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,OAAO,CAAA;CACd"}
|
|
@@ -31,7 +31,9 @@ export type Authority = (typeof AUTHORITIES)[number];
|
|
|
31
31
|
* inside a ceremony's own sequenced code and only report through the
|
|
32
32
|
* registry; `encounter` entries run where an ordinary read or write meets
|
|
33
33
|
* the state they converge (a sweep-on-read, or a refusal a page handles),
|
|
34
|
-
* inside a live session, and are not on a login chain.
|
|
34
|
+
* inside a live session, and are not on a login chain. An encounter site
|
|
35
|
+
* names the session kinds that reach it, and does not evaluate a
|
|
36
|
+
* declaration's `when`.
|
|
35
37
|
*/
|
|
36
38
|
export declare const TRIGGERS: readonly ["remembered-login-chain", "transient-login-chain", "login-routing", "ceremony-tail", "encounter"];
|
|
37
39
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vocabulary.d.ts","sourceRoot":"","sources":["../../src/menders/vocabulary.ts"],"names":[],"mappings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S,kCAAmC,CAAA;AAEzD;;GAEG;AACH,MAAM,MAAM,OAAO,GAAG,CAAC,OAAO,SAAS,CAAC,CAAC,MAAM,CAAC,CAAA"}
|
|
@@ -27,7 +27,9 @@ export const AUTHORITIES = ['none', 'account', 'enrolled', 'ladder'];
|
|
|
27
27
|
* inside a ceremony's own sequenced code and only report through the
|
|
28
28
|
* registry; `encounter` entries run where an ordinary read or write meets
|
|
29
29
|
* the state they converge (a sweep-on-read, or a refusal a page handles),
|
|
30
|
-
* inside a live session, and are not on a login chain.
|
|
30
|
+
* inside a live session, and are not on a login chain. An encounter site
|
|
31
|
+
* names the session kinds that reach it, and does not evaluate a
|
|
32
|
+
* declaration's `when`.
|
|
31
33
|
*/
|
|
32
34
|
export const TRIGGERS = [
|
|
33
35
|
'remembered-login-chain',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vocabulary.js","sourceRoot":"","sources":["../../src/menders/vocabulary.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;GASG;AAEH;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,MAAM,EAAE,SAAS,EAAE,UAAU,EAAE,QAAQ,CAAU,CAAA;AAO7E
|
|
1
|
+
{"version":3,"file":"vocabulary.js","sourceRoot":"","sources":["../../src/menders/vocabulary.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;GASG;AAEH;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,MAAM,EAAE,SAAS,EAAE,UAAU,EAAE,QAAQ,CAAU,CAAA;AAO7E;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG;IACtB,wBAAwB;IACxB,uBAAuB;IACvB,eAAe;IACf,eAAe;IACf,WAAW;CACH,CAAA;AAOV;;;GAGG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG;IAC5B,wBAAwB;IACxB,uBAAuB;CACf,CAAA;AAOV;;;;;GAKG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,iBAAiB,EAAE,UAAU,CAAU,CAAA;AAOtE;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG;IACtB,cAAc;IACd,mBAAmB;IACnB,iBAAiB;IACjB,sBAAsB;IACtB,cAAc;IACd,aAAa;IACb,mBAAmB;IACnB,cAAc;IACd,aAAa;CACL,CAAA;AAOV;;;GAGG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG;IAC3B,OAAO;IACP,MAAM;IACN,SAAS;IACT,SAAS;IACT,QAAQ;CACA,CAAA;AAOV;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,MAAM,EAAE,aAAa,CAAU,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@interop/wallet-core",
|
|
3
3
|
"description": "Shared wallet-domain logic (WAS sync engine core and wallet Space layout contracts) for Interop wallet apps.",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.89.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"build": "pnpm run clear && tsc",
|