gedcom-ts 2.0.1 → 2.0.2

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 ADDED
@@ -0,0 +1,130 @@
1
+ # Changelog
2
+
3
+ All notable changes of gedcom-ts
4
+
5
+ ## [2.0.2] - 2026-05-11
6
+
7
+ ### Fixed
8
+
9
+ - Sorting of undated acts now follows the expected genealogical order:
10
+ - `BIRT`, `CHR`, `MARR`, `DIV`, `DEAT`, `BURI`
11
+ - Undated/invalid dates are now handled consistently during sorting to avoid `BURI` appearing first.
12
+ - Month comparison now treats unknown months as later than known months for stable ordering.
13
+ - Added non-regression tests for invalid dates and undated act type ordering.
14
+
15
+ ## [2.0.1] - 2026-05-06
16
+
17
+ ### Changed
18
+
19
+ - Removed `file-saver` dependency.
20
+
21
+ ## [2.0.0] - 2026-05-05
22
+
23
+ ### Highlights
24
+
25
+ - Major modernization of GEDCOM import/export and typed genealogy models.
26
+ - Better media lifecycle for acts and persons, including ZIP path reliability.
27
+ - New build and quality toolchain (esbuild, ESLint, Vitest).
28
+ - Fully rewritten technical documentation and improved package metadata.
29
+
30
+ ### Added
31
+
32
+ - New domain models and helpers:
33
+ - `Person` model replacing previous `People` flow
34
+ - `MultimediaFile` / `MultimediaFiles`
35
+ - `Note` / `Notes`
36
+ - `ActsByYear` / `EventsByYears`
37
+ - GED helpers (`parseGedcomLine`, note formatting, media path utilities, Sosa and INDI helpers)
38
+ - New import entrypoint for GED and ZIP: `importGedFile`.
39
+ - ZIP export support with media path strategy for acts:
40
+ - single INDI: `INDI/TYPE/file`
41
+ - multi-INDI: `media/events/indi1-indi2/TYPE/file`
42
+ - Dedicated loader/parser components:
43
+ - `LoadFile`
44
+ - `SplitedInformations`
45
+ - `LICENSE` file added and package license reference aligned (`SEE LICENSE IN LICENSE`).
46
+ - New test suites for core domains and export behavior:
47
+ - `tests/commons/Act.spec.ts`
48
+ - `tests/commons/Person.spec.ts`
49
+ - `tests/export/GEDCOM.spec.ts`
50
+ - `tests/utils/nextAvailableRelativeMediaPath.spec.ts`
51
+
52
+ ### Changed
53
+
54
+ - Full build migration to esbuild (`build.js`) and webpack removal.
55
+ - Test stack migrated from Jest to Vitest (`vitest.config.ts`) with `jsdom`.
56
+ - Build output now minified (esbuild minification + tree-shaking, ES2020 target).
57
+ - Obfuscation pipeline introduced with a moderated profile compatible with modern front-end apps.
58
+ - ZIP generation now uses `DEFLATE` compression level `9`.
59
+ - README rewritten with dedicated sections:
60
+ - Import
61
+ - Utilisation
62
+ - Export
63
+ - public API examples for all exports from `src/index.ts`
64
+ - Package metadata improved (`description`, `keywords`) for npm discoverability.
65
+ - CI/config/tooling updates (`.gitlab-ci.yml`, `.npmignore`, `.gitignore`, `tsconfig.json`, eslint config).
66
+
67
+ ### Fixed
68
+
69
+ - ZIP export no longer misses act media directories in edge cases.
70
+ - Fallback media path handling fixed to prevent `undefined/...` directories.
71
+ - GED `FILE` lines are now consistent with real ZIP archive paths.
72
+ - Import robustness improved:
73
+ - fallback to `file.text()` when `File.stream()` is unavailable
74
+ - more reliable GED record block parsing (`0 ...` headers preserved and detected)
75
+ - Multiple reliability fixes around acts, notes, places and media handling.
76
+
77
+ ## [1.0.9] - 2023-06-16
78
+
79
+ ### Added
80
+
81
+ - support multiple FAMS
82
+
83
+ ## [1.0.8] - 2023-06-15
84
+
85
+ ### Added
86
+
87
+ - all right reserved - proprietary code explicit in licence package
88
+
89
+ ## [1.0.7] - 2023-06-15
90
+
91
+ ### Added
92
+
93
+ - FAMS and FAMC are exported
94
+
95
+ ## [1.0.6] - 2023-06-15
96
+
97
+ ### Added
98
+
99
+ - export birth and death date and place
100
+
101
+ ## [1.0.5] - 2023-06-10
102
+
103
+ ### Added
104
+
105
+ - act birth and death
106
+
107
+ ## [1.0.4] - 2020-03-10
108
+
109
+ ### Added
110
+
111
+ - read FAMS (code for two parents) and FAMC (code for childs). It's same code between them.
112
+ - read Sex with two possibilities: M or F
113
+ - group partnersMap, it's a map for all parents
114
+ - jest / test in Person / runner
115
+ - createDirectAncestries
116
+
117
+
118
+ ## 1.0.3 - 2019-10-01
119
+
120
+ ### Added
121
+
122
+ - add import gedcom file and return a JSON data model of an array of Person. It just extract names and firstnames
123
+
124
+ ## 1.0.2-alpha - 2019-09-01
125
+
126
+ ### Added
127
+
128
+ - export for birth and death in gedcom
129
+ - All identificators can be used for a developper. It's an enum of properties used for all gedcom
130
+ - City is removed and replaced by Place. Place gets more informations
package/README.md CHANGED
@@ -99,9 +99,9 @@ person.lastname = "DUPONT";
99
99
  ### Act, Acts, TypeAct
100
100
 
101
101
  ```ts
102
- import { Act, Acts, TypeAct, Identificator } from "gedcom-ts";
102
+ import { Act, Acts, TypeAct, Identifier } from "gedcom-ts";
103
103
 
104
- const actType: TypeAct = Identificator.BIRT;
104
+ const actType: TypeAct = Identifier.BIRT;
105
105
  const act = new Act(actType);
106
106
  const acts = new Acts();
107
107
  acts.add(act);
@@ -141,9 +141,9 @@ const place = new Place("Paris, FR", new CoordinateGPS(48.8566, 2.3522));
141
141
  ### Notes, Note, TypeNote
142
142
 
143
143
  ```ts
144
- import { Notes, Note, TypeNote, Identificator } from "gedcom-ts";
144
+ import { Notes, Note, TypeNote, Identifier } from "gedcom-ts";
145
145
 
146
- const typeNote: TypeNote = Identificator.CONT;
146
+ const typeNote: TypeNote = Identifier.CONT;
147
147
  const note = new Note();
148
148
  note.updateType(typeNote);
149
149
  note.updateLines(["first line", "second line"]);
@@ -151,12 +151,12 @@ const notes = new Notes();
151
151
  notes.addNote(note);
152
152
  ```
153
153
 
154
- ### Identificator
154
+ ### Identifier (preferred) / Identificator (deprecated)
155
155
 
156
156
  ```ts
157
- import { Identificator } from "gedcom-ts";
157
+ import { Identifier } from "gedcom-ts";
158
158
 
159
- const birthTag = Identificator.BIRT;
159
+ const birthTag = Identifier.BIRT;
160
160
  ```
161
161
 
162
162
  ### ExportGedcomFile, ExportGedzipFile
@@ -1,9 +1,9 @@
1
1
  import { DateAct } from "./DateAct";
2
2
  import { Place } from "./Place";
3
- import { Identificator } from "./Identificator.enum";
3
+ import { Identifier } from "./Identifier.enum";
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 = Identifier.BIRT | Identifier.DEAT | Identifier.MARR | Identifier.BURI | Identifier.CHR | Identifier.DIV;
7
7
  export declare class Act {
8
8
  type: TypeAct;
9
9
  dateAct?: DateAct | null;
@@ -34,8 +34,13 @@ export declare class Acts {
34
34
  removeFromIndex(indexAct: number): void;
35
35
  removeAll(): void;
36
36
  sortByDate(): void;
37
+ private hasSortableDate;
38
+ private compareByTypeOrder;
39
+ private compareMarriageAndDivorce;
40
+ private haveSameParticipants;
37
41
  }
38
42
  export declare class ActsByExtraction extends Acts {
39
43
  extractActsInfo(lines: string[], INDIS: number[], mapFiles: Map<string, File>): void;
40
44
  private convertToActs;
45
+ private resolveTypeAct;
41
46
  }
@@ -1,6 +1,9 @@
1
1
  export declare enum TypeDateAct {
2
2
  BEF = "BEF",
3
3
  ABT = "ABT",
4
+ AFT = "AFT",
5
+ BET = "BET",
6
+ FROM = "FROM",
4
7
  NULL = "NULL"
5
8
  }
6
9
  export declare enum MonthEnum {
@@ -26,9 +29,43 @@ export declare class DateAct {
26
29
  day?: Day;
27
30
  month?: Month;
28
31
  year?: number;
32
+ endDay?: Day;
33
+ endMonth?: Month;
34
+ endYear?: number;
29
35
  constructor(dateLine: string);
30
36
  get date(): string | null;
37
+ updateExactDate(year?: number, month?: Month, day?: Day): void;
38
+ updateQualifiedDate(typeDateAct: TypeDateAct.ABT | TypeDateAct.BEF | TypeDateAct.AFT, year?: number, month?: Month, day?: Day): void;
39
+ updateBetweenDates(start: {
40
+ year: number;
41
+ month?: Month;
42
+ day?: Day;
43
+ }, end: {
44
+ year: number;
45
+ month?: Month;
46
+ day?: Day;
47
+ }): void;
48
+ updateFromToDates(start: {
49
+ year: number;
50
+ month?: Month;
51
+ day?: Day;
52
+ }, end: {
53
+ year: number;
54
+ month?: Month;
55
+ day?: Day;
56
+ }): void;
57
+ clearDate(): void;
31
58
  private convertMonth;
59
+ private parseSinglePart;
60
+ private parseTwoParts;
61
+ private parseThreeParts;
62
+ private parseFourParts;
63
+ private assignMonthYearFromSlash;
64
+ private parseMonthToken;
65
+ private formatCoreDate;
66
+ private tryParseRangeDate;
67
+ private parseCoreDateValue;
68
+ private isRelativeType;
32
69
  isValid(): boolean;
33
70
  }
34
71
  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,131 @@
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
+ 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,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;
@@ -10,10 +10,8 @@ declare class GEDCOM {
10
10
  gedcomBlob(): Blob;
11
11
  }
12
12
  export declare class ExportGedzipFile extends GEDCOM {
13
- private zip;
14
13
  constructor(...args: [persons: Array<Person>] | [title: string, persons: Array<Person>]);
15
14
  download(): Promise<void>;
16
- private collectMediaFiles;
17
15
  private resolvePersonIndi;
18
16
  private resolveActIndis;
19
17
  private resolveZipPath;
@@ -40,7 +38,6 @@ export declare class PersonLine {
40
38
  private readonly NOTES;
41
39
  constructor(person: Person, haveFiles: boolean);
42
40
  line(): string;
43
- private getFileLines;
44
41
  private getIndi;
45
42
  private getName;
46
43
  private getSex;
@@ -16,4 +16,9 @@ export declare class ReadGed extends SplitGedcom {
16
16
  generateUniqueIndi(): number;
17
17
  private haveParentsOfPerson;
18
18
  private createPersons;
19
+ private buildPerson;
20
+ private hydratePlacesFromActs;
21
+ private upsertPlace;
22
+ private linkPersonAsPartner;
23
+ private linkPersonAsChild;
19
24
  }