gedcom-ts 2.0.2 → 2.1.0
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 +92 -0
- package/README.md +370 -89
- package/dist/commons/Act.d.ts +38 -6
- package/dist/commons/DateAct.d.ts +40 -2
- package/dist/commons/Identifier.enum.d.ts +3 -0
- package/dist/commons/IndiAttribute.d.ts +11 -0
- package/dist/commons/IndiGedcomSubLine.d.ts +6 -0
- package/dist/commons/MultimediaFile.d.ts +13 -2
- package/dist/commons/Person.d.ts +21 -3
- package/dist/commons/PersonNameVariant.d.ts +21 -0
- package/dist/commons/Place.d.ts +19 -0
- package/dist/commons/gedcomEventTags.d.ts +10 -0
- package/dist/edit/ActEdit.d.ts +29 -0
- package/dist/edit/ActsEdit.d.ts +17 -0
- package/dist/edit/DateActEdit.d.ts +37 -0
- package/dist/edit/NotesEdit.d.ts +14 -0
- package/dist/edit/PersonEdit.d.ts +27 -0
- package/dist/edit/PlaceEdit.d.ts +23 -0
- package/dist/edit/index.d.ts +19 -0
- package/dist/export/GEDCOM.d.ts +33 -4
- package/dist/import/LoadFile.d.ts +14 -0
- package/dist/import/ReadGed.d.ts +43 -0
- package/dist/import/SplitedInformations.d.ts +29 -3
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +17 -4
- package/dist/index.mjs +1 -1
- package/dist/utils/gedcom/actExtraction.d.ts +3 -1
- package/dist/utils/gedcom/datasetVersion.d.ts +7 -0
- package/dist/utils/gedcom/extractIndiNamesAndAttributes.d.ts +4 -0
- package/dist/utils/gedcom/labelKeyedRecords.d.ts +13 -0
- package/dist/utils/gedcom/mediaFormFromUri.d.ts +2 -0
- package/dist/utils/gedcom/parseStandaloneObje.d.ts +9 -0
- package/dist/utils/gedcom/personName.d.ts +7 -0
- package/dist/utils/gedcom/pointers.d.ts +16 -0
- package/dist/version.d.ts +6 -0
- package/package.json +1 -1
package/dist/commons/Act.d.ts
CHANGED
|
@@ -1,20 +1,46 @@
|
|
|
1
1
|
import { DateAct } from "./DateAct";
|
|
2
2
|
import { Place } from "./Place";
|
|
3
|
-
import {
|
|
3
|
+
import { GEDCOM_7_ALL_EVENT_TAGS } from "./gedcomEventTags";
|
|
4
4
|
import { MultimediaFile, MultimediaFiles } from "./MultimediaFile";
|
|
5
5
|
import { Notes } from "./Note";
|
|
6
|
-
export type TypeAct =
|
|
6
|
+
export type TypeAct = (typeof GEDCOM_7_ALL_EVENT_TAGS)[number];
|
|
7
|
+
export type ActConstructionOptions = {
|
|
8
|
+
/** GEDCOM 7 `1 EVEN` text payload (only used when `type` is `EVEN`). */
|
|
9
|
+
evenDescription?: string | null;
|
|
10
|
+
/** GEDCOM 7 required `2 TYPE` under `EVEN` (individual or family). */
|
|
11
|
+
evenTypeLabel?: string | null;
|
|
12
|
+
/** GEDCOM 7 `2 SDATE` (+ `3 TIME` / `3 PHRASE` importés comme pour `DATE`). */
|
|
13
|
+
sdateAct?: DateAct | null;
|
|
14
|
+
/** GEDCOM 7 `2 PHRASE` directement sous l’événement. */
|
|
15
|
+
eventPhrases?: readonly string[] | null;
|
|
16
|
+
/** Sous-lignes non modélisées avant la première balise d’ancrage (`DATE`, `PLAC`, …). */
|
|
17
|
+
preservedSubrecordPrefix?: readonly string[] | null;
|
|
18
|
+
/** Sous-lignes non modélisées après la première balise d’ancrage. */
|
|
19
|
+
preservedSubrecordSuffix?: readonly string[] | null;
|
|
20
|
+
};
|
|
7
21
|
export declare class Act {
|
|
8
22
|
type: TypeAct;
|
|
9
23
|
dateAct?: DateAct | null;
|
|
10
24
|
place: Place | null;
|
|
11
25
|
INDIS: number[];
|
|
26
|
+
evenDescription?: string | null;
|
|
27
|
+
evenTypeLabel?: string | null;
|
|
28
|
+
/** GEDCOM 7 `2 SDATE` (sous-structure analogue à `DATE`). */
|
|
29
|
+
sdateAct?: DateAct | null;
|
|
30
|
+
/** GEDCOM 7 `2 PHRASE` au niveau 2 sous l’événement. */
|
|
31
|
+
eventPhrases: string[];
|
|
32
|
+
/**
|
|
33
|
+
* Sous-lignes d’événement non modélisées (ex. `2 HUSB`, `4 PHRASE` sous `AGE`, `3 DATE` sous `STAT`, …),
|
|
34
|
+
* conservées pour limiter la perte à l’import / export.
|
|
35
|
+
*/
|
|
36
|
+
preservedSubrecordPrefix: string[];
|
|
37
|
+
preservedSubrecordSuffix: string[];
|
|
12
38
|
private newMultimediaFiles;
|
|
13
39
|
multimediaFiles: MultimediaFiles;
|
|
14
40
|
notes: Notes;
|
|
15
41
|
get files(): MultimediaFile[];
|
|
16
42
|
get keysFiles(): string[];
|
|
17
|
-
constructor(type: TypeAct, dateAct?: DateAct | null, place?: Place | null, indis?: number[] | null, multimediaFiles?: MultimediaFiles | null, newMultimediaFiles?: Map<string, MultimediaFile>, notes?: Notes);
|
|
43
|
+
constructor(type: TypeAct, dateAct?: DateAct | null, place?: Place | null, indis?: number[] | null, multimediaFiles?: MultimediaFiles | null, newMultimediaFiles?: Map<string, MultimediaFile>, notes?: Notes, options?: ActConstructionOptions | null);
|
|
18
44
|
/**
|
|
19
45
|
* Média rattaché à l’acte : `{indi}/{type}/{nomFichier}` (indi = premier INDI connu ou paramètre).
|
|
20
46
|
* Suffixe `_1`, `_2`, … avant l’extension si le chemin est déjà pris sur cet acte.
|
|
@@ -24,8 +50,10 @@ export declare class Act {
|
|
|
24
50
|
private mediaRelativePathsInUse;
|
|
25
51
|
updateType(typeAct: TypeAct): void;
|
|
26
52
|
addIndis(INDIS: number[]): void;
|
|
27
|
-
updatePlace(place: Place): void;
|
|
28
|
-
updateDateAct(dateAct: DateAct): void;
|
|
53
|
+
updatePlace(place: Place | null): void;
|
|
54
|
+
updateDateAct(dateAct: DateAct | null): void;
|
|
55
|
+
/** Remplace ou efface la date de tri `SDATE`. */
|
|
56
|
+
updateSdateAct(sdateAct: DateAct | null): void;
|
|
29
57
|
}
|
|
30
58
|
export declare class Acts {
|
|
31
59
|
list: Act[];
|
|
@@ -34,13 +62,17 @@ export declare class Acts {
|
|
|
34
62
|
removeFromIndex(indexAct: number): void;
|
|
35
63
|
removeAll(): void;
|
|
36
64
|
sortByDate(): void;
|
|
65
|
+
/** Date utilisée pour le tri : `DATE` si exploitable, sinon `SDATE`. */
|
|
66
|
+
private sortDateAct;
|
|
37
67
|
private hasSortableDate;
|
|
38
68
|
private compareByTypeOrder;
|
|
39
69
|
private compareMarriageAndDivorce;
|
|
40
70
|
private haveSameParticipants;
|
|
41
71
|
}
|
|
42
72
|
export declare class ActsByExtraction extends Acts {
|
|
43
|
-
extractActsInfo(lines: string[], INDIS: number[], mapFiles: Map<string, File
|
|
73
|
+
extractActsInfo(lines: string[], INDIS: number[], mapFiles: Map<string, File>, objePayloadById?: ReadonlyMap<number, {
|
|
74
|
+
sourceUri: string;
|
|
75
|
+
}>, textualIndiXrefToIndi?: ReadonlyMap<string, number>): void;
|
|
44
76
|
private convertToActs;
|
|
45
77
|
private resolveTypeAct;
|
|
46
78
|
}
|
|
@@ -2,10 +2,18 @@ export declare enum TypeDateAct {
|
|
|
2
2
|
BEF = "BEF",
|
|
3
3
|
ABT = "ABT",
|
|
4
4
|
AFT = "AFT",
|
|
5
|
+
/** GEDCOM 5.5 / interop : date interprétée. */
|
|
6
|
+
INT = "INT",
|
|
7
|
+
/** Estimée. */
|
|
8
|
+
EST = "EST",
|
|
9
|
+
/** Calculée. */
|
|
10
|
+
CAL = "CAL",
|
|
5
11
|
BET = "BET",
|
|
6
12
|
FROM = "FROM",
|
|
7
13
|
NULL = "NULL"
|
|
8
14
|
}
|
|
15
|
+
/** Qualificateur de date simple (hors BET/FROM). */
|
|
16
|
+
export type TypeDateActSimpleQualifier = TypeDateAct.BEF | TypeDateAct.ABT | TypeDateAct.AFT | TypeDateAct.INT | TypeDateAct.EST | TypeDateAct.CAL;
|
|
9
17
|
export declare enum MonthEnum {
|
|
10
18
|
JAN = "JAN",
|
|
11
19
|
FEB = "FEB",
|
|
@@ -32,10 +40,28 @@ export declare class DateAct {
|
|
|
32
40
|
endDay?: Day;
|
|
33
41
|
endMonth?: Month;
|
|
34
42
|
endYear?: number;
|
|
43
|
+
/**
|
|
44
|
+
* Texte libre lié à la date : `3 PHRASE` sous `DATE` à l’import, ou fragment final `(...)` hérité 5.5.
|
|
45
|
+
*/
|
|
46
|
+
datePhrase?: string | null;
|
|
47
|
+
/** `3 TIME` sous `DATE` / `SDATE` (GEDCOM 7). */
|
|
48
|
+
dateTime?: string | null;
|
|
49
|
+
/**
|
|
50
|
+
* Charge `DATE`/`SDATE` non résolvable en champs typés (URI GEDCOM 7, texte libre, combos exotiques) :
|
|
51
|
+
* conservée telle quelle pour l’export tant qu’aucune date structurée exploitable n’est présente.
|
|
52
|
+
*/
|
|
53
|
+
verbatimDatePayload?: string | null;
|
|
35
54
|
constructor(dateLine: string);
|
|
55
|
+
private applyVerbatimFallback;
|
|
56
|
+
/** Indique si l’on dispose d’une date structurée exportable (hors seul verbatim). */
|
|
57
|
+
private hasStructuredDateForExport;
|
|
36
58
|
get date(): string | null;
|
|
59
|
+
/** Sous-ligne `3 TIME` (import GEDCOM 7). */
|
|
60
|
+
setDateTimeFromImport(fragment: string): void;
|
|
37
61
|
updateExactDate(year?: number, month?: Month, day?: Day): void;
|
|
38
|
-
|
|
62
|
+
/** Ajoute du texte issu d’un `3 PHRASE` sous `DATE` (import GEDCOM 7). */
|
|
63
|
+
appendDatePhraseFromImport(fragment: string): void;
|
|
64
|
+
updateQualifiedDate(typeDateAct: TypeDateActSimpleQualifier, year?: number, month?: Month, day?: Day): void;
|
|
39
65
|
updateBetweenDates(start: {
|
|
40
66
|
year: number;
|
|
41
67
|
month?: Month;
|
|
@@ -55,17 +81,29 @@ export declare class DateAct {
|
|
|
55
81
|
day?: Day;
|
|
56
82
|
}): void;
|
|
57
83
|
clearDate(): void;
|
|
84
|
+
/**
|
|
85
|
+
* Remplace l’état de cette instance par le résultat du parseur sur une charge `DATE` / `SDATE` GEDCOM
|
|
86
|
+
* (même logique que le constructeur), sans changer la référence d’objet — utile pour l’édition in-place.
|
|
87
|
+
*/
|
|
88
|
+
applyGedcomDatePayload(dateLine: string): void;
|
|
89
|
+
private tryParseIsoYmd;
|
|
90
|
+
/** ISO `YYYY-MM` (GEDCOM 7 : précision au mois). */
|
|
91
|
+
private tryParseIsoYm;
|
|
92
|
+
/** Extrait une note finale `(...)` (style 5.5) du reste de la charge date. */
|
|
93
|
+
private static extractInlineParentheticalPhrase;
|
|
58
94
|
private convertMonth;
|
|
59
95
|
private parseSinglePart;
|
|
60
96
|
private parseTwoParts;
|
|
61
97
|
private parseThreeParts;
|
|
62
98
|
private parseFourParts;
|
|
63
|
-
private
|
|
99
|
+
private tryConsumeMonthYearSlash;
|
|
64
100
|
private parseMonthToken;
|
|
65
101
|
private formatCoreDate;
|
|
66
102
|
private tryParseRangeDate;
|
|
67
103
|
private parseCoreDateValue;
|
|
68
104
|
private isRelativeType;
|
|
105
|
+
/** Retire les préfixes de calendrier GEDCOM (`@#DGREGORIAN@`, … — forme `@#NAME@`). */
|
|
106
|
+
private stripCalendarPrefixes;
|
|
69
107
|
isValid(): boolean;
|
|
70
108
|
}
|
|
71
109
|
export declare const dateToDateLine: (year?: number, month?: Month, day?: Day) => string;
|
|
@@ -58,6 +58,7 @@ export declare enum Identifier {
|
|
|
58
58
|
FAMF = "FAMF",
|
|
59
59
|
FAMS = "FAMS",
|
|
60
60
|
FCOM = "FCOM",
|
|
61
|
+
FACT = "FACT",
|
|
61
62
|
FILE = "FILE",
|
|
62
63
|
FORM = "FORM",
|
|
63
64
|
GEDC = "GEDC",
|
|
@@ -92,6 +93,7 @@ export declare enum Identifier {
|
|
|
92
93
|
PAGE = "PAGE",
|
|
93
94
|
PEDI = "PEDI",
|
|
94
95
|
PHON = "PHON",
|
|
96
|
+
PHRASE = "PHRASE",
|
|
95
97
|
PLAC = "PLAC",
|
|
96
98
|
POST = "POST",
|
|
97
99
|
PROB = "PROB",
|
|
@@ -114,6 +116,7 @@ export declare enum Identifier {
|
|
|
114
116
|
SOUR = "SOUR",
|
|
115
117
|
SPFX = "SPFX",
|
|
116
118
|
SSN = "SSN",
|
|
119
|
+
SDATE = "SDATE",
|
|
117
120
|
STAE = "STAE",
|
|
118
121
|
STAT = "STAT",
|
|
119
122
|
SUBM = "SUBM",
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { IndiGedcomSubLine } from "./IndiGedcomSubLine";
|
|
2
|
+
/**
|
|
3
|
+
* Attribut individuel de niveau 1 (`FACT`, `DSCR`, `CAST`, …) avec sous-structures conservées.
|
|
4
|
+
*/
|
|
5
|
+
export declare class IndiAttribute {
|
|
6
|
+
tag: string;
|
|
7
|
+
value: string;
|
|
8
|
+
children: IndiGedcomSubLine[];
|
|
9
|
+
constructor(tag: string, value: string, children?: IndiGedcomSubLine[]);
|
|
10
|
+
toGedcom(lineEnding: string): string;
|
|
11
|
+
}
|
|
@@ -1,8 +1,19 @@
|
|
|
1
1
|
export declare class MultimediaFile {
|
|
2
2
|
relativePath: string;
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
/** Fichier local ; peut être absent si seulement {@link sourceUri} ou {@link objeXrefId}. */
|
|
4
|
+
file?: File;
|
|
5
|
+
/**
|
|
6
|
+
* URI ou chemin pour `FILE` en GEDCOM 7 sans binaire embarqué (export `.ged`, média hors zip).
|
|
7
|
+
*/
|
|
8
|
+
sourceUri?: string | null;
|
|
9
|
+
/**
|
|
10
|
+
* Référence `OBJE` (`@O{n}@`) : exporte `1 OBJE` / `2 OBJE` + enregistrement `0 @O{n}@ OBJE` si {@link sourceUri} est défini.
|
|
11
|
+
*/
|
|
12
|
+
objeXrefId?: number | null;
|
|
13
|
+
constructor(file?: File, sourceUri?: string | null, objeXrefId?: number | null);
|
|
5
14
|
get filename(): string;
|
|
15
|
+
/** Peut être sérialisé en GEDCOM (fichier local, URI, ou pointeur OBJE). */
|
|
16
|
+
hasExportablePayload(): boolean;
|
|
6
17
|
}
|
|
7
18
|
export declare class MultimediaFiles {
|
|
8
19
|
/** Répertoire logique (sans slash final), ex. `1` ou `1/BIRT`. */
|
package/dist/commons/Person.d.ts
CHANGED
|
@@ -1,10 +1,23 @@
|
|
|
1
1
|
import { Acts } from './Act';
|
|
2
|
+
import { IndiAttribute } from "./IndiAttribute";
|
|
2
3
|
import { MultimediaFile, MultimediaFiles } from "./MultimediaFile";
|
|
3
4
|
import { Notes } from "./Note";
|
|
5
|
+
import { PersonNameVariant } from "./PersonNameVariant";
|
|
4
6
|
export declare enum Sex {
|
|
5
7
|
M = "M",
|
|
6
|
-
F = "F"
|
|
8
|
+
F = "F",
|
|
9
|
+
/** GEDCOM 7 « sexe inconnu ». */
|
|
10
|
+
U = "U",
|
|
11
|
+
/** GEDCOM 7 « non binaire » / intersexe selon fichier source. */
|
|
12
|
+
X = "X"
|
|
7
13
|
}
|
|
14
|
+
export type PersonGedcomImportOptions = {
|
|
15
|
+
famPointerToId?: ReadonlyMap<string, number>;
|
|
16
|
+
notePointerToId?: ReadonlyMap<string, number>;
|
|
17
|
+
objePayloadById?: ReadonlyMap<number, {
|
|
18
|
+
sourceUri: string;
|
|
19
|
+
}>;
|
|
20
|
+
};
|
|
8
21
|
export declare class Person {
|
|
9
22
|
sosa: number | undefined;
|
|
10
23
|
INDI: number;
|
|
@@ -17,16 +30,21 @@ export declare class Person {
|
|
|
17
30
|
multimediaFiles: MultimediaFiles;
|
|
18
31
|
acts: Acts;
|
|
19
32
|
notes: Notes;
|
|
33
|
+
/** Tous les blocs `1 NAME` (alias, traductions, etc.) ; vide si seulement le couple prénom/nom classique. */
|
|
34
|
+
nameVariants: PersonNameVariant[];
|
|
35
|
+
/** Attributs de niveau 1 (`FACT`, `DSCR`, …) avec sous-structures conservées. */
|
|
36
|
+
attributes: IndiAttribute[];
|
|
20
37
|
get files(): MultimediaFile[];
|
|
21
38
|
get keysFiles(): string[];
|
|
22
|
-
constructor(sosa?: number, SEX?: Sex, firstnames?: Array<string>, lastname?: string, FAMC?: number, FAMS?: number[], INDI?: number, multimediaFiles?: MultimediaFiles, newMultimediaFiles?: Map<string, MultimediaFile>, acts?: Acts);
|
|
23
|
-
createPersonJson(personLines: string[], informationFamilies?: Map<number, string[]>, mapFiles?: Map<string, File>, globalNotes?: Map<number, string[]
|
|
39
|
+
constructor(sosa?: number, SEX?: Sex, firstnames?: Array<string>, lastname?: string, FAMC?: number, FAMS?: number[], INDI?: number, multimediaFiles?: MultimediaFiles, newMultimediaFiles?: Map<string, MultimediaFile>, acts?: Acts, nameVariants?: PersonNameVariant[], attributes?: IndiAttribute[]);
|
|
40
|
+
createPersonJson(personLines: string[], informationFamilies?: Map<number, string[]>, mapFiles?: Map<string, File>, globalNotes?: Map<number, string[]>, textualIndiXrefToIndi?: ReadonlyMap<string, number>, importOptions?: PersonGedcomImportOptions): void;
|
|
24
41
|
private parsePersonLine;
|
|
25
42
|
private createIndiFromZeroLine;
|
|
26
43
|
private createSexFromValue;
|
|
27
44
|
private createFAMCFromValue;
|
|
28
45
|
private createFAMSFromValue;
|
|
29
46
|
private createMultimediaFilesFromValue;
|
|
47
|
+
private createMultimediaFromObjePointer;
|
|
30
48
|
private addNoteFromGedcom;
|
|
31
49
|
/**
|
|
32
50
|
* Média au niveau individu (hors acte) : chemin logique `{INDI}/{nomFichier}`.
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { IndiGedcomSubLine } from "./IndiGedcomSubLine";
|
|
2
|
+
/** Traduction `2 TRAN` sous un `1 NAME` (GEDCOM 7). */
|
|
3
|
+
export declare class PersonNameTranslation {
|
|
4
|
+
payload: string;
|
|
5
|
+
lang?: string;
|
|
6
|
+
parts: IndiGedcomSubLine[];
|
|
7
|
+
constructor(payload: string, lang?: string, parts?: IndiGedcomSubLine[]);
|
|
8
|
+
toGedcom(lineEnding: string): string;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Un bloc `1 NAME` complet (type, pièces NPFX/GIVN/…, traductions).
|
|
12
|
+
* Permet un aller-retour GEDCOM sans perdre alias / traductions.
|
|
13
|
+
*/
|
|
14
|
+
export declare class PersonNameVariant {
|
|
15
|
+
payload: string;
|
|
16
|
+
type?: string;
|
|
17
|
+
parts: IndiGedcomSubLine[];
|
|
18
|
+
translations: PersonNameTranslation[];
|
|
19
|
+
constructor(payload: string, type?: string, parts?: IndiGedcomSubLine[], translations?: PersonNameTranslation[]);
|
|
20
|
+
toGedcom(lineEnding: string): string;
|
|
21
|
+
}
|
package/dist/commons/Place.d.ts
CHANGED
|
@@ -1,7 +1,26 @@
|
|
|
1
1
|
export declare class Place {
|
|
2
2
|
city: string | null;
|
|
3
|
+
/** Jurisdiction level 2 in GEDCOM 7 `PLAC` list (after city), when `FORM` is City, County, State, Country. */
|
|
4
|
+
county: string | null;
|
|
5
|
+
state: string | null;
|
|
6
|
+
country: string | null;
|
|
7
|
+
/** Texte `3 PHRASE` sous `PLAC` (GEDCOM 7). */
|
|
8
|
+
placPhrase: string | null;
|
|
3
9
|
coordinate: CoordinateGPS;
|
|
4
10
|
constructor(city?: string, coordinate?: CoordinateGPS);
|
|
11
|
+
/**
|
|
12
|
+
* Remplit les champs à partir d’une charge `PLAC` GEDCOM 7 (liste séparée par des virgules).
|
|
13
|
+
* Ordre attendu avec le `HEAD`.`PLAC`.`FORM` par défaut de l’export : City, County, State, Country.
|
|
14
|
+
*
|
|
15
|
+
* Heuristique : 1 segment → ville seule ; 2 → ville + pays (sans county/state) ;
|
|
16
|
+
* 3 → ville, county, pays (state vide) ; 4 → les quatre niveaux ; 5+ → les trois premiers niveaux
|
|
17
|
+
* puis le reste concaténé dans `country` (ex. subdivisions multiples).
|
|
18
|
+
*/
|
|
19
|
+
setFromGedcom7PlacPayload(payload: string): void;
|
|
20
|
+
/** Ajoute du texte issu d’un `3 PHRASE` sous `PLAC` (import GEDCOM 7). */
|
|
21
|
+
appendPlacPhraseFromImport(fragment: string): void;
|
|
22
|
+
/** Charge `PLAC` pour l’export GEDCOM 7 (liste `,`). */
|
|
23
|
+
toGedcom7PlacPayload(): string | null;
|
|
5
24
|
addCity(city: string): void;
|
|
6
25
|
}
|
|
7
26
|
export declare class CoordinateGPS {
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Identifier } from "./Identifier.enum";
|
|
2
|
+
/**
|
|
3
|
+
* GEDCOM 7 standard event tags: `INDIVIDUAL_EVENT_STRUCTURE` ∪ `FAMILY_EVENT_STRUCTURE`
|
|
4
|
+
* (LDS ordinances excluded).
|
|
5
|
+
*/
|
|
6
|
+
export declare const GEDCOM_7_ALL_EVENT_TAGS: readonly [Identifier.ADOP, Identifier.BAPM, Identifier.BARM, Identifier.BASM, Identifier.BIRT, Identifier.BLES, Identifier.BURI, Identifier.CENS, Identifier.CHR, Identifier.CHRA, Identifier.CONF, Identifier.CREM, Identifier.DEAT, Identifier.EMIG, Identifier.EVEN, Identifier.FCOM, Identifier.GRAD, Identifier.IMMI, Identifier.NATU, Identifier.ORDN, Identifier.PROB, Identifier.RETI, Identifier.WILL, Identifier.ANUL, Identifier.DIV, Identifier.DIVF, Identifier.ENGA, Identifier.MARB, Identifier.MARC, Identifier.MARL, Identifier.MARR, Identifier.MARS];
|
|
7
|
+
export type Gedcom7EventTag = (typeof GEDCOM_7_ALL_EVENT_TAGS)[number];
|
|
8
|
+
/** Document order when two acts have no usable sortable date (`Acts.sortByDate`). */
|
|
9
|
+
export declare const GEDCOM_7_EVENT_SORT_ORDER: readonly Gedcom7EventTag[];
|
|
10
|
+
export declare const GEDCOM_7_EVENT_TAG_SET: ReadonlySet<string>;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { Act, type TypeAct } from "../commons/Act";
|
|
2
|
+
import { DateAct } from "../commons/DateAct";
|
|
3
|
+
import { Place } from "../commons/Place";
|
|
4
|
+
/**
|
|
5
|
+
* API d’édition cohérente autour d’un {@link Act} existant (mutation in-place).
|
|
6
|
+
*/
|
|
7
|
+
export declare class ActEdit {
|
|
8
|
+
private readonly target;
|
|
9
|
+
constructor(target: Act);
|
|
10
|
+
get value(): Act;
|
|
11
|
+
setType(type: TypeAct): this;
|
|
12
|
+
setIndis(ids: readonly number[]): this;
|
|
13
|
+
setDateAct(date: DateAct | null): this;
|
|
14
|
+
setSdateAct(sdate: DateAct | null): this;
|
|
15
|
+
/** Remplace le lieu ; `null` efface le lieu attaché à l’acte. */
|
|
16
|
+
setPlace(place: Place | null): this;
|
|
17
|
+
setEvenDescription(text: string | null): this;
|
|
18
|
+
setEvenTypeLabel(label: string | null): this;
|
|
19
|
+
setEventPhrases(phrases: readonly string[]): this;
|
|
20
|
+
clearEventPhrases(): this;
|
|
21
|
+
appendEventPhrase(phrase: string): this;
|
|
22
|
+
setPreservedPrefix(lines: readonly string[]): this;
|
|
23
|
+
appendPreservedPrefixLine(line: string): this;
|
|
24
|
+
clearPreservedPrefix(): this;
|
|
25
|
+
setPreservedSuffix(lines: readonly string[]): this;
|
|
26
|
+
appendPreservedSuffixLine(line: string): this;
|
|
27
|
+
clearPreservedSuffix(): this;
|
|
28
|
+
}
|
|
29
|
+
export declare function editAct(act: Act): ActEdit;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Acts } from "../commons/Act";
|
|
2
|
+
import { ActEdit } from "./ActEdit";
|
|
3
|
+
/**
|
|
4
|
+
* API d’édition cohérente autour d’un {@link Acts}.
|
|
5
|
+
*/
|
|
6
|
+
export declare class ActsEdit {
|
|
7
|
+
private readonly target;
|
|
8
|
+
constructor(target: Acts);
|
|
9
|
+
get value(): Acts;
|
|
10
|
+
add(act: Parameters<Acts["add"]>[0]): this;
|
|
11
|
+
replaceAt(index: number, act: Parameters<Acts["updateFromIndex"]>[0]): this;
|
|
12
|
+
removeAt(index: number): this;
|
|
13
|
+
clear(): this;
|
|
14
|
+
sortByDate(): this;
|
|
15
|
+
at(index: number): ActEdit;
|
|
16
|
+
}
|
|
17
|
+
export declare function editActs(acts: Acts): ActsEdit;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { DateAct, type Day, type Month, type TypeDateActSimpleQualifier } from "../commons/DateAct";
|
|
2
|
+
/**
|
|
3
|
+
* API d’édition cohérente autour d’un {@link DateAct} existant (mutation in-place).
|
|
4
|
+
*/
|
|
5
|
+
export declare class DateActEdit {
|
|
6
|
+
private readonly target;
|
|
7
|
+
constructor(target: DateAct);
|
|
8
|
+
get value(): DateAct;
|
|
9
|
+
clear(): this;
|
|
10
|
+
/** Parse GEDCOM `DATE` / `SDATE` (même règles que `new DateAct(line)`). */
|
|
11
|
+
applyGedcomPayload(line: string): this;
|
|
12
|
+
setExactDate(year?: number, month?: Month, day?: Day): this;
|
|
13
|
+
setQualified(typeDateAct: TypeDateActSimpleQualifier, year?: number, month?: Month, day?: Day): this;
|
|
14
|
+
setBetween(start: {
|
|
15
|
+
year: number;
|
|
16
|
+
month?: Month;
|
|
17
|
+
day?: Day;
|
|
18
|
+
}, end: {
|
|
19
|
+
year: number;
|
|
20
|
+
month?: Month;
|
|
21
|
+
day?: Day;
|
|
22
|
+
}): this;
|
|
23
|
+
setFromTo(start: {
|
|
24
|
+
year: number;
|
|
25
|
+
month?: Month;
|
|
26
|
+
day?: Day;
|
|
27
|
+
}, end: {
|
|
28
|
+
year: number;
|
|
29
|
+
month?: Month;
|
|
30
|
+
day?: Day;
|
|
31
|
+
}): this;
|
|
32
|
+
setTime(value: string | null): this;
|
|
33
|
+
setDatePhrase(value: string | null): this;
|
|
34
|
+
appendDatePhrase(fragment: string): this;
|
|
35
|
+
setVerbatimPayload(value: string | null): this;
|
|
36
|
+
}
|
|
37
|
+
export declare function editDateAct(date: DateAct): DateActEdit;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Note, Notes } from "../commons/Note";
|
|
2
|
+
/**
|
|
3
|
+
* API d’édition cohérente autour d'un {@link Notes}.
|
|
4
|
+
*/
|
|
5
|
+
export declare class NotesEdit {
|
|
6
|
+
private readonly target;
|
|
7
|
+
constructor(target: Notes);
|
|
8
|
+
get value(): Notes;
|
|
9
|
+
add(note: Note): this;
|
|
10
|
+
replaceAt(index: number, note: Note): this;
|
|
11
|
+
removeAt(index: number): this;
|
|
12
|
+
clear(): this;
|
|
13
|
+
}
|
|
14
|
+
export declare function editNotes(notes: Notes): NotesEdit;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { IndiAttribute } from "../commons/IndiAttribute";
|
|
2
|
+
import { Person, Sex } from "../commons/Person";
|
|
3
|
+
import type { PersonNameVariant } from "../commons/PersonNameVariant";
|
|
4
|
+
import { ActsEdit } from "./ActsEdit";
|
|
5
|
+
import { NotesEdit } from "./NotesEdit";
|
|
6
|
+
/**
|
|
7
|
+
* API d’édition cohérente autour d'un {@link Person} existant (identité, unions, actes, notes).
|
|
8
|
+
*/
|
|
9
|
+
export declare class PersonEdit {
|
|
10
|
+
private readonly target;
|
|
11
|
+
constructor(target: Person);
|
|
12
|
+
get value(): Person;
|
|
13
|
+
setSex(sex: Sex | undefined): this;
|
|
14
|
+
setLastname(lastname: string): this;
|
|
15
|
+
setFirstnames(firstnames: readonly string[]): this;
|
|
16
|
+
setSosa(sosa: number | undefined): this;
|
|
17
|
+
setFamc(famc: number | undefined): this;
|
|
18
|
+
/** Remplace la liste des unions (`FAMS`). */
|
|
19
|
+
setFams(fams: readonly number[]): this;
|
|
20
|
+
clearFams(): this;
|
|
21
|
+
appendFams(famId: number): this;
|
|
22
|
+
setNameVariants(variants: readonly PersonNameVariant[]): this;
|
|
23
|
+
setAttributes(attrs: readonly IndiAttribute[]): this;
|
|
24
|
+
acts(): ActsEdit;
|
|
25
|
+
notes(): NotesEdit;
|
|
26
|
+
}
|
|
27
|
+
export declare function editPerson(person: Person): PersonEdit;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { CoordinateGPS, Place } from "../commons/Place";
|
|
2
|
+
/**
|
|
3
|
+
* API d’édition cohérente autour d’un {@link Place} existant.
|
|
4
|
+
*/
|
|
5
|
+
export declare class PlaceEdit {
|
|
6
|
+
private readonly target;
|
|
7
|
+
constructor(target: Place);
|
|
8
|
+
get value(): Place;
|
|
9
|
+
setFromGedcom7Payload(payload: string): this;
|
|
10
|
+
setCity(city: string | null): this;
|
|
11
|
+
setCounty(county: string | null): this;
|
|
12
|
+
setState(state: string | null): this;
|
|
13
|
+
setCountry(country: string | null): this;
|
|
14
|
+
setPlacPhrase(phrase: string | null): this;
|
|
15
|
+
appendPlacPhrase(fragment: string): this;
|
|
16
|
+
clearPlacPhrase(): this;
|
|
17
|
+
setCoordinates(latitude: number, longitude: number): this;
|
|
18
|
+
clearCoordinates(): this;
|
|
19
|
+
/** Remplace le bloc coordonnées (ex. nouveau `CoordinateGPS`). */
|
|
20
|
+
replaceCoordinateModel(coordinate: CoordinateGPS): this;
|
|
21
|
+
clearStructured(): this;
|
|
22
|
+
}
|
|
23
|
+
export declare function editPlace(place: Place): PlaceEdit;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Couche d’édition cohérente (chaînage `this`, noms `set*` / `clear*` / `append*`) sur le modèle existant.
|
|
3
|
+
*
|
|
4
|
+
* @example
|
|
5
|
+
* ```ts
|
|
6
|
+
* import { editPerson, editDateAct } from "gedcom-ts";
|
|
7
|
+
* editPerson(person)
|
|
8
|
+
* .setLastname("Dupont")
|
|
9
|
+
* .acts()
|
|
10
|
+
* .at(0)
|
|
11
|
+
* .setDateAct(new DateAct("1 JAN 1900"));
|
|
12
|
+
* ```
|
|
13
|
+
*/
|
|
14
|
+
export { ActEdit, editAct } from "./ActEdit";
|
|
15
|
+
export { ActsEdit, editActs } from "./ActsEdit";
|
|
16
|
+
export { DateActEdit, editDateAct } from "./DateActEdit";
|
|
17
|
+
export { NotesEdit, editNotes } from "./NotesEdit";
|
|
18
|
+
export { PersonEdit, editPerson } from "./PersonEdit";
|
|
19
|
+
export { PlaceEdit, editPlace } from "./PlaceEdit";
|
package/dist/export/GEDCOM.d.ts
CHANGED
|
@@ -1,16 +1,42 @@
|
|
|
1
1
|
import { Person } from '../commons/Person';
|
|
2
|
+
/** Options d’export `.ged` / `.zip` (round-trip partiel avec {@link ReadGed.preservedTopLevelRecords}). */
|
|
3
|
+
export type GedcomExportOptions = {
|
|
4
|
+
/** Blocs `0 …` à recoller avant `SUBM` / `TRLR` (ex. `readGed.preservedTopLevelRecords`). */
|
|
5
|
+
extraTopLevelRecords?: readonly string[] | null;
|
|
6
|
+
/** Balise BCP 47 pour `1 LANG` sous `HEAD` (défaut `en-US`). */
|
|
7
|
+
headLanguageTag?: string | null;
|
|
8
|
+
/** Texte `1 COPR` sous `HEAD` (copyright / mention légale), une ligne logique. */
|
|
9
|
+
headCopyright?: string | null;
|
|
10
|
+
/**
|
|
11
|
+
* Définitions d’extensions `HEAD`.`SCHMA` (`2 TAG …`), ex. `{ tag: "_FOO", uri: "https://…" }`.
|
|
12
|
+
* Les tags sont émis tels quels (GEDCOM 7 : souvent préfixe `_`).
|
|
13
|
+
*/
|
|
14
|
+
headSchemaTagDefs?: readonly {
|
|
15
|
+
readonly tag: string;
|
|
16
|
+
readonly uri: string;
|
|
17
|
+
}[] | null;
|
|
18
|
+
/**
|
|
19
|
+
* Valeur `1 DEST` sous `HEAD` (URI ou identifiant d’application cible, ex. `https://gedcom.io/`).
|
|
20
|
+
*/
|
|
21
|
+
headDestination?: string | null;
|
|
22
|
+
};
|
|
2
23
|
declare class GEDCOM {
|
|
3
24
|
protected title: string;
|
|
4
25
|
protected persons: Array<Person>;
|
|
5
26
|
protected onCreate: number;
|
|
6
27
|
private haveFiles;
|
|
7
|
-
|
|
28
|
+
private readonly exportOptions;
|
|
29
|
+
constructor(title: string | undefined, persons: Array<Person>, haveFiles: boolean, exportOptions?: GedcomExportOptions | null);
|
|
8
30
|
private get beginGedcom();
|
|
31
|
+
private get defaultSubmitterRecord();
|
|
32
|
+
/** Enregistrements `OBJE` pour les médias avec {@link MultimediaFile.objeXrefId} et {@link MultimediaFile.sourceUri}. */
|
|
33
|
+
private collectObjeRecords;
|
|
34
|
+
private joinExtraTopLevelRecords;
|
|
9
35
|
private get contentGedcom();
|
|
10
36
|
gedcomBlob(): Blob;
|
|
11
37
|
}
|
|
12
38
|
export declare class ExportGedzipFile extends GEDCOM {
|
|
13
|
-
constructor(...args: [
|
|
39
|
+
constructor(...args: [Person[]] | [string, Person[]] | [Person[], GedcomExportOptions] | [string, Person[], GedcomExportOptions]);
|
|
14
40
|
download(): Promise<void>;
|
|
15
41
|
private resolvePersonIndi;
|
|
16
42
|
private resolveActIndis;
|
|
@@ -18,7 +44,7 @@ export declare class ExportGedzipFile extends GEDCOM {
|
|
|
18
44
|
private zipFile;
|
|
19
45
|
}
|
|
20
46
|
export declare class ExportGedcomFile extends GEDCOM {
|
|
21
|
-
constructor(...args: [
|
|
47
|
+
constructor(...args: [Person[]] | [string, Person[]] | [Person[], GedcomExportOptions] | [string, Person[], GedcomExportOptions]);
|
|
22
48
|
download(): void;
|
|
23
49
|
}
|
|
24
50
|
export declare class FamilyLine {
|
|
@@ -31,17 +57,20 @@ export declare class PersonLine {
|
|
|
31
57
|
private readonly INDI;
|
|
32
58
|
private readonly NAME;
|
|
33
59
|
private readonly SEX;
|
|
60
|
+
private readonly ATTRS;
|
|
34
61
|
private readonly FAMS;
|
|
35
62
|
private readonly FAMC;
|
|
36
63
|
private readonly FILES;
|
|
37
64
|
private readonly ACTS;
|
|
38
65
|
private readonly NOTES;
|
|
66
|
+
private readonly haveFiles;
|
|
39
67
|
constructor(person: Person, haveFiles: boolean);
|
|
40
68
|
line(): string;
|
|
41
69
|
private getIndi;
|
|
42
70
|
private getName;
|
|
71
|
+
private getIndiAttributes;
|
|
43
72
|
private getSex;
|
|
44
|
-
private
|
|
73
|
+
private buildPersonMultimediaLines;
|
|
45
74
|
private getFams;
|
|
46
75
|
private getFamc;
|
|
47
76
|
}
|
|
@@ -1,2 +1,16 @@
|
|
|
1
1
|
import { ReadGed } from './ReadGed';
|
|
2
|
+
import type { Place } from '../commons/Place';
|
|
3
|
+
/**
|
|
4
|
+
* Erreur levée quand une entrée `.ged` dans un ZIP ne se décode pas comme du GEDCOM valide
|
|
5
|
+
* (en-tête `0 HEAD` absent au début). Cause la plus fréquente : **ZIP chiffré** (mot de passe),
|
|
6
|
+
* non pris en charge par le décompresseur utilisé ici.
|
|
7
|
+
*
|
|
8
|
+
* Les applications peuvent comparer `error.message === IMPORT_ERR_ZIP_GED_UNREADABLE`.
|
|
9
|
+
*/
|
|
10
|
+
export declare const IMPORT_ERR_ZIP_GED_UNREADABLE = "ZIP chiffr\u00E9 (mot de passe) ou .ged illisible dans l\u2019archive : extrayez le fichier .ged avec votre explorateur ou utilitaire ZIP, puis importez uniquement ce .ged. L\u2019import direct des archives prot\u00E9g\u00E9es par mot de passe n\u2019est pas pris en charge.";
|
|
11
|
+
/** Same as {@link ReadGed.empty}; use when starting a tree without a `.ged` / `.zip` import. */
|
|
12
|
+
export declare const createEmptyReadGed: (options?: {
|
|
13
|
+
mapFiles?: Map<string, File>;
|
|
14
|
+
placesMap?: Map<string, Place>;
|
|
15
|
+
}) => ReadGed;
|
|
2
16
|
export declare const importGedFile: (file: File) => Promise<ReadGed>;
|