gedcom-ts 2.1.0 → 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.
- package/CHANGELOG.md +83 -0
- package/README.md +99 -8
- package/dist/commons/Act.d.ts +9 -2
- package/dist/commons/Person.d.ts +6 -1
- package/dist/commons/clonePrimitives.d.ts +17 -0
- package/dist/commons/gedcomEventTags.d.ts +7 -0
- package/dist/dataset/ReadGedEdit.d.ts +27 -0
- package/dist/dataset/cloneModels.d.ts +8 -0
- package/dist/dataset/graphOps.d.ts +29 -0
- package/dist/dataset/index.d.ts +9 -0
- package/dist/dataset/readGedCommands.d.ts +46 -0
- package/dist/dataset/readGedMutations.d.ts +12 -0
- package/dist/dataset/validation.d.ts +36 -0
- package/dist/edit/ActEdit.d.ts +8 -0
- package/dist/edit/ActMediaEdit.d.ts +21 -0
- package/dist/edit/ActsEdit.d.ts +18 -1
- package/dist/edit/GedcomExportOptionsEdit.d.ts +20 -0
- package/dist/edit/IndiAttributesEdit.d.ts +38 -0
- package/dist/edit/MultimediaFileEdit.d.ts +17 -0
- package/dist/edit/NameVariantsEdit.d.ts +43 -0
- package/dist/edit/NoteEdit.d.ts +18 -0
- package/dist/edit/NotesEdit.d.ts +11 -0
- package/dist/edit/PersonEdit.d.ts +20 -0
- package/dist/edit/PersonMediaEdit.d.ts +27 -0
- package/dist/edit/factories.d.ts +35 -0
- package/dist/edit/index.d.ts +14 -0
- package/dist/import/PreservedRecordsBuffer.d.ts +21 -0
- package/dist/import/ReadGed.d.ts +6 -0
- package/dist/import/SplitedInformations.d.ts +7 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.mjs +1 -1
- package/dist/utils/gedcom/importGedcomNote.d.ts +17 -0
- package/dist/utils/gedcom/uriBasename.d.ts +2 -0
- package/dist/utils/multimedia/registerTrackedMedia.d.ts +10 -0
- package/dist/version.d.ts +1 -1
- package/package.json +1 -1
|
@@ -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;
|
package/dist/edit/NotesEdit.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Note, Notes } from "../commons/Note";
|
|
2
|
+
import { NoteEdit } from "./NoteEdit";
|
|
2
3
|
/**
|
|
3
4
|
* API d’édition cohérente autour d'un {@link Notes}.
|
|
4
5
|
*/
|
|
@@ -6,9 +7,19 @@ export declare class NotesEdit {
|
|
|
6
7
|
private readonly target;
|
|
7
8
|
constructor(target: Notes);
|
|
8
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;
|
|
9
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;
|
|
10
20
|
replaceAt(index: number, note: Note): this;
|
|
11
21
|
removeAt(index: number): this;
|
|
12
22
|
clear(): this;
|
|
23
|
+
at(index: number): NoteEdit;
|
|
13
24
|
}
|
|
14
25
|
export declare function editNotes(notes: Notes): NotesEdit;
|
|
@@ -2,7 +2,10 @@ import type { IndiAttribute } from "../commons/IndiAttribute";
|
|
|
2
2
|
import { Person, Sex } from "../commons/Person";
|
|
3
3
|
import type { PersonNameVariant } from "../commons/PersonNameVariant";
|
|
4
4
|
import { ActsEdit } from "./ActsEdit";
|
|
5
|
+
import { IndiAttributesEdit } from "./IndiAttributesEdit";
|
|
6
|
+
import { NameVariantsEdit } from "./NameVariantsEdit";
|
|
5
7
|
import { NotesEdit } from "./NotesEdit";
|
|
8
|
+
import { PersonMediaEdit } from "./PersonMediaEdit";
|
|
6
9
|
/**
|
|
7
10
|
* API d’édition cohérente autour d'un {@link Person} existant (identité, unions, actes, notes).
|
|
8
11
|
*/
|
|
@@ -15,13 +18,30 @@ export declare class PersonEdit {
|
|
|
15
18
|
setFirstnames(firstnames: readonly string[]): this;
|
|
16
19
|
setSosa(sosa: number | undefined): this;
|
|
17
20
|
setFamc(famc: number | undefined): this;
|
|
21
|
+
/** Efface le lien de filiation (`FAMC`). */
|
|
22
|
+
clearFamc(): this;
|
|
18
23
|
/** Remplace la liste des unions (`FAMS`). */
|
|
19
24
|
setFams(fams: readonly number[]): this;
|
|
20
25
|
clearFams(): this;
|
|
21
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;
|
|
22
31
|
setNameVariants(variants: readonly PersonNameVariant[]): this;
|
|
32
|
+
/** Édition élément par élément des blocs `1 NAME`. */
|
|
33
|
+
nameVariants(): NameVariantsEdit;
|
|
23
34
|
setAttributes(attrs: readonly IndiAttribute[]): this;
|
|
35
|
+
/** Édition élément par élément des attributs de niveau 1 (`FACT`, …). */
|
|
36
|
+
attributes(): IndiAttributesEdit;
|
|
24
37
|
acts(): ActsEdit;
|
|
25
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;
|
|
26
46
|
}
|
|
27
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,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;
|
package/dist/edit/index.d.ts
CHANGED
|
@@ -12,8 +12,22 @@
|
|
|
12
12
|
* ```
|
|
13
13
|
*/
|
|
14
14
|
export { ActEdit, editAct } from "./ActEdit";
|
|
15
|
+
export { ActMediaEdit, editActMedia } from "./ActMediaEdit";
|
|
15
16
|
export { ActsEdit, editActs } from "./ActsEdit";
|
|
17
|
+
export { cloneAct, clonePerson } from "../dataset/cloneModels";
|
|
16
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";
|
|
17
27
|
export { NotesEdit, editNotes } from "./NotesEdit";
|
|
18
28
|
export { PersonEdit, editPerson } from "./PersonEdit";
|
|
29
|
+
export { PersonMediaEdit, editPersonMedia } from "./PersonMediaEdit";
|
|
19
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";
|
|
@@ -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
|
+
}
|
package/dist/import/ReadGed.d.ts
CHANGED
|
@@ -53,6 +53,12 @@ export declare class ReadGed extends SplitGedcom {
|
|
|
53
53
|
getChildrenForParent(parent: Person): Person[];
|
|
54
54
|
/** Enfants d’une famille donnée (identifiant interne `F`, ex. `0` pour `@F0000@`). */
|
|
55
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;
|
|
56
62
|
private haveParentsOfPerson;
|
|
57
63
|
private createPersons;
|
|
58
64
|
/**
|
|
@@ -11,8 +11,14 @@ export declare class SplitGedcom {
|
|
|
11
11
|
* numérique, etc.). Conservés dans l’ordre du fichier pour diagnostic ou futur re‑export.
|
|
12
12
|
* `0 TRLR` n’est pas conservé (terminaison standard).
|
|
13
13
|
*/
|
|
14
|
-
private readonly
|
|
14
|
+
private readonly preservedRecords;
|
|
15
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;
|
|
16
22
|
constructor(gedcomContent?: string);
|
|
17
23
|
protected ingestGedcomText(gedcomContent: string): void;
|
|
18
24
|
protected ingestGedcomFileStream(file: File): Promise<void>;
|