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
@@ -3,4 +3,6 @@ export type ActsExtractionResult = {
3
3
  entries: GedcomActEntry[];
4
4
  indis: number[];
5
5
  };
6
- export declare function extractActEntriesAndIndis(lines: string[], initialIndis: number[]): ActsExtractionResult;
6
+ /** Level-1 tag from a line like `1 BIRT` or `1 DIVF` (no false match on `DIV` vs `DIVF`). */
7
+ export declare function gedcomLevel1Tag(line: string): string | null;
8
+ export declare function extractActEntriesAndIndis(lines: string[], initialIndis: number[], textualIndiXrefToIndi?: ReadonlyMap<string, number>): ActsExtractionResult;
@@ -0,0 +1,7 @@
1
+ /** Version logique du jeu de données déduite du bloc `HEAD`. */
2
+ export type GedcomDatasetVersion = "7.0" | "5.5" | "unknown";
3
+ /**
4
+ * Déduit la version FamilySearch GEDCOM à partir des lignes du bloc `0 HEAD` …
5
+ * (sous-structure `GEDC`.`VERS`, typiquement niveau 2).
6
+ */
7
+ export declare function resolveDatasetVersion(headerLines: string[] | null | undefined): GedcomDatasetVersion;
@@ -0,0 +1,4 @@
1
+ import { IndiAttribute } from "../../commons/IndiAttribute";
2
+ import { PersonNameVariant } from "../../commons/PersonNameVariant";
3
+ export declare function extractPersonNameVariants(personLines: string[]): PersonNameVariant[];
4
+ export declare function extractIndiAttributes(personLines: string[]): IndiAttribute[];
@@ -0,0 +1,17 @@
1
+ import { Note } from "../../commons/Note";
2
+ import { Identifier } from "../../commons/Identifier.enum";
3
+ export type GedcomNoteImportContext = {
4
+ globalNotes?: Map<number, string[]>;
5
+ notePointerToId?: ReadonlyMap<string, number>;
6
+ };
7
+ /** `1 NOTE` sous INDI (pas `2 NOTE` sous un acte). */
8
+ export declare function isPersonLevelGedcomLine(level: string): boolean;
9
+ /** `2 NOTE` sous un événement (`BIRT`, `MARR`, …). */
10
+ export declare function isActLevelGedcomNoteLine(level: string): boolean;
11
+ export declare function isGedcomNoteContinuationTag(tag: string): tag is Identifier.CONC | Identifier.CONT;
12
+ /**
13
+ * Construit une {@link Note} à partir d’une valeur `NOTE` inline ou d’un pointeur `@N…@`.
14
+ */
15
+ export declare function createNoteFromGedcomPayload(rawValue: string, ctx?: GedcomNoteImportContext | null): Note | null;
16
+ /** Ajoute une sous-ligne `CONC` / `CONT` à une note en cours d’import. */
17
+ export declare function appendGedcomNoteSubline(note: Note, tag: Identifier.CONC | Identifier.CONT, value: string): void;
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Clés d’xref `F` / `N` canoniques : `005` → `5`, les libellés non numériques restent inchangés.
3
+ */
4
+ export declare function canonicalFamOrNoteLabel(inner: string): string;
5
+ export type LabelKeyedMapsResult = {
6
+ byNumericId: Map<number, string[]>;
7
+ pointerToId: Map<string, number>;
8
+ };
9
+ /**
10
+ * À partir d’une carte « libelle xref → lignes sous l’en-tête `0` », produit une carte par id
11
+ * numérique interne et la table de résolution `@FfamA@` / `@Nfoo@` → id.
12
+ */
13
+ export declare function resolveLabelKeyedMapToNumericIds(labelMap: Map<string, string[]>): LabelKeyedMapsResult;
@@ -0,0 +1,2 @@
1
+ /** Best-effort `FORM` (media type) for GEDCOM 7 `OBJE`.`FILE` from a URI or path. */
2
+ export declare function guessMediaFormFromUri(uri: string): string;
@@ -0,0 +1,9 @@
1
+ export type StandaloneObjePayload = {
2
+ id: number;
3
+ sourceUri: string;
4
+ };
5
+ /**
6
+ * Extrait l’id `@O{n}@` et le premier `FILE` utile d’un enregistrement `0 @O…@ OBJE`.
7
+ * Préfère une URI `http(s)`, sinon première valeur `FILE` non vide.
8
+ */
9
+ export declare function parseStandaloneObjeBlock(block: string): StandaloneObjePayload | null;
@@ -1,6 +1,13 @@
1
+ import type { PersonNameVariant } from "../../commons/PersonNameVariant";
1
2
  export type ParsedPersonName = {
2
3
  firstnames: string[];
3
4
  lastname: string;
4
5
  };
5
6
  export declare function parsePersonName(rawName: string): ParsedPersonName;
7
+ /**
8
+ * Choisit la valeur `1 NAME` la plus pertinente : priorité au bloc avec `2 TYPE BIRTH`
9
+ * (GEDCOM 7 / noms multiples), sinon premier nom avec patronyme `/…/`, sinon le premier `NAME`.
10
+ */
6
11
  export declare function extractRawNameFromGedcomLines(lines: string[]): string | null;
12
+ /** Même logique que {@link extractRawNameFromGedcomLines} appliquée aux blocs `NAME` déjà découpés. */
13
+ export declare function selectPrimaryNameVariant(variants: PersonNameVariant[]): PersonNameVariant | null;
@@ -1,3 +1,19 @@
1
1
  export declare function extractNumericPointer(value: string, prefix: string): number | null;
2
+ /**
3
+ * Libellé brut entre `@F` / `@N` et `@` (tout caractère sauf `@`), sans canoniser.
4
+ */
5
+ export declare function extractPointerInnerLabel(value: string, prefixLetter: "F" | "N"): string | null;
6
+ /** Clé pour {@link resolveLabelKeyedMapToNumericIds} : canonise les ids numériques (`01` → `1`). */
7
+ export declare function extractFamNotePointerKey(value: string, prefixLetter: "F" | "N"): string | null;
2
8
  export declare function extractEntityIdFromZeroLine(line: string, prefix: string, entityTag: string): number | null;
9
+ /**
10
+ * Xref « textuelle » sous `0 @…@ INDI` (ex. GRAMPS `@Homer_Simpson@`).
11
+ * Retourne `null` si l’xref est déjà le schéma numérique `@I{n}@` (géré par {@link extractEntityIdFromZeroLine}).
12
+ */
13
+ export declare function extractTextualIndiXrefFromZeroLine(line: string): string | null;
3
14
  export declare function extractPointerIdFromLine(line: string, prefix: string): number | null;
15
+ /**
16
+ * Résout la valeur d’un pointeur `INDI` (`@I12@`, `@Homer_Simpson@`) vers un id numérique interne,
17
+ * comme pour {@link extractTextualIndiXrefFromZeroLine} + {@link extractNumericPointer}.
18
+ */
19
+ export declare function resolveIndiPointerValueToId(pointerValue: string, textualIndiXrefToIndi?: ReadonlyMap<string, number>): number | null;
@@ -0,0 +1,2 @@
1
+ /** Dernier segment exploitable d’une URI pour nommer un média distant (sans query). */
2
+ export declare function basenameFromUri(uri: string): string;
@@ -0,0 +1,10 @@
1
+ import { MultimediaFile, MultimediaFiles } from "../../commons/MultimediaFile";
2
+ export type TrackedMediaContext = {
3
+ multimediaFiles: MultimediaFiles;
4
+ newMultimediaFiles: Map<string, MultimediaFile>;
5
+ pathBase: string;
6
+ };
7
+ /**
8
+ * Enregistre un {@link MultimediaFile} avec chemin relatif unique (suffixe `_1`, …) et synchronise `files` + map interne.
9
+ */
10
+ export declare function registerTrackedMedia(ctx: TrackedMediaContext, file: MultimediaFile, logicalFileName: string): string | null;
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Version affichée dans l’export GEDCOM (`HEAD`.`SOUR`.`VERS`, etc.).
3
+ * **À aligner sur** la propriété `version` du `package.json` à chaque release
4
+ * (un test vérifie l’égalité).
5
+ */
6
+ export declare const GEDCOM_LIBRARY_VERSION = "2026.5.0";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gedcom-ts",
3
- "version": "2.0.2",
3
+ "version": "2026.5.0",
4
4
  "description": "TypeScript GEDCOM toolkit for browser apps: import .ged/.zip, edit typed genealogy data, and export GEDCOM or GEDZIP.",
5
5
  "author": "Bertrand Jaunet <bertrand.jaunet@gmail.com>",
6
6
  "license": "SEE LICENSE IN LICENSE",