strom-research 1.34.0-beta.3 → 1.34.0-beta.4
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 +4 -3
- package/CHANGELOG.de.md +3 -3
- package/CHANGELOG.md +3 -2
- package/CHANGELOG.pl.md +4 -3
- package/assets/lang/cs.json +1 -0
- package/assets/lang/de.json +1 -0
- package/assets/lang/pl.json +1 -0
- package/dist/cli/main.js +10 -0
- package/dist/cli/ui.js +1 -0
- package/dist/core/backup.js +32 -0
- package/dist/core/live.js +10 -0
- package/dist/core/notefix.js +285 -0
- package/dist/core/stromapp.js +18 -0
- package/dist/core/sync.js +22 -10
- package/dist/core/tree.js +1 -1
- package/package.json +1 -1
package/CHANGELOG.cs.md
CHANGED
|
@@ -7,7 +7,7 @@ Změny každé verze ve zkratce. Úplné poznámky a instalační řádky jsou n
|
|
|
7
7
|
|
|
8
8
|
## 1.34.0
|
|
9
9
|
|
|
10
|
-
*Připravuje se: bety do 1.34.0-beta.
|
|
10
|
+
*Připravuje se: bety do 1.34.0-beta.4. Oddíl bude úplný s vydáním.*
|
|
11
11
|
|
|
12
12
|
- **Hlavní citace a jedno pořadí citací:** citace každého údaje jdou v každém souboru v jednom pořadí – nejdřív hlavní
|
|
13
13
|
citace, pak záznam samotné události, další originály a zbytek podle toho, jak jsou jisté. Hlavní citaci volí jen
|
|
@@ -19,8 +19,9 @@ Změny každé verze ve zkratce. Úplné poznámky a instalační řádky jsou n
|
|
|
19
19
|
- **Samostatná práce s podmínkou:** když limit plánu agenta přeruší sezení, práce počká do obnovy limitu (v terminálu
|
|
20
20
|
i v aplikaci Strom jako pauza), pak se znovu zeptá podmínky a pokračuje; přerušený úkol se vrátí do fronty. Hlášení
|
|
21
21
|
agenta, že limit došel, se čte jako limit plánu i s časem obnovy.
|
|
22
|
-
- **Poznámky z aplikace Strom:** úpravy poznámky údaje a poznámky účastníka od uživatele se vracejí do výzkumu,
|
|
23
|
-
text zůstane v historii poznámky;
|
|
22
|
+
- **Poznámky z aplikace Strom:** úpravy poznámky údaje a poznámky účastníka od uživatele se vracejí do výzkumu, každá
|
|
23
|
+
ke svému údaji, dřívější text zůstane v historii poznámky; poznámka účastníka jen od aplikace, která ji posílá celou;
|
|
24
|
+
odebraná poznámka nic neodebere. Vlastní událost kmotra nebo svědka z GEDCOM
|
|
24
25
|
aplikace se pojmenuje v jazyce výzkumu.
|
|
25
26
|
Vlastní druhé narození nebo úmrtí aplikace a její zápis narození či úmrtí se poznají i v polštině a nehlásí se jako
|
|
26
27
|
nepřevzaté.
|
package/CHANGELOG.de.md
CHANGED
|
@@ -7,7 +7,7 @@ Die Änderungen jeder Version in Kürze. Die vollständigen Hinweise und die Ins
|
|
|
7
7
|
|
|
8
8
|
## 1.34.0
|
|
9
9
|
|
|
10
|
-
*In Vorbereitung: die Betas bis 1.34.0-beta.
|
|
10
|
+
*In Vorbereitung: die Betas bis 1.34.0-beta.4. Der Abschnitt ist mit dem Release vollständig.*
|
|
11
11
|
|
|
12
12
|
- **Das Hauptzitat und eine Reihenfolge der Zitate:** Die Zitate jeder Angabe stehen in jeder Datei in einer
|
|
13
13
|
Reihenfolge – zuerst das Hauptzitat, dann der Eintrag des Ereignisses selbst, die weiteren Originale und der Rest
|
|
@@ -23,8 +23,8 @@ Die Änderungen jeder Version in Kürze. Die vollständigen Hinweise und die Ins
|
|
|
23
23
|
weiter; die unterbrochene Aufgabe kommt zurück in die Warteschlange. Die Meldung eines Agenten, dass sein Limit erreicht
|
|
24
24
|
ist, gilt als Limit des Plans samt seiner Zeit.
|
|
25
25
|
- **Notizen aus der Strom-App:** Die Änderungen des Benutzers an der Notiz einer Angabe und an der Notiz eines
|
|
26
|
-
Beteiligten kommen in die Forschung zurück, der frühere Text bleibt in der Geschichte der
|
|
27
|
-
entfernt nichts. Das eigene Ereignis eines Paten oder Zeugen im GEDCOM der App wird in der Sprache der Forschung
|
|
26
|
+
Beteiligten kommen in die Forschung zurück, jede zu ihrer eigenen Angabe, der frühere Text bleibt in der Geschichte der
|
|
27
|
+
Notiz; die Notiz eines Beteiligten nur von einer App, die sie ganz sendet; eine entfernte Notiz entfernt nichts. Das eigene Ereignis eines Paten oder Zeugen im GEDCOM der App wird in der Sprache der Forschung
|
|
28
28
|
benannt. Die eigene zweite Geburt oder der zweite Tod der App und ihr Eintrag einer Geburt oder eines Todes werden
|
|
29
29
|
auch auf Polnisch erkannt und nie als nicht übernommen gemeldet.
|
|
30
30
|
- **Ein Zuhause, in dem schon eine Forschung liegt:** `strom setup --home <Ordner> --use-existing` (und die Einrichtung
|
package/CHANGELOG.md
CHANGED
|
@@ -7,7 +7,7 @@ The changes of each version in short. The full notes and the install lines are o
|
|
|
7
7
|
|
|
8
8
|
## 1.34.0
|
|
9
9
|
|
|
10
|
-
*In preparation: the betas up to 1.34.0-beta.
|
|
10
|
+
*In preparation: the betas up to 1.34.0-beta.4. The section is complete with the release.*
|
|
11
11
|
|
|
12
12
|
- **The main citation and one order of citations:** every fact's citations come in one order in every file — the
|
|
13
13
|
main citation first, then the record of the event itself, the other originals, the rest by how sure they are. The
|
|
@@ -20,7 +20,8 @@ The changes of each version in short. The full notes and the install lines are o
|
|
|
20
20
|
resets (shown as paused in the terminal and the Strom app), then asks the condition again and goes on — the
|
|
21
21
|
interrupted task back in the queue. An agent's notice that its limit was hit is read as the plan's limit, with its time.
|
|
22
22
|
- **Notes from the Strom app:** the user's edits of a fact's note and of a participant's note come back into the
|
|
23
|
-
research, the earlier text kept in the note's history; a note
|
|
23
|
+
research, each to its own fact, the earlier text kept in the note's history; a participant's note only from an app
|
|
24
|
+
that sends it whole; a note taken away takes nothing away. A godparent's or a
|
|
24
25
|
witness's own event in the app's GEDCOM is named in the research's language.
|
|
25
26
|
The app's own second birth or death and its entry of a birth or a death are known in Polish too, never reported as
|
|
26
27
|
not taken over.
|
package/CHANGELOG.pl.md
CHANGED
|
@@ -7,7 +7,7 @@ Zmiany każdej wersji w skrócie. Pełne informacje o wydaniach i polecenia inst
|
|
|
7
7
|
|
|
8
8
|
## 1.34.0
|
|
9
9
|
|
|
10
|
-
*W przygotowaniu: bety do 1.34.0-beta.
|
|
10
|
+
*W przygotowaniu: bety do 1.34.0-beta.4. Sekcja będzie kompletna z wydaniem.*
|
|
11
11
|
|
|
12
12
|
- **Główny przypis i jedna kolejność przypisów:** przypisy każdej danej idą w każdym pliku w jednej kolejności – najpierw
|
|
13
13
|
główny przypis, potem zapis samego zdarzenia, inne oryginały, a reszta według tego, jak są pewne. Główny przypis
|
|
@@ -20,8 +20,9 @@ Zmiany każdej wersji w skrócie. Pełne informacje o wydaniach i polecenia inst
|
|
|
20
20
|
- **Samodzielna praca z warunkiem:** gdy limit planu agenta przerwie sesję, praca czeka do odnowienia limitu (w
|
|
21
21
|
terminalu i w aplikacji Strom jako pauza), potem ponownie pyta warunek i idzie dalej; przerwane zadanie wraca do
|
|
22
22
|
kolejki. Komunikat agenta o wyczerpaniu limitu jest odczytywany jako limit planu razem z czasem odnowienia.
|
|
23
|
-
- **Notatki z aplikacji Strom:** zmiany użytkownika w notatce danej i w notatce uczestnika wracają do badania,
|
|
24
|
-
tekst zostaje w historii notatki;
|
|
23
|
+
- **Notatki z aplikacji Strom:** zmiany użytkownika w notatce danej i w notatce uczestnika wracają do badania, każda do
|
|
24
|
+
swojej danej, wcześniejszy tekst zostaje w historii notatki; notatka uczestnika tylko z aplikacji, która wysyła ją w
|
|
25
|
+
całości; usunięta notatka niczego nie usuwa. Własne zdarzenie chrzestnego lub świadka w
|
|
25
26
|
GEDCOM aplikacji jest nazwane w języku badania. Własne drugie urodzenie lub zgon aplikacji i jej akt urodzenia lub
|
|
26
27
|
zgonu są rozpoznawane także po polsku i nigdy nie są zgłaszane jako nieprzejęte.
|
|
27
28
|
- **Folder domowy, w którym badanie już jest:** `strom setup --home <folder> --use-existing` (i konfiguracja po
|
package/assets/lang/cs.json
CHANGED
|
@@ -1179,6 +1179,7 @@
|
|
|
1179
1179
|
"ui.backup.what.pack": "Jeden rodokmen v jednom souboru ZIP, k poslání nebo uložení: {strom} pack (v menu: {menu}).",
|
|
1180
1180
|
"ui.backup.what.nohome": "Složka výzkumů zatím není: zvolí ji {strom} setup.",
|
|
1181
1181
|
"ui.backup.last": "Poslední záloha (před přechodem z {from} na {to}, {date}): {path}",
|
|
1182
|
+
"ui.backup.readme.notes": "Strom výzkum – záloha\n\nVytvořena {date} stromem {to}, než sám opravil poznámky, které odeslání z aplikace Strom před stromem {since} zapsalo k jinému údaji téhož dne a pramene.\n\nUvnitř:\n- trees: rodokmen {tree}, celá jeho složka i s historií (.git);\n- settings: nastavení stromu s klíči pečetí a přihlášeními, jak byly na tomto počítači.\n\nVynecháno: co strom vytvoří znovu sám (náhledy skenů, výřezy, mezipaměť).\n\nVrácení rodokmenu: zkopírovat jeho složku z trees zpět tam, kde rodokmeny jsou (místo té, která tam je, nebo vedle ní pod jiným jménem), a spustit {strom}: strom ho zkontroluje ({strom} check).",
|
|
1182
1183
|
"ui.backup.readme": "Strom výzkum – záloha\n\nVytvořena {date}, před přechodem ze stromu {from} na {to}.\n\nUvnitř:\n- trees: všechny rodokmeny tohoto počítače, každý celou svou složkou i s historií (.git);\n- shared: sdílená složka – konektory a nástroje, co čeká na uložení, a sdílené obrázky (shared/media): {media}\n- settings: nastavení stromu s klíči pečetí a přihlášeními, jak byly na tomto počítači.\n\nVynecháno: co strom vytvoří znovu sám (náhledy skenů, výřezy, mezipaměť).\n\nVrácení rodokmenu: zkopírovat jeho složku z trees zpět tam, kde rodokmeny jsou (místo té, která tam je, nebo vedle ní pod jiným jménem), a spustit {strom}: strom ho zkontroluje ({strom} check).",
|
|
1183
1184
|
"ui.backup.media.linked": "{n, plural, one {# obrázek} few {# obrázky} other {# obrázků}} ({size}), propojené: tytéž soubory jako ve shared/media, místo nezabírají dvakrát a zůstanou tu, ať se se sdílenou složkou stane cokoli; kopie této zálohy na jiný disk je vezme celé;",
|
|
1184
1185
|
"ui.backup.media.copied": "{n, plural, one {# obrázek} few {# obrázky} other {# obrázků}} ({size}), zkopírované;",
|
package/assets/lang/de.json
CHANGED
|
@@ -1179,6 +1179,7 @@
|
|
|
1179
1179
|
"ui.backup.what.pack": "Ein Stammbaum in einer ZIP-Datei, zum Versenden oder Aufbewahren: {strom} pack (im Menü: {menu}).",
|
|
1180
1180
|
"ui.backup.what.nohome": "Noch kein Forschungsordner: {strom} setup wählt einen.",
|
|
1181
1181
|
"ui.backup.last": "Letzte Sicherung (vor dem Wechsel von {from} auf {to}, {date}): {path}",
|
|
1182
|
+
"ui.backup.readme.notes": "Strom-Forschung – eine Sicherung\n\nErstellt {date} von strom {to}, bevor es von selbst die Notizen richtigstellte, die eine Sendung der Strom-App vor strom {since} zu einer anderen Angabe desselben Tages und derselben Quelle geschrieben hatte.\n\nDarin:\n- trees: der Stammbaum {tree}, sein ganzer Ordner samt Verlauf (.git);\n- settings: die Einstellungen von strom mit den Siegelschlüsseln und den Anmeldungen, wie sie auf diesem Computer waren.\n\nWeggelassen: was strom selbst wieder erstellt (Ansichten von Scans, Ausschnitte, sein Zwischenspeicher).\n\nEinen Stammbaum zurückholen: seinen Ordner aus trees dorthin zurückkopieren, wo die Stammbäume liegen (anstelle des vorhandenen oder daneben unter anderem Namen), dann {strom} starten: strom prüft ihn ({strom} check).",
|
|
1182
1183
|
"ui.backup.readme": "Strom-Forschung – eine Sicherung\n\nErstellt {date}, vor dem Wechsel von strom {from} auf {to}.\n\nDarin:\n- trees: alle Stammbäume dieses Computers, jeder mit seinem ganzen Ordner samt Verlauf (.git);\n- shared: der gemeinsame Ordner – die Konnektoren und Werkzeuge, was auf das Speichern wartet, und die gemeinsamen Bilder (shared/media): {media}\n- settings: die Einstellungen von strom mit den Siegelschlüsseln und den Anmeldungen, wie sie auf diesem Computer waren.\n\nWeggelassen: was strom selbst wieder erstellt (Ansichten von Scans, Ausschnitte, sein Zwischenspeicher).\n\nEinen Stammbaum zurückholen: seinen Ordner aus trees dorthin zurückkopieren, wo die Stammbäume liegen (anstelle des vorhandenen oder daneben unter anderem Namen), dann {strom} starten: strom prüft ihn ({strom} check).",
|
|
1183
1184
|
"ui.backup.media.linked": "{n, plural, one {# Bild} other {# Bilder}} ({size}), verknüpft: dieselben Dateien wie in shared/media, sie belegen keinen Platz doppelt und bleiben hier, was auch mit dem gemeinsamen Ordner geschieht; eine Kopie dieser Sicherung auf eine andere Platte nimmt sie ganz mit;",
|
|
1184
1185
|
"ui.backup.media.copied": "{n, plural, one {# Bild} other {# Bilder}} ({size}), kopiert;",
|
package/assets/lang/pl.json
CHANGED
|
@@ -1179,6 +1179,7 @@
|
|
|
1179
1179
|
"ui.backup.what.pack": "Jedno drzewo w jednym pliku ZIP, do wysłania lub przechowania: {strom} pack (w menu: {menu}).",
|
|
1180
1180
|
"ui.backup.what.nohome": "Folderu badań jeszcze nie ma: wybierze go {strom} setup.",
|
|
1181
1181
|
"ui.backup.last": "Ostatnia kopia zapasowa (przed przejściem z {from} na {to}, {date}): {path}",
|
|
1182
|
+
"ui.backup.readme.notes": "Badania Strom – kopia zapasowa\n\nUtworzona {date} przez program strom {to}, zanim sam poprawił notatki, które wysyłka z aplikacji Strom przed programem strom {since} zapisała przy innym fakcie z tego samego dnia i źródła.\n\nWewnątrz:\n- trees: drzewo {tree}, cały jego folder wraz z historią (.git);\n- settings: ustawienia programu strom z kluczami pieczęci i danymi logowania, takie, jakie były na tym komputerze.\n\nPominięto: to, co strom utworzy ponownie sam (widoki skanów, wycinki, pamięć podręczna).\n\nPrzywrócenie drzewa: skopiować jego folder z trees z powrotem tam, gdzie są drzewa (zamiast tego, który tam jest, albo obok niego pod inną nazwą), i uruchomić {strom}: strom je sprawdzi ({strom} check).",
|
|
1182
1183
|
"ui.backup.readme": "Badania Strom – kopia zapasowa\n\nUtworzona {date}, przed przejściem z programu strom {from} na {to}.\n\nWewnątrz:\n- trees: wszystkie drzewa tego komputera, każde całym swoim folderem wraz z historią (.git);\n- shared: folder wspólny – konektory i narzędzia, to, co czeka na zapisanie, oraz wspólne obrazy (shared/media): {media}\n- settings: ustawienia programu strom z kluczami pieczęci i danymi logowania, takie, jakie były na tym komputerze.\n\nPominięto: to, co strom utworzy ponownie sam (widoki skanów, wycinki, pamięć podręczna).\n\nPrzywrócenie drzewa: skopiować jego folder z trees z powrotem tam, gdzie są drzewa (zamiast tego, który tam jest, albo obok niego pod inną nazwą), i uruchomić {strom}: strom je sprawdzi ({strom} check).",
|
|
1183
1184
|
"ui.backup.media.linked": "{n, plural, one {# obraz} few {# obrazy} many {# obrazów} other {# obrazów}} ({size}), połączone: te same pliki co w shared/media, nie zajmują miejsca dwa razy i zostaną tu bez względu na to, co stanie się z folderem wspólnym; kopia tej kopii zapasowej na inny dysk weźmie je w całości;",
|
|
1184
1185
|
"ui.backup.media.copied": "{n, plural, one {# obraz} few {# obrazy} many {# obrazów} other {# obrazów}} ({size}), skopiowane;",
|
package/dist/cli/main.js
CHANGED
|
@@ -26,6 +26,7 @@ import { settleReaders } from "../core/readerfix.js";
|
|
|
26
26
|
import { settleProven } from "../core/provenfix.js";
|
|
27
27
|
import { settleHeldProposals, settleOrigins } from "../core/originfix.js";
|
|
28
28
|
import { settleClips } from "../core/clipmerge.js";
|
|
29
|
+
import { settleNotes } from "../core/notefix.js";
|
|
29
30
|
import { liveRunning, reviveLive, startLive } from "../core/live.js";
|
|
30
31
|
import { revivePhone } from "../core/phone.js";
|
|
31
32
|
import { fireHooks, HOOK_INTERFACE } from "../core/hooks.js";
|
|
@@ -516,6 +517,15 @@ async function mainOf(argv, io, env, cwd) {
|
|
|
516
517
|
catch {
|
|
517
518
|
// another computer's seal, a tree at work: its bridge's start joins them
|
|
518
519
|
}
|
|
520
|
+
// …and the notes a send of the Strom app wrote to a fact alike (before 1.34.0): set right once (one commit)
|
|
521
|
+
try {
|
|
522
|
+
const done = settleNotes(Tree.open(k.root, env), last ? { from: last } : {});
|
|
523
|
+
if (done?.backup)
|
|
524
|
+
io.stderr(`${backupSaid(ctx, done.backup)}\n`);
|
|
525
|
+
}
|
|
526
|
+
catch {
|
|
527
|
+
// another computer's seal, a tree at work: its bridge's start sets them right
|
|
528
|
+
}
|
|
519
529
|
// …and the strom its agents' hooks and conversations start (.strom/bin) leads to this one — an older strom's, or one
|
|
520
530
|
// whose mark went with the program folder an update replaced; only where a research has one, never an archive
|
|
521
531
|
refreshTreeShim(k.root, env);
|
package/dist/cli/ui.js
CHANGED
|
@@ -931,6 +931,7 @@ export const UI = {
|
|
|
931
931
|
"ui.backup.what.pack": "One family tree in one ZIP file, to send or keep: {strom} pack (in the menu: {menu}).",
|
|
932
932
|
"ui.backup.what.nohome": "No research folder yet: {strom} setup chooses one.",
|
|
933
933
|
"ui.backup.last": "The last backup (before going from {from} to {to}, {date}): {path}",
|
|
934
|
+
"ui.backup.readme.notes": "Strom research – a backup\n\nMade {date} by strom {to}, before it set right by itself the notes a send of the Strom app wrote before strom {since} to another fact of the same day and source.\n\nInside:\n- trees: the family tree {tree}, its whole folder with its history (.git);\n- settings: strom's settings with the seal keys and the logins, as they were on this computer.\n\nLeft out: what strom makes again by itself (views of scans, excerpts, its cache).\n\nTo bring the family tree back: copy its folder from trees back to where the family trees are (in place of the one there, or beside it under another name), then run {strom}: strom checks it ({strom} check).",
|
|
934
935
|
"ui.backup.readme": "Strom research – a backup\n\nMade {date}, before going from strom {from} to {to}.\n\nInside:\n- trees: every family tree of this computer, each its whole folder with its history (.git);\n- shared: the shared folder – the connectors and tools, what waits to be saved, and the shared images (shared/media): {media}\n- settings: strom's settings with the seal keys and the logins, as they were on this computer.\n\nLeft out: what strom makes again by itself (views of scans, excerpts, its cache).\n\nTo bring a family tree back: copy its folder from trees back to where the family trees are (in place of the one there, or beside it under another name), then run {strom}: strom checks it ({strom} check).",
|
|
935
936
|
"ui.backup.media.linked": "{n, plural, one {# image} other {# images}} ({size}), linked: the same files as in shared/media, taking no room twice and staying here whatever happens to the shared folder; a copy of this backup onto another disk takes them whole;",
|
|
936
937
|
"ui.backup.media.copied": "{n, plural, one {# image} other {# images}} ({size}), copied;",
|
package/dist/core/backup.js
CHANGED
|
@@ -387,3 +387,35 @@ export function backupOnce(opts) {
|
|
|
387
387
|
release();
|
|
388
388
|
}
|
|
389
389
|
}
|
|
390
|
+
/** Whether a backup holds the research of this ID (its strom.json under trees/, whatever its folder's name there). */
|
|
391
|
+
function holdsTree(b, id) {
|
|
392
|
+
const trees = path.join(b.path, "trees");
|
|
393
|
+
try {
|
|
394
|
+
return fs.readdirSync(trees).some((name) => readJsonIfExists(path.join(trees, name, "strom.json"))?.id === id);
|
|
395
|
+
}
|
|
396
|
+
catch {
|
|
397
|
+
return false;
|
|
398
|
+
}
|
|
399
|
+
}
|
|
400
|
+
/**
|
|
401
|
+
* The backup of one research before this strom writes on it by itself what a version before wrote wrong (core/notefix.ts:
|
|
402
|
+
* a fix, once) — the same backup a change of channel makes, of this research and the settings alone: under the lock of
|
|
403
|
+
* the settings, none made when a backup of the last day for this version holds the research already (the change of
|
|
404
|
+
* channel's, made a moment ago, or this fix's at a start before). Returns the one made now, else undefined; throws
|
|
405
|
+
* BackupFailed when it cannot (nothing to be written then).
|
|
406
|
+
*/
|
|
407
|
+
export function backupTreeOnce(opts) {
|
|
408
|
+
const release = acquireLock(path.join(configDir(opts.env), "backup.lock"), { owner: "strom backup", waitMs: 30 * 60_000, staleMs: 6 * 3600_000 });
|
|
409
|
+
try {
|
|
410
|
+
const before = backupsMade(opts.env);
|
|
411
|
+
const now = opts.now ?? Date.now();
|
|
412
|
+
if (before.some((b) => b.to === opts.transition.to && now - Date.parse(b.at) <= SAME_TRIP_MS && holdsTree(b, opts.id)))
|
|
413
|
+
return undefined;
|
|
414
|
+
const made = makeBackup({ home: opts.home, env: opts.env, trees: [opts.root], transition: opts.transition, readme: opts.readme, research: [path.dirname(opts.root), ...(opts.research ?? [])] });
|
|
415
|
+
opts.record(made, before.slice(-(KEPT - 1)));
|
|
416
|
+
return made;
|
|
417
|
+
}
|
|
418
|
+
finally {
|
|
419
|
+
release();
|
|
420
|
+
}
|
|
421
|
+
}
|
package/dist/core/live.js
CHANGED
|
@@ -511,6 +511,7 @@ import { settleReaders } from "./readerfix.js";
|
|
|
511
511
|
import { settleProven } from "./provenfix.js";
|
|
512
512
|
import { settleHeldProposals, settleOrigins } from "./originfix.js";
|
|
513
513
|
import { settleClips } from "./clipmerge.js";
|
|
514
|
+
import { settleNotes } from "./notefix.js";
|
|
514
515
|
import { PROFILES } from "../agents/profiles.js";
|
|
515
516
|
import { ui } from "../cli/ui.js";
|
|
516
517
|
import { DISK_FULL, EXIT, isDiskFull, StromError } from "./errors.js";
|
|
@@ -2742,6 +2743,15 @@ export function serveLive(root, env) {
|
|
|
2742
2743
|
catch (e) {
|
|
2743
2744
|
noteLive(root, `the overlapping clips of one image not joined now: ${errorText(e)}`);
|
|
2744
2745
|
}
|
|
2746
|
+
// the notes a send of the Strom app wrote to a fact alike (before 1.34.0): set right once, the wrong one kept in its history
|
|
2747
|
+
try {
|
|
2748
|
+
const done = settleNotes(Tree.open(root, env));
|
|
2749
|
+
if (done)
|
|
2750
|
+
noteLive(root, `notes a send of the app wrote to a fact alike: ${counted(done.notes, "note")} of ${counted(done.facts, "fact")} set right, ${counted(done.left.length, "fact")} changed since, left as they are${done.left.length ? ` (${done.left.join(", ")})` : ""}${done.backup ? `; backed up first: ${done.backup.path}` : ""}`);
|
|
2751
|
+
}
|
|
2752
|
+
catch (e) {
|
|
2753
|
+
noteLive(root, `the notes a send of the app wrote to a fact alike not set right now: ${errorText(e)}`);
|
|
2754
|
+
}
|
|
2745
2755
|
// the phone connection on and its server gone (the computer started again): started again beside the bridge
|
|
2746
2756
|
try {
|
|
2747
2757
|
if (phoneConfig(env).on && !phoneRunning(env)) {
|
|
@@ -0,0 +1,285 @@
|
|
|
1
|
+
// The notes a send of the Strom app wrote wrong before strom NOTES_FIX_SINCE, set right once by themselves (1115 B1):
|
|
2
|
+
// a sync paired a fact of the file with the first of the research's facts alike (the same kind, day, place and value —
|
|
3
|
+
// two events of one day cited at one page), so the note of one, and the note of someone it names, "corrected" its
|
|
4
|
+
// twin's; and the Strom app 3.28.0 sent a longer note of someone a fact names cut short, taken for the user's edit.
|
|
5
|
+
// Found in what each sync wrote (its input's `sync.applied`): a note whose new lines the file did not give that fact
|
|
6
|
+
// (its `_STROM_EID`), else — no file kept, no IDs in it — that its twin has; a participant's note cut to its beginning
|
|
7
|
+
// by an app before APP_SENDS_PART_NOTES. Only while the fact still says what the sync wrote: one changed since is
|
|
8
|
+
// left as it is and said. The note before is put back, the wrong one kept in the note's history; each fact one
|
|
9
|
+
// operation, the marker in strom.json, one commit.
|
|
10
|
+
import fs from "node:fs";
|
|
11
|
+
import { now, VERSION } from "./tree.js";
|
|
12
|
+
import { inputPath } from "./media.js";
|
|
13
|
+
import { freshConfig, quiet } from "./hypolinks.js";
|
|
14
|
+
import { writableUnasked } from "./integrity.js";
|
|
15
|
+
import { update } from "./records.js";
|
|
16
|
+
import { factNote, noteLine, readGedcom, readStromJson } from "./sync.js";
|
|
17
|
+
import { compareVersions } from "./semver.js";
|
|
18
|
+
import { isAppVersion } from "./stromapp.js";
|
|
19
|
+
import { backupTreeOnce } from "./backup.js";
|
|
20
|
+
import { Settings } from "./config.js";
|
|
21
|
+
import { ui } from "../cli/ui.js";
|
|
22
|
+
/** The strom version that pairs each fact of a send by its ID (and so sets the notes right). */
|
|
23
|
+
export const NOTES_FIX_SINCE = "1.34.0";
|
|
24
|
+
/** The marker in strom.json: the notes a send wrote to a fact's twin set right once. */
|
|
25
|
+
export const NOTES_SETTLED = "twin-notes-1";
|
|
26
|
+
/** The first Strom app that sends a participant's longer note whole (its 3.28.0 cut it short). */
|
|
27
|
+
const WHOLE_PART_NOTES = "3.29.0";
|
|
28
|
+
/** A participant's note the 3.28.0 cut short was longer than this (its ~260 bytes): a shorter one is never taken so. */
|
|
29
|
+
const CUT_LONGER = 200;
|
|
30
|
+
const owners = (tree) => [...tree.list("person"), ...tree.list("family")];
|
|
31
|
+
const kindOf = (k) => (k === "CHR" ? "BAPM" : k);
|
|
32
|
+
const linesOf = (t) => (t ? (factNote(t)?.split("\n") ?? []) : []);
|
|
33
|
+
/** The facts alike: the same kind, day, place and value (what a sync paired them by). */
|
|
34
|
+
const alike = (a, b) => a.id !== b.id && !b.retracted && kindOf(a.kind) === kindOf(b.kind) && (a.date ?? "") === (b.date ?? "") && noteLine(a.place ?? "") === noteLine(b.place ?? "") && noteLine(a.value ?? "") === noteLine(b.value ?? "");
|
|
35
|
+
const whoOf = (p) => p.person ?? noteLine(p.name ?? "").toLowerCase();
|
|
36
|
+
const samePart = (a, b) => a.role === b.role && whoOf(a) === whoOf(b);
|
|
37
|
+
/**
|
|
38
|
+
* Whether the note a sync wrote to a fact (`wrote`, the one before `before`) is of a fact alike (`twins`), not the
|
|
39
|
+
* user's: its new lines are not what the file gave that fact (`given`, under its `_STROM_EID`) — or, no such fact in
|
|
40
|
+
* the file (none kept, no IDs in it), all of them a twin's.
|
|
41
|
+
*/
|
|
42
|
+
export function wrongFactNote(twins, before, wrote, given) {
|
|
43
|
+
if (!twins.length)
|
|
44
|
+
return false;
|
|
45
|
+
const was = linesOf(before);
|
|
46
|
+
const fresh = linesOf(wrote).filter((l) => !was.includes(l));
|
|
47
|
+
if (!fresh.length)
|
|
48
|
+
return false;
|
|
49
|
+
if (given)
|
|
50
|
+
return !fresh.every((l) => linesOf(given.note).includes(l));
|
|
51
|
+
return fresh.every((l) => twins.some((t) => linesOf(t.note).includes(l)));
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Whether the note a sync wrote to someone a fact names (`now`, theirs before `old`) is wrong, and why: the beginning
|
|
55
|
+
* alone of their longer note, of an app that cuts it short (`app` before WHOLE_PART_NOTES, or none said); the note
|
|
56
|
+
* the same person in the same role has at a twin, which the file did not give this fact (`given`).
|
|
57
|
+
*/
|
|
58
|
+
export function wrongPartNote(now, old, twins, given, app) {
|
|
59
|
+
if (!old.note || !now.note || noteLine(old.note) === noteLine(now.note))
|
|
60
|
+
return undefined;
|
|
61
|
+
const whole = !!app && isAppVersion(app) && compareVersions(app, WHOLE_PART_NOTES) >= 0;
|
|
62
|
+
if (!whole && Buffer.byteLength(old.note, "utf8") > CUT_LONGER && noteLine(old.note).startsWith(noteLine(now.note)))
|
|
63
|
+
return "cut";
|
|
64
|
+
const atTwin = twins.some((t) => (t.participants ?? []).some((x) => samePart(x, now) && noteLine(x.note ?? "") === noteLine(now.note)));
|
|
65
|
+
if (atTwin && !(given?.parts ?? []).some((x) => noteLine(x.note ?? "") === noteLine(now.note)))
|
|
66
|
+
return "twin";
|
|
67
|
+
return undefined;
|
|
68
|
+
}
|
|
69
|
+
/** The facts of the same person or family alike (what a sync before 1.34.0 paired them by). */
|
|
70
|
+
export const twinsOf = (owner, event) => owner.events.filter((x) => alike(event, x));
|
|
71
|
+
/** The file a sync read, as read again (its text kept, or its file in inputs/ or the shared media); none: undefined. */
|
|
72
|
+
function sentFile(tree, input) {
|
|
73
|
+
let text = input.text;
|
|
74
|
+
if (text === undefined) {
|
|
75
|
+
const file = inputPath(tree, input);
|
|
76
|
+
if (!file)
|
|
77
|
+
return undefined;
|
|
78
|
+
try {
|
|
79
|
+
text = fs.readFileSync(file, "utf8");
|
|
80
|
+
}
|
|
81
|
+
catch {
|
|
82
|
+
return undefined;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
try {
|
|
86
|
+
const snap = /^?\s*[{[]/u.test(text) ? readStromJson(JSON.parse(text)) : readGedcom(text);
|
|
87
|
+
return { snap, ...(snap.appVersion ? { app: snap.appVersion } : {}) };
|
|
88
|
+
}
|
|
89
|
+
catch {
|
|
90
|
+
return undefined;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
/** The fact the file gave under this ID (`2 _STROM_EID`), if it gave one. */
|
|
94
|
+
export function sentFact(snap, id) {
|
|
95
|
+
if (!snap)
|
|
96
|
+
return undefined;
|
|
97
|
+
for (const facts of [...[...snap.persons.values()].map((p) => p.facts), ...snap.families.map((f) => f.facts)]) {
|
|
98
|
+
const f = facts.find((x) => x.eid === id);
|
|
99
|
+
if (f)
|
|
100
|
+
return f;
|
|
101
|
+
}
|
|
102
|
+
return undefined;
|
|
103
|
+
}
|
|
104
|
+
/** What the fix finds: nothing once the notes are set right (the marker in strom.json). */
|
|
105
|
+
export function noteFixes(tree) {
|
|
106
|
+
const out = { fixes: [], left: [] };
|
|
107
|
+
if (tree.config.settled?.includes(NOTES_SETTLED))
|
|
108
|
+
return out;
|
|
109
|
+
const inputs = tree.list("input").filter((i) => !i.retracted && i.sync?.applied?.some((a) => a.do === "event.note" || a.do === "event.parts") && !i.sync.undone);
|
|
110
|
+
if (!inputs.length)
|
|
111
|
+
return out;
|
|
112
|
+
const facts = new Map();
|
|
113
|
+
for (const o of owners(tree))
|
|
114
|
+
for (const e of o.events)
|
|
115
|
+
facts.set(e.id, { owner: o, event: e });
|
|
116
|
+
const seen = new Set();
|
|
117
|
+
for (const input of inputs) {
|
|
118
|
+
let file = null;
|
|
119
|
+
const sent = () => (file === null ? (file = sentFile(tree, input)) : file);
|
|
120
|
+
for (const a of input.sync.applied) {
|
|
121
|
+
if (a.do !== "event.note" && a.do !== "event.parts")
|
|
122
|
+
continue;
|
|
123
|
+
const at = facts.get(a.id);
|
|
124
|
+
if (!at || at.event.retracted)
|
|
125
|
+
continue;
|
|
126
|
+
const { owner, event } = at;
|
|
127
|
+
const twins = twinsOf(owner, event);
|
|
128
|
+
if (a.do === "event.note") {
|
|
129
|
+
if (!twins.length)
|
|
130
|
+
continue;
|
|
131
|
+
let b;
|
|
132
|
+
try {
|
|
133
|
+
b = JSON.parse(String(a.before ?? "{}"));
|
|
134
|
+
}
|
|
135
|
+
catch {
|
|
136
|
+
continue;
|
|
137
|
+
}
|
|
138
|
+
if (typeof b.now !== "string")
|
|
139
|
+
continue;
|
|
140
|
+
// what the file gave this fact is the user's, never set right
|
|
141
|
+
if (!wrongFactNote(twins, b.note ?? undefined, b.now, sentFact(sent()?.snap, event.id)))
|
|
142
|
+
continue;
|
|
143
|
+
const key = `${event.id}|`;
|
|
144
|
+
if (seen.has(key))
|
|
145
|
+
continue;
|
|
146
|
+
seen.add(key);
|
|
147
|
+
const fix = { input: input.id, owner: owner.id, event: event.id, why: "twin", before: b.note ?? "", wrote: b.now };
|
|
148
|
+
// as before already (undone, set right by hand): nothing; changed since into another: left, said
|
|
149
|
+
if (event.note === b.now)
|
|
150
|
+
out.fixes.push(fix);
|
|
151
|
+
else if (noteLine(event.note ?? "") !== noteLine(b.note ?? ""))
|
|
152
|
+
out.left.push(fix);
|
|
153
|
+
continue;
|
|
154
|
+
}
|
|
155
|
+
let was;
|
|
156
|
+
try {
|
|
157
|
+
was = JSON.parse(String(a.before ?? "[]"));
|
|
158
|
+
}
|
|
159
|
+
catch {
|
|
160
|
+
continue;
|
|
161
|
+
}
|
|
162
|
+
if (!Array.isArray(was))
|
|
163
|
+
continue;
|
|
164
|
+
const given = sentFact(sent()?.snap, event.id);
|
|
165
|
+
for (const p of event.participants ?? []) {
|
|
166
|
+
const old = was.find((x) => samePart(x, p));
|
|
167
|
+
const key = `${event.id}|${p.role}|${whoOf(p)}`;
|
|
168
|
+
if (!old || seen.has(key))
|
|
169
|
+
continue;
|
|
170
|
+
const why = wrongPartNote(p, old, twins, given, sent()?.app);
|
|
171
|
+
if (!why)
|
|
172
|
+
continue;
|
|
173
|
+
seen.add(key);
|
|
174
|
+
out.fixes.push({ input: input.id, owner: owner.id, event: event.id, part: { role: p.role, who: whoOf(p) }, why, before: old.note, wrote: p.note });
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
return out;
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* The fix: each note put back as it was before the sync, the one it wrote kept in the note's history (a fact's) — one
|
|
182
|
+
* operation per fact, the marker in strom.json. Inside atomically (the tree lock).
|
|
183
|
+
*/
|
|
184
|
+
export function applyNoteFixes(tree, found) {
|
|
185
|
+
const at = now();
|
|
186
|
+
const byEvent = new Map();
|
|
187
|
+
for (const f of found.fixes)
|
|
188
|
+
byEvent.set(f.event, [...(byEvent.get(f.event) ?? []), f]);
|
|
189
|
+
for (const [id, fixes] of byEvent) {
|
|
190
|
+
const owner = fixes[0].owner;
|
|
191
|
+
const reason = `strom ${VERSION}: what a send of the Strom app (${[...new Set(fixes.map((f) => f.input))].join(", ")}) wrote ${fixes.some((f) => f.why === "twin") ? "of a fact alike (the same kind, day and source)" : "cut short by the app"} set right`;
|
|
192
|
+
update(tree, owner, owner.startsWith("F") ? "family" : "person", (o) => ({
|
|
193
|
+
...o,
|
|
194
|
+
events: o.events.map((e) => {
|
|
195
|
+
if (e.id !== id)
|
|
196
|
+
return e;
|
|
197
|
+
let next = { ...e };
|
|
198
|
+
for (const f of fixes) {
|
|
199
|
+
if (!f.part) {
|
|
200
|
+
if (next.note !== f.wrote)
|
|
201
|
+
continue;
|
|
202
|
+
const edits = [...(next.noteEdits ?? []), { text: f.wrote, at, by: tree.actor, reason }];
|
|
203
|
+
const { note: _n, ...rest } = next;
|
|
204
|
+
next = { ...rest, ...(f.before ? { note: f.before } : {}), noteEdits: edits };
|
|
205
|
+
}
|
|
206
|
+
else {
|
|
207
|
+
next = { ...next, participants: (next.participants ?? []).map((p) => (p.role === f.part.role && whoOf(p) === f.part.who && p.note === f.wrote ? { ...p, note: f.before } : p)) };
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
return next;
|
|
211
|
+
}),
|
|
212
|
+
}), { op: "note.edit", summary: `${id} note${fixes.some((f) => f.part) ? "s" : ""} set right: ${fixes.map((f) => (f.part ? `${f.part.role}'s` : "the fact's")).join(", ")} as before ${[...new Set(fixes.map((f) => f.input))].join(", ")}`, reason });
|
|
213
|
+
}
|
|
214
|
+
tree.updateConfig((c) => {
|
|
215
|
+
c.settled = [...new Set([...(c.settled ?? []), NOTES_SETTLED])];
|
|
216
|
+
}, { op: "tree.settle", summary: found.fixes.length ? "the notes a send of the Strom app wrote to a fact alike set right once" : "the notes a send of the Strom app wrote: none to set right" });
|
|
217
|
+
return byEvent.size;
|
|
218
|
+
}
|
|
219
|
+
/** A local date and time for the backup's README. */
|
|
220
|
+
function when(d) {
|
|
221
|
+
const p = (n) => String(n).padStart(2, "0");
|
|
222
|
+
return `${d.getFullYear()}-${p(d.getMonth() + 1)}-${p(d.getDate())} ${p(d.getHours())}:${p(d.getMinutes())}`;
|
|
223
|
+
}
|
|
224
|
+
/**
|
|
225
|
+
* The backup of this research before its notes are set right (1115 N1): the same backup a change of channel makes —
|
|
226
|
+
* a beta after a beta of the same channel makes none, and that is where the wrong notes were written. Of this research
|
|
227
|
+
* and the settings (core/backup.ts backupTreeOnce), kept in the user config; none when a backup of the last day for
|
|
228
|
+
* this version holds it already, none with no home of the research configured. Throws when it cannot be made.
|
|
229
|
+
*/
|
|
230
|
+
export function backupBeforeNotes(tree, from) {
|
|
231
|
+
const settings = new Settings(tree.env, {});
|
|
232
|
+
const home = settings.home()?.value;
|
|
233
|
+
if (!home)
|
|
234
|
+
return undefined;
|
|
235
|
+
const lang = settings.lang(tree.config).value;
|
|
236
|
+
return backupTreeOnce({
|
|
237
|
+
home,
|
|
238
|
+
env: tree.env,
|
|
239
|
+
root: tree.root,
|
|
240
|
+
id: tree.config.id,
|
|
241
|
+
transition: { from: from ?? VERSION, to: VERSION },
|
|
242
|
+
readme: ui(lang, "ui.backup.readme.notes", { date: when(new Date()), to: VERSION, since: NOTES_FIX_SINCE, tree: tree.config.name }),
|
|
243
|
+
research: [settings.trees()?.value, settings.shared()?.value].filter((p) => !!p),
|
|
244
|
+
record: (made, before) => {
|
|
245
|
+
settings.reload();
|
|
246
|
+
settings.config.backups = [...before, made];
|
|
247
|
+
settings.save();
|
|
248
|
+
},
|
|
249
|
+
});
|
|
250
|
+
}
|
|
251
|
+
/**
|
|
252
|
+
* Once per research, at the first start of this strom and at a bridge's start: the notes set right by themselves, in
|
|
253
|
+
* one commit — the research backed up first when there is a note to set right (`from`: the strom that ran before, for
|
|
254
|
+
* the backup's name). Nothing found: nothing written (looked at again next time, cheaply). Skipped while somebody is at
|
|
255
|
+
* work on the tree or holds its lock, while strom may not write it unasked (another computer's seal, data changed
|
|
256
|
+
* outside strom), in a dry run; a backup that cannot be made writes nothing (it throws: tried again next time). What it
|
|
257
|
+
* did, else undefined.
|
|
258
|
+
*/
|
|
259
|
+
export function settleNotes(tree, opts = {}) {
|
|
260
|
+
if (tree.dryRun || tree.config.settled?.includes(NOTES_SETTLED))
|
|
261
|
+
return undefined;
|
|
262
|
+
const first = noteFixes(tree);
|
|
263
|
+
if ((!first.fixes.length && !first.left.length) || !quiet(tree))
|
|
264
|
+
return undefined;
|
|
265
|
+
// a note to set right: the research backed up first (outside its lock — the backup takes it to copy)
|
|
266
|
+
const backedUp = first.fixes.length > 0 && writableUnasked(tree);
|
|
267
|
+
const backup = backedUp ? backupBeforeNotes(tree, opts.from) : undefined;
|
|
268
|
+
let out;
|
|
269
|
+
tree.atomically(() => {
|
|
270
|
+
// read afresh under the lock: another strom may have settled it meanwhile
|
|
271
|
+
if (!freshConfig(tree) || tree.config.settled?.includes(NOTES_SETTLED) || !writableUnasked(tree))
|
|
272
|
+
return;
|
|
273
|
+
const found = noteFixes(tree);
|
|
274
|
+
if (!found.fixes.length && !found.left.length)
|
|
275
|
+
return;
|
|
276
|
+
// a note to set right found only now (written meanwhile): none set right without the backup — next time
|
|
277
|
+
if (found.fixes.length && !backedUp)
|
|
278
|
+
return;
|
|
279
|
+
const facts = applyNoteFixes(tree, found);
|
|
280
|
+
const left = [...new Set(found.left.map((f) => f.event))];
|
|
281
|
+
tree.commit(`Notes a send of the Strom app wrote to a fact alike set right: ${[...new Set(found.fixes.map((f) => f.event))].join(", ") || "none"}${left.length ? `; changed since, left as they are: ${left.join(", ")}` : ""}`);
|
|
282
|
+
out = { facts, notes: found.fixes.length, left, ...(backup ? { backup } : {}) };
|
|
283
|
+
});
|
|
284
|
+
return out;
|
|
285
|
+
}
|
package/dist/core/stromapp.js
CHANGED
|
@@ -803,6 +803,24 @@ export const APP_READS_MAIN_CITATION_BETA = undefined;
|
|
|
803
803
|
* None (the app has not said it yet): never.
|
|
804
804
|
*/
|
|
805
805
|
export const APP_SENDS_UNCITE = undefined;
|
|
806
|
+
/**
|
|
807
|
+
* The first Strom app whose file gives the note of someone a fact names whole (the app's full check of 3.29.0, N1: the
|
|
808
|
+
* 3.28.0 reads a longer note of a participant in part and sends it cut short) — a real version, not a gate, as
|
|
809
|
+
* APP_SENDS_UNCITE: from it the user's edit of such a note comes back into the research (fact.part.note); of an older
|
|
810
|
+
* app, or one that says no version, nothing of it. None (not set yet): never.
|
|
811
|
+
*/
|
|
812
|
+
export const APP_SENDS_PART_NOTES = undefined;
|
|
813
|
+
/** The data version of the Strom app's JSON that gives a participant's note whole (as APP_SENDS_PART_NOTES). None: never. */
|
|
814
|
+
export const APP_DATA_PART_NOTES = undefined;
|
|
815
|
+
/** Does a file of the Strom app of this version (its HEAD's 2 VERS) give the note of someone a fact names whole? No version said: no. */
|
|
816
|
+
export function appSendsPartNotes(version, gate = APP_SENDS_PART_NOTES) {
|
|
817
|
+
const v = version?.trim();
|
|
818
|
+
return !!gate && !!v && isAppVersion(v) && compareVersions(v, gate) >= 0;
|
|
819
|
+
}
|
|
820
|
+
/** Does the Strom app's JSON of this data version give the note of someone a fact names whole? None said: no. */
|
|
821
|
+
export function appDataPartNotes(dataVersion, gate = APP_DATA_PART_NOTES) {
|
|
822
|
+
return gate !== undefined && typeof dataVersion === "number" && dataVersion >= gate;
|
|
823
|
+
}
|
|
806
824
|
/** The data version of the Strom app's JSON with the main citation of a fact (citationMain) and a source's events (its answer: 21). */
|
|
807
825
|
export const APP_DATA_MAIN_CITATION = 21;
|
|
808
826
|
/** Does the Strom app of this version read the main citation of a fact (_STROM_MAIN, 1 DATA / 2 EVEN)? Unknown or no gate: no. */
|
package/dist/core/sync.js
CHANGED
|
@@ -49,7 +49,7 @@ import { actsAsArchive } from "./state.js";
|
|
|
49
49
|
import { appSides } from "./conflicts.js";
|
|
50
50
|
import { userReading } from "./readers.js";
|
|
51
51
|
import { applyProposal, changedPerson, FACT_PARTS, factChanges, importSourceFor, importsOfHead, knownImportSource, markUnder, NAME_PARTS, originOfMark, personChangedFact, primaryVerdict, proposedLine, proposeFact, proposeName, proposePrimary, proposeRetract, proposeSex, researchChangedFact, verdictOf } from "./origin.js";
|
|
52
|
-
import { APP_DATA_SEX_UNKNOWN, APP_DATA_SOURCE_FIELDS, appDataDecidesShares, appDataMainCitation, appReadsMainCitation, appSendsUncite, appDecidesShares, appKeepsPeriods, appKeepsSourceFields, appKnowsPrimaryName, appReadsLines, appReadsSurnameGroups, appShowsVerify, isAppVersion } from "./stromapp.js";
|
|
52
|
+
import { APP_DATA_SEX_UNKNOWN, APP_DATA_SOURCE_FIELDS, appDataDecidesShares, appDataMainCitation, appDataPartNotes, appReadsMainCitation, appSendsPartNotes, appSendsUncite, appDecidesShares, appKeepsPeriods, appKeepsSourceFields, appKnowsPrimaryName, appReadsLines, appReadsSurnameGroups, appShowsVerify, isAppVersion } from "./stromapp.js";
|
|
53
53
|
import { lineMarkOf, lineMarks, lineagesAt, planLines, setLineMark, undoLineMark } from "./lineages.js";
|
|
54
54
|
import { Settings } from "./config.js";
|
|
55
55
|
import { applySurnameChange, formsSaid, planSurnames, readMarkLines, readSurnames, surnamesAt, undoSurnameChange } from "./surnames.js";
|
|
@@ -435,7 +435,7 @@ function knownNote(text, said) {
|
|
|
435
435
|
return unknown.length < 3 && unknown.length * 2 <= w.size && unknown.every((x) => labels.has(x));
|
|
436
436
|
}
|
|
437
437
|
/** A line of a note as compared: NFC, its spaces one (the app joins what GEDCOM splits). */
|
|
438
|
-
const noteLine = (t) => t.normalize("NFC").replace(/\s+/g, " ").trim();
|
|
438
|
+
export const noteLine = (t) => t.normalize("NFC").replace(/\s+/g, " ").trim();
|
|
439
439
|
/** A line strom intake writes into a fact's note itself: what a file said that the fact has no place for. */
|
|
440
440
|
const STROM_NOTE_LINE = /^(?:source there|date as written|age as written): |^(?:husband|wife) aged /u;
|
|
441
441
|
/**
|
|
@@ -448,7 +448,7 @@ const exportSays = (line) => EXPORT_SAYS.some((x) => x.exact.includes(line) || x
|
|
|
448
448
|
* A fact's note as compared: its lines as compared, none empty, without the labelled details the Strom app writes
|
|
449
449
|
* back into it ("Věk: 61 let" — the fact's age, compared as one); undefined when nothing is left.
|
|
450
450
|
*/
|
|
451
|
-
function factNote(text) {
|
|
451
|
+
export function factNote(text) {
|
|
452
452
|
const lines = text.split(/\r?\n/).map(noteLine).filter((l) => l && !detailLine(l));
|
|
453
453
|
return lines.length ? lines.join("\n") : undefined;
|
|
454
454
|
}
|
|
@@ -2229,6 +2229,9 @@ export function planSync(tree, incoming, edits, opts = {}) {
|
|
|
2229
2229
|
? appReadsMainCitation(new Settings(tree.env, {}), incoming.appVersion) && (!base?.appVersion || appReadsMainCitation(new Settings(tree.env, {}), base.appVersion))
|
|
2230
2230
|
: appDataMainCitation(incoming.dataVersion));
|
|
2231
2231
|
const sendsUncite = opts.sendsUncite ?? (incoming.format === "gedcom" && appSendsUncite(incoming.appVersion));
|
|
2232
|
+
// the note of someone a fact names: only of an app that gives it whole (APP_SENDS_PART_NOTES; its JSON from
|
|
2233
|
+
// APP_DATA_PART_NOTES) — an older one sends a longer note cut short, never an edit of the user's
|
|
2234
|
+
const partNotes = opts.partNotes ?? (incoming.format === "gedcom" ? appSendsPartNotes(incoming.appVersion) : appDataPartNotes(incoming.dataVersion));
|
|
2232
2235
|
const changes = [];
|
|
2233
2236
|
const push = (c) => changes.push({ ...c, n: changes.length + 1 });
|
|
2234
2237
|
/** What the file no longer has: an archive takes it away — unless the window that sends never had it (kept, said). */
|
|
@@ -2280,7 +2283,7 @@ export function planSync(tree, incoming, edits, opts = {}) {
|
|
|
2280
2283
|
* the user called "porodní bába") changed into another role is no edit of a note (the role read from it differs).
|
|
2281
2284
|
*/
|
|
2282
2285
|
const partNoteDiff = (f, o, p) => {
|
|
2283
|
-
if (!o?.id || !p.note)
|
|
2286
|
+
if (!partNotes || !o?.id || !p.note)
|
|
2284
2287
|
return;
|
|
2285
2288
|
const mine = (o.parts ?? []).find((x) => x.role === p.role && sameWho(p, incoming, x, ours));
|
|
2286
2289
|
if (!mine || noteLine(mine.note ?? "") === noteLine(p.note))
|
|
@@ -2292,7 +2295,7 @@ export function planSync(tree, incoming, edits, opts = {}) {
|
|
|
2292
2295
|
push({ kind: "fact.part.note", action, ...owner, fact: f, was: o, part: { ...p, note: noteLine(p.note) }, wasPart: mine });
|
|
2293
2296
|
};
|
|
2294
2297
|
/** Who the file names at a fact the research has (`o`): one more is added, another role a change, as a fact's. */
|
|
2295
|
-
const partsDiff = (f, o) => {
|
|
2298
|
+
const partsDiff = (f, o, sure = true) => {
|
|
2296
2299
|
for (const p of f.parts ?? []) {
|
|
2297
2300
|
const known = ourParts.find((x) => sameWho(p, incoming, x.part, ours) && sameRole(p, x.part));
|
|
2298
2301
|
if (known) {
|
|
@@ -2300,7 +2303,8 @@ export function planSync(tree, incoming, edits, opts = {}) {
|
|
|
2300
2303
|
const linked = was && baseParts.some((x) => sameWho(p, incoming, x.part, base) && x.part.person);
|
|
2301
2304
|
if (p.person && !known.part.person && known.fact.id && !linked)
|
|
2302
2305
|
push({ kind: "fact.part", action: "add", ...owner, fact: f, was: known.fact, part: p, wasPart: known.part });
|
|
2303
|
-
|
|
2306
|
+
if (sure)
|
|
2307
|
+
partNoteDiff(f, o, p);
|
|
2304
2308
|
continue;
|
|
2305
2309
|
}
|
|
2306
2310
|
if (was && baseParts.some((x) => sameWho(p, incoming, x.part, base) && sameRole(p, x.part)))
|
|
@@ -2520,12 +2524,20 @@ export function planSync(tree, incoming, edits, opts = {}) {
|
|
|
2520
2524
|
return Object.keys(x).every((d) => exact(x[d]) === exact(y[d]));
|
|
2521
2525
|
};
|
|
2522
2526
|
const mates = our.filter((x) => factKey(x) === k);
|
|
2523
|
-
// the
|
|
2524
|
-
|
|
2525
|
-
|
|
2527
|
+
// the research's fact it is: by the ID the app was given (`2 _STROM_EID`), else the one of the same details,
|
|
2528
|
+
// then of the same name (two events of one day and one source, told apart by their names only — 1115 B1)
|
|
2529
|
+
const byId = f.eid ? mates.find((x) => x.id?.toUpperCase() === f.eid) : undefined;
|
|
2530
|
+
const alike = mates.filter((x) => sameDetails(f, x));
|
|
2531
|
+
const named = (alike.length ? alike : mates).filter((x) => fold(x.label) === fold(f.label));
|
|
2532
|
+
const paired = byId ?? (named.length === 1 ? named[0] : (alike[0] ?? mates[0]));
|
|
2533
|
+
// what the user wrote of one fact (its note, a note of someone it names) only to the one it surely is: never
|
|
2534
|
+
// guessed among facts alike (the note of one would correct its twin's)
|
|
2535
|
+
const sure = !!byId || mates.length === 1 || alike.length === 1 || named.length === 1;
|
|
2536
|
+
partsDiff(f, paired, sure);
|
|
2526
2537
|
confirmDiff(f, paired);
|
|
2527
2538
|
shareDiff(f, paired);
|
|
2528
|
-
|
|
2539
|
+
if (sure)
|
|
2540
|
+
noteDiff(f, paired);
|
|
2529
2541
|
// facts alike (two events of a year, told apart by their names only) pair loosely: a source any of them cites is no news
|
|
2530
2542
|
const fresh = newCites(tree, f, mates, was?.filter((x) => factKey(x) === k) ?? [], sources, owner.family);
|
|
2531
2543
|
if (fresh.length)
|
package/dist/core/tree.js
CHANGED
|
@@ -32,7 +32,7 @@ export const TREE_FILE = "strom.json";
|
|
|
32
32
|
export const SEAL_FOREIGN = "seal.foreign";
|
|
33
33
|
// between releases the candidate being made (a bridge run from the sources says what it is: the Strom app goes by it);
|
|
34
34
|
// at a release the release's own (package.json)
|
|
35
|
-
export const VERSION = "1.34.0-beta.
|
|
35
|
+
export const VERSION = "1.34.0-beta.4";
|
|
36
36
|
/** What a new research is settled with from the start: nothing an older strom counted otherwise to set right in it. */
|
|
37
37
|
export const NEW_TREE_SETTLED = ["readers-1", "proven-originals-1", "origins-1", "verify-originals-1", "origins-tree-1"];
|
|
38
38
|
const GITIGNORE = `# Strom Research — local state and large files are not versioned
|