gedcom-ts 2.0.1 → 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.
Files changed (39) hide show
  1. package/CHANGELOG.md +222 -0
  2. package/README.md +373 -92
  3. package/dist/commons/Act.d.ts +43 -6
  4. package/dist/commons/DateAct.d.ts +75 -0
  5. package/dist/commons/Identificator.enum.d.ts +5 -131
  6. package/dist/commons/Identifier.enum.d.ts +134 -0
  7. package/dist/commons/IndiAttribute.d.ts +11 -0
  8. package/dist/commons/IndiGedcomSubLine.d.ts +6 -0
  9. package/dist/commons/MultimediaFile.d.ts +13 -2
  10. package/dist/commons/Note.d.ts +2 -2
  11. package/dist/commons/Person.d.ts +21 -3
  12. package/dist/commons/PersonNameVariant.d.ts +21 -0
  13. package/dist/commons/Place.d.ts +19 -0
  14. package/dist/commons/gedcomEventTags.d.ts +10 -0
  15. package/dist/edit/ActEdit.d.ts +29 -0
  16. package/dist/edit/ActsEdit.d.ts +17 -0
  17. package/dist/edit/DateActEdit.d.ts +37 -0
  18. package/dist/edit/NotesEdit.d.ts +14 -0
  19. package/dist/edit/PersonEdit.d.ts +27 -0
  20. package/dist/edit/PlaceEdit.d.ts +23 -0
  21. package/dist/edit/index.d.ts +19 -0
  22. package/dist/export/GEDCOM.d.ts +33 -7
  23. package/dist/import/LoadFile.d.ts +14 -0
  24. package/dist/import/ReadGed.d.ts +48 -0
  25. package/dist/import/SplitedInformations.d.ts +29 -3
  26. package/dist/index.cjs +1 -1
  27. package/dist/index.d.ts +25 -9
  28. package/dist/index.mjs +1 -1
  29. package/dist/utils/gedcom/actExtraction.d.ts +8 -0
  30. package/dist/utils/gedcom/datasetVersion.d.ts +7 -0
  31. package/dist/utils/gedcom/extractIndiNamesAndAttributes.d.ts +4 -0
  32. package/dist/utils/gedcom/labelKeyedRecords.d.ts +13 -0
  33. package/dist/utils/gedcom/mediaFormFromUri.d.ts +2 -0
  34. package/dist/utils/gedcom/parseStandaloneObje.d.ts +9 -0
  35. package/dist/utils/gedcom/personName.d.ts +13 -0
  36. package/dist/utils/gedcom/pointers.d.ts +19 -0
  37. package/dist/utils/multimedia/collectRelativeMediaPaths.d.ts +2 -0
  38. package/dist/version.d.ts +6 -0
  39. package/package.json +4 -3
@@ -1,20 +1,46 @@
1
1
  import { DateAct } from "./DateAct";
2
2
  import { Place } from "./Place";
3
- import { Identificator } from "./Identificator.enum";
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 = Identificator.BIRT | Identificator.DEAT | Identificator.MARR;
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,8 +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;
67
+ private hasSortableDate;
68
+ private compareByTypeOrder;
69
+ private compareMarriageAndDivorce;
70
+ private haveSameParticipants;
37
71
  }
38
72
  export declare class ActsByExtraction extends Acts {
39
- extractActsInfo(lines: string[], INDIS: number[], mapFiles: Map<string, File>): void;
73
+ extractActsInfo(lines: string[], INDIS: number[], mapFiles: Map<string, File>, objePayloadById?: ReadonlyMap<number, {
74
+ sourceUri: string;
75
+ }>, textualIndiXrefToIndi?: ReadonlyMap<string, number>): void;
40
76
  private convertToActs;
77
+ private resolveTypeAct;
41
78
  }
@@ -1,8 +1,19 @@
1
1
  export declare enum TypeDateAct {
2
2
  BEF = "BEF",
3
3
  ABT = "ABT",
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",
11
+ BET = "BET",
12
+ FROM = "FROM",
4
13
  NULL = "NULL"
5
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;
6
17
  export declare enum MonthEnum {
7
18
  JAN = "JAN",
8
19
  FEB = "FEB",
@@ -26,9 +37,73 @@ export declare class DateAct {
26
37
  day?: Day;
27
38
  month?: Month;
28
39
  year?: number;
40
+ endDay?: Day;
41
+ endMonth?: Month;
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;
29
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;
30
58
  get date(): string | null;
59
+ /** Sous-ligne `3 TIME` (import GEDCOM 7). */
60
+ setDateTimeFromImport(fragment: string): void;
61
+ updateExactDate(year?: number, month?: Month, day?: Day): void;
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;
65
+ updateBetweenDates(start: {
66
+ year: number;
67
+ month?: Month;
68
+ day?: Day;
69
+ }, end: {
70
+ year: number;
71
+ month?: Month;
72
+ day?: Day;
73
+ }): void;
74
+ updateFromToDates(start: {
75
+ year: number;
76
+ month?: Month;
77
+ day?: Day;
78
+ }, end: {
79
+ year: number;
80
+ month?: Month;
81
+ day?: Day;
82
+ }): void;
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;
31
94
  private convertMonth;
95
+ private parseSinglePart;
96
+ private parseTwoParts;
97
+ private parseThreeParts;
98
+ private parseFourParts;
99
+ private tryConsumeMonthYearSlash;
100
+ private parseMonthToken;
101
+ private formatCoreDate;
102
+ private tryParseRangeDate;
103
+ private parseCoreDateValue;
104
+ private isRelativeType;
105
+ /** Retire les préfixes de calendrier GEDCOM (`@#DGREGORIAN@`, … — forme `@#NAME@`). */
106
+ private stripCalendarPrefixes;
32
107
  isValid(): boolean;
33
108
  }
34
109
  export declare const dateToDateLine: (year?: number, month?: Month, day?: Day) => string;
@@ -1,131 +1,5 @@
1
- export declare enum Identificator {
2
- ABBR = "ABBR",
3
- ADDR = "ADDR",
4
- ADR1 = "ADDR1",
5
- ADR2 = "ADDR2",
6
- ADOP = "ADOP",
7
- AFN = "AFN",
8
- AGE = "AGE",
9
- AGNC = "AGNC",
10
- ALIA = "ALIA",
11
- ANCE = "ANCE",
12
- ANCI = "ANCI",
13
- ANUL = "ANUL",
14
- ASSO = "ASSO",
15
- AUTH = "AUTH",
16
- BAPL = "BAPL",
17
- BAPM = "BAPM",
18
- BARM = "BARM",
19
- BASM = "BASM",
20
- BIRT = "BIRT",
21
- BLES = "BLES",
22
- BLOB = "BLOB",
23
- BURI = "BURI",
24
- CALN = "CALN",
25
- CAST = "CAST",
26
- CAUS = "CAUS",
27
- CENS = "CENS",
28
- CHAN = "CHAN",
29
- CHAR = "CHAR",
30
- CHIL = "CHIL",
31
- CHR = "CHR",
32
- CHRA = "CHRA",
33
- CITY = "CITY",
34
- CONC = "CONC",
35
- CONF = "CONF",
36
- CONL = "CONL",
37
- CONT = "CONT",
38
- COPR = "COPR",
39
- CORP = "CORP",
40
- CREM = "CREM",
41
- CTRY = "CTRY",
42
- DATA = "DATA",
43
- DATE = "DATE",
44
- DEAT = "DEAT",
45
- DESC = "DESC",
46
- DESI = "DESI",
47
- DEST = "DEST",
48
- DIV = "DIV",
49
- DIVF = "DIVF",
50
- DSCR = "DSCR",
51
- EDUC = "EDUC",
52
- EMIG = "EMIG",
53
- ENDL = "ENDL",
54
- ENGA = "ENGA",
55
- EVEN = "EVEN",
56
- FAM = "FAM",
57
- FAMC = "FAMC",
58
- FAMF = "FAMF",
59
- FAMS = "FAMS",
60
- FCOM = "FCOM",
61
- FILE = "FILE",
62
- FORM = "FORM",
63
- GEDC = "GEDC",
64
- GIVN = "GIVN",
65
- GRAD = "GRAD",
66
- HEAD = "HEAD",
67
- HUSB = "HUSB",
68
- IDNO = "IDNO",
69
- IMMI = "IMMI",
70
- INDI = "INDI",
71
- LANG = "LANG",
72
- LEGA = "LEGA",
73
- MARB = "MARB",
74
- MARC = "MARC",
75
- MARL = "MARL",
76
- MARR = "MARR",
77
- MARS = "MARS",
78
- MEDI = "MEDI",
79
- NAME = "NAME",
80
- NATI = "NATI",
81
- NATU = "NATU",
82
- NCHI = "NCHI",
83
- NICK = "NICK",
84
- NMR = "NMR",
85
- NOTE = "NOTE",
86
- NPFX = "NPFX",
87
- NSFX = "NSFX",
88
- OBJE = "OBJE",
89
- OCCU = "OCCU",
90
- ORDI = "ORDI",
91
- ORDN = "ORDN",
92
- PAGE = "PAGE",
93
- PEDI = "PEDI",
94
- PHON = "PHON",
95
- PLAC = "PLAC",
96
- POST = "POST",
97
- PROB = "PROB",
98
- PROP = "PROP",
99
- PUBL = "PUBL",
100
- QUAY = "QUAY",
101
- REFN = "REFN",
102
- RELA = "RELA",
103
- RELI = "RELI",
104
- REPO = "REPO",
105
- RESI = "RESI",
106
- RESN = "RESN",
107
- RETI = "RETI",
108
- RFN = "RFN",
109
- RIN = "RIN",
110
- ROLE = "ROLE",
111
- SEX = "SEX",
112
- SLGC = "SLGC",
113
- SLGS = "SLGS",
114
- SOUR = "SOUR",
115
- SPFX = "SPFX",
116
- SSN = "SSN",
117
- STAE = "STAE",
118
- STAT = "STAT",
119
- SUBM = "SUBM",
120
- SUBN = "SUBN",
121
- SURN = "SURN",
122
- TEMP = "TEMP",
123
- TEXT = "TEXT",
124
- TIME = "TIME",
125
- TITL = "TITL",
126
- TRLR = "TRLR",
127
- TYPE = "TYPE",
128
- VERS = "VERS",
129
- WIFE = "WIFE",
130
- WILL = "WILL"
131
- }
1
+ import { Identifier } from "./Identifier.enum";
2
+ /**
3
+ * @deprecated Use `Identifier` instead.
4
+ */
5
+ export declare const Identificator: typeof Identifier;
@@ -0,0 +1,134 @@
1
+ export declare enum Identifier {
2
+ ABBR = "ABBR",
3
+ ADDR = "ADDR",
4
+ ADR1 = "ADR1",
5
+ ADR2 = "ADR2",
6
+ ADOP = "ADOP",
7
+ AFN = "AFN",
8
+ AGE = "AGE",
9
+ AGNC = "AGNC",
10
+ ALIA = "ALIA",
11
+ ANCE = "ANCE",
12
+ ANCI = "ANCI",
13
+ ANUL = "ANUL",
14
+ ASSO = "ASSO",
15
+ AUTH = "AUTH",
16
+ BAPL = "BAPL",
17
+ BAPM = "BAPM",
18
+ BARM = "BARM",
19
+ BASM = "BASM",
20
+ BIRT = "BIRT",
21
+ BLES = "BLES",
22
+ BLOB = "BLOB",
23
+ BURI = "BURI",
24
+ CALN = "CALN",
25
+ CAST = "CAST",
26
+ CAUS = "CAUS",
27
+ CENS = "CENS",
28
+ CHAN = "CHAN",
29
+ CHAR = "CHAR",
30
+ CHIL = "CHIL",
31
+ CHR = "CHR",
32
+ CHRA = "CHRA",
33
+ CITY = "CITY",
34
+ CONC = "CONC",
35
+ CONF = "CONF",
36
+ CONL = "CONL",
37
+ CONT = "CONT",
38
+ COPR = "COPR",
39
+ CORP = "CORP",
40
+ CREM = "CREM",
41
+ CTRY = "CTRY",
42
+ DATA = "DATA",
43
+ DATE = "DATE",
44
+ DEAT = "DEAT",
45
+ DESC = "DESC",
46
+ DESI = "DESI",
47
+ DEST = "DEST",
48
+ DIV = "DIV",
49
+ DIVF = "DIVF",
50
+ DSCR = "DSCR",
51
+ EDUC = "EDUC",
52
+ EMIG = "EMIG",
53
+ ENDL = "ENDL",
54
+ ENGA = "ENGA",
55
+ EVEN = "EVEN",
56
+ FAM = "FAM",
57
+ FAMC = "FAMC",
58
+ FAMF = "FAMF",
59
+ FAMS = "FAMS",
60
+ FCOM = "FCOM",
61
+ FACT = "FACT",
62
+ FILE = "FILE",
63
+ FORM = "FORM",
64
+ GEDC = "GEDC",
65
+ GIVN = "GIVN",
66
+ GRAD = "GRAD",
67
+ HEAD = "HEAD",
68
+ HUSB = "HUSB",
69
+ IDNO = "IDNO",
70
+ IMMI = "IMMI",
71
+ INDI = "INDI",
72
+ LANG = "LANG",
73
+ LEGA = "LEGA",
74
+ MARB = "MARB",
75
+ MARC = "MARC",
76
+ MARL = "MARL",
77
+ MARR = "MARR",
78
+ MARS = "MARS",
79
+ MEDI = "MEDI",
80
+ NAME = "NAME",
81
+ NATI = "NATI",
82
+ NATU = "NATU",
83
+ NCHI = "NCHI",
84
+ NICK = "NICK",
85
+ NMR = "NMR",
86
+ NOTE = "NOTE",
87
+ NPFX = "NPFX",
88
+ NSFX = "NSFX",
89
+ OBJE = "OBJE",
90
+ OCCU = "OCCU",
91
+ ORDI = "ORDI",
92
+ ORDN = "ORDN",
93
+ PAGE = "PAGE",
94
+ PEDI = "PEDI",
95
+ PHON = "PHON",
96
+ PHRASE = "PHRASE",
97
+ PLAC = "PLAC",
98
+ POST = "POST",
99
+ PROB = "PROB",
100
+ PROP = "PROP",
101
+ PUBL = "PUBL",
102
+ QUAY = "QUAY",
103
+ REFN = "REFN",
104
+ RELA = "RELA",
105
+ RELI = "RELI",
106
+ REPO = "REPO",
107
+ RESI = "RESI",
108
+ RESN = "RESN",
109
+ RETI = "RETI",
110
+ RFN = "RFN",
111
+ RIN = "RIN",
112
+ ROLE = "ROLE",
113
+ SEX = "SEX",
114
+ SLGC = "SLGC",
115
+ SLGS = "SLGS",
116
+ SOUR = "SOUR",
117
+ SPFX = "SPFX",
118
+ SSN = "SSN",
119
+ SDATE = "SDATE",
120
+ STAE = "STAE",
121
+ STAT = "STAT",
122
+ SUBM = "SUBM",
123
+ SUBN = "SUBN",
124
+ SURN = "SURN",
125
+ TEMP = "TEMP",
126
+ TEXT = "TEXT",
127
+ TIME = "TIME",
128
+ TITL = "TITL",
129
+ TRLR = "TRLR",
130
+ TYPE = "TYPE",
131
+ VERS = "VERS",
132
+ WIFE = "WIFE",
133
+ WILL = "WILL"
134
+ }
@@ -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
+ }
@@ -0,0 +1,6 @@
1
+ /** Sous-structure sous un `1 NAME` (niveau ≥ 2) ou sous un attribut individuel (niveau ≥ 2). */
2
+ export type IndiGedcomSubLine = {
3
+ level: string;
4
+ tag: string;
5
+ value: string;
6
+ };
@@ -1,8 +1,19 @@
1
1
  export declare class MultimediaFile {
2
2
  relativePath: string;
3
- file: File;
4
- constructor(file?: File);
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`. */
@@ -1,5 +1,5 @@
1
- import { Identificator } from "./Identificator.enum";
2
- export type TypeNote = Identificator.CONC | Identificator.CONT | undefined;
1
+ import { Identifier } from "./Identifier.enum";
2
+ export type TypeNote = Identifier.CONC | Identifier.CONT | undefined;
3
3
  export declare class Note {
4
4
  INDIS: number[];
5
5
  type: TypeNote;
@@ -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[]>): void;
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
+ }
@@ -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;