@mccaskie-labs/workbench-agreements 0.3.1 → 0.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @mccaskie-labs/workbench-agreements
2
2
 
3
+ ## 0.3.2
4
+
5
+ ### Patch Changes
6
+
7
+ - Open documents (`openDocuments`, `documents.*`, `documentsMigration`): a waiver, consent form or terms signed from a public link or from one-use request links for a booking; versions, retiring, signing for a child (parent or legal guardian), validity in months with renewal emails or for one event, `valid()` for check-in, a `workbench-forms` form under the document, sensitive answers and files kept apart and scrubbed after `retention.sensitive_days_after` days, and abuse limits. `cleanup()` now returns `{ deleted, scrubbed }`. New config settings `renew_days_before` and `retention.sensitive_days_after`. Needs `@mccaskie-labs/workbench-forms` ^0.11.0.
8
+
3
9
  ## 0.3.1
4
10
 
5
11
  ### Patch Changes
package/README.md CHANGED
@@ -46,6 +46,40 @@ Notices: a decline emails the business (`copyTo`, else `replyTo`), every other s
46
46
 
47
47
  Commands: `npx workbench-agreements init`, `generate [--check]`, `migration`.
48
48
 
49
+ ## Open documents (0.3.2)
50
+
51
+ A document signed from a link rather than sent to named people: a waiver, a consent form or a set of terms. Turn it on with `openDocuments` and run the second migration (`npx workbench-agreements migration` writes both).
52
+
53
+ ```ts
54
+ import { createAgreements } from "@mccaskie-labs/workbench-agreements";
55
+ import { WAIVER_FORM } from "./forms.generated"; // a workbench-forms form, optional
56
+
57
+ const agreements = createAgreements({ /* as above */, t, openDocuments: { forms: { waiver: WAIVER_FORM } } });
58
+
59
+ // Publish it: anyone with the link signs it. A new save is a new version; old signatures stay on their version.
60
+ const doc = await agreements.documents.save({
61
+ account: business.id, slug: "reef-waiver", title: "Reef tour waiver", business: business.name,
62
+ document: pdfBytes, form: "waiver", forChild: "allowed", validity: { months: 12 }, copyTo: [business.email],
63
+ });
64
+ // doc.url is /sign/d/reef-waiver
65
+
66
+ // Or one link per place on a booking, each signed once, valid for that booking only.
67
+ const { links } = await agreements.documents.request({ slug: "reef-waiver", subject: { type: "booking", id: booking.id }, places: 4, validUntil: booking.endsAt, email: { to: booker.email, name: booker.name } });
68
+
69
+ // At check-in
70
+ const ok = await agreements.documents.valid("reef-waiver", { email: guest.email, child: guest.childName }, { type: "booking", id: booking.id });
71
+ ```
72
+
73
+ | Part | What it does |
74
+ | --- | --- |
75
+ | Signing for a child | `forChild: "no" \| "allowed" \| "only"`. The signer names the child, says whether they are the parent or legal guardian, and ticks that they may sign for them. `valid()` tells the adult's own signature and each child's apart. |
76
+ | Validity | `{ months }` (the signature lapses that many months after signing, and the signer gets a renewal email `renew_days_before` days before) or `"event"` (valid until the request's `validUntil`). |
77
+ | Questions | A `workbench-forms` form drawn under the document. Its answers go on the certificate, except **sensitive** fields (health, medication) and **files**, which only the business sees. |
78
+ | Sensitive answers and files | Kept in the app's own database and R2 bucket, never in Workbench, never sent to AI, never in an email, and deleted `retention.sensitive_days_after` days (default 30) after the signature lapses. |
79
+ | Abuse limits | 5 starts per email an hour and 500 per document an hour; a signing session lasts 24 hours. |
80
+
81
+ `documents.signatures(account)` and `documents.file(id, "signed" \| { field })` are for the owner's own pages; `tick()` also sends renewals, and `cleanup()` also scrubs sensitive answers and files (`{ deleted, scrubbed }`).
82
+
49
83
  ## Size and Workers tests
50
84
 
51
85
  PDF work uses `pdf-lib` (about 1 MB), which the package loads only when a PDF is read or made: on `create`, on signing, and in `pdfPages` or `buildSignedCopy`. Importing the package doesn't load it, so a Workers test run (`@cloudflare/vitest-plugin`), which sends each test file's modules to the runtime, doesn't fail with "Message is too large". If a test file of yours imports `pdf-lib` itself, for example to make a sample PDF, load it with `await import("pdf-lib")` inside the test, not at the top of the file.
@@ -1,5 +1,6 @@
1
1
  import { type AgreementLanguage, type AgreementsConfig, type SigningMethod } from "./config.ts";
2
2
  import { type AgreementStrings } from "./words.ts";
3
+ import { type DocumentForm, type Documents } from "./documents.ts";
3
4
  type DbError = {
4
5
  message?: string;
5
6
  code?: string;
@@ -59,6 +60,15 @@ export interface AgreementsOptions {
59
60
  locale?: string;
60
61
  /** Where replies to the emails go: the business's own address. It also gets the business's notices (a decline, one of several signing, running out) when an agreement has no copyTo. */
61
62
  replyTo?: string;
63
+ /**
64
+ * Turns on open documents (waivers and consent forms signed from a link),
65
+ * once documentsMigration is applied. `forms`: the forms their questions
66
+ * come from, by form name, each from src/forms.generated.ts with its
67
+ * validation context. Off, documents' methods throw and its links are 404s.
68
+ */
69
+ openDocuments?: {
70
+ forms?: Readonly<Record<string, DocumentForm>>;
71
+ };
62
72
  /** For tests. */
63
73
  now?: () => Date;
64
74
  }
@@ -186,12 +196,16 @@ export interface Agreements {
186
196
  finished: number;
187
197
  copies: number;
188
198
  reminded: number;
199
+ renewed: number;
189
200
  failed: number;
190
201
  }>;
191
- /** Once a day: deletes agreements and their files past the retention. */
202
+ /** Once a day: deletes agreements and their files past the retention, and open documents' signatures, sensitive answers and uploads past theirs. */
192
203
  cleanup(): Promise<{
193
204
  deleted: number;
205
+ scrubbed: number;
194
206
  }>;
207
+ /** Open documents: saved wording plus a form's questions, signed by anyone from a link (waivers, consent forms). */
208
+ documents: Documents;
195
209
  }
196
210
  export declare function createAgreements(opts: AgreementsOptions): Agreements;
197
211
  export {};
@@ -13,6 +13,7 @@ import { signScriptHash } from "./script.js";
13
13
  import { codeHash, isToken, newCode, newToken, sha256Hex } from "./secrets.js";
14
14
  import { readDrawnSignature } from "./signature.js";
15
15
  import { agreementWord } from "./words.js";
16
+ import { openDocuments, RESERVED_FIELDS } from "./documents.js";
16
17
  const DAY_MS = 86_400_000;
17
18
  const CODE_MS = 10 * 60_000;
18
19
  const MAX_DOCUMENT_BYTES = 10 * 1024 * 1024;
@@ -345,7 +346,53 @@ export function createAgreements(opts) {
345
346
  "content-security-policy": "default-src 'none'; frame-ancestors 'self'",
346
347
  },
347
348
  });
349
+ const forms = opts.openDocuments?.forms ?? {};
350
+ for (const [name, f] of Object.entries(forms)) {
351
+ if (!f?.form || f.form.name !== name)
352
+ throw new AgreementsError("invalid_config", `documentForms.${name} must be { form, context } for the form named ${name}`);
353
+ const clash = Object.keys(f.form.fields).filter((x) => RESERVED_FIELDS.includes(x));
354
+ if (clash.length)
355
+ throw new AgreementsError("invalid_config", `form ${name} has a field the signing page uses itself (${clash.join(", ")}): rename it`);
356
+ if (!opts.t)
357
+ throw new AgreementsError("invalid_config", "openDocuments.forms needs t, the project's strings, for the questions' labels");
358
+ }
359
+ const open = openDocuments({
360
+ config,
361
+ base,
362
+ ...(opts.t ? { t: opts.t } : {}),
363
+ forms,
364
+ ...(opts.replyTo ? { replyTo: opts.replyTo } : {}),
365
+ locale,
366
+ now,
367
+ call,
368
+ load,
369
+ store,
370
+ remove: async (keys) => {
371
+ try {
372
+ for (let i = 0; i < keys.length; i += 1000)
373
+ if (keys.slice(i, i + 1000).length)
374
+ await files.delete(keys.slice(i, i + 1000));
375
+ }
376
+ catch (e) {
377
+ throw new AgreementsError("storage", `deleting files: ${e.message}`, { cause: e });
378
+ }
379
+ },
380
+ mailer,
381
+ dateLabel,
382
+ device,
383
+ html,
384
+ redirect,
385
+ bare,
386
+ pdf,
387
+ common: (language) => ({ language, ...(opts.t ? { t: opts.t } : {}), ...(opts.styles ? { styles: opts.styles } : {}) }),
388
+ slug,
389
+ });
348
390
  return {
391
+ documents: opts.openDocuments
392
+ ? open.api
393
+ : new Proxy({}, {
394
+ get: () => () => Promise.reject(new AgreementsError("invalid_config", "open documents are off: pass openDocuments to createAgreements and apply documentsMigration")),
395
+ }),
349
396
  async create(req) {
350
397
  if (!text(req.account, 1, 200))
351
398
  throw new AgreementsError("invalid_request", "account must be 1 to 200 characters");
@@ -483,6 +530,9 @@ export function createAgreements(opts) {
483
530
  return r ? { id: r.id, title: r.title, status: r.status, which: r.which, completedAt: iso(r.completed_at) } : null;
484
531
  },
485
532
  async handle(request, ctx) {
533
+ const openResponse = opts.openDocuments ? await open.handle(request, ctx) : null;
534
+ if (openResponse)
535
+ return openResponse;
486
536
  const url = new URL(request.url);
487
537
  const m = pathRe.exec(url.pathname);
488
538
  if (!m)
@@ -654,7 +704,7 @@ export function createAgreements(opts) {
654
704
  return redirect(self);
655
705
  },
656
706
  async tick() {
657
- const out = { expired: 0, finished: 0, copies: 0, reminded: 0, failed: 0 };
707
+ const out = { expired: 0, finished: 0, copies: 0, reminded: 0, renewed: 0, failed: 0 };
658
708
  const at = now();
659
709
  const scan = await call("agreements_scan", { p_at: at.toISOString(), p_limit: 100 }, "scanning agreements");
660
710
  out.expired = scan.expired.length;
@@ -707,6 +757,11 @@ export function createAgreements(opts) {
707
757
  }
708
758
  });
709
759
  }
760
+ const docs = opts.openDocuments ? await open.tick() : { finished: 0, copies: 0, renewed: 0, failed: 0 };
761
+ out.finished += docs.finished;
762
+ out.copies += docs.copies;
763
+ out.renewed = docs.renewed;
764
+ out.failed += docs.failed;
710
765
  return out;
711
766
  },
712
767
  async cleanup() {
@@ -714,18 +769,20 @@ export function createAgreements(opts) {
714
769
  const signedBefore = new Date(t);
715
770
  signedBefore.setUTCFullYear(signedBefore.getUTCFullYear() - config.retention.signed_years);
716
771
  const old = await call("agreements_old", { p_signed_before: signedBefore.toISOString(), p_unsigned_before: new Date(t.getTime() - config.retention.unsigned_days * DAY_MS).toISOString(), p_limit: 200 }, "finding old agreements");
717
- if (!old?.length)
718
- return { deleted: 0 };
719
- const keys = old.flatMap((o) => o.keys);
720
- try {
721
- for (let i = 0; i < keys.length; i += 1000)
722
- await files.delete(keys.slice(i, i + 1000));
723
- }
724
- catch (e) {
725
- throw new AgreementsError("storage", `deleting old agreements' files: ${e.message}`, { cause: e });
772
+ let deleted = 0;
773
+ if (old?.length) {
774
+ const keys = old.flatMap((o) => o.keys);
775
+ try {
776
+ for (let i = 0; i < keys.length; i += 1000)
777
+ await files.delete(keys.slice(i, i + 1000));
778
+ }
779
+ catch (e) {
780
+ throw new AgreementsError("storage", `deleting old agreements' files: ${e.message}`, { cause: e });
781
+ }
782
+ deleted = await call("agreements_delete", { p_ids: old.map((o) => o.id) }, "deleting old agreements");
726
783
  }
727
- const deleted = await call("agreements_delete", { p_ids: old.map((o) => o.id) }, "deleting old agreements");
728
- return { deleted };
784
+ const docs = opts.openDocuments ? await open.cleanup() : { deleted: 0, scrubbed: 0 };
785
+ return { deleted: deleted + docs.deleted, scrubbed: docs.scrubbed };
729
786
  },
730
787
  };
731
788
  }
@@ -7,7 +7,8 @@ export interface CertificateSigner {
7
7
  method: SigningMethod;
8
8
  typedName: string;
9
9
  signedAt: string;
10
- identity: IdentityCheck;
10
+ /** How they showed it was them: a private link, with or without an emailed code; or, for an open document, the name and email they gave, with or without a code. */
11
+ identity: IdentityCheck | "open_link" | "open_email_code";
11
12
  ip?: string | null;
12
13
  userAgent?: string | null;
13
14
  /** The drawn signature's PNG. */
@@ -29,6 +30,17 @@ export interface CertificateInput {
29
30
  events: readonly CertificateEvent[];
30
31
  timeZone: string;
31
32
  locale?: string;
33
+ /** Open documents: the "Agreement" line's word ("Signature"), and the form's answers that may be printed. */
34
+ kind?: "agreement" | "open";
35
+ answers?: {
36
+ /** Label and answer, in the form's order; sensitive answers and files are never here. */
37
+ facts: readonly {
38
+ label: string;
39
+ value: string;
40
+ }[];
41
+ /** What isn't printed and the fingerprint of all of it. */
42
+ note: string;
43
+ };
32
44
  }
33
45
  /** The page count, refusing a file pdf-lib can't open or one that is encrypted (a signed copy couldn't be made from it). */
34
46
  export declare function pdfPages(bytes: Uint8Array): Promise<number>;
@@ -88,7 +88,12 @@ export function bothTimes(iso, timeZone, locale = "en-AU") {
88
88
  return `${local} (${d.toISOString().replace("T", " ").replace(/\.\d+Z$/, " UTC")})`;
89
89
  }
90
90
  const METHOD = { typed: "Typed their name", drawn: "Drew their signature" };
91
- const IDENTITY = { link: "Opened the private signing link sent to them", email_code: "Opened the private signing link and entered a one-time code emailed to them" };
91
+ const IDENTITY = {
92
+ link: "Opened the private signing link sent to them",
93
+ email_code: "Opened the private signing link and entered a one-time code emailed to them",
94
+ open_link: "Gave their name and email on the signing page",
95
+ open_email_code: "Gave their name and email on the signing page and entered a one-time code emailed to that address",
96
+ };
92
97
  /** The signed copy's bytes. */
93
98
  export async function buildSignedCopy(c) {
94
99
  const { PDFDocument, StandardFonts } = await loadPdfLib();
@@ -106,7 +111,7 @@ export async function buildSignedCopy(c) {
106
111
  const pages = doc.getPages();
107
112
  const total = pages.length;
108
113
  pages.forEach((p, i) => {
109
- const text = winAnsi(regular, `Signed electronically · Agreement ${short} · Page ${i + 1} of ${total} · Certificate at the end`);
114
+ const text = winAnsi(regular, `Signed electronically · ${c.kind === "open" ? "Signature" : "Agreement"} ${short} · Page ${i + 1} of ${total} · Certificate at the end`);
110
115
  const { width } = p.getSize();
111
116
  const size = 7;
112
117
  p.drawText(text, { x: Math.max(10, (width - regular.widthOfTextAtSize(text, size)) / 2), y: 12, size, font: regular, color: MUTED });
@@ -152,8 +157,8 @@ export async function buildSignedCopy(c) {
152
157
  para("Signing certificate", { font: bold, size: 18, gap: 6 });
153
158
  para(c.title, { font: bold, size: 12, gap: 2 });
154
159
  para(`From ${c.business}`, { color: MUTED, gap: 10 });
155
- fact("Agreement", c.id);
156
- fact("Sent", bothTimes(c.createdAt, c.timeZone, c.locale));
160
+ fact(c.kind === "open" ? "Signature" : "Agreement", c.id);
161
+ fact(c.kind === "open" ? "Started" : "Sent", bothTimes(c.createdAt, c.timeZone, c.locale));
157
162
  fact("Completed", bothTimes(c.completedAt, c.timeZone, c.locale));
158
163
  fact("Original SHA-256", c.documentSha256);
159
164
  fact("Pages", `${total} page${total === 1 ? "" : "s"} before this certificate`);
@@ -188,6 +193,15 @@ export async function buildSignedCopy(c) {
188
193
  y -= 12;
189
194
  rule();
190
195
  }
196
+ if (c.answers) {
197
+ para("Answers", { font: bold, size: 12, gap: 4 });
198
+ for (const f of c.answers.facts) {
199
+ para(f.label, { font: bold, gap: 0 });
200
+ para(f.value || "-", { indent: 12, gap: 4 });
201
+ }
202
+ para(c.answers.note, { color: MUTED, size: 8.5, gap: 8 });
203
+ rule();
204
+ }
191
205
  para("Audit trail", { font: bold, size: 12, gap: 4 });
192
206
  for (const e of c.events)
193
207
  para(`${bothTimes(e.at, c.timeZone, c.locale)} ${e.what}`, { size: 8.5, gap: 1 });
package/dist/cli.js CHANGED
@@ -9,12 +9,14 @@
9
9
  // (AGREEMENTS_CONFIG for createAgreements). --check writes nothing and
10
10
  // fails when the file is out of date or the answers are wrong.
11
11
  // workbench-agreements migration [dir]
12
- // writes agreementsMigration into supabase/migrations and its down file
13
- // into supabase/rollback, unless an agreements migration is already there.
12
+ // writes agreementsMigration and documentsMigration (open documents) into
13
+ // supabase/migrations and their down files into supabase/rollback, each
14
+ // unless it is already there.
14
15
  import { existsSync, mkdirSync, readdirSync, readFileSync, realpathSync, writeFileSync } from "node:fs";
15
16
  import { dirname, join, resolve } from "node:path";
16
17
  import { fileURLToPath } from "node:url";
17
18
  import { agreementsProblems, STARTER_AGREEMENTS } from "./config.js";
19
+ import { documentsMigration } from "./documents-migration.js";
18
20
  import { agreementsMigration } from "./migration.js";
19
21
  const USAGE = "usage: workbench-agreements init [dir]\n workbench-agreements generate [--check] [dir]\n workbench-agreements migration [dir]";
20
22
  export const AGREEMENTS_FILE = "workbench/agreements.json";
@@ -75,16 +77,26 @@ export function run(argv, log = console.log, err = console.error, at = () => new
75
77
  }
76
78
  if (command === "migration") {
77
79
  const folder = join(dir, "supabase/migrations");
78
- if (existsSync(folder) && readdirSync(folder).some((f) => f.endsWith("_workbench_agreements.sql"))) {
79
- log("supabase/migrations already has the agreements migration; nothing written");
80
+ const have = existsSync(folder) ? readdirSync(folder) : [];
81
+ const stamp = at().toISOString().replace(/[-:T]/g, "").slice(0, 14);
82
+ const wanted = [
83
+ ["_workbench_agreements.sql", stamp, agreementsMigration, "agreements and e-signing (docs/agreements.md)"],
84
+ // One second later, so it always sorts after the agreements migration it builds beside.
85
+ ["_workbench_agreements_documents.sql", String(Number(stamp) + 1), documentsMigration, "open documents: waivers and consent forms signed from a link (docs/agreements.md §6)"],
86
+ ];
87
+ const missing = wanted.filter(([suffix]) => !have.some((f) => f.endsWith(suffix)));
88
+ if (!missing.length) {
89
+ log("supabase/migrations already has the agreements migrations; nothing written");
80
90
  return 0;
81
91
  }
82
- const name = `${at().toISOString().replace(/[-:T]/g, "").slice(0, 14)}_workbench_agreements.sql`;
83
92
  mkdirSync(folder, { recursive: true });
84
93
  mkdirSync(join(dir, "supabase/rollback"), { recursive: true });
85
- writeFileSync(join(folder, name), `-- workbench-agreements: agreements and e-signing (docs/agreements.md)\n${agreementsMigration.up}`);
86
- writeFileSync(join(dir, "supabase/rollback", name.replace(/\.sql$/, "_down.sql")), `-- Reverses ${name}\n${agreementsMigration.down}`);
87
- log(`wrote supabase/migrations/${name} and its down file`);
94
+ for (const [suffix, time, m, about] of missing) {
95
+ const name = `${time}${suffix}`;
96
+ writeFileSync(join(folder, name), `-- workbench-agreements: ${about}\n${m.up}`);
97
+ writeFileSync(join(dir, "supabase/rollback", name.replace(/\.sql$/, "_down.sql")), `-- Reverses ${name}\n${m.down}`);
98
+ log(`wrote supabase/migrations/${name} and its down file`);
99
+ }
88
100
  return 0;
89
101
  }
90
102
  const text = moduleText(readAgreements(dir));
package/dist/config.d.ts CHANGED
@@ -24,9 +24,13 @@ export interface AgreementsConfig {
24
24
  retention: {
25
25
  /** Years a completed agreement is kept, 1 to 30. */
26
26
  signed_years: number;
27
- /** Days an agreement that was never completed (declined, voided, expired) is kept after it ended, 1 to 3650. */
27
+ /** Days an agreement that was never completed (declined, voided, expired) is kept after it ended, 1 to 3650. Also how long an unused request link and a retired, unsigned document version are kept. */
28
28
  unsigned_days: number;
29
+ /** Open documents: days a signature's sensitive answers and uploaded files are kept after it stops being valid (after the event, or once its months run out), 0 to 365. Default 30. */
30
+ sensitive_days_after?: number;
29
31
  };
32
+ /** Open documents that last a number of months: days before a signature runs out to email the signer to sign again, 1 to 90, or 0 for no email. Default 14. */
33
+ renew_days_before?: number;
30
34
  /** The business's time zone, for the certificate's local times (an IANA name, from workbench/country.json). */
31
35
  time_zone: string;
32
36
  /** The default language of the signing page and emails. */
package/dist/config.js CHANGED
@@ -16,11 +16,12 @@ export const STARTER_AGREEMENTS = {
16
16
  methods: ["typed", "drawn"],
17
17
  record_device: true,
18
18
  reminders: { after_days: [3, 7] },
19
- retention: { signed_years: 7, unsigned_days: 90 },
19
+ retention: { signed_years: 7, unsigned_days: 90, sensitive_days_after: 30 },
20
+ renew_days_before: 14,
20
21
  time_zone: "Australia/Sydney",
21
22
  language: "en",
22
23
  };
23
- const KEYS = ["format", "path", "expires_after_days", "identity", "methods", "record_device", "reminders", "retention", "time_zone", "language"];
24
+ const KEYS = ["format", "path", "expires_after_days", "identity", "methods", "record_device", "reminders", "retention", "renew_days_before", "time_zone", "language"];
24
25
  const whole = (v, min, max) => typeof v === "number" && Number.isInteger(v) && v >= min && v <= max;
25
26
  function validZone(z) {
26
27
  try {
@@ -65,7 +66,14 @@ export function agreementsProblems(v, where = "workbench/agreements.json") {
65
66
  say("retention.signed_years", "must be a whole number of years from 1 to 30");
66
67
  if (!whole(ret.unsigned_days, 1, 3650))
67
68
  say("retention.unsigned_days", "must be a whole number of days from 1 to 3650");
69
+ for (const k of Object.keys(ret))
70
+ if (!["signed_years", "unsigned_days", "sensitive_days_after"].includes(k))
71
+ say(`retention.${k}`, "isn't a setting");
72
+ if (ret.sensitive_days_after !== undefined && !whole(ret.sensitive_days_after, 0, 365))
73
+ say("retention.sensitive_days_after", "must be a whole number of days from 0 to 365");
68
74
  }
75
+ if (c.renew_days_before !== undefined && !whole(c.renew_days_before, 0, 90))
76
+ say("renew_days_before", "must be a whole number of days from 0 to 90 (0 for no email)");
69
77
  if (typeof c.time_zone !== "string" || !validZone(c.time_zone))
70
78
  say("time_zone", "must be an IANA time zone such as Australia/Sydney or Asia/Manila");
71
79
  if (!AGREEMENT_LANGUAGES.includes(c.language))
@@ -0,0 +1,4 @@
1
+ export declare const documentsMigration: {
2
+ up: string;
3
+ down: string;
4
+ };