@biolibs/bionet 1.1.0 → 1.2.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/README.md +95 -11
- package/dist/discover.d.ts +1 -1
- package/dist/discover.js +1 -1
- package/dist/fetch.d.ts +2 -2
- package/dist/fetch.js +2 -2
- package/dist/index.d.ts +7 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -1
- package/dist/index.js.map +1 -1
- package/dist/inventory.d.ts +2 -2
- package/dist/inventory.js +2 -2
- package/dist/log.d.ts +196 -0
- package/dist/log.d.ts.map +1 -0
- package/dist/log.js +246 -0
- package/dist/log.js.map +1 -0
- package/dist/merge.d.ts +171 -0
- package/dist/merge.d.ts.map +1 -0
- package/dist/merge.js +520 -0
- package/dist/merge.js.map +1 -0
- package/dist/model.d.ts +3 -3
- package/dist/model.js +2 -2
- package/dist/origin.d.ts +4 -4
- package/dist/origin.js +4 -4
- package/dist/sync.d.ts +157 -0
- package/dist/sync.d.ts.map +1 -0
- package/dist/sync.js +203 -0
- package/dist/sync.js.map +1 -0
- package/package.json +1 -1
- package/src/discover.ts +1 -1
- package/src/fetch.ts +2 -2
- package/src/index.ts +7 -1
- package/src/inventory.ts +2 -2
- package/src/log.ts +325 -0
- package/src/merge.ts +605 -0
- package/src/model.ts +3 -3
- package/src/origin.ts +4 -4
- package/src/sync.ts +210 -0
package/dist/log.js
ADDED
|
@@ -0,0 +1,246 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* One signed change to a lab, and the log it belongs to.
|
|
3
|
+
*
|
|
4
|
+
* A published inventory is what a lab shows the world. This is what happens inside it: every change
|
|
5
|
+
* anybody makes — somebody joined, a tube was added, some of it was used — is one entry, signed by
|
|
6
|
+
* the key of the device it was made on, and appended to that key's own log. Nobody writes to another
|
|
7
|
+
* key's log, so two people working offline cannot overwrite each other; what the lab holds is
|
|
8
|
+
* whatever `merge.ts` makes of all the logs together.
|
|
9
|
+
*
|
|
10
|
+
* An entry says three things beyond the change itself. Which lab it is for, so it cannot be replayed
|
|
11
|
+
* into another. Where it sits in its own key's log, so a missing or substituted entry shows. And what
|
|
12
|
+
* its author had seen of everybody else's logs when they wrote it, which is the only honest way to
|
|
13
|
+
* order changes made on laptops whose clocks agree about nothing.
|
|
14
|
+
*
|
|
15
|
+
* Reading is the careful half here too. An entry arrives from another machine, so `readEntry` checks
|
|
16
|
+
* its shape and its size before anything else looks at it.
|
|
17
|
+
*/
|
|
18
|
+
import { canonicalJson, signUnder, verifyUnder } from "@biolibs/opencloning";
|
|
19
|
+
/** The version of the entry format written here. */
|
|
20
|
+
export const LOG_VERSION = 1;
|
|
21
|
+
/** What the bytes of a signed entry are for. No other kind of document is signed under this. */
|
|
22
|
+
export const LOG_DOMAIN = "biolibs/bionet log entry v1";
|
|
23
|
+
/** The longest one entry may be, as canonical text. A plasmid's sequence has to fit. */
|
|
24
|
+
export const LONGEST_ENTRY = 600_000;
|
|
25
|
+
/** How many other logs one entry may say it had seen. */
|
|
26
|
+
export const MOST_SEEN = 1_000;
|
|
27
|
+
const HEX_ID = /^[0-9a-f]{64}$/;
|
|
28
|
+
const KEY = /^[A-Za-z0-9_-]{43}$/;
|
|
29
|
+
/**
|
|
30
|
+
* The ID of an entry: the SHA-256 of its canonical form, in hex.
|
|
31
|
+
*
|
|
32
|
+
* It covers the entry and not the signature, so it names the change itself. An entry's ID is how the
|
|
33
|
+
* next entry in the log points back at it and how another key says it has seen it.
|
|
34
|
+
*
|
|
35
|
+
* @param entry - The entry.
|
|
36
|
+
* @returns 64 hex characters.
|
|
37
|
+
*/
|
|
38
|
+
export async function entryId(entry) {
|
|
39
|
+
const bytes = new TextEncoder().encode(canonicalJson(entry));
|
|
40
|
+
const digest = await globalThis.crypto.subtle.digest("SHA-256", bytes);
|
|
41
|
+
return [...new Uint8Array(digest)].map((byte) => byte.toString(16).padStart(2, "0")).join("");
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Write and sign the next entry in a key's log.
|
|
45
|
+
*
|
|
46
|
+
* Most callers want `nextEntry` in `merge.ts`, which works the place out from the lab's merged state.
|
|
47
|
+
* This is the plain form underneath it.
|
|
48
|
+
*
|
|
49
|
+
* @param key - The device's key. Its log is the one written to.
|
|
50
|
+
* @param place - Which lab, what came before in this log, and what had been seen of the others.
|
|
51
|
+
* @param op - The change.
|
|
52
|
+
* @param options - A name to sign under, and when.
|
|
53
|
+
* @returns The signed entry.
|
|
54
|
+
* @throws If `prev` belongs to another key or another lab.
|
|
55
|
+
*/
|
|
56
|
+
export async function writeEntry(key, place, op, options = {}) {
|
|
57
|
+
const before = place.prev?.entry ?? null;
|
|
58
|
+
if (before !== null && before.author !== key.publicKey) {
|
|
59
|
+
throw new Error("The previous entry is from another key's log.");
|
|
60
|
+
}
|
|
61
|
+
if (before !== null && before.lab !== place.lab && !(before.lab === null && before.seq === 0)) {
|
|
62
|
+
throw new Error("The previous entry is from another lab.");
|
|
63
|
+
}
|
|
64
|
+
const entry = {
|
|
65
|
+
bionet_log_version: LOG_VERSION,
|
|
66
|
+
lab: place.lab,
|
|
67
|
+
author: key.publicKey,
|
|
68
|
+
seq: before === null ? 0 : before.seq + 1,
|
|
69
|
+
prev: before === null ? null : await entryId(before),
|
|
70
|
+
seen: { ...(place.seen ?? {}) },
|
|
71
|
+
op,
|
|
72
|
+
};
|
|
73
|
+
return { entry, signature: await sign(entry, key, options) };
|
|
74
|
+
}
|
|
75
|
+
/** Sign an entry, saying in this file's own terms why one cannot be signed. */
|
|
76
|
+
async function sign(entry, key, options) {
|
|
77
|
+
try {
|
|
78
|
+
canonicalJson(entry);
|
|
79
|
+
}
|
|
80
|
+
catch {
|
|
81
|
+
throw new Error("An entry can carry only whole numbers: an amount is a whole number of the item's unit.");
|
|
82
|
+
}
|
|
83
|
+
return signUnder(LOG_DOMAIN, entry, key, options);
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Found a lab: write the entry every other entry in it will point back to.
|
|
87
|
+
*
|
|
88
|
+
* The lab's ID is this entry's ID, so a lab is named by an act — this key, founding this lab, at this
|
|
89
|
+
* claimed moment — and not by an address, which can change, or a name, which anybody can use.
|
|
90
|
+
*
|
|
91
|
+
* @param key - The founder's device key. It becomes the lab's first keeper.
|
|
92
|
+
* @param about - What the lab is called, and who is founding it.
|
|
93
|
+
* @param options - A name to sign under, and when.
|
|
94
|
+
* @returns The founding entry. `entryId` of its `entry` is the lab's ID.
|
|
95
|
+
*
|
|
96
|
+
* @example
|
|
97
|
+
* ```ts
|
|
98
|
+
* import { entryId, foundLab } from "@biolibs/bionet";
|
|
99
|
+
*
|
|
100
|
+
* const founding = await foundLab(key, { name: "The Wren Lab", person: "Ada" });
|
|
101
|
+
* const lab = await entryId(founding.entry);
|
|
102
|
+
* ```
|
|
103
|
+
*/
|
|
104
|
+
export async function foundLab(key, about, options = {}) {
|
|
105
|
+
const entry = {
|
|
106
|
+
bionet_log_version: LOG_VERSION,
|
|
107
|
+
lab: null,
|
|
108
|
+
author: key.publicKey,
|
|
109
|
+
seq: 0,
|
|
110
|
+
prev: null,
|
|
111
|
+
seen: {},
|
|
112
|
+
op: { type: "roster.found", name: about.name, person: about.person },
|
|
113
|
+
};
|
|
114
|
+
return { entry, signature: await sign(entry, key, { signer: about.person, ...options }) };
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Whether a value is shaped like a signed entry. Says nothing about whether the signature holds.
|
|
118
|
+
*
|
|
119
|
+
* @param value - Anything.
|
|
120
|
+
* @returns Whether it has an entry and a signature.
|
|
121
|
+
*/
|
|
122
|
+
export function isSignedEntry(value) {
|
|
123
|
+
if (typeof value !== "object" || value === null)
|
|
124
|
+
return false;
|
|
125
|
+
const held = value;
|
|
126
|
+
return typeof held.entry === "object" && held.entry !== null
|
|
127
|
+
&& typeof held.signature === "object" && held.signature !== null;
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Read an entry that came from somewhere else.
|
|
131
|
+
*
|
|
132
|
+
* This checks shape and size and nothing more: that it could be an entry. Whether its signature
|
|
133
|
+
* holds is `verifyEntry`'s question, and whether it belongs in the lab is `mergeLog`'s.
|
|
134
|
+
*
|
|
135
|
+
* @param value - What arrived.
|
|
136
|
+
* @returns The same value, known to be shaped like an entry.
|
|
137
|
+
* @throws If it is not one, saying what is wrong.
|
|
138
|
+
*/
|
|
139
|
+
export function readEntry(value) {
|
|
140
|
+
if (!isSignedEntry(value))
|
|
141
|
+
throw new Error("This is not a signed log entry.");
|
|
142
|
+
const entry = value.entry;
|
|
143
|
+
if (entry.bionet_log_version !== LOG_VERSION) {
|
|
144
|
+
throw new Error(`This entry is in a format this does not read (version ${String(entry.bionet_log_version)}).`);
|
|
145
|
+
}
|
|
146
|
+
if (typeof entry.author !== "string" || !KEY.test(entry.author))
|
|
147
|
+
throw new Error("This entry does not say whose log it is in.");
|
|
148
|
+
if (!Number.isInteger(entry.seq) || entry.seq < 0 || entry.seq > 1_000_000_000) {
|
|
149
|
+
throw new Error("This entry does not say where in the log it sits.");
|
|
150
|
+
}
|
|
151
|
+
if (entry.prev !== null && (typeof entry.prev !== "string" || !HEX_ID.test(entry.prev))) {
|
|
152
|
+
throw new Error("This entry's pointer to the one before it is not an entry ID.");
|
|
153
|
+
}
|
|
154
|
+
if ((entry.seq === 0) !== (entry.prev === null)) {
|
|
155
|
+
throw new Error("Only the first entry in a log has nothing before it.");
|
|
156
|
+
}
|
|
157
|
+
if (entry.lab !== null && (typeof entry.lab !== "string" || !HEX_ID.test(entry.lab))) {
|
|
158
|
+
throw new Error("This entry does not say which lab it is for.");
|
|
159
|
+
}
|
|
160
|
+
const op = entry.op;
|
|
161
|
+
if (typeof op !== "object" || op === null || Array.isArray(op) || typeof op.type !== "string"
|
|
162
|
+
|| op.type.length === 0 || op.type.length > 60) {
|
|
163
|
+
throw new Error("This entry carries no change.");
|
|
164
|
+
}
|
|
165
|
+
if (entry.lab === null && !(entry.seq === 0 && op.type === "roster.found")) {
|
|
166
|
+
throw new Error("Only a founding entry may leave out the lab.");
|
|
167
|
+
}
|
|
168
|
+
if (op.type === "roster.found" && entry.lab !== null) {
|
|
169
|
+
throw new Error("A founding entry cannot be written into an existing lab.");
|
|
170
|
+
}
|
|
171
|
+
const seen = entry.seen;
|
|
172
|
+
if (typeof seen !== "object" || seen === null || Array.isArray(seen))
|
|
173
|
+
throw new Error("This entry does not say what it had seen.");
|
|
174
|
+
const others = Object.entries(seen);
|
|
175
|
+
if (others.length > MOST_SEEN)
|
|
176
|
+
throw new Error(`An entry may name at most ${MOST_SEEN} other logs.`);
|
|
177
|
+
for (const [key, id] of others) {
|
|
178
|
+
if (!KEY.test(key) || typeof id !== "string" || !HEX_ID.test(id) || key === entry.author) {
|
|
179
|
+
throw new Error("This entry's record of what it had seen is not a list of keys and entry IDs.");
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
const signature = value.signature;
|
|
183
|
+
if (typeof signature.algorithm !== "string" || typeof signature.public_key !== "string"
|
|
184
|
+
|| typeof signature.signature !== "string" || typeof signature.signed_at !== "string"
|
|
185
|
+
|| signature.signed_at.length > 40 || signature.signature.length > 200
|
|
186
|
+
|| (signature.signer !== null && (typeof signature.signer !== "string" || signature.signer.length > 200))) {
|
|
187
|
+
throw new Error("This entry's signature is not a signature.");
|
|
188
|
+
}
|
|
189
|
+
if (canonicalJson(entry).length > LONGEST_ENTRY)
|
|
190
|
+
throw new Error("This entry is longer than will be read.");
|
|
191
|
+
return value;
|
|
192
|
+
}
|
|
193
|
+
/**
|
|
194
|
+
* Check an entry's signature.
|
|
195
|
+
*
|
|
196
|
+
* Two things have to be true: the signature holds over these bytes under the log's own domain, and
|
|
197
|
+
* the key that signed is the key whose log the entry claims to be in. The second matters as much as
|
|
198
|
+
* the first — without it anybody could sign an entry into somebody else's log with their own key.
|
|
199
|
+
*
|
|
200
|
+
* @param signed - The entry.
|
|
201
|
+
* @returns The check. `ok` only if both hold; `problem` says which did not.
|
|
202
|
+
*/
|
|
203
|
+
export async function verifyEntry(signed) {
|
|
204
|
+
const [check] = await verifyUnder(LOG_DOMAIN, signed.entry, [signed.signature]);
|
|
205
|
+
if (check.ok && signed.signature.public_key !== signed.entry.author) {
|
|
206
|
+
return { ...check, ok: false, problem: "This entry was signed by a key other than the one whose log it is in." };
|
|
207
|
+
}
|
|
208
|
+
return check;
|
|
209
|
+
}
|
|
210
|
+
/** @returns The change that adds a key to the roster. */
|
|
211
|
+
export const addToRoster = (key, person, role = "member") => ({ type: "roster.add", key, person, role });
|
|
212
|
+
/**
|
|
213
|
+
* @param key - The key to remove.
|
|
214
|
+
* @param cutoff - The last `seq` of that key's log the lab accepts. -1 accepts none of it.
|
|
215
|
+
* @returns The change that removes a key, keeping its entries up to the cutoff.
|
|
216
|
+
*/
|
|
217
|
+
export const removeFromRoster = (key, cutoff) => ({ type: "roster.remove", key, cutoff });
|
|
218
|
+
/** @returns The change that makes a key a keeper, or an ordinary member again. */
|
|
219
|
+
export const setRole = (key, role) => ({ type: "roster.role", key, role });
|
|
220
|
+
/** @returns The change that adds a part, by its sequence. Its checksum is computed when applied. */
|
|
221
|
+
export const addPart = (part) => ({ type: "part.add", sequence: part.sequence, circular: part.circular === true, name: part.name });
|
|
222
|
+
/** @returns The change that says whether a part is on offer to other labs. */
|
|
223
|
+
export const offerPart = (part, available) => ({ type: "part.offer", part, available });
|
|
224
|
+
/** @returns The change that adds one physical item of a part. `amount` is a whole number of `unit`. */
|
|
225
|
+
export const addItem = (item) => ({ type: "item.add", item: item.item, part: item.part, amount: item.amount, unit: item.unit ?? null });
|
|
226
|
+
/** @returns The change that adds to or takes from an item. `by` is a whole-number difference, never a total. */
|
|
227
|
+
export const adjustItem = (item, by) => ({ type: "item.adjust", item, by });
|
|
228
|
+
/** @returns The change that says how much of an item is physically there. */
|
|
229
|
+
export const recountItem = (item, amount) => ({ type: "item.recount", item, amount });
|
|
230
|
+
/** @returns The change that retires an item. It stays in the history. */
|
|
231
|
+
export const retireItem = (item) => ({ type: "item.retire", item });
|
|
232
|
+
/** @returns The change that sets one field on a part (by checksum) or an item (by ID). */
|
|
233
|
+
export const setField = (on, id, field, value) => ({ type: "field.set", on, id, field, value });
|
|
234
|
+
/**
|
|
235
|
+
* A new ID for an item: 16 random bytes in hex.
|
|
236
|
+
*
|
|
237
|
+
* Random, because items are created on laptops that are offline, and two of them counting up from
|
|
238
|
+
* the same number would collide the moment they met.
|
|
239
|
+
*
|
|
240
|
+
* @returns 32 hex characters.
|
|
241
|
+
*/
|
|
242
|
+
export function newItemId() {
|
|
243
|
+
const bytes = globalThis.crypto.getRandomValues(new Uint8Array(16));
|
|
244
|
+
return [...bytes].map((byte) => byte.toString(16).padStart(2, "0")).join("");
|
|
245
|
+
}
|
|
246
|
+
//# sourceMappingURL=log.js.map
|
package/dist/log.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"log.js","sourceRoot":"","sources":["../src/log.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AACH,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,WAAW,EACF,MAAM,sBAAsB,CAAC;AAEzE,oDAAoD;AACpD,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,CAAC;AAE7B,gGAAgG;AAChG,MAAM,CAAC,MAAM,UAAU,GAAG,6BAA6B,CAAC;AAExD,wFAAwF;AACxF,MAAM,CAAC,MAAM,aAAa,GAAG,OAAO,CAAC;AAErC,yDAAyD;AACzD,MAAM,CAAC,MAAM,SAAS,GAAG,KAAK,CAAC;AAgD/B,MAAM,MAAM,GAAG,gBAAgB,CAAC;AAChC,MAAM,GAAG,GAAG,qBAAqB,CAAC;AAElC;;;;;;;;GAQG;AACH,MAAM,CAAC,KAAK,UAAU,OAAO,CAAC,KAAe;IAC3C,MAAM,KAAK,GAAG,IAAI,WAAW,EAAE,CAAC,MAAM,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC,CAAC;IAC7D,MAAM,MAAM,GAAG,MAAM,UAAU,CAAC,MAAM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;;GAOG;AACH,MAAM,UAAU,SAAS;IACvB,MAAM,KAAK,GAAG,UAAU,CAAC,MAAM,CAAC,eAAe,CAAC,IAAI,UAAU,CAAC,EAAE,CAAC,CAAC,CAAC;IACpE,OAAO,CAAC,GAAG,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;AAC/E,CAAC"}
|
package/dist/merge.d.ts
ADDED
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
import type { SignOptions, SigningKey } from "@biolibs/opencloning";
|
|
2
|
+
import { type Operation, type Role, type SignedEntry } from "./log.js";
|
|
3
|
+
import { type InventoryDocument, type LabModel, type PeerModel } from "./model.js";
|
|
4
|
+
/** The longest sequence one part may have. */
|
|
5
|
+
export declare const LONGEST_SEQUENCE = 500000;
|
|
6
|
+
/** One key on the roster, now or once. */
|
|
7
|
+
export interface RosterKey {
|
|
8
|
+
/** The key, 32 bytes in base64url. */
|
|
9
|
+
key: string;
|
|
10
|
+
/** Whose device it is. A claim made by whoever added it. */
|
|
11
|
+
person: string;
|
|
12
|
+
/** What it may do. */
|
|
13
|
+
role: Role;
|
|
14
|
+
/** Whether this is the key that founded the lab. */
|
|
15
|
+
founder: boolean;
|
|
16
|
+
/** The entry that put it on the roster. */
|
|
17
|
+
added: string;
|
|
18
|
+
/** If it was removed: by which entry, and the last `seq` of its log the lab accepts. */
|
|
19
|
+
removed: {
|
|
20
|
+
by: string;
|
|
21
|
+
cutoff: number;
|
|
22
|
+
} | null;
|
|
23
|
+
}
|
|
24
|
+
/** One part the lab knows of. */
|
|
25
|
+
export interface PartState {
|
|
26
|
+
/** Its checksum, which is its identity. */
|
|
27
|
+
checksum: string;
|
|
28
|
+
/** Its bases. */
|
|
29
|
+
sequence: string;
|
|
30
|
+
/** Whether it is a circle. */
|
|
31
|
+
circular: boolean;
|
|
32
|
+
/** How long it is. */
|
|
33
|
+
length: number;
|
|
34
|
+
/** What the lab calls it. */
|
|
35
|
+
name: string;
|
|
36
|
+
/** Whether it is on offer to other labs. Nothing is until somebody says so. */
|
|
37
|
+
offered: boolean;
|
|
38
|
+
/** Anything else set on it. */
|
|
39
|
+
fields: Record<string, string | number | null>;
|
|
40
|
+
/** The entry that added it. */
|
|
41
|
+
added: string;
|
|
42
|
+
}
|
|
43
|
+
/** One physical item: a tube, a prep. */
|
|
44
|
+
export interface ItemState {
|
|
45
|
+
/** Its ID. */
|
|
46
|
+
item: string;
|
|
47
|
+
/** The checksum of the part it is an item of. */
|
|
48
|
+
part: string;
|
|
49
|
+
/** What one of its amount is, if anybody said: a tube, a microlitre. */
|
|
50
|
+
unit: string | null;
|
|
51
|
+
/** How much there is, by the log. Always a whole number of the unit. */
|
|
52
|
+
amount: number;
|
|
53
|
+
/** Whether it has been retired. */
|
|
54
|
+
retired: boolean;
|
|
55
|
+
/** Whether the log has lost track: the amount went below zero, or two recounts overlapped. */
|
|
56
|
+
needsRecount: boolean;
|
|
57
|
+
/** Anything else set on it. */
|
|
58
|
+
fields: Record<string, string | number | null>;
|
|
59
|
+
/** The entry that added it. */
|
|
60
|
+
added: string;
|
|
61
|
+
}
|
|
62
|
+
/** What became of one entry. */
|
|
63
|
+
export type EntryStatus = "applied" | "set aside" | "refused" | "not understood";
|
|
64
|
+
/** One entry, in the order the merge settled on, with what became of it. */
|
|
65
|
+
export interface Placed {
|
|
66
|
+
/** Its ID. */
|
|
67
|
+
id: string;
|
|
68
|
+
/** The entry. */
|
|
69
|
+
signed: SignedEntry;
|
|
70
|
+
/** Whether it counted. */
|
|
71
|
+
status: EntryStatus;
|
|
72
|
+
/** Why not, if not. */
|
|
73
|
+
reason: string | null;
|
|
74
|
+
}
|
|
75
|
+
/** An entry that could not be placed, or was not looked at further. */
|
|
76
|
+
export interface Unplaced {
|
|
77
|
+
/** What arrived. */
|
|
78
|
+
signed: unknown;
|
|
79
|
+
/** Why it is not in the lab. */
|
|
80
|
+
reason: string;
|
|
81
|
+
}
|
|
82
|
+
/** Two changes made without knowledge of each other, where only one could stand. */
|
|
83
|
+
export interface Overlap {
|
|
84
|
+
/** What they were both about. */
|
|
85
|
+
what: string;
|
|
86
|
+
/** The entry that stood. */
|
|
87
|
+
kept: string;
|
|
88
|
+
/** The entry that did not. */
|
|
89
|
+
dropped: string;
|
|
90
|
+
}
|
|
91
|
+
/** A lab, as its logs describe it. */
|
|
92
|
+
export interface LabState {
|
|
93
|
+
/** The lab's ID, or `null` if no founding entry was among the entries. */
|
|
94
|
+
lab: string | null;
|
|
95
|
+
/** What its founder called it. */
|
|
96
|
+
name: string | null;
|
|
97
|
+
/** Every key that is or was on the roster. */
|
|
98
|
+
roster: RosterKey[];
|
|
99
|
+
/** Every part. */
|
|
100
|
+
parts: PartState[];
|
|
101
|
+
/** Every item. */
|
|
102
|
+
items: ItemState[];
|
|
103
|
+
/** Every entry that could be placed, in order, with what became of it. */
|
|
104
|
+
entries: Placed[];
|
|
105
|
+
/** Entries that are waiting on others that have not arrived. */
|
|
106
|
+
waiting: Unplaced[];
|
|
107
|
+
/** Entries that were thrown out before they were placed: unreadable, badly signed, another lab's. */
|
|
108
|
+
discarded: Unplaced[];
|
|
109
|
+
/** Changes that overlapped. */
|
|
110
|
+
overlaps: Overlap[];
|
|
111
|
+
/** The latest placed entry in each key's log. */
|
|
112
|
+
heads: Record<string, {
|
|
113
|
+
seq: number;
|
|
114
|
+
id: string;
|
|
115
|
+
}>;
|
|
116
|
+
/** For each key, how far into every log its latest entry had seen. */
|
|
117
|
+
knows: Record<string, Record<string, number>>;
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Work a lab out from its entries.
|
|
121
|
+
*
|
|
122
|
+
* @param entries - Every entry held, from every key, in any order. Duplicates are harmless.
|
|
123
|
+
* @param options - `lab` says which lab to build, when entries from more than one may be present.
|
|
124
|
+
* @returns The lab. It is the same for the same set of entries, whatever order they came in.
|
|
125
|
+
* @throws If the entries found more than one lab and `options.lab` does not say which is meant.
|
|
126
|
+
*
|
|
127
|
+
* @example
|
|
128
|
+
* ```ts
|
|
129
|
+
* import { adjustItem, mergeLog, nextEntry } from "@biolibs/bionet";
|
|
130
|
+
*
|
|
131
|
+
* const lab = await mergeLog(everyEntryHeld);
|
|
132
|
+
* lab.items.find((one) => one.item === tube)?.amount; // 9
|
|
133
|
+
*
|
|
134
|
+
* const used = await nextEntry(lab, key, adjustItem(tube, -1));
|
|
135
|
+
* (await mergeLog([...everyEntryHeld, used])).items.find((one) => one.item === tube)?.amount; // 8
|
|
136
|
+
* ```
|
|
137
|
+
*/
|
|
138
|
+
export declare function mergeLog(entries: readonly unknown[], options?: {
|
|
139
|
+
lab?: string;
|
|
140
|
+
}): Promise<LabState>;
|
|
141
|
+
/**
|
|
142
|
+
* Write the next entry in a key's log, given the lab as it stands.
|
|
143
|
+
*
|
|
144
|
+
* It works out the three things an entry has to say about its place: which lab, what came before it
|
|
145
|
+
* in this key's log, and which other logs have moved on since this key last wrote.
|
|
146
|
+
*
|
|
147
|
+
* @param state - The lab, from `mergeLog` over everything held.
|
|
148
|
+
* @param key - The device's key.
|
|
149
|
+
* @param op - The change.
|
|
150
|
+
* @param options - A name to sign under, and when.
|
|
151
|
+
* @returns The signed entry, to be added to what is held and sent to the others.
|
|
152
|
+
* @throws If `state` has no lab.
|
|
153
|
+
*/
|
|
154
|
+
export declare function nextEntry(state: LabState, key: SigningKey, op: Operation, options?: SignOptions): Promise<SignedEntry>;
|
|
155
|
+
/**
|
|
156
|
+
* What a lab shows the world: the parts it has in stock, and whether each is on offer.
|
|
157
|
+
*
|
|
158
|
+
* The logs hold everything — every tube, every amount, who took what. None of that leaves. A part is
|
|
159
|
+
* listed if some item of it that has not been retired has anything left, it is on offer only if a
|
|
160
|
+
* member said so, and the only note that travels is one written to be public (`public_note`).
|
|
161
|
+
*
|
|
162
|
+
* @param state - The lab.
|
|
163
|
+
* @param lab - Who is publishing, and from where.
|
|
164
|
+
* @param options - Other labs to point at, and when to say it was published.
|
|
165
|
+
* @returns An inventory, ready for a member to sign with `signInventory`.
|
|
166
|
+
*/
|
|
167
|
+
export declare function publicInventory(state: LabState, lab: LabModel, options?: {
|
|
168
|
+
peers?: readonly PeerModel[];
|
|
169
|
+
publishedAt?: string;
|
|
170
|
+
}): InventoryDocument;
|
|
171
|
+
//# sourceMappingURL=merge.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"merge.d.ts","sourceRoot":"","sources":["../src/merge.ts"],"names":[],"mappings":"AA2BA,OAAO,KAAK,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AACpE,OAAO,EAA+C,KAAK,SAAS,EAAE,KAAK,IAAI,EACtE,KAAK,WAAW,EAAE,MAAM,UAAU,CAAC;AAC5C,OAAO,EAAqB,KAAK,iBAAiB,EAAsB,KAAK,QAAQ,EAC5E,KAAK,SAAS,EAAE,MAAM,YAAY,CAAC;AAE5C,8CAA8C;AAC9C,eAAO,MAAM,gBAAgB,SAAU,CAAC;AAExC,0CAA0C;AAC1C,MAAM,WAAW,SAAS;IACxB,sCAAsC;IACtC,GAAG,EAAE,MAAM,CAAC;IACZ,4DAA4D;IAC5D,MAAM,EAAE,MAAM,CAAC;IACf,sBAAsB;IACtB,IAAI,EAAE,IAAI,CAAC;IACX,oDAAoD;IACpD,OAAO,EAAE,OAAO,CAAC;IACjB,2CAA2C;IAC3C,KAAK,EAAE,MAAM,CAAC;IACd,wFAAwF;IACxF,OAAO,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC;CAChD;AAED,iCAAiC;AACjC,MAAM,WAAW,SAAS;IACxB,2CAA2C;IAC3C,QAAQ,EAAE,MAAM,CAAC;IACjB,iBAAiB;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,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