strom-research 1.36.0 → 1.37.0-beta.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.cs.md +42 -0
- package/CHANGELOG.de.md +50 -0
- package/CHANGELOG.md +45 -0
- package/CHANGELOG.pl.md +46 -0
- package/assets/lang/cs.json +40 -4
- package/assets/lang/de.json +40 -4
- package/assets/lang/pl.json +40 -4
- package/assets/strom-doc/cs/R12-where-the-agent-works.md +2 -2
- package/assets/strom-doc/de/R12-where-the-agent-works.md +2 -2
- package/assets/strom-doc/en/R12-where-the-agent-works.md +2 -2
- package/assets/strom-doc/pl/R12-where-the-agent-works.md +1 -1
- package/dist/brief/brief.js +43 -5
- package/dist/cli/menu-links.js +3 -2
- package/dist/cli/menu-waiting.js +3 -1
- package/dist/cli/ui.js +36 -4
- package/dist/commands/archives.js +11 -3
- package/dist/commands/browse.js +5 -1
- package/dist/commands/fixchecks.js +21 -1
- package/dist/commands/fixes.js +38 -6
- package/dist/commands/intake.js +10 -2
- package/dist/commands/links.js +5 -4
- package/dist/commands/media.js +14 -4
- package/dist/commands/people.js +2 -0
- package/dist/commands/session.js +54 -1
- package/dist/commands/setup.js +1 -1
- package/dist/commands/sync.js +113 -54
- package/dist/commands/tasks.js +2 -2
- package/dist/core/actions.js +4 -0
- package/dist/core/appmedia.js +207 -7
- package/dist/core/changelog.js +7 -0
- package/dist/core/contact.js +220 -0
- package/dist/core/contactfix.js +260 -0
- package/dist/core/floor.js +13 -3
- package/dist/core/import.js +53 -5
- package/dist/core/inboxwait.js +93 -18
- package/dist/core/links.js +8 -2
- package/dist/core/lists.js +117 -0
- package/dist/core/live.js +273 -39
- package/dist/core/machine.js +28 -0
- package/dist/core/material.js +14 -1
- package/dist/core/mediaqueue.js +1 -1
- package/dist/core/metrics.js +32 -1
- package/dist/core/originals.js +28 -9
- package/dist/core/overview.js +1 -0
- package/dist/core/ownsave.js +43 -0
- package/dist/core/phrases.js +4 -0
- package/dist/core/queue.js +1 -1
- package/dist/core/receive.js +9 -3
- package/dist/core/runstate.js +2 -1
- package/dist/core/session.js +16 -0
- package/dist/core/shaindex.js +31 -5
- package/dist/core/shortcut.js +2 -1
- package/dist/core/stromapp.js +2 -3
- package/dist/core/sync.js +242 -27
- package/dist/core/terms.js +44 -8
- package/dist/core/text.js +11 -0
- package/dist/core/tree.js +1 -1
- package/dist/core/validate.js +21 -0
- package/dist/core/waiting.js +2 -1
- package/dist/core/web.js +49 -7
- package/dist/core/webfull.js +105 -0
- package/dist/gedcom/export.js +8 -0
- package/dist/gedcom/validate.js +2 -1
- package/package.json +4 -1
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
// A person's contact (spec 134 U11): the e-mail addresses another program gives a person in its GEDCOM — a
|
|
2
|
+
// residence (RESI) carrying nothing but an e-mail (MyHeritage: "2 EMAIL x", or "2 ADDR" / "3 ADR1 Email" beside it;
|
|
3
|
+
// the Strom app up to 3.31: a residence whose note is "E-mail: x"), or "1 EMAIL" right under the person. One rule,
|
|
4
|
+
// used by strom intake, strom sync and the checks of a research alike: what is no residence is never taken as one,
|
|
5
|
+
// a label in place of an address is never a house, and nothing beyond an address the value is guessed.
|
|
6
|
+
import { LABELS } from "../gedcom/labels.js";
|
|
7
|
+
import { foldText } from "./text.js";
|
|
8
|
+
/** The tags of a contact the research does not keep. */
|
|
9
|
+
export const CONTACT_NOT_TAKEN = ["PHON", "FAX", "WWW"];
|
|
10
|
+
/** The parts of an address (GEDCOM 5.5.1 ADDRESS_STRUCTURE) under ADDR. */
|
|
11
|
+
const ADDRESS_PARTS = new Set(["ADR1", "ADR2", "ADR3", "CITY", "STAE", "POST", "CTRY"]);
|
|
12
|
+
/** Another program's own marks of an event that say nothing of it (its IDs, strom's status and origin). */
|
|
13
|
+
const MARK_ONLY = /^_(?:EID|STROM_EID|STROM_STATUS|STROM_ORIGIN|UID|RIN|UPD)$/u;
|
|
14
|
+
/** A label another program writes in place of an address (MyHeritage "3 ADR1 Email"), folded (as the app's ADDRESS_PART_LABEL). */
|
|
15
|
+
const ADDRESS_LABELS = new Set(["email", "e-mail", "e mail", "mail", "phone", "telephone", "telefon", "tel", "tel.", "fax", "www", "web"]);
|
|
16
|
+
/** A note line of the Strom app (up to 3.31) holding an e-mail: "E-mail: x" (cs, en, pl), "E-Mail: x" (de), "Email: x". */
|
|
17
|
+
const EMAIL_LINE = /^e-?mail\s*:\s*(\S+@\S+)$/iu;
|
|
18
|
+
/** The status words of strom's export (a lead's, a possible fact's) the app gives back in the note: no note of the user's. */
|
|
19
|
+
const STATUS_LINES = new Set(Object.values(LABELS).flatMap((l) => [l.lead, l.possible].map(line)));
|
|
20
|
+
function line(t) {
|
|
21
|
+
return t.normalize("NFC").replace(/\s+/gu, " ").trim();
|
|
22
|
+
}
|
|
23
|
+
/** An e-mail address as the research keeps it — trimmed, NFC, something@something with no space — or nothing. */
|
|
24
|
+
export function emailOf(raw) {
|
|
25
|
+
if (typeof raw !== "string")
|
|
26
|
+
return undefined;
|
|
27
|
+
const v = raw.normalize("NFC").trim();
|
|
28
|
+
return /^\S+@\S+$/u.test(v) ? v : undefined;
|
|
29
|
+
}
|
|
30
|
+
/** The e-mail addresses of both, each once (letter case aside), in their order: the first's first. */
|
|
31
|
+
export function joinEmails(a, b) {
|
|
32
|
+
const out = [];
|
|
33
|
+
const seen = new Set();
|
|
34
|
+
for (const x of [...(a ?? []), ...(b ?? [])]) {
|
|
35
|
+
const e = emailOf(x);
|
|
36
|
+
if (!e || seen.has(e.toLowerCase()))
|
|
37
|
+
continue;
|
|
38
|
+
seen.add(e.toLowerCase());
|
|
39
|
+
out.push(e);
|
|
40
|
+
}
|
|
41
|
+
return out;
|
|
42
|
+
}
|
|
43
|
+
/** Whether two lists hold the same addresses (letter case and order aside). */
|
|
44
|
+
export function sameEmails(a, b) {
|
|
45
|
+
const k = (l) => [...new Set((l ?? []).map((x) => x.toLowerCase()))].sort().join("\n");
|
|
46
|
+
return k(a) === k(b);
|
|
47
|
+
}
|
|
48
|
+
/** Whether an address field holds only a label another program writes in place of the address ("Email", "Telefon:"). */
|
|
49
|
+
export function addressLabel(s) {
|
|
50
|
+
if (!s)
|
|
51
|
+
return false;
|
|
52
|
+
return ADDRESS_LABELS.has(foldText(s).replace(/\s*:$/u, ""));
|
|
53
|
+
}
|
|
54
|
+
/** An address field's value unless it is empty or a label in place of the address. */
|
|
55
|
+
export function realAddress(s) {
|
|
56
|
+
const v = s?.trim();
|
|
57
|
+
return v && !addressLabel(v) ? v : undefined;
|
|
58
|
+
}
|
|
59
|
+
/** The address an ADDR gives — its first line (ADR1) or its own value — a label in place of one never. */
|
|
60
|
+
export function addressText(addr) {
|
|
61
|
+
if (!addr)
|
|
62
|
+
return undefined;
|
|
63
|
+
return realAddress(addr.children.find((c) => c.tag === "ADR1")?.value) ?? realAddress(addr.value);
|
|
64
|
+
}
|
|
65
|
+
/** The e-mail addresses of a note made of them alone (with at most a status word of strom's export), else nothing. */
|
|
66
|
+
export function noteEmails(text) {
|
|
67
|
+
const lines = (text ?? "").split(/\r\n|\r|\n/u).map(line).filter(Boolean);
|
|
68
|
+
const emails = [];
|
|
69
|
+
let status = 0;
|
|
70
|
+
for (const l of lines) {
|
|
71
|
+
const m = EMAIL_LINE.exec(l);
|
|
72
|
+
const e = m ? emailOf(m[1]) : undefined;
|
|
73
|
+
if (e)
|
|
74
|
+
emails.push(e);
|
|
75
|
+
else if (STATUS_LINES.has(l) && ++status === 1)
|
|
76
|
+
continue;
|
|
77
|
+
else
|
|
78
|
+
return undefined;
|
|
79
|
+
}
|
|
80
|
+
return emails.length ? joinEmails(emails, []) : undefined;
|
|
81
|
+
}
|
|
82
|
+
/** A note with a line "E-mail: x" in it (beside other text too). */
|
|
83
|
+
export function noteMentionsEmail(text) {
|
|
84
|
+
return (text ?? "").split(/\r\n|\r|\n/u).some((l) => EMAIL_LINE.test(line(l)));
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* A residence with nothing of a residence in it (spec 134 U11): no date, place, real house (a label "Email" is none),
|
|
88
|
+
* value, label, age, cause, people at it, share or role — its note nothing (or only e-mail lines, a status word beside
|
|
89
|
+
* them). What a contact of another program or of the Strom app left as a fact before strom took it for the contact:
|
|
90
|
+
* never a place someone lived, never a fact to fill in.
|
|
91
|
+
*/
|
|
92
|
+
export function contactOnlyEvent(e) {
|
|
93
|
+
if (e.kind !== "RESI")
|
|
94
|
+
return false;
|
|
95
|
+
if (e.date || e.place || e.value || e.label || e.age || e.cause || e.share || e.roleAt || e.confirmed)
|
|
96
|
+
return false;
|
|
97
|
+
if (e.ages && Object.keys(e.ages).length)
|
|
98
|
+
return false;
|
|
99
|
+
if (e.participants?.length)
|
|
100
|
+
return false;
|
|
101
|
+
if (e.house && !addressLabel(e.house))
|
|
102
|
+
return false;
|
|
103
|
+
return !e.note?.trim() || noteEmails(e.note) !== undefined;
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* What a residence (1 RESI of a person) gives of a contact. A residence with anything of a residence stays one: its
|
|
107
|
+
* EMAIL lines go to the contact (never into its note), the rest of it as it is. One with nothing but a contact is no
|
|
108
|
+
* event: its e-mails — EMAIL lines and the note lines "E-mail: x" — are the person's contact.
|
|
109
|
+
*/
|
|
110
|
+
export function residenceContact(resi, noteText = (n) => n.value) {
|
|
111
|
+
const emails = [];
|
|
112
|
+
const noted = [];
|
|
113
|
+
const notTaken = [];
|
|
114
|
+
let content = !!resi.value.trim() && resi.value.trim().toUpperCase() !== "Y";
|
|
115
|
+
let something = false;
|
|
116
|
+
const contactLine = (c) => {
|
|
117
|
+
if (c.tag === "EMAIL") {
|
|
118
|
+
const e = emailOf(c.value);
|
|
119
|
+
if (e)
|
|
120
|
+
emails.push(e);
|
|
121
|
+
else if (c.value.trim())
|
|
122
|
+
notTaken.push(c.tag);
|
|
123
|
+
something = true;
|
|
124
|
+
return true;
|
|
125
|
+
}
|
|
126
|
+
if (CONTACT_NOT_TAKEN.includes(c.tag)) {
|
|
127
|
+
if (c.value.trim())
|
|
128
|
+
notTaken.push(c.tag);
|
|
129
|
+
something = true;
|
|
130
|
+
return true;
|
|
131
|
+
}
|
|
132
|
+
return false;
|
|
133
|
+
};
|
|
134
|
+
for (const c of resi.children) {
|
|
135
|
+
if (contactLine(c) || MARK_ONLY.test(c.tag))
|
|
136
|
+
continue;
|
|
137
|
+
if (c.tag === "ADDR") {
|
|
138
|
+
if (realAddress(c.value))
|
|
139
|
+
content = true;
|
|
140
|
+
else if (c.value.trim())
|
|
141
|
+
something = true;
|
|
142
|
+
for (const a of c.children) {
|
|
143
|
+
if (contactLine(a))
|
|
144
|
+
continue;
|
|
145
|
+
if (ADDRESS_PARTS.has(a.tag) && !realAddress(a.value)) {
|
|
146
|
+
if (a.value.trim())
|
|
147
|
+
something = true;
|
|
148
|
+
continue;
|
|
149
|
+
}
|
|
150
|
+
content = true;
|
|
151
|
+
}
|
|
152
|
+
continue;
|
|
153
|
+
}
|
|
154
|
+
if (c.tag === "NOTE") {
|
|
155
|
+
const said = !c.children.length ? noteEmails(noteText(c)) : undefined;
|
|
156
|
+
if (!said)
|
|
157
|
+
content = true;
|
|
158
|
+
else {
|
|
159
|
+
noted.push(...said);
|
|
160
|
+
something = true;
|
|
161
|
+
}
|
|
162
|
+
continue;
|
|
163
|
+
}
|
|
164
|
+
content = true;
|
|
165
|
+
}
|
|
166
|
+
if (content)
|
|
167
|
+
return { emails: joinEmails(emails, []), onlyContact: false, notTaken };
|
|
168
|
+
return { emails: joinEmails(emails, noted), onlyContact: something, notTaken };
|
|
169
|
+
}
|
|
170
|
+
/** What a person (0 INDI) gives of a contact right under it: "1 EMAIL x" (PHON, FAX, WWW said, not taken). */
|
|
171
|
+
export function personContact(indi) {
|
|
172
|
+
const emails = [];
|
|
173
|
+
const notTaken = [];
|
|
174
|
+
for (const c of indi.children) {
|
|
175
|
+
if (c.tag === "EMAIL") {
|
|
176
|
+
const e = emailOf(c.value);
|
|
177
|
+
if (e)
|
|
178
|
+
emails.push(e);
|
|
179
|
+
else if (c.value.trim())
|
|
180
|
+
notTaken.push(c.tag);
|
|
181
|
+
}
|
|
182
|
+
else if (CONTACT_NOT_TAKEN.includes(c.tag) && c.value.trim())
|
|
183
|
+
notTaken.push(c.tag);
|
|
184
|
+
}
|
|
185
|
+
return { emails: joinEmails(emails, []), onlyContact: false, notTaken };
|
|
186
|
+
}
|
|
187
|
+
/** All a person of a GEDCOM gives of a contact: "1 EMAIL" and their residences' e-mails (those that are none and those that are). */
|
|
188
|
+
export function gedcomPersonContact(indi, noteText = (n) => n.value) {
|
|
189
|
+
const own = personContact(indi);
|
|
190
|
+
let emails = own.emails;
|
|
191
|
+
const notTaken = [...own.notTaken];
|
|
192
|
+
for (const c of indi.children) {
|
|
193
|
+
if (c.tag !== "RESI")
|
|
194
|
+
continue;
|
|
195
|
+
const r = residenceContact(c, noteText);
|
|
196
|
+
emails = joinEmails(emails, r.emails);
|
|
197
|
+
notTaken.push(...r.notTaken);
|
|
198
|
+
}
|
|
199
|
+
return { emails, onlyContact: false, notTaken };
|
|
200
|
+
}
|
|
201
|
+
/** The same rule for a residence of the Strom app's JSON: its note's "E-mail: x" lines and its gedcomEmails. */
|
|
202
|
+
export function appResidenceContact(e) {
|
|
203
|
+
const has = (v) => (typeof v === "string" ? !!v.trim() : Array.isArray(v) ? v.length > 0 : v !== undefined && v !== null && v !== false);
|
|
204
|
+
const given = Array.isArray(e.gedcomEmails) ? e.gedcomEmails.map((x) => emailOf(typeof x === "string" ? x : undefined)).filter((x) => !!x) : [];
|
|
205
|
+
const note = typeof e.note === "string" && e.note.trim() ? e.note : undefined;
|
|
206
|
+
const noted = note ? noteEmails(note) : [];
|
|
207
|
+
const content = has(e.date) || has(e.place) || !!realAddress(typeof e.address === "string" ? e.address : undefined) || has(e.cause) || has(e.age) ||
|
|
208
|
+
has(e.sourceIds) || has(e.participants) || has(e.shareId) || has(e.shareRole) || has(e.roleAt) || noted === undefined;
|
|
209
|
+
if (content)
|
|
210
|
+
return { emails: joinEmails(given, []), onlyContact: false, notTaken: [] };
|
|
211
|
+
const emails = joinEmails(given, noted);
|
|
212
|
+
return { emails, onlyContact: emails.length > 0 || addressLabel(typeof e.address === "string" ? e.address : undefined), notTaken: [] };
|
|
213
|
+
}
|
|
214
|
+
/** The person with these e-mails as their contact (none: no list, an empty contact left out). */
|
|
215
|
+
export function withEmails(p, emails) {
|
|
216
|
+
const { contact, ...rest } = p;
|
|
217
|
+
const { emails: _was, ...other } = contact ?? {};
|
|
218
|
+
const next = emails.length ? { ...other, emails: [...emails] } : other;
|
|
219
|
+
return Object.keys(next).length ? { ...rest, contact: next } : rest;
|
|
220
|
+
}
|
|
@@ -0,0 +1,260 @@
|
|
|
1
|
+
// strom fixes contact-residences (spec 134 U11): what a contact of another program or of the Strom app left as a
|
|
2
|
+
// residence before strom took it for the person's contact — set right by rules, on a person's word alone:
|
|
3
|
+
// (a) a residence of nothing but a note of e-mail lines ("E-mail: x", a status word beside them) — the Strom app's older
|
|
4
|
+
// form of an e-mail, taken in from its send or its file;
|
|
5
|
+
// (b) an empty residence an import of another program's GEDCOM made of "1 RESI / 2 EMAIL x" (the e-mail lost): its
|
|
6
|
+
// e-mail read again from the file kept in inputs/ (the person by the xref the import left: refs, originalIds) — an
|
|
7
|
+
// e-mail not found there, the residence stays and is not offered;
|
|
8
|
+
// (c) a residence whose house is the label of an address ("Email": MyHeritage's 2 ADDR / 3 ADR1 Email): the label is
|
|
9
|
+
// no house, taken off always; its e-mail read again as (b), the residence withdrawn where nothing of one is left.
|
|
10
|
+
// The e-mails join the person's contact (each once); the residence is withdrawn with the reason (never deleted). One
|
|
11
|
+
// with a record cited, a witness or a note of its own beside the e-mail is left and said why. Free, one operation,
|
|
12
|
+
// kept for its undo (CONTACT_RESIDENCES_FILE): the residences back, the label back, only the e-mails it added taken off.
|
|
13
|
+
import fs from "node:fs";
|
|
14
|
+
import path from "node:path";
|
|
15
|
+
import { decodeGedcom } from "../gedcom/encoding.js";
|
|
16
|
+
import { parseGedcomText } from "../gedcom/parse.js";
|
|
17
|
+
import { addressLabel, gedcomPersonContact, joinEmails, noteEmails, noteMentionsEmail, residenceContact } from "./contact.js";
|
|
18
|
+
import { inputPath } from "./media.js";
|
|
19
|
+
import { phrase } from "./phrases.js";
|
|
20
|
+
import { now } from "./tree.js";
|
|
21
|
+
/** The strom that sets them right. */
|
|
22
|
+
export const CONTACT_RESIDENCES_SINCE = "1.37.0";
|
|
23
|
+
/** Where the fix keeps what it changed, for its undo (sealed like the rest of quality/). */
|
|
24
|
+
export const CONTACT_RESIDENCES_FILE = "quality/contact-residences.json";
|
|
25
|
+
/** Anything of a residence in it, its house aside (a label "Email" is none, a real house is). */
|
|
26
|
+
function residenceContent(e) {
|
|
27
|
+
if (e.date || e.place || e.value || e.label || e.age || e.cause || e.share || e.roleAt || e.confirmed)
|
|
28
|
+
return true;
|
|
29
|
+
if (e.ages && Object.keys(e.ages).length)
|
|
30
|
+
return true;
|
|
31
|
+
return !!e.house && !addressLabel(e.house);
|
|
32
|
+
}
|
|
33
|
+
function readTreeFile(tree, source, input) {
|
|
34
|
+
if (input.kind !== "tree" || !/\.ged$/iu.test(input.name))
|
|
35
|
+
return undefined;
|
|
36
|
+
try {
|
|
37
|
+
const file = inputPath(tree, input);
|
|
38
|
+
if (!file || !fs.existsSync(file))
|
|
39
|
+
return undefined;
|
|
40
|
+
const { records } = parseGedcomText(decodeGedcom(fs.readFileSync(file)).text);
|
|
41
|
+
const notes = new Map(records.filter((r) => r.tag === "NOTE" && r.xref).map((r) => [r.xref, r.value]));
|
|
42
|
+
return {
|
|
43
|
+
...(input.sha ? { system: `gedcom:${input.sha.slice(0, 12)}` } : {}),
|
|
44
|
+
source: source.id,
|
|
45
|
+
people: new Map(records.filter((r) => r.tag === "INDI" && r.xref).map((r) => [r.xref, r])),
|
|
46
|
+
noteText: (n) => (/^@[^@]+@$/u.test(n.value.trim()) ? (notes.get(n.value.trim()) ?? "") : n.value),
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
catch {
|
|
50
|
+
return undefined;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
/** The residences of contacts left as they are and those to set right, each found once. */
|
|
54
|
+
export function contactResidenceFixes(tree) {
|
|
55
|
+
const fixes = [];
|
|
56
|
+
const left = [];
|
|
57
|
+
const sources = new Map(tree.list("source").map((s) => [s.id, s]));
|
|
58
|
+
const files = new Map();
|
|
59
|
+
const fileOf = (s) => {
|
|
60
|
+
if (!s.input)
|
|
61
|
+
return undefined;
|
|
62
|
+
if (!files.has(s.input)) {
|
|
63
|
+
const input = tree.get(s.input);
|
|
64
|
+
files.set(s.input, input && input.type === "input" ? readTreeFile(tree, s, input) : undefined);
|
|
65
|
+
}
|
|
66
|
+
return files.get(s.input);
|
|
67
|
+
};
|
|
68
|
+
// the sources of families trees taken in (an import, a send of the Strom app): no record of the research's
|
|
69
|
+
const ofTree = (id) => sources.get(id)?.kind === "family-tree";
|
|
70
|
+
for (const p of tree.list("person")) {
|
|
71
|
+
if (p.retracted || p.mergedInto)
|
|
72
|
+
continue;
|
|
73
|
+
// the person in a file of an import: by the xref the import left (refs: gedcom:<sha12>, originalIds: the source)
|
|
74
|
+
const fromFiles = (cited) => {
|
|
75
|
+
const tried = new Set();
|
|
76
|
+
const order = [...cited, ...[...sources.values()].filter((s) => s.kind === "family-tree" && s.input && !s.retracted).map((s) => s.id)];
|
|
77
|
+
for (const sid of order) {
|
|
78
|
+
const s = sources.get(sid);
|
|
79
|
+
if (!s?.input || tried.has(s.input))
|
|
80
|
+
continue;
|
|
81
|
+
tried.add(s.input);
|
|
82
|
+
const f = fileOf(s);
|
|
83
|
+
if (!f)
|
|
84
|
+
continue;
|
|
85
|
+
const xref = (f.system ? p.refs?.find((r) => r.system === f.system)?.id : undefined) ?? p.originalIds?.find((o) => o.source === s.id && o.xref)?.xref;
|
|
86
|
+
const indi = xref ? f.people.get(xref) : undefined;
|
|
87
|
+
if (!indi)
|
|
88
|
+
continue;
|
|
89
|
+
const emails = gedcomPersonContact(indi, f.noteText).emails;
|
|
90
|
+
const residences = indi.children.filter((c) => c.tag === "RESI" && residenceContact(c, f.noteText).onlyContact).length;
|
|
91
|
+
return { input: s.input, emails, residences };
|
|
92
|
+
}
|
|
93
|
+
return undefined;
|
|
94
|
+
};
|
|
95
|
+
let fromInput = null;
|
|
96
|
+
let taken = 0;
|
|
97
|
+
for (const e of p.events) {
|
|
98
|
+
if (e.kind !== "RESI" || e.retracted || e.status === "retracted")
|
|
99
|
+
continue;
|
|
100
|
+
const label = e.house && addressLabel(e.house) ? e.house : undefined;
|
|
101
|
+
const content = residenceContent(e);
|
|
102
|
+
// a residence of its own: only a label of an address in its house taken off
|
|
103
|
+
if (content) {
|
|
104
|
+
if (label)
|
|
105
|
+
fixes.push({ owner: p.id, event: e.id, how: "house", from: "none", emails: [], house: label });
|
|
106
|
+
continue;
|
|
107
|
+
}
|
|
108
|
+
const inNote = noteEmails(e.note);
|
|
109
|
+
const ownNote = !!e.note?.trim() && !inNote;
|
|
110
|
+
const why = e.participants?.length
|
|
111
|
+
? "witness"
|
|
112
|
+
: e.citations.some((c) => !ofTree(c.source))
|
|
113
|
+
? "record"
|
|
114
|
+
: ownNote && noteMentionsEmail(e.note)
|
|
115
|
+
? "note"
|
|
116
|
+
: undefined;
|
|
117
|
+
if (why) {
|
|
118
|
+
left.push({ owner: p.id, event: e.id, why, ...(inNote ? { emails: inNote } : {}) });
|
|
119
|
+
continue;
|
|
120
|
+
}
|
|
121
|
+
// a note of its own with no e-mail in it: something of a residence said, not a contact's
|
|
122
|
+
if (ownNote) {
|
|
123
|
+
if (label)
|
|
124
|
+
fixes.push({ owner: p.id, event: e.id, how: "house", from: "none", emails: [], house: label });
|
|
125
|
+
continue;
|
|
126
|
+
}
|
|
127
|
+
if (inNote) {
|
|
128
|
+
fixes.push({ owner: p.id, event: e.id, how: "retract", from: "note", emails: inNote, ...(label ? { house: label } : {}) });
|
|
129
|
+
continue;
|
|
130
|
+
}
|
|
131
|
+
// nothing in it: its e-mail from the file of the import, never more of them than the file has residences of a contact
|
|
132
|
+
if (fromInput === null)
|
|
133
|
+
fromInput = fromFiles(e.citations.map((c) => c.source).filter(ofTree));
|
|
134
|
+
if (fromInput && fromInput.emails.length && taken < Math.max(1, fromInput.residences)) {
|
|
135
|
+
taken++;
|
|
136
|
+
fixes.push({ owner: p.id, event: e.id, how: "retract", from: "input", input: fromInput.input, emails: fromInput.emails, ...(label ? { house: label } : {}) });
|
|
137
|
+
}
|
|
138
|
+
else if (label)
|
|
139
|
+
fixes.push({ owner: p.id, event: e.id, how: "house", from: "none", emails: [], house: label });
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
return { fixes, left };
|
|
143
|
+
}
|
|
144
|
+
function readContactFile(tree) {
|
|
145
|
+
try {
|
|
146
|
+
const f = JSON.parse(fs.readFileSync(path.join(tree.root, ...CONTACT_RESIDENCES_FILE.split("/")), "utf8"));
|
|
147
|
+
return { v: 1, runs: Array.isArray(f.runs) ? f.runs : [] };
|
|
148
|
+
}
|
|
149
|
+
catch {
|
|
150
|
+
return { v: 1, runs: [] };
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
const fileContent = (f) => JSON.stringify(f, null, 2) + "\n";
|
|
154
|
+
/** The fix: every residence found set right — one operation, what it changed kept for its undo. Inside withTreeLock. */
|
|
155
|
+
export function applyContactResidences(tree, items, version, config) {
|
|
156
|
+
const at = now();
|
|
157
|
+
const reason = phrase(tree.lang, "fix.contact.retracted");
|
|
158
|
+
const records = new Map();
|
|
159
|
+
const done = [];
|
|
160
|
+
const added = {};
|
|
161
|
+
let left = 0;
|
|
162
|
+
for (const it of items) {
|
|
163
|
+
const was = records.get(it.owner) ?? tree.get(it.owner);
|
|
164
|
+
if (!was || was.retracted) {
|
|
165
|
+
left++;
|
|
166
|
+
continue;
|
|
167
|
+
}
|
|
168
|
+
const p = records.get(it.owner) ?? structuredClone(was);
|
|
169
|
+
const e = p.events.find((x) => x.id === it.event);
|
|
170
|
+
// only as it was found: not withdrawn since, its label still its house
|
|
171
|
+
if (!e || e.retracted || e.status === "retracted" || (it.house !== undefined && e.house !== it.house)) {
|
|
172
|
+
left++;
|
|
173
|
+
continue;
|
|
174
|
+
}
|
|
175
|
+
if (it.house !== undefined)
|
|
176
|
+
delete e.house;
|
|
177
|
+
const item = { ...it };
|
|
178
|
+
if (it.how === "retract") {
|
|
179
|
+
item.status = e.status;
|
|
180
|
+
e.retracted = { at, reason };
|
|
181
|
+
e.status = "retracted";
|
|
182
|
+
}
|
|
183
|
+
if (it.emails.length) {
|
|
184
|
+
const before = p.contact?.emails ?? [];
|
|
185
|
+
const joined = joinEmails(before, it.emails);
|
|
186
|
+
const had = new Set(before.map((x) => x.toLowerCase()));
|
|
187
|
+
const fresh = joined.filter((x) => !had.has(x.toLowerCase()));
|
|
188
|
+
if (fresh.length) {
|
|
189
|
+
p.contact = { ...p.contact, emails: joined };
|
|
190
|
+
added[p.id] = [...(added[p.id] ?? []), ...fresh];
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
records.set(p.id, p);
|
|
194
|
+
done.push(item);
|
|
195
|
+
}
|
|
196
|
+
if (!done.length)
|
|
197
|
+
return { changed: 0, records: 0, left };
|
|
198
|
+
const file = readContactFile(tree);
|
|
199
|
+
file.runs.push({ at, version, items: done, added });
|
|
200
|
+
tree.putMany([...records.values()], [{ rel: CONTACT_RESIDENCES_FILE, content: fileContent(file) }], { op: "contact.fix", targets: [...records.keys()].sort(), summary: `contacts out of the residences: ${done.length} in ${records.size} records (fix contact-residences)`, reason }, config);
|
|
201
|
+
return { changed: done.length, records: records.size, left };
|
|
202
|
+
}
|
|
203
|
+
/** What the fix set right and is not undone yet. */
|
|
204
|
+
export function contactResidencesDone(tree) {
|
|
205
|
+
return readContactFile(tree).runs.flatMap((r) => r.items);
|
|
206
|
+
}
|
|
207
|
+
/**
|
|
208
|
+
* The fix undone: each residence back as it was (its status, its label) where still as the fix left it, and only the
|
|
209
|
+
* e-mails the fix added taken off the contact (those still there) — one changed since is left and counted. One
|
|
210
|
+
* operation; what the fix kept is emptied.
|
|
211
|
+
*/
|
|
212
|
+
export function undoContactResidences(tree, config) {
|
|
213
|
+
const file = readContactFile(tree);
|
|
214
|
+
if (!file.runs.length)
|
|
215
|
+
return { restored: 0, records: 0, left: 0 };
|
|
216
|
+
const records = new Map();
|
|
217
|
+
const person = (id) => {
|
|
218
|
+
if (records.has(id))
|
|
219
|
+
return records.get(id);
|
|
220
|
+
const was = tree.get(id);
|
|
221
|
+
return was && !was.retracted ? structuredClone(was) : undefined;
|
|
222
|
+
};
|
|
223
|
+
let restored = 0;
|
|
224
|
+
let left = 0;
|
|
225
|
+
for (const run of [...file.runs].reverse()) {
|
|
226
|
+
for (const it of [...run.items].reverse()) {
|
|
227
|
+
const p = person(it.owner);
|
|
228
|
+
const e = p?.events.find((x) => x.id === it.event);
|
|
229
|
+
const ok = !!e && (it.how === "retract" ? e.retracted?.at === run.at : !e.house) && (it.house === undefined || !e.house);
|
|
230
|
+
if (!p || !e || !ok) {
|
|
231
|
+
left++;
|
|
232
|
+
continue;
|
|
233
|
+
}
|
|
234
|
+
if (it.how === "retract") {
|
|
235
|
+
delete e.retracted;
|
|
236
|
+
e.status = it.status ?? "lead";
|
|
237
|
+
}
|
|
238
|
+
if (it.house !== undefined)
|
|
239
|
+
e.house = it.house;
|
|
240
|
+
records.set(p.id, p);
|
|
241
|
+
restored++;
|
|
242
|
+
}
|
|
243
|
+
for (const [id, emails] of Object.entries(run.added ?? {})) {
|
|
244
|
+
const p = person(id);
|
|
245
|
+
if (!p?.contact?.emails?.length)
|
|
246
|
+
continue;
|
|
247
|
+
const off = new Set(emails.map((x) => x.toLowerCase()));
|
|
248
|
+
const kept = p.contact.emails.filter((x) => !off.has(x.toLowerCase()));
|
|
249
|
+
if (kept.length === p.contact.emails.length)
|
|
250
|
+
continue;
|
|
251
|
+
if (kept.length)
|
|
252
|
+
p.contact = { ...p.contact, emails: kept };
|
|
253
|
+
else
|
|
254
|
+
delete p.contact;
|
|
255
|
+
records.set(p.id, p);
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
tree.putMany([...records.values()], [{ rel: CONTACT_RESIDENCES_FILE, content: fileContent({ v: 1, runs: [] }) }], { op: "contact.unfix", targets: [...records.keys()].sort(), summary: `residences of contacts put back as they were: ${restored} in ${records.size} records${left ? `, ${left} changed since left` : ""} (fix contact-residences undone)` }, config);
|
|
259
|
+
return { restored, records: records.size, left };
|
|
260
|
+
}
|
package/dist/core/floor.js
CHANGED
|
@@ -25,7 +25,7 @@ function holdsOf(a, c) {
|
|
|
25
25
|
if (c && (f === "connector" || f === "new connector" || f === "kept" || f === "pages"))
|
|
26
26
|
out.push({ by: "connector", name: c.name });
|
|
27
27
|
else if (f === "tree")
|
|
28
|
-
out.push({ by: "tree", ...(a.repository ? { repository: a.repository } : {}) });
|
|
28
|
+
out.push({ by: "tree", ...(a.repository ? { repository: a.repository } : {}), ...(a.repositoryName ? { name: a.repositoryName } : {}), ...(a.recordset ? { recordset: a.recordset.id, site: a.recordset.host } : {}) });
|
|
29
29
|
else if (f === "robots" || f === "refused")
|
|
30
30
|
out.push({ by: "host" });
|
|
31
31
|
}
|
|
@@ -93,7 +93,14 @@ export function floorQuestion(env, host, o = {}) {
|
|
|
93
93
|
}
|
|
94
94
|
/** What holds a floor, for the agent and in strom's own outputs (English): "connector example-archive", "the research's archive R0001". */
|
|
95
95
|
export function holdText(h) {
|
|
96
|
-
|
|
96
|
+
if (h.by === "tree") {
|
|
97
|
+
const id = h.repository ? ` ${h.repository}` : "";
|
|
98
|
+
const name = h.name ? ` (${h.name})` : "";
|
|
99
|
+
return h.recordset
|
|
100
|
+
? `the research's archive${id}${name} through its record set ${h.recordset} on ${h.site ?? "the site"} (strom recordset show ${h.recordset} · strom repo show${id})`
|
|
101
|
+
: `the research's archive${id}${name} (strom repo show${id})`;
|
|
102
|
+
}
|
|
103
|
+
return h.by === "connector" ? `connector ${h.name}` : h.by === "host" ? "the host's own refusal or robots.txt" : "the person's default settings folder";
|
|
97
104
|
}
|
|
98
105
|
/** Whose reading raised a floor, for the agent and strom's outputs (English). */
|
|
99
106
|
export function floorSource(n) {
|
|
@@ -112,7 +119,10 @@ export function floorLine(lang, n) {
|
|
|
112
119
|
export function floorWhat(lang, n) {
|
|
113
120
|
if (!n.holds.length)
|
|
114
121
|
return ui(lang, "ui.archive.floor.decide", { host: n.host, code: n.list });
|
|
115
|
-
const what = n.holds.map((h) => h.by === "connector" ? ui(lang, "ui.archive.floor.hold.connector", { name: h.name }) : h.by === "tree"
|
|
122
|
+
const what = n.holds.map((h) => h.by === "connector" ? ui(lang, "ui.archive.floor.hold.connector", { name: h.name }) : h.by === "tree"
|
|
123
|
+
? h.recordset
|
|
124
|
+
? ui(lang, "ui.archive.floor.hold.treeSet", { id: h.repository ?? "R…", name: h.name ?? h.repository ?? "R…", set: h.recordset, site: h.site ?? n.host })
|
|
125
|
+
: ui(lang, "ui.archive.floor.hold.tree", { id: h.repository ?? "R…" }) : h.by === "host" ? ui(lang, "ui.archive.floor.hold.host") : ui(lang, "ui.archive.floor.hold.other"));
|
|
116
126
|
return ui(lang, "ui.archive.floor.holds", { what: what.join(", ") });
|
|
117
127
|
}
|
|
118
128
|
/**
|
package/dist/core/import.js
CHANGED
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
import { eventKind, FAMILY_EVENT_KINDS, treeNoteText } from "./model.js";
|
|
9
9
|
import { normalizeAge } from "./age.js";
|
|
10
10
|
import { foldText } from "./text.js";
|
|
11
|
+
import { addressText, appResidenceContact, joinEmails, personContact, realAddress, residenceContact } from "./contact.js";
|
|
11
12
|
import { eventMarksOf, gedcomRole, participantRole, roleAtMark, roleWord, shareMark } from "./roles.js";
|
|
12
13
|
import { labels } from "../gedcom/labels.js";
|
|
13
14
|
import { phrase } from "./phrases.js";
|
|
@@ -346,14 +347,40 @@ export function importGedcom(tree, text, opts) {
|
|
|
346
347
|
const families = new Set(records.filter((x) => x.tag === "FAM" && x.xref).map((x) => x.xref));
|
|
347
348
|
const familyOf = new Map();
|
|
348
349
|
const atLater = [];
|
|
350
|
+
// a person's contact (spec 134 U11): the e-mails of residences that are none and of "1 EMAIL", by the person's xref;
|
|
351
|
+
// what of a contact the research does not keep (PHON, FAX, WWW) counted by tag
|
|
352
|
+
const contactOf = new Map();
|
|
353
|
+
const contactNotTaken = (tags) => {
|
|
354
|
+
if (!tags.length)
|
|
355
|
+
return;
|
|
356
|
+
const nt = (result.notTaken ??= { objects: 0, links: 0, tags: {} });
|
|
357
|
+
for (const t of tags)
|
|
358
|
+
(nt.contact ??= {})[t] = (nt.contact[t] ?? 0) + 1;
|
|
359
|
+
};
|
|
349
360
|
const events = (node, xref, forFamily, couple = {}) => {
|
|
350
361
|
const out = [];
|
|
362
|
+
if (!forFamily) {
|
|
363
|
+
const own = personContact(node);
|
|
364
|
+
contactNotTaken(own.notTaken);
|
|
365
|
+
if (own.emails.length)
|
|
366
|
+
contactOf.set(xref, joinEmails(contactOf.get(xref), own.emails));
|
|
367
|
+
}
|
|
351
368
|
for (const c of node.children) {
|
|
352
369
|
const kind = eventKind(c.tag);
|
|
353
370
|
if (!kind || ["NAME", "SEX"].includes(c.tag))
|
|
354
371
|
continue;
|
|
355
372
|
if (forFamily !== FAMILY_EVENT_KINDS.has(kind) && kind !== "EVEN" && kind !== "RESI" && kind !== "CENS")
|
|
356
373
|
continue;
|
|
374
|
+
// a residence of nothing but a contact is none: its e-mails the person's contact; a residence's EMAIL the
|
|
375
|
+
// contact too, never its note
|
|
376
|
+
if (!forFamily && c.tag === "RESI") {
|
|
377
|
+
const ct = residenceContact(c, noteText);
|
|
378
|
+
contactNotTaken(ct.notTaken);
|
|
379
|
+
if (ct.emails.length)
|
|
380
|
+
contactOf.set(xref, joinEmails(contactOf.get(xref), ct.emails));
|
|
381
|
+
if (ct.onlyContact)
|
|
382
|
+
continue;
|
|
383
|
+
}
|
|
357
384
|
const origin = originOf(c);
|
|
358
385
|
const ev = {
|
|
359
386
|
id: tree.allocate("E"),
|
|
@@ -375,7 +402,7 @@ export function importGedcom(tree, text, opts) {
|
|
|
375
402
|
// an address in the place (ADDR / ADR1) is the house; the age a person's fact's (a couple's: the partners')
|
|
376
403
|
const addr = c.children.find((x) => x.tag === "ADDR");
|
|
377
404
|
const rawAge = val(c, "AGE");
|
|
378
|
-
const { ageAsWritten, ...said } = factDetails(val(c, "CAUS"), forFamily ? undefined : rawAge,
|
|
405
|
+
const { ageAsWritten, ...said } = factDetails(val(c, "CAUS"), forFamily ? undefined : rawAge, addressText(addr));
|
|
379
406
|
Object.assign(ev, said);
|
|
380
407
|
if (ageAsWritten)
|
|
381
408
|
extra.push(`age as written: ${rawAge}`);
|
|
@@ -550,11 +577,14 @@ export function importGedcom(tree, text, opts) {
|
|
|
550
577
|
const names = namesOf(r).filter((n) => n.given !== "?" && !cur.names.some((x) => sameName(x, n)) && !isRetractedName(cur, n)).map(withoutMark);
|
|
551
578
|
// the IDs it has in this file: added (the same import and xref once), nothing taken off
|
|
552
579
|
const ids = joinIds(cur.originalIds, idEntries(r).entries);
|
|
553
|
-
|
|
580
|
+
// the contact the file gives: added to the person's (each address once), nothing taken off
|
|
581
|
+
const emails = joinEmails(cur.contact?.emails, contactOf.get(r.xref));
|
|
582
|
+
const contactAdded = emails.length - (cur.contact?.emails?.length ?? 0);
|
|
583
|
+
if (!facts.length && !names.length && !ids.changed && !contactAdded)
|
|
554
584
|
continue;
|
|
555
585
|
const refs = (cur.refs ?? []).some((x) => x.system === system && x.id === r.xref) ? cur.refs : [...(cur.refs ?? []), { system, id: r.xref }];
|
|
556
|
-
const next = { ...cur, names: [...cur.names, ...names], events: [...cur.events, ...facts], ...(refs ? { refs } : {}), ...(ids.changed ? { originalIds: ids.list } : {}), updated: now() };
|
|
557
|
-
const what = [...facts.map((e) => [e.kind, e.date].filter(Boolean).join(" ")), ...names.map((n) => `name ${[n.given, n.surname].filter(Boolean).join(" ")}`)].join(", ");
|
|
586
|
+
const next = { ...cur, names: [...cur.names, ...names], events: [...cur.events, ...facts], ...(refs ? { refs } : {}), ...(ids.changed ? { originalIds: ids.list } : {}), ...(contactAdded ? { contact: { ...cur.contact, emails } } : {}), updated: now() };
|
|
587
|
+
const what = [...facts.map((e) => [e.kind, e.date].filter(Boolean).join(" ")), ...names.map((n) => `name ${[n.given, n.surname].filter(Boolean).join(" ")}`), ...(contactAdded ? [`contact +${contactAdded} e-mail(s)`] : [])].join(", ");
|
|
558
588
|
const saved = save(next, { op: "person.import", targets: [cur.id], summary: `${cur.id} + ${what || "IDs of the file"}${what ? " (lead)" : ""}` }, bare(r.xref));
|
|
559
589
|
if (saved && what)
|
|
560
590
|
result.extended.push(`${cur.id}: ${what}`);
|
|
@@ -592,6 +622,7 @@ export function importGedcom(tree, text, opts) {
|
|
|
592
622
|
notes: personNotes.filter((x) => x.trim()).map((x) => note(tree, x)),
|
|
593
623
|
refs,
|
|
594
624
|
...(originalIds.length ? { originalIds } : {}),
|
|
625
|
+
...(contactOf.get(r.xref)?.length ? { contact: { emails: contactOf.get(r.xref) } } : {}),
|
|
595
626
|
created: t,
|
|
596
627
|
updated: t,
|
|
597
628
|
};
|
|
@@ -1047,9 +1078,21 @@ export function importStromJson(tree, data, opts) {
|
|
|
1047
1078
|
const made = [];
|
|
1048
1079
|
for (const [i, sp] of all.entries()) {
|
|
1049
1080
|
const ours = ourPeople[i];
|
|
1081
|
+
// the person's contact (spec 134 U11): the app's e-mails and its residences of nothing but one
|
|
1082
|
+
let emails = joinEmails(Array.isArray(sp.emails) ? sp.emails : [], []);
|
|
1083
|
+
const residences = (Array.isArray(sp.events) ? sp.events : []).filter((e) => e && typeof e === "object" && typeof e.type === "string" && appPersonEvent(e, lang)?.kind === "RESI");
|
|
1084
|
+
for (const e of residences)
|
|
1085
|
+
emails = joinEmails(emails, appResidenceContact(e).emails);
|
|
1050
1086
|
if (ours) {
|
|
1051
1087
|
idMap.set(sp.id, ours.id);
|
|
1052
1088
|
result.matched++;
|
|
1089
|
+
// one of ours: the contact the file gives added to theirs, nothing taken off
|
|
1090
|
+
const cur = tree.get(ours.id);
|
|
1091
|
+
const joined = cur ? joinEmails(cur.contact?.emails, emails) : [];
|
|
1092
|
+
if (cur && joined.length > (cur.contact?.emails?.length ?? 0)) {
|
|
1093
|
+
tree.put({ ...cur, contact: { ...cur.contact, emails: joined }, updated: now() }, { op: "person.import", targets: [cur.id], summary: `${cur.id} + contact +${joined.length - (cur.contact?.emails?.length ?? 0)} e-mail(s)` });
|
|
1094
|
+
result.extended.push(`${cur.id}: contact +${joined.length - (cur.contact?.emails?.length ?? 0)} e-mail(s)`);
|
|
1095
|
+
}
|
|
1053
1096
|
continue;
|
|
1054
1097
|
}
|
|
1055
1098
|
const events = [];
|
|
@@ -1072,6 +1115,9 @@ export function importStromJson(tree, data, opts) {
|
|
|
1072
1115
|
const value = VALUE_TAGS.has(what.kind) ? (e.note?.split("\n")[0] ?? "").replace(/\s+/gu, " ").trim() : "";
|
|
1073
1116
|
if ((what.kind === "EVEN" && !what.label) || (VALUE_TAGS.has(what.kind) && !value))
|
|
1074
1117
|
continue;
|
|
1118
|
+
// a residence of nothing but a contact is none (its e-mails the contact, above)
|
|
1119
|
+
if (what.kind === "RESI" && appResidenceContact(e).onlyContact)
|
|
1120
|
+
continue;
|
|
1075
1121
|
const ev = factOf(sp.id, what.kind, e, e.date, e.place);
|
|
1076
1122
|
if (what.label)
|
|
1077
1123
|
ev.label = what.label;
|
|
@@ -1114,6 +1160,7 @@ export function importStromJson(tree, data, opts) {
|
|
|
1114
1160
|
events,
|
|
1115
1161
|
notes: sp.notes?.trim() ? [note(tree, sp.notes)] : [],
|
|
1116
1162
|
refs: [{ system: "strom-app", id: sp.id }, ...(sp.refn ? [{ system: "refn", id: sp.refn }] : [])],
|
|
1163
|
+
...(emails.length ? { contact: { emails } } : {}),
|
|
1117
1164
|
created: t,
|
|
1118
1165
|
updated: t,
|
|
1119
1166
|
};
|
|
@@ -1321,7 +1368,8 @@ export function factDetails(cause, age, address) {
|
|
|
1321
1368
|
out.age = a;
|
|
1322
1369
|
else if (raw)
|
|
1323
1370
|
out.ageAsWritten = raw;
|
|
1324
|
-
|
|
1371
|
+
// a label another program writes in place of the address ("Email") is no house (spec 134 U11)
|
|
1372
|
+
const h = realAddress(address) ? houseOf(address) : "";
|
|
1325
1373
|
if (h)
|
|
1326
1374
|
out.house = h;
|
|
1327
1375
|
return out;
|