gedcom-ts 2.0.2 → 2026.5.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 (56) hide show
  1. package/CHANGELOG.md +175 -0
  2. package/README.md +460 -88
  3. package/dist/commons/Act.d.ts +46 -7
  4. package/dist/commons/DateAct.d.ts +40 -2
  5. package/dist/commons/Identifier.enum.d.ts +3 -0
  6. package/dist/commons/IndiAttribute.d.ts +11 -0
  7. package/dist/commons/IndiGedcomSubLine.d.ts +6 -0
  8. package/dist/commons/MultimediaFile.d.ts +13 -2
  9. package/dist/commons/Person.d.ts +27 -4
  10. package/dist/commons/PersonNameVariant.d.ts +21 -0
  11. package/dist/commons/Place.d.ts +19 -0
  12. package/dist/commons/clonePrimitives.d.ts +17 -0
  13. package/dist/commons/gedcomEventTags.d.ts +17 -0
  14. package/dist/dataset/ReadGedEdit.d.ts +27 -0
  15. package/dist/dataset/cloneModels.d.ts +8 -0
  16. package/dist/dataset/graphOps.d.ts +29 -0
  17. package/dist/dataset/index.d.ts +9 -0
  18. package/dist/dataset/readGedCommands.d.ts +46 -0
  19. package/dist/dataset/readGedMutations.d.ts +12 -0
  20. package/dist/dataset/validation.d.ts +36 -0
  21. package/dist/edit/ActEdit.d.ts +37 -0
  22. package/dist/edit/ActMediaEdit.d.ts +21 -0
  23. package/dist/edit/ActsEdit.d.ts +34 -0
  24. package/dist/edit/DateActEdit.d.ts +37 -0
  25. package/dist/edit/GedcomExportOptionsEdit.d.ts +20 -0
  26. package/dist/edit/IndiAttributesEdit.d.ts +38 -0
  27. package/dist/edit/MultimediaFileEdit.d.ts +17 -0
  28. package/dist/edit/NameVariantsEdit.d.ts +43 -0
  29. package/dist/edit/NoteEdit.d.ts +18 -0
  30. package/dist/edit/NotesEdit.d.ts +25 -0
  31. package/dist/edit/PersonEdit.d.ts +47 -0
  32. package/dist/edit/PersonMediaEdit.d.ts +27 -0
  33. package/dist/edit/PlaceEdit.d.ts +23 -0
  34. package/dist/edit/factories.d.ts +35 -0
  35. package/dist/edit/index.d.ts +33 -0
  36. package/dist/export/GEDCOM.d.ts +33 -4
  37. package/dist/import/LoadFile.d.ts +14 -0
  38. package/dist/import/PreservedRecordsBuffer.d.ts +21 -0
  39. package/dist/import/ReadGed.d.ts +49 -0
  40. package/dist/import/SplitedInformations.d.ts +35 -3
  41. package/dist/index.cjs +1 -1
  42. package/dist/index.d.ts +17 -4
  43. package/dist/index.mjs +1 -1
  44. package/dist/utils/gedcom/actExtraction.d.ts +3 -1
  45. package/dist/utils/gedcom/datasetVersion.d.ts +7 -0
  46. package/dist/utils/gedcom/extractIndiNamesAndAttributes.d.ts +4 -0
  47. package/dist/utils/gedcom/importGedcomNote.d.ts +17 -0
  48. package/dist/utils/gedcom/labelKeyedRecords.d.ts +13 -0
  49. package/dist/utils/gedcom/mediaFormFromUri.d.ts +2 -0
  50. package/dist/utils/gedcom/parseStandaloneObje.d.ts +9 -0
  51. package/dist/utils/gedcom/personName.d.ts +7 -0
  52. package/dist/utils/gedcom/pointers.d.ts +16 -0
  53. package/dist/utils/gedcom/uriBasename.d.ts +2 -0
  54. package/dist/utils/multimedia/registerTrackedMedia.d.ts +10 -0
  55. package/dist/version.d.ts +6 -0
  56. package/package.json +1 -1
@@ -0,0 +1,34 @@
1
+ import { Act, Acts, type TypeAct } from "../commons/Act";
2
+ import { ActEdit } from "./ActEdit";
3
+ import { type CreateActInit } from "./factories";
4
+ /**
5
+ * API d’édition cohérente autour d’un {@link Acts}.
6
+ */
7
+ export declare class ActsEdit {
8
+ private readonly target;
9
+ constructor(target: Acts);
10
+ get value(): Acts;
11
+ /**
12
+ * Crée un {@link Act}, l’ajoute en fin de liste et renvoie sa facade d’édition.
13
+ */
14
+ addNew(type: TypeAct, init?: CreateActInit | null): ActEdit;
15
+ add(act: Parameters<Acts["add"]>[0]): this;
16
+ /** Insère un acte existant à la position donnée (0 = début). */
17
+ insertAt(index: number, act: Act): this;
18
+ /**
19
+ * Crée un acte et l’insère à la position donnée.
20
+ */
21
+ insertNewAt(index: number, type: TypeAct, init?: CreateActInit | null): ActEdit;
22
+ /** Supprime le dernier acte s’il en existe au moins un. */
23
+ removeLast(): this;
24
+ /** Index de l’acte par identité de référence, ou `-1`. */
25
+ indexOfAct(act: Act): number;
26
+ /** Retire l’acte s’il appartient à la liste ; @returns si une entrée a été supprimée. */
27
+ removeAct(act: Act): boolean;
28
+ replaceAt(index: number, act: Parameters<Acts["updateFromIndex"]>[0]): this;
29
+ removeAt(index: number): this;
30
+ clear(): this;
31
+ sortByDate(): this;
32
+ at(index: number): ActEdit;
33
+ }
34
+ 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,20 @@
1
+ import type { GedcomExportOptions } from "../export/GEDCOM";
2
+ /**
3
+ * Mutation in-place des {@link GedcomExportOptions} (export `.ged` / `.zip`).
4
+ */
5
+ export declare class GedcomExportOptionsEdit {
6
+ private readonly target;
7
+ constructor(target: GedcomExportOptions);
8
+ get value(): GedcomExportOptions;
9
+ setExtraTopLevelRecords(lines: readonly string[] | null | undefined): this;
10
+ clearExtraTopLevelRecords(): this;
11
+ setHeadLanguageTag(tag: string | null | undefined): this;
12
+ setHeadCopyright(text: string | null | undefined): this;
13
+ setHeadDestination(dest: string | null | undefined): this;
14
+ setHeadSchemaTagDefs(defs: readonly {
15
+ readonly tag: string;
16
+ readonly uri: string;
17
+ }[] | null | undefined): this;
18
+ clearHeadSchemaTagDefs(): this;
19
+ }
20
+ export declare function editGedcomExportOptions(options: GedcomExportOptions): GedcomExportOptionsEdit;
@@ -0,0 +1,38 @@
1
+ import type { IndiGedcomSubLine } from "../commons/IndiGedcomSubLine";
2
+ import type { IndiAttribute } from "../commons/IndiAttribute";
3
+ /**
4
+ * API d’édition cohérente autour d’un {@link IndiAttribute} existant.
5
+ */
6
+ export declare class IndiAttributeEdit {
7
+ private readonly target;
8
+ constructor(target: IndiAttribute);
9
+ get value(): IndiAttribute;
10
+ setTag(tag: string): this;
11
+ setValue(value: string): this;
12
+ setChildren(children: readonly IndiGedcomSubLine[]): this;
13
+ appendChild(child: IndiGedcomSubLine): this;
14
+ clearChildren(): this;
15
+ }
16
+ export declare function editIndiAttribute(attr: IndiAttribute): IndiAttributeEdit;
17
+ /**
18
+ * Liste d’attributs individuels (`FACT`, `DSCR`, …) sur une {@link Person}.
19
+ */
20
+ export declare class IndiAttributesEdit {
21
+ private readonly target;
22
+ constructor(target: {
23
+ attributes: IndiAttribute[];
24
+ });
25
+ get value(): IndiAttribute[];
26
+ add(attr: IndiAttribute): this;
27
+ addNew(tag: string, value?: string, children?: readonly IndiGedcomSubLine[]): IndiAttributeEdit;
28
+ insertAt(index: number, attr: IndiAttribute): this;
29
+ insertNewAt(index: number, tag: string, value?: string, children?: readonly IndiGedcomSubLine[]): IndiAttributeEdit;
30
+ removeLast(): this;
31
+ replaceAt(index: number, attr: IndiAttribute): this;
32
+ removeAt(index: number): this;
33
+ clear(): this;
34
+ at(index: number): IndiAttributeEdit;
35
+ }
36
+ export declare function editIndiAttributes(person: {
37
+ attributes: IndiAttribute[];
38
+ }): IndiAttributesEdit;
@@ -0,0 +1,17 @@
1
+ import { MultimediaFile } from "../commons/MultimediaFile";
2
+ /**
3
+ * API d’édition cohérente autour d’un {@link MultimediaFile} existant.
4
+ */
5
+ export declare class MultimediaFileEdit {
6
+ private readonly target;
7
+ constructor(target: MultimediaFile);
8
+ get value(): MultimediaFile;
9
+ setRelativePath(path: string): this;
10
+ setFile(file: File | undefined): this;
11
+ clearFile(): this;
12
+ setSourceUri(uri: string | null | undefined): this;
13
+ clearSourceUri(): this;
14
+ setObjeXrefId(id: number | null | undefined): this;
15
+ clearObjeXrefId(): this;
16
+ }
17
+ export declare function editMultimediaFile(file: MultimediaFile): MultimediaFileEdit;
@@ -0,0 +1,43 @@
1
+ import type { IndiGedcomSubLine } from "../commons/IndiGedcomSubLine";
2
+ import { PersonNameTranslation, PersonNameVariant } from "../commons/PersonNameVariant";
3
+ /**
4
+ * API d’édition cohérente autour d’un {@link PersonNameVariant} existant.
5
+ */
6
+ export declare class PersonNameVariantEdit {
7
+ private readonly target;
8
+ constructor(target: PersonNameVariant);
9
+ get value(): PersonNameVariant;
10
+ setPayload(payload: string): this;
11
+ setType(type: string | null | undefined): this;
12
+ clearType(): this;
13
+ setParts(parts: readonly IndiGedcomSubLine[]): this;
14
+ appendPart(part: IndiGedcomSubLine): this;
15
+ clearParts(): this;
16
+ setTranslations(translations: readonly PersonNameTranslation[]): this;
17
+ appendTranslation(translation: PersonNameTranslation): this;
18
+ clearTranslations(): this;
19
+ }
20
+ export declare function editPersonNameVariant(variant: PersonNameVariant): PersonNameVariantEdit;
21
+ /**
22
+ * Variants `1 NAME` sur une {@link Person}.
23
+ */
24
+ export declare class NameVariantsEdit {
25
+ private readonly target;
26
+ constructor(target: {
27
+ nameVariants: PersonNameVariant[];
28
+ });
29
+ get value(): PersonNameVariant[];
30
+ add(variant: PersonNameVariant): this;
31
+ /** Ajoute un variant minimal (`1 NAME` / `2 TYPE` optionnel) et renvoie sa facade. */
32
+ addNew(payload: string, type?: string): PersonNameVariantEdit;
33
+ insertAt(index: number, variant: PersonNameVariant): this;
34
+ insertNewAt(index: number, payload: string, type?: string): PersonNameVariantEdit;
35
+ removeLast(): this;
36
+ replaceAt(index: number, variant: PersonNameVariant): this;
37
+ removeAt(index: number): this;
38
+ clear(): this;
39
+ at(index: number): PersonNameVariantEdit;
40
+ }
41
+ export declare function editNameVariants(person: {
42
+ nameVariants: PersonNameVariant[];
43
+ }): NameVariantsEdit;
@@ -0,0 +1,18 @@
1
+ import { Note, type TypeNote } from "../commons/Note";
2
+ /**
3
+ * API d’édition cohérente autour d’une {@link Note} existante (mutation in-place).
4
+ */
5
+ export declare class NoteEdit {
6
+ private readonly target;
7
+ constructor(target: Note);
8
+ get value(): Note;
9
+ setType(type: TypeNote): this;
10
+ /** Remplace le texte de la note (y compris tableau vide). */
11
+ setLines(lines: readonly string[]): this;
12
+ appendLine(line: string): this;
13
+ clearLines(): this;
14
+ setIndis(ids: readonly number[]): this;
15
+ appendIndi(indi: number): this;
16
+ clearIndis(): this;
17
+ }
18
+ export declare function editNote(note: Note): NoteEdit;
@@ -0,0 +1,25 @@
1
+ import { Note, Notes } from "../commons/Note";
2
+ import { NoteEdit } from "./NoteEdit";
3
+ /**
4
+ * API d’édition cohérente autour d'un {@link Notes}.
5
+ */
6
+ export declare class NotesEdit {
7
+ private readonly target;
8
+ constructor(target: Notes);
9
+ get value(): Notes;
10
+ /**
11
+ * Crée une {@link Note}, l’ajoute en fin de liste et renvoie sa facade d’édition.
12
+ */
13
+ addNew(initialLines?: readonly string[] | null): NoteEdit;
14
+ add(note: Note): this;
15
+ insertAt(index: number, note: Note): this;
16
+ insertNewAt(index: number, initialLines?: readonly string[] | null): NoteEdit;
17
+ removeLast(): this;
18
+ indexOfNote(note: Note): number;
19
+ removeNote(note: Note): boolean;
20
+ replaceAt(index: number, note: Note): this;
21
+ removeAt(index: number): this;
22
+ clear(): this;
23
+ at(index: number): NoteEdit;
24
+ }
25
+ export declare function editNotes(notes: Notes): NotesEdit;
@@ -0,0 +1,47 @@
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 { IndiAttributesEdit } from "./IndiAttributesEdit";
6
+ import { NameVariantsEdit } from "./NameVariantsEdit";
7
+ import { NotesEdit } from "./NotesEdit";
8
+ import { PersonMediaEdit } from "./PersonMediaEdit";
9
+ /**
10
+ * API d’édition cohérente autour d'un {@link Person} existant (identité, unions, actes, notes).
11
+ */
12
+ export declare class PersonEdit {
13
+ private readonly target;
14
+ constructor(target: Person);
15
+ get value(): Person;
16
+ setSex(sex: Sex | undefined): this;
17
+ setLastname(lastname: string): this;
18
+ setFirstnames(firstnames: readonly string[]): this;
19
+ setSosa(sosa: number | undefined): this;
20
+ setFamc(famc: number | undefined): this;
21
+ /** Efface le lien de filiation (`FAMC`). */
22
+ clearFamc(): this;
23
+ /** Remplace la liste des unions (`FAMS`). */
24
+ setFams(fams: readonly number[]): this;
25
+ clearFams(): this;
26
+ appendFams(famId: number): this;
27
+ /** Retire l’identifiant de famille à l’index donné dans `FAMS`. */
28
+ removeFamsAt(index: number): this;
29
+ /** Retire la première occurrence de `familyId` dans `FAMS` (no-op si absent). */
30
+ removeFamsByFamilyId(familyId: number): this;
31
+ setNameVariants(variants: readonly PersonNameVariant[]): this;
32
+ /** Édition élément par élément des blocs `1 NAME`. */
33
+ nameVariants(): NameVariantsEdit;
34
+ setAttributes(attrs: readonly IndiAttribute[]): this;
35
+ /** Édition élément par élément des attributs de niveau 1 (`FACT`, …). */
36
+ attributes(): IndiAttributesEdit;
37
+ acts(): ActsEdit;
38
+ notes(): NotesEdit;
39
+ /** Médias de niveau individu (fichiers locaux via {@link Person.addMultimedia}). */
40
+ multimedia(): PersonMediaEdit;
41
+ clearActs(): this;
42
+ clearNotes(): this;
43
+ clearMultimedia(): this;
44
+ clearNameVariants(): this;
45
+ clearAttributes(): this;
46
+ }
47
+ export declare function editPerson(person: Person): PersonEdit;
@@ -0,0 +1,27 @@
1
+ import { MultimediaFile } from "../commons/MultimediaFile";
2
+ import type { Person } from "../commons/Person";
3
+ import { MultimediaFileEdit } from "./MultimediaFileEdit";
4
+ /**
5
+ * Médias au niveau individu : s'appuie sur {@link Person.addMultimedia} / {@link Person.deleteMultimedia}.
6
+ */
7
+ export declare class PersonMediaEdit {
8
+ private readonly target;
9
+ constructor(target: Person);
10
+ get value(): Person;
11
+ /**
12
+ * Crée un {@link MultimediaFile} à partir d'un fichier local, l'ajoute et renvoie sa facade.
13
+ */
14
+ addNewFromFile(file: File): MultimediaFileEdit;
15
+ /**
16
+ * Ajoute un média à partir d’une URI (sans fichier local), voir {@link Person.addMultimediaFromUri}.
17
+ */
18
+ addNewFromUri(uri: string, objeXrefId?: number | null): MultimediaFileEdit;
19
+ /**
20
+ * Ajoute un média avec fichier local (chemins relatifs gérés comme dans {@link Person.addMultimedia}).
21
+ */
22
+ add(multimediaFile: MultimediaFile): this;
23
+ removeAt(index: number): this;
24
+ clear(): this;
25
+ at(index: number): MultimediaFileEdit;
26
+ }
27
+ export declare function editPersonMedia(person: Person): PersonMediaEdit;
@@ -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,35 @@
1
+ import { Act, type ActConstructionOptions, type TypeAct } from "../commons/Act";
2
+ import { DateAct } from "../commons/DateAct";
3
+ import type { IndiGedcomSubLine } from "../commons/IndiGedcomSubLine";
4
+ import { IndiAttribute } from "../commons/IndiAttribute";
5
+ import { Note, Notes } from "../commons/Note";
6
+ import { Person, Sex } from "../commons/Person";
7
+ import { PersonNameVariant } from "../commons/PersonNameVariant";
8
+ import { Place } from "../commons/Place";
9
+ export type CreateActInit = {
10
+ dateAct?: DateAct | null;
11
+ place?: Place | null;
12
+ indis?: readonly number[] | null;
13
+ construction?: ActConstructionOptions | null;
14
+ notes?: Notes;
15
+ };
16
+ /** Construit un {@link Act} (pour `ActsEdit.add`, `addNew`, etc.). */
17
+ export declare function createAct(type: TypeAct, init?: CreateActInit | null): Act;
18
+ /**
19
+ * Construit une {@link Note} avec des lignes initialisées (tableau vide par défaut).
20
+ */
21
+ export declare function createNote(initialLines?: readonly string[] | null): Note;
22
+ export type CreatePersonStubInit = {
23
+ sosa?: number;
24
+ sex?: Sex;
25
+ firstnames?: readonly string[];
26
+ lastname?: string;
27
+ famc?: number;
28
+ fams?: readonly number[];
29
+ };
30
+ /**
31
+ * Crée un {@link Person} minimal avec un `INDI` connu (arbre vide ou ajout manuel).
32
+ */
33
+ export declare function createPersonStub(indi: number, init?: CreatePersonStubInit | null): Person;
34
+ export declare function createPersonNameVariant(payload: string, type?: string): PersonNameVariant;
35
+ export declare function createIndiAttribute(tag: string, value?: string, children?: readonly IndiGedcomSubLine[]): IndiAttribute;
@@ -0,0 +1,33 @@
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 { ActMediaEdit, editActMedia } from "./ActMediaEdit";
16
+ export { ActsEdit, editActs } from "./ActsEdit";
17
+ export { cloneAct, clonePerson } from "../dataset/cloneModels";
18
+ export { DateActEdit, editDateAct } from "./DateActEdit";
19
+ export { createAct, createIndiAttribute, createNote, createPersonNameVariant, createPersonStub, type CreateActInit, type CreatePersonStubInit, } from "./factories";
20
+ export { editGedcomExportOptions, GedcomExportOptionsEdit } from "./GedcomExportOptionsEdit";
21
+ export { addPersonToReadGed, commandBlockingIssues, createMarriageFamily, linkChildToFamily, nextFamilyId, removeFamilyReferencesFromDataset, removePersonFromReadGedByIndi, tryAddPersonToReadGed, tryCreateMarriageFamily, tryLinkChildToFamily, tryRemovePersonFromReadGedByIndi, tryUnlinkChildFromFamily, unlinkChildFromFamily, validateAddPersonCommand, validateCreateMarriageCommand, validateLinkChildCommand, validateUnlinkChildCommand, } from "../dataset";
22
+ export type { CommandFail, CommandOk, CommandResult, CreateUnionFamilyOptions } from "../dataset";
23
+ export { IndiAttributeEdit, IndiAttributesEdit, editIndiAttribute, editIndiAttributes } from "./IndiAttributesEdit";
24
+ export { MultimediaFileEdit, editMultimediaFile } from "./MultimediaFileEdit";
25
+ export { NameVariantsEdit, PersonNameVariantEdit, editNameVariants, editPersonNameVariant } from "./NameVariantsEdit";
26
+ export { NoteEdit, editNote } from "./NoteEdit";
27
+ export { NotesEdit, editNotes } from "./NotesEdit";
28
+ export { PersonEdit, editPerson } from "./PersonEdit";
29
+ export { PersonMediaEdit, editPersonMedia } from "./PersonMediaEdit";
30
+ export { PlaceEdit, editPlace } from "./PlaceEdit";
31
+ export { PreservedTopLevelEdit, ReadGedEdit, editReadGed } from "../dataset/ReadGedEdit";
32
+ export { assertPersonConsistent, assertReadGedConsistent, validatePerson, validateReadGed, } from "../dataset/validation";
33
+ export type { AssertConsistencyOptions, ConsistencySeverity, ModelConsistencyIssue, ModelConsistencyIssueCode, ValidatePersonContext, ValidateReadGedOptions, } from "../dataset/validation";
@@ -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
- constructor(title: string | undefined, persons: Array<Person>, haveFiles: boolean);
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: [persons: Array<Person>] | [title: string, persons: Array<Person>]);
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: [persons: Array<Person>] | [title: string, persons: Array<Person>]);
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 getFiles;
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>;
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Liste interne des blocs `0 …` conservés pour diagnostic / round-trip (hors `0 TRLR`).
3
+ */
4
+ export declare class PreservedRecordsBuffer {
5
+ private readonly items;
6
+ get length(): number;
7
+ /** Vue en lecture seule (référence au tableau interne, comme l’ancien `_preservedTopLevelRecords`). */
8
+ asReadonly(): readonly string[];
9
+ at(index: number): string | undefined;
10
+ /**
11
+ * Ajoute le bloc tel quel (sauf filtre `0 TRLR`), pour l’ingestion GEDCOM — aligné sur l’ancien `preserveTopLevelRecord`.
12
+ */
13
+ appendRaw(block: string): void;
14
+ append(block: string): void;
15
+ insertAt(index: number, block: string): void;
16
+ replaceAt(index: number, block: string): void;
17
+ removeAt(index: number): void;
18
+ clear(): void;
19
+ /** Retire l’élément à l’index sans normalisation (usage interne parse / absorb). */
20
+ spliceRemoveAt(index: number): void;
21
+ }
@@ -1,21 +1,70 @@
1
1
  import { Person } from '../commons/Person';
2
2
  import { SplitGedcom } from "./SplitedInformations";
3
3
  import { Place } from "../commons/Place";
4
+ import { type GedcomDatasetVersion } from "../utils/gedcom/datasetVersion";
5
+ /**
6
+ * Graphe importé depuis un fichier GEDCOM. Les enregistrements de niveau `0` non intégrés au modèle
7
+ * typé (OBJE, REPO, SOUR, etc.) restent accessibles via {@link preservedTopLevelRecords}.
8
+ */
4
9
  export declare class ReadGed extends SplitGedcom {
10
+ private resolvedInformationFamilies;
11
+ private resolvedInformationNotes;
12
+ private famPointerToId;
13
+ private notePointerToId;
14
+ private objePayloadById;
15
+ /** Déduit du bloc `HEAD` (`GEDC`.`VERS`). */
16
+ datasetVersion: GedcomDatasetVersion;
5
17
  persons: Person[];
6
18
  mapPersons: Map<number, Person>;
7
19
  partnersMap: Map<number, Person[]>;
8
20
  childsMap: Map<number, Person[]>;
9
21
  mapFiles: Map<string, File>;
10
22
  placesMap: Map<string, Place>;
23
+ /**
24
+ * Index des pointeurs d’individu GEDCOM vers {@link Person.INDI} interne.
25
+ * Clés typiques : `Homer_Simpson` (xref textuelle), `I12` (xref `@I12@`).
26
+ */
27
+ private individualPointerToIndiNumber;
11
28
  constructor(gedcomContent?: string, mapFiles?: Map<string, File>, placesMap?: Map<string, Place>, mapPersons?: Map<number, Person>);
29
+ /**
30
+ * Empty genealogy (no INDI/FAM), same runtime shape as after {@link importGedFile}:
31
+ * `persons`, `partnersMap`, `childsMap`, `mapPersons`, `placesMap`, `mapFiles` are initialized.
32
+ */
33
+ static empty(options?: {
34
+ mapFiles?: Map<string, File>;
35
+ placesMap?: Map<string, Place>;
36
+ }): ReadGed;
12
37
  static fromGedcomFile(gedcomFile: File, mapFiles?: Map<string, File>, placesMap?: Map<string, Place>, mapPersons?: Map<number, Person>): Promise<ReadGed>;
13
38
  private finalizeAfterParse;
39
+ /**
40
+ * Reconstruit {@link partnersMap} et {@link childsMap} à partir des pointeurs `FAMS` / `FAMC`
41
+ * de chaque personne. Peut être rappelé après édition des liens ; chaque appel remplace les
42
+ * cartes (pas d’accumulation).
43
+ */
14
44
  groupPartners(): void;
15
45
  createDirectAncestries(person: Person): Person[];
16
46
  generateUniqueIndi(): number;
47
+ /**
48
+ * Résout un pointeur GEDCOM d’individu (`@Homer_Simpson@`, `Homer_Simpson`, `@I5@`, `I5`) vers la personne importée.
49
+ * Utile pour interpréter `1 CHIL @…@` ou `1 HUSB @…@` dans des fichiers à xref textuelle.
50
+ */
51
+ resolveIndividualPointer(raw: string): Person | undefined;
52
+ /** Enfants rattachés aux unions listées dans `parent.FAMS` (même logique que {@link childsMap}). */
53
+ getChildrenForParent(parent: Person): Person[];
54
+ /** Enfants d’une famille donnée (identifiant interne `F`, ex. `0` pour `@F0000@`). */
55
+ getChildrenOfFamily(familyId: number): Person[];
56
+ /**
57
+ * Reconstruit {@link placesMap} à partir des lieux des actes (après édition du graphe).
58
+ * Préférez la façade `editReadGed` pour les mutations ; cette méthode est utile si vous modifiez
59
+ * les personnes hors façade.
60
+ */
61
+ rehydratePlacesFromActs(): void;
17
62
  private haveParentsOfPerson;
18
63
  private createPersons;
64
+ /**
65
+ * Xrefs textuelles `0 @Homer_Simpson@ INDI` → entiers uniques (après le max des `@I{n}@` du fichier).
66
+ */
67
+ private buildTextualIndiXrefToSyntheticIdMap;
19
68
  private buildPerson;
20
69
  private hydratePlacesFromActs;
21
70
  private upsertPlace;
@@ -1,13 +1,45 @@
1
1
  export declare class SplitGedcom {
2
+ /** Lignes du premier enregistrement `0 HEAD` (y compris la ligne `0 HEAD`), si présent. */
3
+ protected informationHeaderLines: string[] | null;
2
4
  protected informationPersons: string[][];
3
- protected informationFamilies: Map<number, string[]>;
4
- protected informationNotes: Map<number, string[]>;
5
+ /** Lignes sous `0 @F…@ FAM` indexées par libellé xref canonique (`1`, `famA`, …). */
6
+ protected informationFamiliesByLabel: Map<string, string[]>;
7
+ /** Lignes sous `0 @N…@ NOTE|SNOTE` indexées par libellé xref canonique. */
8
+ protected informationNotesByLabel: Map<string, string[]>;
9
+ /**
10
+ * Enregistrements `0 …` non intégrés au modèle typé (OBJE, REPO, SOUR, SUBM, FAM/NOTE à xref non
11
+ * numérique, etc.). Conservés dans l’ordre du fichier pour diagnostic ou futur re‑export.
12
+ * `0 TRLR` n’est pas conservé (terminaison standard).
13
+ */
14
+ private readonly preservedRecords;
15
+ get preservedTopLevelRecords(): readonly string[];
16
+ /** Ajoute un bloc `0 …` complet (multi-lignes) en fin de liste préservée. */
17
+ appendPreservedTopLevelRecord(block: string): void;
18
+ insertPreservedTopLevelRecordAt(index: number, block: string): void;
19
+ replacePreservedTopLevelRecordAt(index: number, block: string): void;
20
+ removePreservedTopLevelRecordAt(index: number): void;
21
+ clearPreservedTopLevelRecords(): void;
5
22
  constructor(gedcomContent?: string);
6
23
  protected ingestGedcomText(gedcomContent: string): void;
7
24
  protected ingestGedcomFileStream(file: File): Promise<void>;
8
25
  private ingestRecordBlock;
26
+ /** N’ajoute pas `0 TRLR` (terminaison du fichier). */
27
+ private preserveTopLevelRecord;
28
+ /** Tout enregistrement `0 @xref@ INDI` (xref numérique `@I1@` ou textuelle `@Homer_Simpson@`). */
29
+ private isIndiRecordFirstLine;
30
+ /**
31
+ * Retire de {@link preservedTopLevelRecords} les blocs `0 @O…@ OBJE` décodables et renvoie leurs
32
+ * charges utiles pour l’hydratation des pointeurs `OBJE` sous `INDI` / actes.
33
+ */
34
+ protected absorbStandaloneObjeBlocksInto(): Map<number, {
35
+ sourceUri: string;
36
+ }>;
37
+ private splitInformationHeader;
9
38
  private splitInformationPersons;
39
+ /** @returns `true` si le bloc a été stocké dans {@link informationFamiliesByLabel}. */
10
40
  private splitInformationFamilies;
41
+ /** @returns `true` si le bloc a été stocké dans {@link informationNotesByLabel}. */
11
42
  private splitInformationNotes;
12
- private extractXrefId;
43
+ private extractFamRecordLabel;
44
+ private extractNoteRecordLabel;
13
45
  }