@biolibs/bionet-tools 0.1.10 → 0.1.12

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.
Files changed (51) hide show
  1. package/README.md +211 -0
  2. package/dist/codons.d.ts +35 -0
  3. package/dist/codons.d.ts.map +1 -1
  4. package/dist/codons.js +55 -0
  5. package/dist/codons.js.map +1 -1
  6. package/dist/fusion-bench.d.ts +62 -0
  7. package/dist/fusion-bench.d.ts.map +1 -0
  8. package/dist/fusion-bench.js +114 -0
  9. package/dist/fusion-bench.js.map +1 -0
  10. package/dist/fusion.d.ts +120 -0
  11. package/dist/fusion.d.ts.map +1 -0
  12. package/dist/fusion.js +176 -0
  13. package/dist/fusion.js.map +1 -0
  14. package/dist/index.d.ts +12 -0
  15. package/dist/index.d.ts.map +1 -1
  16. package/dist/index.js +12 -0
  17. package/dist/index.js.map +1 -1
  18. package/dist/modify.js +4 -4
  19. package/dist/modify.js.map +1 -1
  20. package/dist/ordering.d.ts +147 -0
  21. package/dist/ordering.d.ts.map +1 -0
  22. package/dist/ordering.js +203 -0
  23. package/dist/ordering.js.map +1 -0
  24. package/dist/protocol.d.ts +91 -0
  25. package/dist/protocol.d.ts.map +1 -0
  26. package/dist/protocol.js +278 -0
  27. package/dist/protocol.js.map +1 -0
  28. package/dist/remedy.d.ts +137 -0
  29. package/dist/remedy.d.ts.map +1 -0
  30. package/dist/remedy.js +234 -0
  31. package/dist/remedy.js.map +1 -0
  32. package/dist/tools.d.ts +1 -1
  33. package/dist/tools.d.ts.map +1 -1
  34. package/dist/tools.js +7 -3
  35. package/dist/tools.js.map +1 -1
  36. package/dist/work.d.ts +18 -0
  37. package/dist/work.d.ts.map +1 -0
  38. package/dist/work.js +155 -0
  39. package/dist/work.js.map +1 -0
  40. package/package.json +2 -2
  41. package/src/codons.ts +53 -0
  42. package/src/fusion-bench.tsx +209 -0
  43. package/src/fusion.ts +270 -0
  44. package/src/index.ts +12 -0
  45. package/src/modify.ts +4 -4
  46. package/src/ordering.ts +301 -0
  47. package/src/protocol.ts +332 -0
  48. package/src/remedy.ts +277 -0
  49. package/src/tools.tsx +8 -4
  50. package/src/work.tsx +319 -0
  51. package/tools.css +18 -0
@@ -0,0 +1,147 @@
1
+ /**
2
+ * The order a lab's open proposals have to be carried out in, worked out from what each one makes
3
+ * and what each one needs.
4
+ *
5
+ * A proposal is one run. Nothing in the log says that eleven of them are one piece of work, or which
6
+ * comes first, and until now nothing read them as anything but eleven unrelated cards. But the order
7
+ * is not missing from the data — it is simply never followed. A plan says what it `expects` to make,
8
+ * each thing with the checksum that would be its identity; another plan says what it needs, and may
9
+ * name a part there is no tube of yet by that same checksum. Where one plan expects what another
10
+ * needs, the first has to happen first. That is a fact about the molecules, not a declaration
11
+ * somebody made, and it is true whether or not anybody wrote it down.
12
+ *
13
+ * So this derives the order rather than adding a way to assert one. No new kind of entry, nothing an
14
+ * older device has to understand, and no way for the stated order and the real one to disagree.
15
+ *
16
+ * **Where the chain stops, and why.** It stops at a transformation. What a transformation makes is
17
+ * alive, so it has no checksum to point at: a strain is this lab's own, known by an ID, and the
18
+ * culture that would be an induction's input does not exist until somebody has grown it. A plan
19
+ * cannot name a tube that is not there. So the work up to and including putting a construct into a
20
+ * host can be proposed as one chain, and what follows it has to be proposed afresh once there is
21
+ * something growing. That is a real limit and it is said here rather than hidden: a plan that
22
+ * claimed to run past it would be claiming to name something nothing can name yet.
23
+ */
24
+ import type { ItemState, PlanState } from "@biolibs/bionet";
25
+ /** As much of a lab as the ordering reads. */
26
+ export interface OrderingLab {
27
+ plans: readonly PlanState[];
28
+ items: readonly ItemState[];
29
+ }
30
+ /** Why a step cannot be carried out yet, or `null` if it can. */
31
+ export type Holding = {
32
+ why: "a step before it";
33
+ steps: string[];
34
+ } | {
35
+ why: "something nobody is making";
36
+ parts: string[];
37
+ } | {
38
+ why: "a tube that has run short";
39
+ tubes: string[];
40
+ };
41
+ /** One step: a proposal, where it sits in the order, and what stands in its way. */
42
+ export interface Step {
43
+ /** The proposal itself. */
44
+ plan: PlanState;
45
+ /** The plans that have to be carried out before it, by ID. */
46
+ after: string[];
47
+ /** How deep it is: 0 for a step with nothing before it. */
48
+ depth: number;
49
+ /** What stands in its way, or `null` if it could be done now. */
50
+ held: Holding | null;
51
+ /** The checksums it would make. */
52
+ makes: string[];
53
+ }
54
+ /** The field a plan is filed under, unless a lab uses another word for it. */
55
+ export declare const FILED_UNDER = "project";
56
+ /** What a piece of work with no project is called. */
57
+ export declare const UNFILED = "Not filed";
58
+ /** One chain of steps that leads to one thing. */
59
+ export interface Thread {
60
+ /** What to call it: what it ends by making. */
61
+ name: string;
62
+ /** Its steps, in an order that can be carried out. */
63
+ steps: Step[];
64
+ /** What it ends with: what it makes that nothing else in it consumes. */
65
+ ends: {
66
+ checksum: string;
67
+ name: string;
68
+ }[];
69
+ /** Whether every step of it could be carried out as things stand. */
70
+ clear: boolean;
71
+ }
72
+ /** Everything on in one project. */
73
+ export interface Project {
74
+ /** What it is called, as somebody filed it. */
75
+ name: string;
76
+ /** Whether anybody actually filed it, or it is the heap of what nobody did. */
77
+ filed: boolean;
78
+ /** Its chains. */
79
+ threads: Thread[];
80
+ /** Its steps, in one order that works. */
81
+ order: Step[];
82
+ /** The ones that could be carried out now. */
83
+ ready: Step[];
84
+ }
85
+ /** The open proposals, read as work to be done. */
86
+ export interface PlanOfWork {
87
+ /**
88
+ * What is on, by project.
89
+ *
90
+ * A chain is not a project and cannot be: four caseins are four chains in one project, and two
91
+ * unrelated projects are also chains. Which work belongs together is a thing people decide, so it
92
+ * is filed rather than derived, and a plan nobody filed is in `Not filed` rather than silently
93
+ * lumped in with somebody else's.
94
+ */
95
+ projects: Project[];
96
+ /** The chains, each leading to one thing. A lab building four proteins has four. */
97
+ threads: Thread[];
98
+ /** Every open step, in one order that works. */
99
+ order: Step[];
100
+ /** The steps that could be carried out now. */
101
+ ready: Step[];
102
+ /** The steps that could not, and what each is waiting on. */
103
+ held: Step[];
104
+ /**
105
+ * Plans that need something nothing makes and no tube holds: what has to be ordered or
106
+ * synthesised before any of this can start, by checksum.
107
+ */
108
+ toGet: {
109
+ checksum: string;
110
+ name: string;
111
+ forSteps: string[];
112
+ }[];
113
+ /** Plans that somehow depend on each other in a circle, by ID. Empty, unless something is wrong. */
114
+ tangled: string[];
115
+ }
116
+ /**
117
+ * The open proposals, read as work: what order they go in, what can start now, what is waiting.
118
+ *
119
+ * @param lab - The lab, with its plans and its tubes.
120
+ * @returns The work, in threads and in one order.
121
+ *
122
+ * @example
123
+ * ```ts
124
+ * import { planOfWork } from "@biolibs/bionet-tools";
125
+ *
126
+ * const work = planOfWork(lab);
127
+ * work.ready.map((one) => one.plan.kind); // what somebody could go and do now
128
+ * work.toGet; // what has to be ordered before any of it
129
+ * ```
130
+ */
131
+ export declare function planOfWork(lab: OrderingLab): PlanOfWork;
132
+ /**
133
+ * The work said in a sentence or two, for somebody who wants to know where things stand.
134
+ *
135
+ * @param work - What `planOfWork` gave.
136
+ * @returns A line for each thing worth saying. Empty if nothing is proposed.
137
+ *
138
+ * @example
139
+ * ```ts
140
+ * import { planOfWork, saysWork } from "@biolibs/bionet-tools";
141
+ *
142
+ * saysWork(planOfWork(lab));
143
+ * // ["Eleven steps are proposed, in four pieces of work.", "Three could be done now.", …]
144
+ * ```
145
+ */
146
+ export declare function saysWork(work: PlanOfWork): string[];
147
+ //# sourceMappingURL=ordering.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ordering.d.ts","sourceRoot":"","sources":["../src/ordering.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5D,8CAA8C;AAC9C,MAAM,WAAW,WAAW;IAC1B,KAAK,EAAE,SAAS,SAAS,EAAE,CAAC;IAC5B,KAAK,EAAE,SAAS,SAAS,EAAE,CAAC;CAC7B;AAED,iEAAiE;AACjE,MAAM,MA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f;AAED,mDAAmD;AACnD,MAAM,WAAW,UAAU;IACzB;;;;;;;OAOG;IACH,QAAQ,EAAE,OAAO,EAAE,CAAC;IACpB,oFAAoF;IACpF,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,gDAAgD;IAChD,KAAK,EAAE,IAAI,EAAE,CAAC;IACd,+CAA+C;IAC/C,KAAK,EAAE,IAAI,EAAE,CAAC;IACd,6DAA6D;IAC7D,IAAI,EAAE,IAAI,EAAE,CAAC;IACb;;;OAGG;IACH,KAAK,EAAE;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,EAAE,CAAA;KAAE,EAAE,CAAC;IAChE,oGAAoG;IACpG,OAAO,EAAE,MAAM,EAAE,CAAC;CACnB;AAMD;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,UAAU,CAAC,GAAG,EAAE,WAAW,GAAG,UAAU,CAmIvD;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,QAAQ,CAAC,IAAI,EAAE,UAAU,GAAG,MAAM,EAAE,CAuBnD"}
@@ -0,0 +1,203 @@
1
+ /** The field a plan is filed under, unless a lab uses another word for it. */
2
+ export const FILED_UNDER = "project";
3
+ /** What a piece of work with no project is called. */
4
+ export const UNFILED = "Not filed";
5
+ /** Whether the lab holds a tube of a part that has anything in it. */
6
+ const holds = (lab, checksum) => lab.items.some((one) => one.part === checksum && !one.retired && one.amount > 0);
7
+ /**
8
+ * The open proposals, read as work: what order they go in, what can start now, what is waiting.
9
+ *
10
+ * @param lab - The lab, with its plans and its tubes.
11
+ * @returns The work, in threads and in one order.
12
+ *
13
+ * @example
14
+ * ```ts
15
+ * import { planOfWork } from "@biolibs/bionet-tools";
16
+ *
17
+ * const work = planOfWork(lab);
18
+ * work.ready.map((one) => one.plan.kind); // what somebody could go and do now
19
+ * work.toGet; // what has to be ordered before any of it
20
+ * ```
21
+ */
22
+ export function planOfWork(lab) {
23
+ const open = lab.plans.filter((one) => one.settled === null);
24
+ const byId = new Map(open.map((one) => [one.plan, one]));
25
+ // What each open plan would make, and who would make each thing.
26
+ const makers = new Map();
27
+ for (const plan of open) {
28
+ for (const expected of plan.expects)
29
+ makers.set(expected.checksum, [...(makers.get(expected.checksum) ?? []), plan.plan]);
30
+ }
31
+ const nameOf = (checksum) => open.flatMap((one) => one.expects).find((one) => one.checksum === checksum)?.name ?? checksum.slice(0, 12);
32
+ /** What each plan waits on, and what it needs that nothing is making. */
33
+ const after = new Map();
34
+ const missing = new Map();
35
+ for (const plan of open) {
36
+ const waits = [];
37
+ const nowhere = [];
38
+ for (const input of plan.inputs) {
39
+ if (input.part === undefined)
40
+ continue;
41
+ // A plan names a part rather than a tube when there was no tube of it when it was proposed.
42
+ // There may be one now, and that is a fact about the lab, not about the plan.
43
+ if (holds(lab, input.part))
44
+ continue;
45
+ const made = (makers.get(input.part) ?? []).filter((one) => one !== plan.plan);
46
+ if (made.length > 0)
47
+ waits.push(...made);
48
+ else
49
+ nowhere.push(input.part);
50
+ }
51
+ after.set(plan.plan, [...new Set(waits)]);
52
+ missing.set(plan.plan, [...new Set(nowhere)]);
53
+ }
54
+ // The order: a step comes after everything it waits on. Kahn's algorithm, which also finds a
55
+ // circle if the proposals somehow make one.
56
+ const left = new Set(open.map((one) => one.plan));
57
+ const depth = new Map();
58
+ const order = [];
59
+ for (let guard = 0; left.size > 0 && guard <= open.length; guard += 1) {
60
+ const free = [...left].filter((id) => (after.get(id) ?? []).every((before) => !left.has(before)));
61
+ if (free.length === 0)
62
+ break;
63
+ // In the order they were proposed, so that two steps that could both go now keep their order.
64
+ free.sort((a, b) => open.findIndex((one) => one.plan === a) - open.findIndex((one) => one.plan === b));
65
+ for (const id of free) {
66
+ depth.set(id, Math.max(0, ...(after.get(id) ?? []).map((before) => (depth.get(before) ?? 0) + 1)));
67
+ order.push(id);
68
+ left.delete(id);
69
+ }
70
+ }
71
+ const tangled = [...left];
72
+ const stepOf = (id) => {
73
+ const plan = byId.get(id);
74
+ const waits = (after.get(id) ?? []).filter((one) => byId.has(one));
75
+ const nowhere = missing.get(id) ?? [];
76
+ const held = waits.length > 0 ? { why: "a step before it", steps: waits }
77
+ : nowhere.length > 0 ? { why: "something nobody is making", parts: nowhere }
78
+ : plan.wanting.length > 0 ? { why: "a tube that has run short", tubes: [...plan.wanting] }
79
+ : null;
80
+ return { plan, after: waits, depth: depth.get(id) ?? 0, held, makes: plan.expects.map((one) => one.checksum) };
81
+ };
82
+ const steps = order.map(stepOf);
83
+ const tangledSteps = tangled.map(stepOf);
84
+ // A thread is a set of steps joined by what they make and need: a lab building four proteins has
85
+ // four of them, and they are four separate pieces of work however they were proposed.
86
+ const where = new Map();
87
+ const threads = [];
88
+ const join = (id, into) => {
89
+ const was = where.get(id);
90
+ if (was === into)
91
+ return;
92
+ if (was === undefined) {
93
+ where.set(id, into);
94
+ return;
95
+ }
96
+ // Two threads met, so they were one thread: everything in the older joins the newer.
97
+ for (const [each, at] of where)
98
+ if (at === was)
99
+ where.set(each, into);
100
+ };
101
+ for (const step of steps) {
102
+ const joined = [step.plan.plan, ...step.after].map((id) => where.get(id)).find((at) => at !== undefined);
103
+ const at = joined ?? threads.push([]) - 1;
104
+ join(step.plan.plan, at);
105
+ for (const before of step.after)
106
+ join(before, at);
107
+ }
108
+ for (const step of steps)
109
+ threads[where.get(step.plan.plan)].push(step);
110
+ const made = new Set(steps.flatMap((one) => one.makes));
111
+ const woven = threads.filter((one) => one.length > 0).map((one) => {
112
+ const inside = new Set(one.flatMap((step) => step.makes));
113
+ const needed = new Set(one.flatMap((step) => step.plan.inputs.flatMap((input) => (input.part === undefined ? [] : [input.part]))));
114
+ // What it ends with is what it makes that nothing in it then uses.
115
+ let ends = [...inside].filter((checksum) => !needed.has(checksum)).map((checksum) => ({ checksum, name: nameOf(checksum) }));
116
+ // Unless there is no such thing, which happens whenever a chain finishes with a transformation:
117
+ // every molecule it made went into the host, and what came out is alive and has no checksum to
118
+ // be named by. The last thing that can be named is then what the chain is known by.
119
+ if (ends.length === 0) {
120
+ const last = [...one].reverse().find((step) => step.makes.length > 0);
121
+ ends = (last?.makes ?? []).map((checksum) => ({ checksum, name: nameOf(checksum) }));
122
+ }
123
+ return {
124
+ // A chain is known by what it is for, which is the last thing it makes.
125
+ name: ends.map((each) => each.name).join(" and ") || `${one.length} ${one.length === 1 ? "step" : "steps"}`,
126
+ steps: one, ends, clear: one.every((step) => step.held === null || step.held.why === "a step before it"),
127
+ };
128
+ });
129
+ const toGet = new Map();
130
+ for (const step of [...steps, ...tangledSteps]) {
131
+ for (const checksum of missing.get(step.plan.plan) ?? [])
132
+ toGet.set(checksum, [...(toGet.get(checksum) ?? []), step.plan.plan]);
133
+ }
134
+ // Filed, not derived: which chains belong to one project is somebody's decision.
135
+ const filedAs = (step) => {
136
+ const said = step.plan.fields[FILED_UNDER];
137
+ return typeof said === "string" && said.trim() !== "" ? said.trim() : UNFILED;
138
+ };
139
+ const byProject = new Map();
140
+ for (const step of steps)
141
+ byProject.set(filedAs(step), [...(byProject.get(filedAs(step)) ?? []), step]);
142
+ const projects = [...byProject].map(([name, own]) => ({
143
+ name, filed: name !== UNFILED,
144
+ // A chain belongs to a project if any of its steps was filed under it. A chain whose steps were
145
+ // filed differently is shown under each, since the steps really are in both and saying
146
+ // otherwise would hide work from one of them.
147
+ threads: woven.filter((thread) => thread.steps.some((step) => filedAs(step) === name)),
148
+ order: own, ready: own.filter((step) => step.held === null),
149
+ // What nobody filed goes last: it is a heap, not a project.
150
+ })).sort((a, b) => Number(a.name === UNFILED) - Number(b.name === UNFILED) || a.name.localeCompare(b.name));
151
+ return {
152
+ projects, threads: woven, order: steps,
153
+ ready: steps.filter((one) => one.held === null),
154
+ held: steps.filter((one) => one.held !== null),
155
+ toGet: [...toGet].map(([checksum, forSteps]) => ({ checksum, name: made.has(checksum) ? nameOf(checksum) : checksum.slice(0, 12), forSteps })),
156
+ tangled,
157
+ };
158
+ }
159
+ /**
160
+ * The work said in a sentence or two, for somebody who wants to know where things stand.
161
+ *
162
+ * @param work - What `planOfWork` gave.
163
+ * @returns A line for each thing worth saying. Empty if nothing is proposed.
164
+ *
165
+ * @example
166
+ * ```ts
167
+ * import { planOfWork, saysWork } from "@biolibs/bionet-tools";
168
+ *
169
+ * saysWork(planOfWork(lab));
170
+ * // ["Eleven steps are proposed, in four pieces of work.", "Three could be done now.", …]
171
+ * ```
172
+ */
173
+ export function saysWork(work) {
174
+ if (work.order.length === 0 && work.tangled.length === 0)
175
+ return [];
176
+ const count = (many, one, more) => `${many} ${many === 1 ? one : more}`;
177
+ const filed = work.projects.filter((one) => one.filed);
178
+ const said = [
179
+ `${count(work.order.length, "step is", "steps are")} proposed, in ${count(work.threads.length, "piece", "pieces")} of work`
180
+ + (filed.length === 0 ? "." : `, across ${count(filed.length, "project", "projects")}: ${filed.map((one) => one.name).join(", ")}.`),
181
+ ];
182
+ const loose = work.projects.find((one) => !one.filed);
183
+ if (loose !== undefined && filed.length > 0) {
184
+ said.push(`${count(loose.order.length, "step is", "steps are")} filed under no project.`);
185
+ }
186
+ if (work.ready.length > 0)
187
+ said.push(`${count(work.ready.length, "step", "steps")} could be carried out now.`);
188
+ else if (work.order.length > 0)
189
+ said.push("Nothing can be carried out yet.");
190
+ const waiting = work.held.filter((one) => one.held?.why === "a step before it").length;
191
+ if (waiting > 0)
192
+ said.push(`${count(waiting, "step is", "steps are")} waiting on a step before it.`);
193
+ if (work.toGet.length > 0) {
194
+ said.push(`${count(work.toGet.length, "part has", "parts have")} to be ordered or made first: nothing proposed makes ${work.toGet.length === 1 ? "it" : "them"}, and there is no tube.`);
195
+ }
196
+ const short = work.held.filter((one) => one.held?.why === "a tube that has run short").length;
197
+ if (short > 0)
198
+ said.push(`${count(short, "step counts", "steps count")} on a tube that has been retired or run short.`);
199
+ if (work.tangled.length > 0)
200
+ said.push(`${count(work.tangled.length, "step", "steps")} depend on each other in a circle and cannot be ordered.`);
201
+ return said;
202
+ }
203
+ //# sourceMappingURL=ord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AC,KAAK,EAAE,aAAa,EAAE,aAAa,CAAC,gDAAgD,CAAC,CAAC;IACxH,IAAI,IAAI,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC;QAAE,IAAI,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,0DAA0D,CAAC,CAAC;IACjJ,OAAO,IAAI,CAAC;AACd,CAAC"}
@@ -0,0 +1,91 @@
1
+ import { type OrderingLab } from "./ordering.js";
2
+ /**
3
+ * As much of a lab as a protocol reads: the work, plus the names of things, since a sheet carried to
4
+ * a bench says "1 µL of pGene, in Box 1" and not a checksum.
5
+ */
6
+ export interface ProtocolLab extends OrderingLab {
7
+ parts: readonly {
8
+ checksum: string;
9
+ name: string;
10
+ length: number;
11
+ circular: boolean;
12
+ }[];
13
+ strains?: readonly {
14
+ strain: string;
15
+ name: string;
16
+ host: string;
17
+ }[];
18
+ places?: readonly {
19
+ place: string;
20
+ name: string;
21
+ }[];
22
+ }
23
+ /** One step, as somebody at a bench reads it. */
24
+ export interface ProtocolStep {
25
+ /** Its number within its piece of work. */
26
+ number: number;
27
+ /** What the step is, in a line. */
28
+ title: string;
29
+ /** What to get out before starting, with how much of each and where it is. */
30
+ takeOut: string[];
31
+ /** What to set a machine to, from what the plan recorded. */
32
+ set: {
33
+ what: string;
34
+ to: string;
35
+ }[];
36
+ /** What to do, in order. */
37
+ doThis: string[];
38
+ /** What to record afterwards, which is what keeps the lab's history true. */
39
+ thenRecord: string;
40
+ /**
41
+ * What this plan does not say, and the lab has to supply.
42
+ *
43
+ * The most important list on the page. A protocol that quietly left these out would read as
44
+ * complete and send somebody to the bench without a polymerase.
45
+ */
46
+ notSaid: string[];
47
+ /** Whatever the person who proposed it wanted to say. */
48
+ note: string | null;
49
+ }
50
+ /** One piece of work, written out. */
51
+ export interface Protocol {
52
+ /** What it is called. */
53
+ title: string;
54
+ /** A line or two about what it is and what it leaves you with. */
55
+ about: string[];
56
+ /** What the lab has to have before the first step. */
57
+ haveReady: string[];
58
+ /** The steps, in the order to carry them out. */
59
+ steps: ProtocolStep[];
60
+ /** What you have at the end of it. */
61
+ atTheEnd: string[];
62
+ }
63
+ /**
64
+ * The work of one piece, written out as a protocol.
65
+ *
66
+ * @param lab - The lab, for the names of what its tubes hold and where they are.
67
+ * @param options - `project` picks one project's work; `title` names the sheet.
68
+ * @returns One protocol for each piece of work, in the order the pieces come.
69
+ *
70
+ * @example
71
+ * ```ts
72
+ * import { protocolsFor, protocolText } from "@biolibs/bionet-tools";
73
+ *
74
+ * for (const sheet of protocolsFor(lab, { project: "Real Vegan Cheese" })) console.log(protocolText(sheet));
75
+ * ```
76
+ */
77
+ export declare function protocolsFor(lab: ProtocolLab, options?: {
78
+ project?: string;
79
+ title?: string;
80
+ }): Protocol[];
81
+ /**
82
+ * A protocol as text, to print or to paste.
83
+ *
84
+ * Markdown, because it reads as well unrendered as rendered, and somebody at a bench is as likely to
85
+ * have it in a terminal or a text file as on a page.
86
+ *
87
+ * @param protocol - What `protocolsFor` gave.
88
+ * @returns The sheet.
89
+ */
90
+ export declare function protocolText(protocol: Protocol): string;
91
+ //# sourceMappingURL=protocol.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"protocol.d.ts","sourceRoot":"","sources":["../src/protocol.ts"],"names":[],"mappings":"AAkBA,OAAO,EAAc,KAAK,WAAW,EAAa,MAAM,eAAe,CAAC;AAExE;;;GAGG;AACH,MAAM,WAAW,WAAY,SAAQ,WAAW;IAC9C,KAAK,EAAE,SAAS;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,OAAO,CAAA;KAAE,EAAE,CAAC;IACxF,OAAO,CAAC,EAAE,SAAS;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,C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