gedcom-ts 1.1.1 → 2.0.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/LICENSE +22 -0
- package/README.md +228 -35
- package/dist/commons/Act.d.ts +38 -5
- package/dist/commons/ActsByYears.d.ts +10 -0
- package/dist/commons/DateAct.d.ts +24 -5
- package/dist/commons/MultimediaFile.d.ts +14 -0
- package/dist/commons/Note.d.ts +18 -0
- package/dist/commons/Person.d.ts +44 -0
- package/dist/commons/Place.d.ts +7 -9
- package/dist/export/GEDCOM.d.ts +46 -37
- package/dist/import/LoadFile.d.ts +2 -0
- package/dist/import/ReadGed.d.ts +17 -17
- package/dist/import/SplitedInformations.d.ts +13 -0
- package/dist/index.cjs +1 -0
- package/dist/index.d.ts +12 -4
- package/dist/index.mjs +1 -0
- package/dist/services/CitySearch.d.ts +2 -0
- package/dist/utils/acts-helper/acts-helper.d.ts +2 -0
- package/dist/utils/gedcom/formatNoteForExport.d.ts +12 -0
- package/dist/utils/gedcom/parseGedcomLine.d.ts +13 -0
- package/dist/utils/indi/indi.d.ts +2 -0
- package/dist/utils/multimedia/nextAvailableRelativeMediaPath.d.ts +9 -0
- package/dist/utils/sosa/calculate-sosa.d.ts +2 -0
- package/package.json +50 -13
- package/CHANGELOG.md +0 -58
- package/dist/commons/Act.js +0 -20
- package/dist/commons/DateAct.js +0 -130
- package/dist/commons/Identificator.enum.js +0 -132
- package/dist/commons/People.d.ts +0 -29
- package/dist/commons/People.js +0 -88
- package/dist/commons/Place.js +0 -24
- package/dist/commons/Separators.js +0 -4
- package/dist/commons/Utils-People.d.ts +0 -2
- package/dist/commons/Utils-People.js +0 -9
- package/dist/export/GEDCOM.js +0 -189
- package/dist/import/ReadGed.js +0 -92
- package/dist/index.js +0 -6
- package/webpack.config.ts +0 -28
package/LICENSE
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
GEDCOM-TS© - 2019/2026 - Bertrand Jaunet
|
|
2
|
+
All rights reserved.
|
|
3
|
+
|
|
4
|
+
This license (the "License") governs the use of the software and associated documentation files (the "Software").
|
|
5
|
+
1. Non-commercial use
|
|
6
|
+
|
|
7
|
+
Personal, non-commercial use of the Software is permitted free of charge.
|
|
8
|
+
2. Commercial use
|
|
9
|
+
|
|
10
|
+
Any commercial use of the Software by a legal entity or professional organization, including but not limited to SaaS services, paid services, internal business operations, or any revenue-generating activity, requires prior subscription to a paid plan of 20 EUR per month.
|
|
11
|
+
3. Retroactive payment obligation
|
|
12
|
+
|
|
13
|
+
If commercial use of the Software begins before subscribing to the required plan, the user agrees to pay all fees due for the entire period of commercial use on a retroactive basis ("catch-up payment"), including the current month if any commercial use occurred during that month.
|
|
14
|
+
4. Restrictions
|
|
15
|
+
|
|
16
|
+
Except as expressly permitted by this License, no rights are granted to copy, modify, adapt, merge, publish, distribute, sublicense, or sell the Software, in whole or in part, without prior written permission from the copyright holder.
|
|
17
|
+
5. Warranty disclaimer
|
|
18
|
+
|
|
19
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
|
|
20
|
+
6. Limitation of liability
|
|
21
|
+
|
|
22
|
+
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES, OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT, OR OTHERWISE, ARISING FROM, OUT OF, OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,58 +1,251 @@
|
|
|
1
1
|
# gedcom-ts
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
`gedcom-ts` is a browser-oriented TypeScript library to:
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
- import genealogy data from GEDCOM (`.ged`) or ZIP (`.zip`)
|
|
6
|
+
- work with a typed JSON model (persons, acts, notes, media, places)
|
|
7
|
+
- export data back to GEDCOM (`.ged`) or ZIP (`.zip`)
|
|
6
8
|
|
|
7
|
-
|
|
9
|
+
## Project
|
|
8
10
|
|
|
9
|
-
|
|
11
|
+
- NPM package: [gedcom-ts](https://www.npmjs.com/package/gedcom-ts)
|
|
10
12
|
|
|
11
|
-
|
|
13
|
+
## Installation
|
|
12
14
|
|
|
13
|
-
|
|
15
|
+
```bash
|
|
16
|
+
npm install gedcom-ts
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Runtime Requirements
|
|
20
|
+
|
|
21
|
+
- modern browser runtime (`File`, `Blob`, `XMLHttpRequest`, `URL.createObjectURL`)
|
|
22
|
+
- for pure Node.js usage, DOM polyfills are required
|
|
23
|
+
|
|
24
|
+
## Import
|
|
25
|
+
|
|
26
|
+
```ts
|
|
27
|
+
import { importGedFile } from "gedcom-ts";
|
|
28
|
+
|
|
29
|
+
async function loadGenealogy(file: File) {
|
|
30
|
+
const readGed = await importGedFile(file);
|
|
31
|
+
return readGed.persons;
|
|
32
|
+
}
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
`importGedFile(file)` accepts:
|
|
36
|
+
|
|
37
|
+
- a GED file (`.ged`)
|
|
38
|
+
- a ZIP containing one GED file + optional media files
|
|
39
|
+
|
|
40
|
+
It returns a `ReadGed` instance with parsed persons, families, notes, acts, media and maps.
|
|
41
|
+
|
|
42
|
+
## Utilisation
|
|
43
|
+
|
|
44
|
+
```ts
|
|
45
|
+
import { ReadGed, Person, createSosaMap } from "gedcom-ts";
|
|
46
|
+
|
|
47
|
+
function buildViewModel(readGed: ReadGed, root: Person) {
|
|
48
|
+
const persons = readGed.persons;
|
|
49
|
+
const personByIndi = readGed.mapPersons;
|
|
50
|
+
const sosaMap = createSosaMap(root, readGed.partnersMap);
|
|
51
|
+
return { persons, personByIndi, sosaMap };
|
|
52
|
+
}
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
Typical workflow:
|
|
56
|
+
|
|
57
|
+
1. import a file with `importGedFile`
|
|
58
|
+
2. read and update `Person` objects
|
|
59
|
+
3. export as `.ged` or `.zip`
|
|
60
|
+
|
|
61
|
+
## Export
|
|
62
|
+
|
|
63
|
+
### GED (`.ged`)
|
|
64
|
+
|
|
65
|
+
```ts
|
|
66
|
+
import { ExportGedcomFile, Person } from "gedcom-ts";
|
|
67
|
+
|
|
68
|
+
function exportGed(persons: Person[]) {
|
|
69
|
+
new ExportGedcomFile("my-tree", persons).download();
|
|
70
|
+
}
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
### ZIP (`.zip`) GED + media
|
|
74
|
+
|
|
75
|
+
```ts
|
|
76
|
+
import { ExportGedzipFile, Person } from "gedcom-ts";
|
|
77
|
+
|
|
78
|
+
async function exportZip(persons: Person[]) {
|
|
79
|
+
await new ExportGedzipFile("my-tree", persons).download();
|
|
80
|
+
}
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
## Public API with Examples
|
|
84
|
+
|
|
85
|
+
Everything exported from `src/index.ts` is shown below with a minimal usage snippet.
|
|
86
|
+
|
|
87
|
+
### Person, Sex
|
|
88
|
+
|
|
89
|
+
```ts
|
|
90
|
+
import { Person, Sex } from "gedcom-ts";
|
|
91
|
+
|
|
92
|
+
const person = new Person();
|
|
93
|
+
person.INDI = 1;
|
|
94
|
+
person.SEX = Sex.M;
|
|
95
|
+
person.firstnames = ["Jean"];
|
|
96
|
+
person.lastname = "DUPONT";
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
### Act, Acts, TypeAct
|
|
100
|
+
|
|
101
|
+
```ts
|
|
102
|
+
import { Act, Acts, TypeAct, Identificator } from "gedcom-ts";
|
|
103
|
+
|
|
104
|
+
const actType: TypeAct = Identificator.BIRT;
|
|
105
|
+
const act = new Act(actType);
|
|
106
|
+
const acts = new Acts();
|
|
107
|
+
acts.add(act);
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
### DateAct, Day, Month, dateToDateLine, days, months
|
|
111
|
+
|
|
112
|
+
```ts
|
|
113
|
+
import { DateAct, Day, Month, dateToDateLine, days, months } from "gedcom-ts";
|
|
114
|
+
|
|
115
|
+
const day: Day = 12;
|
|
116
|
+
const month: Month = months[0]; // JAN
|
|
117
|
+
const dateLine = dateToDateLine(1901, month, day); // "12 JAN 1901"
|
|
118
|
+
const dateAct = new DateAct(dateLine);
|
|
119
|
+
const formattedDate = dateAct.date;
|
|
120
|
+
const knownDaysCount = days.length;
|
|
121
|
+
```
|
|
14
122
|
|
|
15
|
-
|
|
123
|
+
### MultimediaFile, MultimediaFiles
|
|
16
124
|
|
|
17
|
-
|
|
125
|
+
```ts
|
|
126
|
+
import { MultimediaFile, MultimediaFiles } from "gedcom-ts";
|
|
127
|
+
|
|
128
|
+
const bucket = new MultimediaFiles();
|
|
129
|
+
bucket.relativePath = "1/BIRT";
|
|
130
|
+
bucket.add(new MultimediaFile(new File(["img"], "birth.jpg")));
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
### Place, CoordinateGPS
|
|
134
|
+
|
|
135
|
+
```ts
|
|
136
|
+
import { Place, CoordinateGPS } from "gedcom-ts";
|
|
137
|
+
|
|
138
|
+
const place = new Place("Paris, FR", new CoordinateGPS(48.8566, 2.3522));
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
### Notes, Note, TypeNote
|
|
142
|
+
|
|
143
|
+
```ts
|
|
144
|
+
import { Notes, Note, TypeNote, Identificator } from "gedcom-ts";
|
|
145
|
+
|
|
146
|
+
const typeNote: TypeNote = Identificator.CONT;
|
|
147
|
+
const note = new Note();
|
|
148
|
+
note.updateType(typeNote);
|
|
149
|
+
note.updateLines(["first line", "second line"]);
|
|
150
|
+
const notes = new Notes();
|
|
151
|
+
notes.addNote(note);
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
### Identificator
|
|
155
|
+
|
|
156
|
+
```ts
|
|
157
|
+
import { Identificator } from "gedcom-ts";
|
|
158
|
+
|
|
159
|
+
const birthTag = Identificator.BIRT;
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
### ExportGedcomFile, ExportGedzipFile
|
|
163
|
+
|
|
164
|
+
```ts
|
|
165
|
+
import { ExportGedcomFile, ExportGedzipFile, Person } from "gedcom-ts";
|
|
166
|
+
|
|
167
|
+
const persons: Person[] = [];
|
|
168
|
+
new ExportGedcomFile("tree", persons).download();
|
|
169
|
+
await new ExportGedzipFile("tree", persons).download();
|
|
170
|
+
```
|
|
18
171
|
|
|
19
|
-
|
|
172
|
+
### ReadGed
|
|
20
173
|
|
|
174
|
+
```ts
|
|
175
|
+
import { ReadGed } from "gedcom-ts";
|
|
176
|
+
|
|
177
|
+
function useReadGed(readGed: ReadGed) {
|
|
178
|
+
return {
|
|
179
|
+
persons: readGed.persons,
|
|
180
|
+
places: readGed.placesMap,
|
|
181
|
+
};
|
|
182
|
+
}
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
### importGedFile
|
|
186
|
+
|
|
187
|
+
```ts
|
|
188
|
+
import { importGedFile } from "gedcom-ts";
|
|
189
|
+
|
|
190
|
+
const readGed = await importGedFile(fileInput.files![0]);
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
### createSosaMap
|
|
194
|
+
|
|
195
|
+
```ts
|
|
196
|
+
import { createSosaMap, Person } from "gedcom-ts";
|
|
197
|
+
|
|
198
|
+
const root = new Person();
|
|
199
|
+
root.INDI = 1;
|
|
200
|
+
const sosaMap = createSosaMap(root, new Map());
|
|
201
|
+
```
|
|
21
202
|
|
|
22
|
-
|
|
203
|
+
### remainingTypesAct
|
|
23
204
|
|
|
24
|
-
|
|
205
|
+
```ts
|
|
206
|
+
import { remainingTypesAct, Acts } from "gedcom-ts";
|
|
25
207
|
|
|
208
|
+
const availableTypes = remainingTypesAct(new Acts());
|
|
26
209
|
```
|
|
27
|
-
|
|
210
|
+
|
|
211
|
+
### EventsByYears, ActsByYear
|
|
212
|
+
|
|
213
|
+
```ts
|
|
214
|
+
import { EventsByYears, ActsByYear } from "gedcom-ts";
|
|
215
|
+
|
|
216
|
+
const grouped = new EventsByYears([]);
|
|
217
|
+
const yearBucket = new ActsByYear(1901);
|
|
218
|
+
const eventsByYear = grouped.events;
|
|
219
|
+
const selectedYear = yearBucket.year;
|
|
28
220
|
```
|
|
29
221
|
|
|
30
|
-
##
|
|
222
|
+
## End-to-End Example
|
|
31
223
|
|
|
32
224
|
```ts
|
|
33
|
-
import {
|
|
225
|
+
import { importGedFile, ExportGedzipFile } from "gedcom-ts";
|
|
226
|
+
|
|
227
|
+
async function importModifyExport(file: File) {
|
|
228
|
+
const readGed = await importGedFile(file);
|
|
229
|
+
const persons = readGed.persons;
|
|
230
|
+
|
|
231
|
+
if (persons.length > 0) {
|
|
232
|
+
persons[0].lastname = persons[0].lastname.toUpperCase();
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
await new ExportGedzipFile("updated-tree", persons).download();
|
|
236
|
+
}
|
|
34
237
|
```
|
|
35
238
|
|
|
36
|
-
|
|
239
|
+
## Error Handling
|
|
37
240
|
|
|
38
|
-
```
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
1 CHAR UTF-8
|
|
48
|
-
0 @I1@ INDI
|
|
49
|
-
1 NAME "Bruce" Thomas /WAYNE/
|
|
50
|
-
1 SEX H
|
|
51
|
-
1 BIRT
|
|
52
|
-
2 DATE 01 Jan 1938
|
|
53
|
-
2 PLAC Gotham City,USA
|
|
54
|
-
1 DEAT
|
|
55
|
-
2 DATE 01 Jan 2000
|
|
56
|
-
2 PLAC Gotham City,USA
|
|
57
|
-
TRLR
|
|
241
|
+
```ts
|
|
242
|
+
import { importGedFile } from "gedcom-ts";
|
|
243
|
+
|
|
244
|
+
try {
|
|
245
|
+
const readGed = await importGedFile(file);
|
|
246
|
+
const personsCount = readGed.persons.length;
|
|
247
|
+
} catch (error) {
|
|
248
|
+
console.error("GED import failed:", error);
|
|
249
|
+
}
|
|
58
250
|
```
|
|
251
|
+
|
package/dist/commons/Act.d.ts
CHANGED
|
@@ -1,8 +1,41 @@
|
|
|
1
1
|
import { DateAct } from "./DateAct";
|
|
2
|
+
import { Place } from "./Place";
|
|
3
|
+
import { Identificator } from "./Identificator.enum";
|
|
4
|
+
import { MultimediaFile, MultimediaFiles } from "./MultimediaFile";
|
|
5
|
+
import { Notes } from "./Note";
|
|
6
|
+
export type TypeAct = Identificator.BIRT | Identificator.DEAT | Identificator.MARR;
|
|
2
7
|
export declare class Act {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
+
type: TypeAct;
|
|
9
|
+
dateAct?: DateAct | null;
|
|
10
|
+
place: Place | null;
|
|
11
|
+
INDIS: number[];
|
|
12
|
+
private newMultimediaFiles;
|
|
13
|
+
multimediaFiles: MultimediaFiles;
|
|
14
|
+
notes: Notes;
|
|
15
|
+
get files(): MultimediaFile[];
|
|
16
|
+
get keysFiles(): string[];
|
|
17
|
+
constructor(type: TypeAct, dateAct?: DateAct | null, place?: Place | null, indis?: number[] | null, multimediaFiles?: MultimediaFiles | null, newMultimediaFiles?: Map<string, MultimediaFile>, notes?: Notes);
|
|
18
|
+
/**
|
|
19
|
+
* Média rattaché à l’acte : `{indi}/{type}/{nomFichier}` (indi = premier INDI connu ou paramètre).
|
|
20
|
+
* Suffixe `_1`, `_2`, … avant l’extension si le chemin est déjà pris sur cet acte.
|
|
21
|
+
*/
|
|
22
|
+
addMultimedia(multimediaFile: MultimediaFile, ownerIndi?: number): void;
|
|
23
|
+
removeMultimedia(index: number): void;
|
|
24
|
+
private mediaRelativePathsInUse;
|
|
25
|
+
updateType(typeAct: TypeAct): void;
|
|
26
|
+
addIndis(INDIS: number[]): void;
|
|
27
|
+
updatePlace(place: Place): void;
|
|
28
|
+
updateDateAct(dateAct: DateAct): void;
|
|
29
|
+
}
|
|
30
|
+
export declare class Acts {
|
|
31
|
+
list: Act[];
|
|
32
|
+
add(act: Act): void;
|
|
33
|
+
updateFromIndex(act: Act, indexAct: number): void;
|
|
34
|
+
removeFromIndex(indexAct: number): void;
|
|
35
|
+
removeAll(): void;
|
|
36
|
+
sortByDate(): void;
|
|
37
|
+
}
|
|
38
|
+
export declare class ActsByExtraction extends Acts {
|
|
39
|
+
extractActsInfo(lines: string[], INDIS: number[], mapFiles: Map<string, File>): void;
|
|
40
|
+
private convertToActs;
|
|
8
41
|
}
|
|
@@ -3,13 +3,32 @@ export declare enum TypeDateAct {
|
|
|
3
3
|
ABT = "ABT",
|
|
4
4
|
NULL = "NULL"
|
|
5
5
|
}
|
|
6
|
+
export declare enum MonthEnum {
|
|
7
|
+
JAN = "JAN",
|
|
8
|
+
FEB = "FEB",
|
|
9
|
+
MAR = "MAR",
|
|
10
|
+
APR = "APR",
|
|
11
|
+
MAY = "MAY",
|
|
12
|
+
JUN = "JUN",
|
|
13
|
+
JUL = "JUL",
|
|
14
|
+
AUG = "AUG",
|
|
15
|
+
SEP = "SEP",
|
|
16
|
+
OCT = "OCT",
|
|
17
|
+
NOV = "NOV",
|
|
18
|
+
DEC = "DEC"
|
|
19
|
+
}
|
|
20
|
+
export type Day = 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | null;
|
|
21
|
+
export declare const days: number[];
|
|
22
|
+
export type Month = MonthEnum.JAN | MonthEnum.FEB | MonthEnum.MAR | MonthEnum.APR | MonthEnum.MAY | MonthEnum.JUN | MonthEnum.JUL | MonthEnum.AUG | MonthEnum.SEP | MonthEnum.OCT | MonthEnum.NOV | MonthEnum.DEC | null;
|
|
23
|
+
export declare const months: Month[];
|
|
6
24
|
export declare class DateAct {
|
|
7
25
|
typeDateAct?: TypeDateAct;
|
|
8
|
-
day?:
|
|
9
|
-
month?:
|
|
10
|
-
year?:
|
|
11
|
-
date?: Date | null;
|
|
26
|
+
day?: Day;
|
|
27
|
+
month?: Month;
|
|
28
|
+
year?: number;
|
|
12
29
|
constructor(dateLine: string);
|
|
30
|
+
get date(): string | null;
|
|
13
31
|
private convertMonth;
|
|
14
|
-
|
|
32
|
+
isValid(): boolean;
|
|
15
33
|
}
|
|
34
|
+
export declare const dateToDateLine: (year?: number, month?: Month, day?: Day) => string;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export declare class MultimediaFile {
|
|
2
|
+
relativePath: string;
|
|
3
|
+
file: File;
|
|
4
|
+
constructor(file?: File);
|
|
5
|
+
get filename(): string;
|
|
6
|
+
}
|
|
7
|
+
export declare class MultimediaFiles {
|
|
8
|
+
/** Répertoire logique (sans slash final), ex. `1` ou `1/BIRT`. */
|
|
9
|
+
relativePath: string;
|
|
10
|
+
files: MultimediaFile[];
|
|
11
|
+
add(multimediaFile: MultimediaFile): void;
|
|
12
|
+
removeFromIndex(indexMultimediaFile: number): void;
|
|
13
|
+
removeAll(): void;
|
|
14
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Identificator } from "./Identificator.enum";
|
|
2
|
+
export type TypeNote = Identificator.CONC | Identificator.CONT | undefined;
|
|
3
|
+
export declare class Note {
|
|
4
|
+
INDIS: number[];
|
|
5
|
+
type: TypeNote;
|
|
6
|
+
lines: string[];
|
|
7
|
+
updateLines(lines: string[]): void;
|
|
8
|
+
removeLines(): void;
|
|
9
|
+
updateType(typeNote: TypeNote): void;
|
|
10
|
+
addIndis(INDIS: number[]): void;
|
|
11
|
+
}
|
|
12
|
+
export declare class Notes {
|
|
13
|
+
list: Note[];
|
|
14
|
+
addNote(note: Note): void;
|
|
15
|
+
updateFromIndex(note: Note, indexNote: number): void;
|
|
16
|
+
removeFromIndex(indexNote: number): void;
|
|
17
|
+
removeAll(): void;
|
|
18
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { Acts } from './Act';
|
|
2
|
+
import { MultimediaFile, MultimediaFiles } from "./MultimediaFile";
|
|
3
|
+
import { Notes } from "./Note";
|
|
4
|
+
export declare enum Sex {
|
|
5
|
+
M = "M",
|
|
6
|
+
F = "F"
|
|
7
|
+
}
|
|
8
|
+
export declare class Person {
|
|
9
|
+
sosa: number | undefined;
|
|
10
|
+
INDI: number;
|
|
11
|
+
SEX: Sex | undefined;
|
|
12
|
+
firstnames: Array<string>;
|
|
13
|
+
lastname: string;
|
|
14
|
+
FAMC?: number;
|
|
15
|
+
FAMS: number[];
|
|
16
|
+
private newMultimediaFiles;
|
|
17
|
+
multimediaFiles: MultimediaFiles;
|
|
18
|
+
acts: Acts;
|
|
19
|
+
notes: Notes;
|
|
20
|
+
get files(): MultimediaFile[];
|
|
21
|
+
get keysFiles(): string[];
|
|
22
|
+
constructor(sosa?: number, SEX?: Sex, firstnames?: Array<string>, lastname?: string, FAMC?: number, FAMS?: number[], INDI?: number, multimediaFiles?: MultimediaFiles, newMultimediaFiles?: Map<string, MultimediaFile>, acts?: Acts);
|
|
23
|
+
createPersonJson(personLines: string[], informationFamilies?: Map<number, string[]>, mapFiles?: Map<string, File>, globalNotes?: Map<number, string[]>): void;
|
|
24
|
+
private parsePersonLine;
|
|
25
|
+
private createIndiFromZeroLine;
|
|
26
|
+
private createSexFromValue;
|
|
27
|
+
private createFAMCFromValue;
|
|
28
|
+
private createFAMSFromValue;
|
|
29
|
+
private createMultimediaFilesFromValue;
|
|
30
|
+
private addNoteFromGedcom;
|
|
31
|
+
/**
|
|
32
|
+
* Média au niveau individu (hors acte) : chemin logique `{INDI}/{nomFichier}`.
|
|
33
|
+
* Si le même nom existe déjà pour cet individu, suffixe `_1`, `_2`, etc. avant l’extension.
|
|
34
|
+
*/
|
|
35
|
+
addMultimedia(multimediaFile: MultimediaFile): void;
|
|
36
|
+
deleteMultimedia(path: string): void;
|
|
37
|
+
private mediaRelativePathsInUse;
|
|
38
|
+
private createFirstnamesAndLastnameJson;
|
|
39
|
+
}
|
|
40
|
+
export declare class TreePerson extends Person {
|
|
41
|
+
parents: Person[];
|
|
42
|
+
childrens: Person[];
|
|
43
|
+
constructor(person: Person, parents: Person[], childrens: Person[], currentSosa: number);
|
|
44
|
+
}
|
package/dist/commons/Place.d.ts
CHANGED
|
@@ -1,14 +1,12 @@
|
|
|
1
1
|
export declare class Place {
|
|
2
|
-
city: string;
|
|
3
|
-
zip: number;
|
|
4
|
-
county: string;
|
|
5
|
-
region: string;
|
|
6
|
-
country: string;
|
|
2
|
+
city: string | null;
|
|
7
3
|
coordinate: CoordinateGPS;
|
|
8
|
-
constructor(city?: string,
|
|
4
|
+
constructor(city?: string, coordinate?: CoordinateGPS);
|
|
5
|
+
addCity(city: string): void;
|
|
9
6
|
}
|
|
10
7
|
export declare class CoordinateGPS {
|
|
11
|
-
latitude: number;
|
|
12
|
-
longitude: number;
|
|
13
|
-
constructor(latitude
|
|
8
|
+
latitude: number | undefined;
|
|
9
|
+
longitude: number | undefined;
|
|
10
|
+
constructor(latitude?: number, longitude?: number);
|
|
11
|
+
addCoordinates([x, y]: [number, number]): void;
|
|
14
12
|
}
|
package/dist/export/GEDCOM.d.ts
CHANGED
|
@@ -1,42 +1,51 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
import { Person } from '../commons/Person';
|
|
2
|
+
declare class GEDCOM {
|
|
3
|
+
protected title: string;
|
|
4
|
+
protected persons: Array<Person>;
|
|
5
|
+
protected onCreate: number;
|
|
6
|
+
private haveFiles;
|
|
7
|
+
constructor(title: string | undefined, persons: Array<Person>, haveFiles: boolean);
|
|
8
|
+
private get beginGedcom();
|
|
9
|
+
private get contentGedcom();
|
|
10
|
+
gedcomBlob(): Blob;
|
|
10
11
|
}
|
|
11
|
-
export declare class
|
|
12
|
-
|
|
13
|
-
constructor(title: string,
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
12
|
+
export declare class ExportGedzipFile extends GEDCOM {
|
|
13
|
+
private zip;
|
|
14
|
+
constructor(...args: [persons: Array<Person>] | [title: string, persons: Array<Person>]);
|
|
15
|
+
download(): Promise<void>;
|
|
16
|
+
private collectMediaFiles;
|
|
17
|
+
private resolvePersonIndi;
|
|
18
|
+
private resolveActIndis;
|
|
19
|
+
private resolveZipPath;
|
|
20
|
+
private zipFile;
|
|
17
21
|
}
|
|
18
|
-
export declare class
|
|
19
|
-
|
|
22
|
+
export declare class ExportGedcomFile extends GEDCOM {
|
|
23
|
+
constructor(...args: [persons: Array<Person>] | [title: string, persons: Array<Person>]);
|
|
24
|
+
download(): void;
|
|
20
25
|
}
|
|
21
|
-
export declare class
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
lastnames: string;
|
|
27
|
-
constructor(sosa: number, firstnames: Array<string>, lastnames: string, fams: number[], famc: number);
|
|
28
|
-
get indi(): string;
|
|
29
|
-
get famsLine(): string;
|
|
30
|
-
get famcLine(): string | null;
|
|
31
|
-
get firstnamesAndNames(): string;
|
|
32
|
-
get sex(): string;
|
|
26
|
+
export declare class FamilyLine {
|
|
27
|
+
private informationFamilies;
|
|
28
|
+
constructor(persons: Person[]);
|
|
29
|
+
lines(): string;
|
|
30
|
+
private setInformationFamilies;
|
|
33
31
|
}
|
|
34
|
-
export declare class
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
private
|
|
32
|
+
export declare class PersonLine {
|
|
33
|
+
private readonly INDI;
|
|
34
|
+
private readonly NAME;
|
|
35
|
+
private readonly SEX;
|
|
36
|
+
private readonly FAMS;
|
|
37
|
+
private readonly FAMC;
|
|
38
|
+
private readonly FILES;
|
|
39
|
+
private readonly ACTS;
|
|
40
|
+
private readonly NOTES;
|
|
41
|
+
constructor(person: Person, haveFiles: boolean);
|
|
42
|
+
line(): string;
|
|
43
|
+
private getFileLines;
|
|
44
|
+
private getIndi;
|
|
45
|
+
private getName;
|
|
46
|
+
private getSex;
|
|
47
|
+
private getFiles;
|
|
48
|
+
private getFams;
|
|
49
|
+
private getFamc;
|
|
42
50
|
}
|
|
51
|
+
export {};
|
package/dist/import/ReadGed.d.ts
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
1
|
+
import { Person } from '../commons/Person';
|
|
2
|
+
import { SplitGedcom } from "./SplitedInformations";
|
|
3
|
+
import { Place } from "../commons/Place";
|
|
4
|
+
export declare class ReadGed extends SplitGedcom {
|
|
5
|
+
persons: Person[];
|
|
6
|
+
mapPersons: Map<number, Person>;
|
|
7
|
+
partnersMap: Map<number, Person[]>;
|
|
8
|
+
childsMap: Map<number, Person[]>;
|
|
9
|
+
mapFiles: Map<string, File>;
|
|
10
|
+
placesMap: Map<string, Place>;
|
|
11
|
+
constructor(gedcomContent?: string, mapFiles?: Map<string, File>, placesMap?: Map<string, Place>, mapPersons?: Map<number, Person>);
|
|
12
|
+
static fromGedcomFile(gedcomFile: File, mapFiles?: Map<string, File>, placesMap?: Map<string, Place>, mapPersons?: Map<number, Person>): Promise<ReadGed>;
|
|
13
|
+
private finalizeAfterParse;
|
|
13
14
|
groupPartners(): void;
|
|
14
|
-
createDirectAncestries(
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
static json(peoplesFile: string[], marriagesFile: string[]): People[];
|
|
15
|
+
createDirectAncestries(person: Person): Person[];
|
|
16
|
+
generateUniqueIndi(): number;
|
|
17
|
+
private haveParentsOfPerson;
|
|
18
|
+
private createPersons;
|
|
19
19
|
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export declare class SplitGedcom {
|
|
2
|
+
protected informationPersons: string[][];
|
|
3
|
+
protected informationFamilies: Map<number, string[]>;
|
|
4
|
+
protected informationNotes: Map<number, string[]>;
|
|
5
|
+
constructor(gedcomContent?: string);
|
|
6
|
+
protected ingestGedcomText(gedcomContent: string): void;
|
|
7
|
+
protected ingestGedcomFileStream(file: File): Promise<void>;
|
|
8
|
+
private ingestRecordBlock;
|
|
9
|
+
private splitInformationPersons;
|
|
10
|
+
private splitInformationFamilies;
|
|
11
|
+
private splitInformationNotes;
|
|
12
|
+
private extractXrefId;
|
|
13
|
+
}
|