@treeviz/gedcom-parser 2.0.0 → 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.
@@ -1,5 +1,5 @@
1
- import { ah as IKinshipTranslator, aB as Path, aC as PathItem, af as IndiType, ac as IndiKey, ai as Language } from '../index-CzYZg44D.js';
2
- export { C as Cases, f as CrossCase, g as CrossCases } from '../index-CzYZg44D.js';
1
+ import { ah as IKinshipTranslator, aB as Path, aC as PathItem, af as IndiType, ac as IndiKey, ai as Language } from '../index-B3Po1Kaw.js';
2
+ export { C as Cases, f as CrossCase, g as CrossCases } from '../index-B3Po1Kaw.js';
3
3
  import 'date-fns';
4
4
 
5
5
  declare class KinshipTranslatorBasic implements IKinshipTranslator {
@@ -8,15 +8,15 @@ declare class KinshipTranslatorBasic implements IKinshipTranslator {
8
8
  displayName: "none" | "givenname" | "surname" | "all";
9
9
  private readonly _path?;
10
10
  constructor(path: Path, displayName?: "none" | "givenname" | "surname" | "all");
11
- protected get path(): Path;
12
- get path0(): PathItem;
13
- get path1(): PathItem;
14
- get pathM(): PathItem;
15
- get pathN(): PathItem;
16
- get person1(): IndiType;
17
- get person2(): IndiType;
18
- get personM(): IndiType;
19
- get personN(): IndiType;
11
+ protected get path(): Path | undefined;
12
+ get path0(): PathItem | undefined;
13
+ get path1(): PathItem | undefined;
14
+ get pathM(): PathItem | undefined;
15
+ get pathN(): PathItem | undefined;
16
+ get person1(): IndiType | undefined;
17
+ get person2(): IndiType | undefined;
18
+ get personM(): IndiType | undefined;
19
+ get personN(): IndiType | undefined;
20
20
  indirect(): string;
21
21
  removal(): string;
22
22
  parent(): string;
@@ -125,18 +125,18 @@ declare class KinshipTranslator<T extends boolean | undefined> {
125
125
  private readonly lang;
126
126
  private readonly displayName;
127
127
  constructor(person1: IndiType, person2?: IndiType | IndiKey, lang?: Language, entirePath?: T, displayName?: "none" | "givenname" | "surname" | "all");
128
- get path0(): PathItem;
129
- get path1(): PathItem;
130
- get pathM(): PathItem;
131
- get pathN(): PathItem;
132
- direct(): string;
133
- indirect(): string;
134
- removal(): string;
128
+ get path0(): PathItem | undefined;
129
+ get path1(): PathItem | undefined;
130
+ get pathM(): PathItem | undefined;
131
+ get pathN(): PathItem | undefined;
132
+ direct(): string | undefined;
133
+ indirect(): string | undefined;
134
+ removal(): string | undefined;
135
135
  translate(showMainPerson?: boolean): string | {
136
136
  id?: IndiKey;
137
137
  absolute?: string;
138
138
  relative?: string;
139
- }[];
139
+ }[] | undefined;
140
140
  }
141
141
 
142
142
  declare namespace translators {
@@ -4397,7 +4397,7 @@ var Indi = class extends Common {
4397
4397
  title,
4398
4398
  url,
4399
4399
  contentType: type,
4400
- downloadName: `${this.id.replaceAll("@", "")}_${this.toNaturalName().replaceAll(" ", "-") || ""}_${(title || key.replaceAll("@", "").toString()).replaceAll(" ", "-")}`
4400
+ downloadName: `${this.id.replaceAll("@", "")}_${this.toNaturalName()?.replaceAll(" ", "-") || ""}_${(title || key.replaceAll("@", "").toString()).replaceAll(" ", "-")}`
4401
4401
  };
4402
4402
  }
4403
4403
  })
@@ -4426,7 +4426,7 @@ var Indi = class extends Common {
4426
4426
  const deathObj = this.get("DEAT.OBJE")?.toList().copy();
4427
4427
  objeList?.merge(birthObj).merge(deathObj);
4428
4428
  (this.get("FAMS")?.toValueList().values() ?? []).concat(this.get("FAMC")?.toValueList().values() ?? []).forEach((fam) => {
4429
- objeList.merge(fam?.get("MARR.OBJE"));
4429
+ objeList?.merge(fam?.get("MARR.OBJE"));
4430
4430
  });
4431
4431
  objeList?.forEach((o, index) => {
4432
4432
  if (!o) {
@@ -4452,7 +4452,7 @@ var Indi = class extends Common {
4452
4452
  title,
4453
4453
  url,
4454
4454
  contentType: type,
4455
- downloadName: `${this.id.replaceAll("@", "")}_${this.toNaturalName().replaceAll(" ", "-") || ""}_${(title || key.replaceAll("@", "").toString()).replaceAll(" ", "-")}`
4455
+ downloadName: `${this.id.replaceAll("@", "")}_${this.toNaturalName()?.replaceAll(" ", "-") || ""}_${(title || key.replaceAll("@", "").toString()).replaceAll(" ", "-")}`
4456
4456
  };
4457
4457
  }
4458
4458
  });
@@ -4550,14 +4550,11 @@ var Indi = class extends Common {
4550
4550
  const sourList = this.get("SOUR")?.toList().copy();
4551
4551
  sourList?.forEach((sour) => {
4552
4552
  const sourObje = sour?.get("OBJE")?.toList();
4553
- objeList.merge(sourObje);
4553
+ objeList?.merge(sourObje);
4554
4554
  });
4555
- if (!objeList || objeList.length === 0) {
4556
- return void 0;
4557
- }
4558
4555
  const rfn = this.get("RFN")?.toValue();
4559
4556
  const geniId = rfn?.replace(/^geni:/, "") || "unknown";
4560
- objeList.forEach((obje, index) => {
4557
+ objeList?.forEach((obje, index) => {
4561
4558
  if (!obje) {
4562
4559
  return;
4563
4560
  }
@@ -4596,7 +4593,7 @@ var Indi = class extends Common {
4596
4593
  return list;
4597
4594
  }
4598
4595
  const rfn = this.get("RFN")?.toValue();
4599
- const treeId = rfn || "universal";
4596
+ const treeId = this.getUniversalTreeId() || rfn || "universal";
4600
4597
  objeList.forEach((obje, index) => {
4601
4598
  if (!obje) {
4602
4599
  return;
@@ -1,4 +1,4 @@
1
- import { ac as IndiKey, aB as Path, ag as Individuals, aH as ProfilePicture, p as GedComType } from './index-CzYZg44D.js';
1
+ import { ac as IndiKey, aB as Path, ag as Individuals, aH as ProfilePicture, p as GedComType } from './index-B3Po1Kaw.js';
2
2
 
3
3
  /**
4
4
  * Cache manager interface for pluggable cache implementations.
@@ -1,10 +1,13 @@
1
- import { aU as Settings, p as GedComType, ao as MultiTag, a as Common, a7 as IdType, D as IDateStructure, af as IndiType, ac as IndiKey, j as FamType, b as CommonDate, aq as NestedGroup, ag as Individuals } from './index-CzYZg44D.js';
1
+ import { aU as Settings, p as GedComType, ao as MultiTag, a as Common, a7 as IdType, D as IDateStructure, af as IndiType, ac as IndiKey, j as FamType, b as CommonDate, aq as NestedGroup, ag as Individuals } from './index-B3Po1Kaw.js';
2
2
 
3
3
  declare const GedcomTree: {
4
4
  parse: (content: string, options?: {
5
5
  settings?: Settings;
6
6
  filename?: string;
7
- }) => any;
7
+ }) => {
8
+ gedcom: GedComType;
9
+ raw: string;
10
+ };
8
11
  parseHierarchy: (content: string, options?: {
9
12
  settings?: Settings;
10
13
  filename?: string;
@@ -21,35 +24,35 @@ declare const create: (gedcom: GedComType, type: MultiTag, id?: string, nodes?:
21
24
  prevNode?: Common;
22
25
  }) => {
23
26
  prevNode: Common<string, IdType>;
24
- curNode: Common<string, IdType>;
25
- mainNode: Common<string, IdType>;
27
+ curNode: Common<string, IdType> | undefined;
28
+ mainNode: Common<string, IdType> | undefined;
26
29
  };
27
30
 
28
31
  declare const ACCEPTED_DATE_FORMATS: string[];
29
32
  declare const ACCEPTED_DATE_FORMATS_REGEX: RegExp;
30
- declare const commonDateFormatter: (date?: IDateStructure["DATE"], format?: string, prefix?: string) => string;
31
- declare const noteDateFormatter: (date?: IDateStructure["DATE"], format?: string, prefix?: string, shortNote?: boolean, showNote?: boolean) => string;
33
+ declare const commonDateFormatter: (date?: IDateStructure["DATE"], format?: string, prefix?: string) => string | undefined;
34
+ declare const noteDateFormatter: (date?: IDateStructure["DATE"], format?: string, prefix?: string, shortNote?: boolean, showNote?: boolean) => string | undefined;
32
35
  declare const marriageDateFormatter: (fam?: FamType, showDays?: boolean, showPlaces?: boolean, shortNote?: boolean, showNote?: boolean, showDisplayTextIfNoDate?: boolean, showAllEvents?: boolean, dateFormatPattern?: string) => {
33
- marriages?: string[];
34
- marriagePlaces?: string[];
35
- rawArray: CommonDate[];
36
+ marriages?: (string | undefined)[] | undefined;
37
+ marriagePlaces?: (string | undefined)[] | undefined;
38
+ rawArray: (CommonDate | undefined)[];
36
39
  inArray: string[];
37
40
  inOrder: string;
38
- places: string[];
41
+ places: (string | undefined)[];
39
42
  marriage: string[];
40
43
  };
41
44
  declare const dateFormatter: (indi?: IndiType, showMarriages?: boolean, showDays?: boolean, showPlaces?: boolean, shortNote?: boolean, showNote?: boolean, isOnStage?: (key: IndiKey) => boolean, showAllEvents?: boolean, dateFormatPattern?: string) => {
42
- births?: string[];
43
- birthPlaces?: string[];
44
- deaths?: string[];
45
- deathPlaces?: string[];
46
- marriages?: string[];
47
- marriagePlaces?: string[];
48
- birthPlace?: string;
49
- deathPlace?: string;
45
+ births?: string[] | undefined;
46
+ birthPlaces?: (string | undefined)[] | undefined;
47
+ deaths?: string[] | undefined;
48
+ deathPlaces?: (string | undefined)[] | undefined;
49
+ marriages?: (string | undefined)[] | undefined;
50
+ marriagePlaces?: (string | undefined)[] | undefined;
51
+ birthPlace?: string | undefined;
52
+ deathPlace?: string | undefined;
50
53
  inArray: string[];
51
54
  inOrder: string;
52
- places: string[];
55
+ places: (string | undefined)[];
53
56
  birth: string;
54
57
  marriage: string[];
55
58
  death: string;
@@ -1,5 +1,5 @@
1
- import { a as Common, Z as INoteStructure, a4 as ISourceCitationStructure } from '../index-CzYZg44D.js';
2
- export { I as IAddress, y as IAssociation, z as IChangeDate, B as ICreationDate, D as IDate, H as IEventDetail, H as IEventDetailStructure, L as IFamily, N as IGedcomStructure, P as IIndividual, Q as IIndividualEvent, R as IIndividualEventDetail, P as IIndividualStructure, T as ILdsOrdinanceDetail, U as ILdsSpouseSealing, W as IMarriageDate, X as IMultimediaLink, Y as INonEvent, $ as IPlace, a1 as IRepository, a3 as ISource, a5 as ISourceRepositoryCitation } from '../index-CzYZg44D.js';
1
+ import { a as Common, Z as INoteStructure, a4 as ISourceCitationStructure } from '../index-B3Po1Kaw.js';
2
+ export { I as IAddress, y as IAssociation, z as IChangeDate, B as ICreationDate, D as IDate, H as IEventDetail, H as IEventDetailStructure, L as IFamily, N as IGedcomStructure, P as IIndividual, Q as IIndividualEvent, R as IIndividualEventDetail, P as IIndividualStructure, T as ILdsOrdinanceDetail, U as ILdsSpouseSealing, W as IMarriageDate, X as IMultimediaLink, Y as INonEvent, $ as IPlace, a1 as IRepository, a3 as ISource, a5 as ISourceRepositoryCitation } from '../index-B3Po1Kaw.js';
3
3
  import 'date-fns';
4
4
 
5
5
  interface IPersonalNamePiecesStructure extends Common {
@@ -1,4 +1,4 @@
1
- export { e as ConvertType, i as FamKey, n as Filter, o as FilterIterator, u as Group, v as GroupDefinition, w as GroupIterator, x as GroupMarker, a7 as IdType, ac as IndiKey, aj as LinkedPersons, al as ListTag, ao as MultiTag, ap as NameOrder, aq as NestedGroup, as as NonStandard, au as ObjeKey, ax as Order, ay as OrderDefinition, az as OrderIterator, aA as PartnerType, aE as PlaceOrder, aL as Range, aO as RelationType, aQ as RepoKey, aT as RequiredFilter, aU as Settings, aW as SourKey, a$ as SubmKey, b2 as Tag, b3 as TagKey, b5 as UnknownKey } from '../index-CzYZg44D.js';
1
+ export { e as ConvertType, i as FamKey, n as Filter, o as FilterIterator, u as Group, v as GroupDefinition, w as GroupIterator, x as GroupMarker, a7 as IdType, ac as IndiKey, aj as LinkedPersons, al as ListTag, ao as MultiTag, ap as NameOrder, aq as NestedGroup, as as NonStandard, au as ObjeKey, ax as Order, ay as OrderDefinition, az as OrderIterator, aA as PartnerType, aE as PlaceOrder, aL as Range, aO as RelationType, aQ as RepoKey, aT as RequiredFilter, aU as Settings, aW as SourKey, a$ as SubmKey, b2 as Tag, b3 as TagKey, b5 as UnknownKey } from '../index-B3Po1Kaw.js';
2
2
  import 'date-fns';
3
3
 
4
4
  interface AncestryMedia {
@@ -1,6 +1,6 @@
1
- export { C as CacheRelatives, I as ICacheManager, P as PlaceParts, g as getPlaceParts, i as initializeCache, p as pathCache, a as profilePictureCache, r as relativesCache, b as resetRelativesCache } from '../place-parser-CJ3EbFmb.js';
2
- export { A as ACCEPTED_DATE_FORMATS, a as ACCEPTED_DATE_FORMATS_REGEX, G as GedcomTree, c as commonDateFormatter, b as create, d as dateFormatter, g as getAllProp, e as getFamilyWith, f as getName, h as getRawSize, i as getVersion, j as hungarianOrdinalize, k as implemented, l as isDevelopment, m as marriageDateFormatter, n as nameFormatter, o as notImplemented, p as noteDateFormatter, q as ordinalize, r as placeTranslator, s as setNestedGroup } from '../place-translator-Ci5rEY6p.js';
3
- export { aD as Place, aF as PlaceType, aG as PrimitiveRange, aM as Range, aZ as SplitResult, bi as extractSeparationYears, bj as extractSplitPoints, bk as findMatchingRangeForSplitRange, bl as fromTuple, bm as generateSplitRanges, bo as getPlaces, bt as inRange, bx as isIntersectedRange, bz as isRangeContained, bC as parseRangeBounds, bD as splitOverlappingRanges, bE as splitRange } from '../index-CzYZg44D.js';
1
+ export { C as CacheRelatives, I as ICacheManager, P as PlaceParts, g as getPlaceParts, i as initializeCache, p as pathCache, a as profilePictureCache, r as relativesCache, b as resetRelativesCache } from '../place-parser-BLwBjtXS.js';
2
+ export { A as ACCEPTED_DATE_FORMATS, a as ACCEPTED_DATE_FORMATS_REGEX, G as GedcomTree, c as commonDateFormatter, b as create, d as dateFormatter, g as getAllProp, e as getFamilyWith, f as getName, h as getRawSize, i as getVersion, j as hungarianOrdinalize, k as implemented, l as isDevelopment, m as marriageDateFormatter, n as nameFormatter, o as notImplemented, p as noteDateFormatter, q as ordinalize, r as placeTranslator, s as setNestedGroup } from '../place-translator-DPMyrsnu.js';
3
+ export { aD as Place, aF as PlaceType, aG as PrimitiveRange, aM as Range, aZ as SplitResult, bi as extractSeparationYears, bj as extractSplitPoints, bk as findMatchingRangeForSplitRange, bl as fromTuple, bm as generateSplitRanges, bo as getPlaces, bt as inRange, bx as isIntersectedRange, bz as isRangeContained, bC as parseRangeBounds, bD as splitOverlappingRanges, bE as splitRange } from '../index-B3Po1Kaw.js';
4
4
  import 'date-fns';
5
5
 
6
6
  /**
@@ -3037,7 +3037,7 @@ var Indi = class extends Common {
3037
3037
  title,
3038
3038
  url,
3039
3039
  contentType: type,
3040
- downloadName: `${this.id.replaceAll("@", "")}_${this.toNaturalName().replaceAll(" ", "-") || ""}_${(title || key.replaceAll("@", "").toString()).replaceAll(" ", "-")}`
3040
+ downloadName: `${this.id.replaceAll("@", "")}_${this.toNaturalName()?.replaceAll(" ", "-") || ""}_${(title || key.replaceAll("@", "").toString()).replaceAll(" ", "-")}`
3041
3041
  };
3042
3042
  }
3043
3043
  })
@@ -3066,7 +3066,7 @@ var Indi = class extends Common {
3066
3066
  const deathObj = this.get("DEAT.OBJE")?.toList().copy();
3067
3067
  objeList?.merge(birthObj).merge(deathObj);
3068
3068
  (this.get("FAMS")?.toValueList().values() ?? []).concat(this.get("FAMC")?.toValueList().values() ?? []).forEach((fam) => {
3069
- objeList.merge(fam?.get("MARR.OBJE"));
3069
+ objeList?.merge(fam?.get("MARR.OBJE"));
3070
3070
  });
3071
3071
  objeList?.forEach((o, index) => {
3072
3072
  if (!o) {
@@ -3092,7 +3092,7 @@ var Indi = class extends Common {
3092
3092
  title,
3093
3093
  url,
3094
3094
  contentType: type,
3095
- downloadName: `${this.id.replaceAll("@", "")}_${this.toNaturalName().replaceAll(" ", "-") || ""}_${(title || key.replaceAll("@", "").toString()).replaceAll(" ", "-")}`
3095
+ downloadName: `${this.id.replaceAll("@", "")}_${this.toNaturalName()?.replaceAll(" ", "-") || ""}_${(title || key.replaceAll("@", "").toString()).replaceAll(" ", "-")}`
3096
3096
  };
3097
3097
  }
3098
3098
  });
@@ -3190,14 +3190,11 @@ var Indi = class extends Common {
3190
3190
  const sourList = this.get("SOUR")?.toList().copy();
3191
3191
  sourList?.forEach((sour) => {
3192
3192
  const sourObje = sour?.get("OBJE")?.toList();
3193
- objeList.merge(sourObje);
3193
+ objeList?.merge(sourObje);
3194
3194
  });
3195
- if (!objeList || objeList.length === 0) {
3196
- return void 0;
3197
- }
3198
3195
  const rfn = this.get("RFN")?.toValue();
3199
3196
  const geniId = rfn?.replace(/^geni:/, "") || "unknown";
3200
- objeList.forEach((obje, index) => {
3197
+ objeList?.forEach((obje, index) => {
3201
3198
  if (!obje) {
3202
3199
  return;
3203
3200
  }
@@ -3236,7 +3233,7 @@ var Indi = class extends Common {
3236
3233
  return list;
3237
3234
  }
3238
3235
  const rfn = this.get("RFN")?.toValue();
3239
- const treeId = rfn || "universal";
3236
+ const treeId = this.getUniversalTreeId() || rfn || "universal";
3240
3237
  objeList.forEach((obje, index) => {
3241
3238
  if (!obje) {
3242
3239
  return;
@@ -6490,7 +6487,7 @@ var isCommonDate = (value) => {
6490
6487
  // package.json
6491
6488
  var package_default = {
6492
6489
  name: "@treeviz/gedcom-parser",
6493
- version: "2.0.0"};
6490
+ version: "2.0.1"};
6494
6491
 
6495
6492
  // src/utils/get-product-details.ts
6496
6493
  var isDevelopment = () => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@treeviz/gedcom-parser",
3
- "version": "2.0.0",
3
+ "version": "2.0.1",
4
4
  "description": "Lightweight, pluggable GEDCOM parser for JavaScript/TypeScript with optional caching and place matching. Zero browser dependencies.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -1 +0,0 @@
1
- #!/usr/bin/env node