agmsg-cloud 0.1.0-rc.8 → 0.1.1
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/scripts/version-output.js +65 -0
- package/dist/src/api.js +85 -3
- package/dist/src/commands/connect.js +14 -7
- package/dist/src/commands/login.js +120 -3
- package/dist/src/commands/logout.js +38 -7
- package/dist/src/commands/request.js +53 -3
- package/dist/src/commands/sync.js +12 -1
- package/dist/src/commands/vault.js +345 -78
- package/dist/src/commands/watch.js +25 -7
- package/dist/src/config.js +11 -2
- package/dist/src/credentials.js +149 -17
- package/dist/src/data-plane.js +67 -0
- package/dist/src/index.js +45 -24
- package/dist/src/oss.js +30 -1
- package/dist/src/preflight.js +140 -15
- package/dist/src/recovery-key.js +11 -16
- package/dist/src/self-install.js +152 -0
- package/dist/src/slot-advice.js +7 -19
- package/dist/src/vault-inventory.js +118 -0
- package/dist/src/vault-placement.js +94 -0
- package/package.json +3 -2
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What happened to each entry the placement loop tried to place, and how that
|
|
3
|
+
* is reported.
|
|
4
|
+
*
|
|
5
|
+
* Kept as data and rendered separately for the same reason `vault-inventory.ts`
|
|
6
|
+
* is: the rule worth checking is about the REPORT, not about the spawning, and
|
|
7
|
+
* a test should be able to read the report without a process.
|
|
8
|
+
*
|
|
9
|
+
* The rule, from #342a and unchanged: **a partial result is never printed as a
|
|
10
|
+
* success.** Anything not placed is listed, with its id.
|
|
11
|
+
*/
|
|
12
|
+
/**
|
|
13
|
+
* @param inVault every entry the vault holds, NOT just the ones that were
|
|
14
|
+
* attempted. `placed 1 of 1` printed under `2 team backup(s) in it` is a
|
|
15
|
+
* partial result reading as a complete one — the denominator has to be the
|
|
16
|
+
* thing the person came here to get back.
|
|
17
|
+
*/
|
|
18
|
+
export function placementLines(results, inVault) {
|
|
19
|
+
if (results.length === 0)
|
|
20
|
+
return [];
|
|
21
|
+
const lines = [];
|
|
22
|
+
const placed = results.filter((r) => r.kind === 'placed');
|
|
23
|
+
const already = results.filter((r) => r.kind === 'already');
|
|
24
|
+
const done = placed.length + already.length;
|
|
25
|
+
lines.push(`placed ${done} of ${inVault} team backup(s) in the vault`);
|
|
26
|
+
if (results.length < inVault) {
|
|
27
|
+
// Said here as well as in the inventory above, because this line is the one
|
|
28
|
+
// a person reads as the outcome, and a denominator it cannot account for
|
|
29
|
+
// invites the reading that the rest simply worked.
|
|
30
|
+
lines.push(` (${inVault - results.length} of those could not be attempted — see the list above)`);
|
|
31
|
+
}
|
|
32
|
+
for (const r of placed)
|
|
33
|
+
lines.push(` ${r.team} (${r.teamId})`);
|
|
34
|
+
for (const r of already) {
|
|
35
|
+
lines.push(` ${r.team} (${r.teamId}) — was already here, its key was re-imported`);
|
|
36
|
+
}
|
|
37
|
+
const stuck = results.filter((r) => r.kind === 'name-held' ||
|
|
38
|
+
r.kind === 'refused' ||
|
|
39
|
+
r.kind === 'locked' ||
|
|
40
|
+
r.kind === 'disconnected' ||
|
|
41
|
+
r.kind === 'wrong-instance' ||
|
|
42
|
+
r.kind === 'server-unknown');
|
|
43
|
+
if (stuck.length === 0)
|
|
44
|
+
return lines;
|
|
45
|
+
lines.push(`${stuck.length} could not be placed:`);
|
|
46
|
+
for (const r of stuck) {
|
|
47
|
+
if (r.kind === 'disconnected') {
|
|
48
|
+
lines.push(` ${r.team} (${r.teamId})`);
|
|
49
|
+
lines.push(' already on this machine, but its connection to the server was ended,');
|
|
50
|
+
lines.push(' so its key cannot be imported. Reconnect it, then run this again.');
|
|
51
|
+
}
|
|
52
|
+
else if (r.kind === 'server-unknown') {
|
|
53
|
+
lines.push(` ${r.team} (${r.teamId})`);
|
|
54
|
+
lines.push(' which server this machine reaches could not be established, so nothing');
|
|
55
|
+
lines.push(' was pulled — placing it without knowing would risk taking the wrong one:');
|
|
56
|
+
lines.push(` ${r.why}`);
|
|
57
|
+
}
|
|
58
|
+
else if (r.kind === 'wrong-instance') {
|
|
59
|
+
lines.push(` ${r.team} (${r.teamId})`);
|
|
60
|
+
lines.push(' this backup is from a different server than the one this machine');
|
|
61
|
+
lines.push(' reaches, so nothing was pulled and nothing was written:');
|
|
62
|
+
lines.push(` the backup's server: ${r.wanted}`);
|
|
63
|
+
lines.push(` the server reached: ${r.got}`);
|
|
64
|
+
lines.push(' no local team was created, so the name is still free for the right one.');
|
|
65
|
+
}
|
|
66
|
+
else if (r.kind === 'name-held') {
|
|
67
|
+
// The facts, and no route. Both ids so the two teams can be told apart,
|
|
68
|
+
// and "nothing was changed" said outright: the worst reading of a bare
|
|
69
|
+
// refusal is that something was half-done.
|
|
70
|
+
lines.push(` ${r.team} (${r.teamId})`);
|
|
71
|
+
lines.push(` a different team on this machine already holds the name '${r.team}'`);
|
|
72
|
+
// BOTH halves of both identities. The two can share a team id and differ
|
|
73
|
+
// only by server, and a report printing one uuid twice says "different
|
|
74
|
+
// team" while showing nothing that differs.
|
|
75
|
+
lines.push(` the local one: ${r.localTeamId} on ${r.localInstance}`);
|
|
76
|
+
lines.push(` the backup: ${r.teamId} on ${r.instance}`);
|
|
77
|
+
lines.push(' nothing local was changed. Placing it needs that name to be free.');
|
|
78
|
+
}
|
|
79
|
+
else if (r.kind === 'locked') {
|
|
80
|
+
lines.push(` ${r.team} (${r.teamId})`);
|
|
81
|
+
lines.push(' it is on this machine but still locked — its key did not import:');
|
|
82
|
+
for (const said of r.said.split('\n'))
|
|
83
|
+
if (said.trim() !== '')
|
|
84
|
+
lines.push(` ${said}`);
|
|
85
|
+
}
|
|
86
|
+
else {
|
|
87
|
+
lines.push(` ${r.team} (${r.teamId})`);
|
|
88
|
+
for (const said of r.said.split('\n'))
|
|
89
|
+
if (said.trim() !== '')
|
|
90
|
+
lines.push(` ${said}`);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
return lines;
|
|
94
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "agmsg-cloud",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "Companion CLI for the agmsg cloud service: connect a team, join from another machine, and back up its keys.",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"type": "module",
|
|
@@ -12,7 +12,8 @@
|
|
|
12
12
|
},
|
|
13
13
|
"files": [
|
|
14
14
|
"dist/src",
|
|
15
|
-
"
|
|
15
|
+
"dist/scripts",
|
|
16
|
+
"!dist/**/*.map"
|
|
16
17
|
],
|
|
17
18
|
"repository": {
|
|
18
19
|
"type": "git",
|