gedcom-ts 2.1.0 → 2026.5.1
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 +91 -0
- package/README.md +119 -14
- 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/geocode/index.d.ts +3 -0
- package/dist/geocode/place-city-utils.d.ts +11 -0
- package/dist/geocode/place-clusters.d.ts +34 -0
- package/dist/geocode/place-geocode.d.ts +50 -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 +5 -3
- package/dist/index.mjs +1 -1
- package/dist/services/CitySearch.d.ts +4 -0
- 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,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;
|
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,3 @@
|
|
|
1
|
+
export { normalizeCityKey, tidyCityDisplay, findCanonicalCityLabel, } from "./place-city-utils";
|
|
2
|
+
export { type GeocodeCandidate, type GeocodeContext, type GeocodeFetchFn, type GeocodeSearchOptions, NOMINATIM_SEARCH_URL, defaultGeocodeUserAgent, parseCityQuery, countryLabelToIso, isoToCountryLabel, inferGeocodeContext, buildGeocodeQuery, geocodeContextWithHint, rankGeocodeCandidates, searchPlaces, searchPlacesWithContext, } from "./place-geocode";
|
|
3
|
+
export { type CoordVariant, type CityHarmonizationCluster, levenshteinDistance, citiesAreSimilar, clusterKeyForCity, findHarmonizationClustersFromActs, findHarmonizationClusters, applyCoordinatesToActs, applyGeocodeCandidateToActs, } from "./place-clusters";
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Act } from "../commons/Act";
|
|
2
|
+
import type { ReadGed } from "../import/ReadGed";
|
|
3
|
+
/** Clé de regroupement : casse, espaces, compatibilité Unicode (NFKC). */
|
|
4
|
+
export declare function normalizeCityKey(city: string): string;
|
|
5
|
+
/** Libellé affiché : trim + espaces internes unifiés (sans forcer la casse). */
|
|
6
|
+
export declare function tidyCityDisplay(city: string): string;
|
|
7
|
+
/**
|
|
8
|
+
* Harmonise l’écriture avec le reste de l’arbre : même clé normalisée → libellé le plus fréquent
|
|
9
|
+
* (exclut l’acte en cours d’édition pour le décompte).
|
|
10
|
+
*/
|
|
11
|
+
export declare function findCanonicalCityLabel(ged: ReadGed, cityInput: string, excludeAct: Act | null): string;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { Act } from "../commons/Act";
|
|
2
|
+
import type { ReadGed } from "../import/ReadGed";
|
|
3
|
+
import { type GeocodeCandidate } from "./place-geocode";
|
|
4
|
+
export interface CoordVariant {
|
|
5
|
+
readonly lat: number;
|
|
6
|
+
readonly lng: number;
|
|
7
|
+
readonly actCount: number;
|
|
8
|
+
}
|
|
9
|
+
/** Groupe de lieux similaires à harmoniser (libellés ou coordonnées divergents). */
|
|
10
|
+
export interface CityHarmonizationCluster {
|
|
11
|
+
readonly clusterKey: string;
|
|
12
|
+
readonly labels: readonly string[];
|
|
13
|
+
readonly coordVariants: readonly CoordVariant[];
|
|
14
|
+
readonly acts: readonly Act[];
|
|
15
|
+
readonly actsWithoutCoord: number;
|
|
16
|
+
}
|
|
17
|
+
/** Distance de Levenshtein (petites chaînes de noms de villes). */
|
|
18
|
+
export declare function levenshteinDistance(a: string, b: string): number;
|
|
19
|
+
/** Ville proche : même clé, faute légère, ou inclusion évidente (Saint-X / St-X). */
|
|
20
|
+
export declare function citiesAreSimilar(a: string, b: string): boolean;
|
|
21
|
+
/**
|
|
22
|
+
* Regroupe les actes dont les villes se ressemblent (libellés uniques + clés normalisées).
|
|
23
|
+
* Complexité ~ O(m²) sur le nombre de villes distinctes, pas sur le nombre d’actes.
|
|
24
|
+
*/
|
|
25
|
+
export declare function findHarmonizationClustersFromActs(acts: readonly Act[]): CityHarmonizationCluster[];
|
|
26
|
+
/** Analyse toute l’arbre (préférer {@link findHarmonizationClustersFromActs} sur un sous-ensemble). */
|
|
27
|
+
export declare function findHarmonizationClusters(ged: ReadGed): CityHarmonizationCluster[];
|
|
28
|
+
export declare function applyCoordinatesToActs(acts: readonly Act[], lat: number, lng: number, patch?: {
|
|
29
|
+
city?: string;
|
|
30
|
+
country?: string | null;
|
|
31
|
+
}): void;
|
|
32
|
+
export declare function applyGeocodeCandidateToActs(acts: readonly Act[], candidate: GeocodeCandidate, preferredCityLabel?: string): void;
|
|
33
|
+
/** Clé de regroupement carte : villes similaires → un marqueur. */
|
|
34
|
+
export declare function clusterKeyForCity(city: string): string;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import type { ReadGed } from "../import/ReadGed";
|
|
2
|
+
/** Résultat Nominatim présenté à l’utilisateur. */
|
|
3
|
+
export interface GeocodeCandidate {
|
|
4
|
+
readonly label: string;
|
|
5
|
+
readonly shortLabel: string;
|
|
6
|
+
readonly lat: number;
|
|
7
|
+
readonly lng: number;
|
|
8
|
+
readonly country: string | null;
|
|
9
|
+
readonly countryCode: string | null;
|
|
10
|
+
readonly region: string | null;
|
|
11
|
+
readonly kind: string | null;
|
|
12
|
+
readonly importance: number;
|
|
13
|
+
}
|
|
14
|
+
export interface GeocodeContext {
|
|
15
|
+
/** Codes ISO 3166-1 alpha-2 (ex. `fr`), du plus au moins probable. */
|
|
16
|
+
readonly countryCodes: readonly string[];
|
|
17
|
+
readonly defaultCountryLabel: string | null;
|
|
18
|
+
readonly centroid: {
|
|
19
|
+
lat: number;
|
|
20
|
+
lng: number;
|
|
21
|
+
} | null;
|
|
22
|
+
}
|
|
23
|
+
export type GeocodeFetchFn = (input: RequestInfo | URL, init?: RequestInit) => Promise<Response>;
|
|
24
|
+
export interface GeocodeSearchOptions {
|
|
25
|
+
readonly countryCodes?: readonly string[];
|
|
26
|
+
readonly limit?: number;
|
|
27
|
+
/** Défaut : `gedcom-ts/<version> (genealogy library)` */
|
|
28
|
+
readonly userAgent?: string;
|
|
29
|
+
/** Client HTTP injectable (tests, Node sans fetch global). */
|
|
30
|
+
readonly fetchFn?: GeocodeFetchFn;
|
|
31
|
+
}
|
|
32
|
+
export declare const NOMINATIM_SEARCH_URL = "https://nominatim.openstreetmap.org/search";
|
|
33
|
+
export declare function defaultGeocodeUserAgent(): string;
|
|
34
|
+
/** Parse « Valence », « Valence, Drôme », « Valence, France ». */
|
|
35
|
+
export declare function parseCityQuery(raw: string): {
|
|
36
|
+
city: string;
|
|
37
|
+
countryHint: string | null;
|
|
38
|
+
};
|
|
39
|
+
export declare function countryLabelToIso(label: string): string | null;
|
|
40
|
+
export declare function isoToCountryLabel(code: string | null | undefined): string | null;
|
|
41
|
+
/** Contexte géographique déduit de l’arbre (pays et centroïde des lieux déjà géolocalisés). */
|
|
42
|
+
export declare function inferGeocodeContext(ged: ReadGed | null): GeocodeContext;
|
|
43
|
+
export declare function buildGeocodeQuery(cityInput: string, context: GeocodeContext, extraCountryHint?: string | null): string;
|
|
44
|
+
/** Priorise le pays saisi par l’utilisateur pour filtre Nominatim et classement. */
|
|
45
|
+
export declare function geocodeContextWithHint(context: GeocodeContext, extraCountryHint?: string | null): GeocodeContext;
|
|
46
|
+
/** Trie les candidats : pays de l’arbre, proximité du centroïde, correspondance du nom. */
|
|
47
|
+
export declare function rankGeocodeCandidates(candidates: GeocodeCandidate[], cityInput: string, context: GeocodeContext): GeocodeCandidate[];
|
|
48
|
+
export declare function searchPlaces(query: string, options?: GeocodeSearchOptions): Promise<GeocodeCandidate[]>;
|
|
49
|
+
/** Recherche avec repli sans filtre pays si trop peu de résultats. */
|
|
50
|
+
export declare function searchPlacesWithContext(cityInput: string, context: GeocodeContext, extraCountryHint?: string | null, options?: GeocodeSearchOptions): Promise<GeocodeCandidate[]>;
|
|
@@ -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>;
|