@treeviz/gedcom-parser 1.0.20 → 1.0.22
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/dist/classes/index.d.ts +1 -1
- package/dist/classes/index.js +112 -50
- package/dist/cli/index.js +112 -50
- package/dist/constants/index.d.ts +1 -1
- package/dist/constants/index.js +111 -49
- package/dist/factories/index.d.ts +2 -2
- package/dist/factories/index.js +111 -49
- package/dist/{index-DOapi7nN.d.ts → index-BPEVN_DY.d.ts} +9 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.js +112 -50
- package/dist/interfaces/index.d.ts +1 -1
- package/dist/kinship-translator/index.d.ts +2 -2
- package/dist/kinship-translator/index.js +111 -49
- package/dist/{place-parser-CIplmmDd.d.ts → place-parser-CM0TJFj8.d.ts} +1 -1
- package/dist/place-translator-CRiaOO9v.d.ts +88 -0
- package/dist/structures/index.d.ts +2 -2
- package/dist/types/index.d.ts +1 -1
- package/dist/utils/index.d.ts +14 -86
- package/dist/utils/index.js +113 -51
- package/package.json +1 -1
package/dist/factories/index.js
CHANGED
|
@@ -1691,6 +1691,27 @@ var getPlaces = (common, type = ["ALL" /* All */], maxLevel = 1, level = 0, main
|
|
|
1691
1691
|
var implemented = (type, ...args) => {
|
|
1692
1692
|
};
|
|
1693
1693
|
|
|
1694
|
+
// src/utils/media-utils.ts
|
|
1695
|
+
var getFileExtension = (filename) => {
|
|
1696
|
+
const match = filename.match(/\.([^.]+)$/);
|
|
1697
|
+
return match ? match[1] : "";
|
|
1698
|
+
};
|
|
1699
|
+
var isImageFormat = (format2) => {
|
|
1700
|
+
if (!format2) return false;
|
|
1701
|
+
const imageFormats = [
|
|
1702
|
+
"jpg",
|
|
1703
|
+
"jpeg",
|
|
1704
|
+
"png",
|
|
1705
|
+
"gif",
|
|
1706
|
+
"bmp",
|
|
1707
|
+
"webp",
|
|
1708
|
+
"svg",
|
|
1709
|
+
"tiff",
|
|
1710
|
+
"tif"
|
|
1711
|
+
];
|
|
1712
|
+
return imageFormats.includes(format2.toLowerCase());
|
|
1713
|
+
};
|
|
1714
|
+
|
|
1694
1715
|
// src/factories/place-parser-provider.ts
|
|
1695
1716
|
var placeParserProvider;
|
|
1696
1717
|
var setPlaceParserProvider = (parser) => {
|
|
@@ -2928,54 +2949,62 @@ var Indi = class extends Common {
|
|
|
2928
2949
|
}
|
|
2929
2950
|
async ancestryMedia(namespace) {
|
|
2930
2951
|
const list = {};
|
|
2931
|
-
const
|
|
2952
|
+
const objeList = this.get("OBJE")?.toList();
|
|
2932
2953
|
const www = this._gedcom?.HEAD?.SOUR?.CORP?.WWW?.value;
|
|
2933
2954
|
const tree = this.getAncestryTreeId();
|
|
2934
|
-
|
|
2935
|
-
|
|
2936
|
-
|
|
2937
|
-
|
|
2938
|
-
|
|
2939
|
-
|
|
2940
|
-
|
|
2941
|
-
|
|
2942
|
-
|
|
2943
|
-
let url = obje?.get("FILE")?.toValue();
|
|
2944
|
-
const title = obje?.get("TITL")?.toValue() ?? "";
|
|
2945
|
-
const type = obje?.get("FORM")?.toValue() ?? "raw";
|
|
2946
|
-
const imgId = clone || mser;
|
|
2947
|
-
if (!www || !tree || !this.id) {
|
|
2948
|
-
return;
|
|
2949
|
-
}
|
|
2950
|
-
if (!namespace && !url) {
|
|
2951
|
-
try {
|
|
2952
|
-
const mediaDetailsResponse = await fetch(
|
|
2953
|
-
`https://www.ancestry.com/api/media/viewer/v2/trees/${tree}/media?id=${media}`
|
|
2954
|
-
);
|
|
2955
|
-
const mediaDetails = await mediaDetailsResponse.json();
|
|
2956
|
-
if (mediaDetails.url) {
|
|
2957
|
-
url = `${mediaDetails.url}&imageQuality=hq`;
|
|
2955
|
+
if (objeList) {
|
|
2956
|
+
await Promise.all(
|
|
2957
|
+
objeList.map(async (objeRef) => {
|
|
2958
|
+
const key = objeRef?.id;
|
|
2959
|
+
const obje = objeRef?.standardizeMedia(
|
|
2960
|
+
namespace,
|
|
2961
|
+
true,
|
|
2962
|
+
(ns, iId) => {
|
|
2963
|
+
return ns && iId ? `https://mediasvc.ancestry.com/v2/image/namespaces/${ns}/media/${iId}?client=trees-mediaservice&imageQuality=hq` : void 0;
|
|
2958
2964
|
}
|
|
2959
|
-
|
|
2965
|
+
);
|
|
2966
|
+
const isPrimary = obje?.get("_PRIM")?.toValue() === "Y";
|
|
2967
|
+
const media = obje?.RIN?.value;
|
|
2968
|
+
const clone = obje?.get("_CLON._OID")?.toValue();
|
|
2969
|
+
const mser = obje?.get("_MSER._LKID")?.toValue();
|
|
2970
|
+
let url = obje?.get("FILE")?.toValue();
|
|
2971
|
+
const title = obje?.get("TITL")?.toValue() ?? "";
|
|
2972
|
+
const type = obje?.get("FORM")?.toValue() ?? "raw";
|
|
2973
|
+
const imgId = clone || mser;
|
|
2974
|
+
if (!www || !tree || !this.id) {
|
|
2975
|
+
return;
|
|
2960
2976
|
}
|
|
2961
|
-
|
|
2962
|
-
|
|
2963
|
-
|
|
2964
|
-
|
|
2965
|
-
|
|
2966
|
-
|
|
2967
|
-
|
|
2968
|
-
|
|
2969
|
-
|
|
2970
|
-
|
|
2971
|
-
|
|
2972
|
-
url
|
|
2973
|
-
|
|
2974
|
-
|
|
2975
|
-
|
|
2976
|
-
|
|
2977
|
-
|
|
2978
|
-
|
|
2977
|
+
if (!namespace && !url) {
|
|
2978
|
+
try {
|
|
2979
|
+
const mediaDetailsResponse = await fetch(
|
|
2980
|
+
`https://www.ancestry.com/api/media/viewer/v2/trees/${tree}/media?id=${media}`
|
|
2981
|
+
);
|
|
2982
|
+
const mediaDetails = await mediaDetailsResponse.json();
|
|
2983
|
+
if (mediaDetails.url) {
|
|
2984
|
+
url = `${mediaDetails.url}&imageQuality=hq`;
|
|
2985
|
+
}
|
|
2986
|
+
} catch (_e) {
|
|
2987
|
+
}
|
|
2988
|
+
url = url || `https://${www}/mediaui-viewer/tree/${tree}/media/${media}`;
|
|
2989
|
+
}
|
|
2990
|
+
if (url && imgId) {
|
|
2991
|
+
const id = `${tree}-${this.id}-${imgId}`;
|
|
2992
|
+
list[id] = {
|
|
2993
|
+
key,
|
|
2994
|
+
isPrimary,
|
|
2995
|
+
id,
|
|
2996
|
+
tree,
|
|
2997
|
+
imgId,
|
|
2998
|
+
person: this.id,
|
|
2999
|
+
title,
|
|
3000
|
+
url,
|
|
3001
|
+
contentType: type,
|
|
3002
|
+
downloadName: `${this.id.replaceAll("@", "")}_${this.toNaturalName().replaceAll(" ", "-") || ""}_${(title || key.replaceAll("@", "").toString()).replaceAll(" ", "-")}`
|
|
3003
|
+
};
|
|
3004
|
+
}
|
|
3005
|
+
})
|
|
3006
|
+
);
|
|
3007
|
+
}
|
|
2979
3008
|
return list;
|
|
2980
3009
|
}
|
|
2981
3010
|
myheritageLink(poolId = 0) {
|
|
@@ -2994,18 +3023,20 @@ var Indi = class extends Common {
|
|
|
2994
3023
|
if (!tree) {
|
|
2995
3024
|
return;
|
|
2996
3025
|
}
|
|
2997
|
-
const
|
|
2998
|
-
const
|
|
2999
|
-
const
|
|
3000
|
-
|
|
3026
|
+
const objeList = this.get("OBJE")?.toList();
|
|
3027
|
+
const birthObj = this.get("BIRT.OBJE")?.toList();
|
|
3028
|
+
const deathObj = this.get("DEAT.OBJE")?.toList();
|
|
3029
|
+
(this.get("FAMS")?.toValueList().values() ?? []).concat(this.get("FAMC")?.toValueList().values() ?? []).forEach((fam) => {
|
|
3030
|
+
objeList?.merge(birthObj).merge(deathObj).merge(fam?.get("MARR.OBJE"));
|
|
3001
3031
|
});
|
|
3002
|
-
|
|
3032
|
+
objeList?.forEach((o, index) => {
|
|
3003
3033
|
if (!o) {
|
|
3004
3034
|
return;
|
|
3005
3035
|
}
|
|
3006
3036
|
const obje = o;
|
|
3007
3037
|
const key = `@O${index}@`;
|
|
3008
3038
|
obje.standardizeMedia();
|
|
3039
|
+
const isPrimary = obje?.get("_PRIM")?.toValue() === "Y";
|
|
3009
3040
|
const url = obje?.get("FILE")?.toValue();
|
|
3010
3041
|
const title = obje?.get("NOTE")?.toValue() ?? "";
|
|
3011
3042
|
const type = obje?.get("FORM")?.toValue() ?? "raw";
|
|
@@ -3013,6 +3044,7 @@ var Indi = class extends Common {
|
|
|
3013
3044
|
if (url && imgId) {
|
|
3014
3045
|
const id = `${tree}-${this.id}-${imgId}`;
|
|
3015
3046
|
list[id] = {
|
|
3047
|
+
isPrimary,
|
|
3016
3048
|
key,
|
|
3017
3049
|
id,
|
|
3018
3050
|
tree,
|
|
@@ -3122,6 +3154,36 @@ var Indi = class extends Common {
|
|
|
3122
3154
|
}
|
|
3123
3155
|
return void 0;
|
|
3124
3156
|
}
|
|
3157
|
+
async getProfilePicture(namespace) {
|
|
3158
|
+
const mediaList = await this.multimedia(namespace);
|
|
3159
|
+
if (!mediaList) {
|
|
3160
|
+
return void 0;
|
|
3161
|
+
}
|
|
3162
|
+
const mediaArray = Object.values(mediaList);
|
|
3163
|
+
const primaryMedia = mediaArray.find(
|
|
3164
|
+
(media) => media.isPrimary && isImageFormat(media.contentType || getFileExtension(media.url))
|
|
3165
|
+
);
|
|
3166
|
+
if (primaryMedia) {
|
|
3167
|
+
return {
|
|
3168
|
+
file: primaryMedia.url,
|
|
3169
|
+
form: primaryMedia.contentType,
|
|
3170
|
+
title: primaryMedia.title,
|
|
3171
|
+
isPrimary: true
|
|
3172
|
+
};
|
|
3173
|
+
}
|
|
3174
|
+
const secondaryMedia = mediaArray.find(
|
|
3175
|
+
(media) => isImageFormat(media.contentType || getFileExtension(media.url))
|
|
3176
|
+
);
|
|
3177
|
+
if (secondaryMedia) {
|
|
3178
|
+
return {
|
|
3179
|
+
file: secondaryMedia.url,
|
|
3180
|
+
form: secondaryMedia.contentType,
|
|
3181
|
+
title: secondaryMedia.title,
|
|
3182
|
+
isPrimary: false
|
|
3183
|
+
};
|
|
3184
|
+
}
|
|
3185
|
+
return void 0;
|
|
3186
|
+
}
|
|
3125
3187
|
link(poolId) {
|
|
3126
3188
|
if (this?.isAncestry()) {
|
|
3127
3189
|
return this.ancestryLink();
|
|
@@ -511,6 +511,7 @@ type GeneratorKey = `${"2nd" | "3rd" | `${4 | 5 | 6 | 7 | 8 | 9}th`}`;
|
|
|
511
511
|
type GeneratorType = "Cousins" | "GreatGrandParents" | "GreatGrandChildren";
|
|
512
512
|
type GeneratedIndiMethods = Record<`get${GeneratorKey}${GeneratorType}`, () => Individuals>;
|
|
513
513
|
type MediaList = Record<string, {
|
|
514
|
+
isPrimary?: boolean;
|
|
514
515
|
key: string;
|
|
515
516
|
id: string;
|
|
516
517
|
imgId: string;
|
|
@@ -855,6 +856,7 @@ declare class Indi extends Common<string, IndiKey> implements IIndi {
|
|
|
855
856
|
hasFamilySearchSources(): boolean;
|
|
856
857
|
getFamilySearchSources(): FamilySearchSource[];
|
|
857
858
|
multimedia(namespace?: string | number): Promise<MediaList | undefined>;
|
|
859
|
+
getProfilePicture(namespace?: string | number): Promise<ProfilePicture | undefined>;
|
|
858
860
|
link(poolId?: number): string;
|
|
859
861
|
toFamilies(list?: List): Families;
|
|
860
862
|
getFamilies(type: "FAMC" | "FAMS"): Families;
|
|
@@ -1064,6 +1066,12 @@ interface FamilySearchSource {
|
|
|
1064
1066
|
www?: string;
|
|
1065
1067
|
notes?: string[];
|
|
1066
1068
|
}
|
|
1069
|
+
interface ProfilePicture {
|
|
1070
|
+
file: string;
|
|
1071
|
+
form?: string;
|
|
1072
|
+
title?: string;
|
|
1073
|
+
isPrimary: boolean;
|
|
1074
|
+
}
|
|
1067
1075
|
interface TreeMember<T = IndiType> {
|
|
1068
1076
|
id: FamKey | IndiKey;
|
|
1069
1077
|
index: number;
|
|
@@ -1664,4 +1672,4 @@ declare const getValidKey: (tag: string, id: string) => string;
|
|
|
1664
1672
|
declare const isId: (string: string) => string is IdType;
|
|
1665
1673
|
declare const idGetter: <T extends IdType>(id?: T) => T;
|
|
1666
1674
|
|
|
1667
|
-
export { type RepoType as $, type Order as A, type OrderIterator as B, type Cases as C, type Group as D, type GroupMarker as E, type FamKey as F, type GroupDefinition as G, type GroupIterator as H, type IKinshipTranslator as I, type NestedGroup as J, type NameOrder as K, type Language as L, type MultiTag as M, type NonStandard as N, type ObjeKey as O, type PrimitiveRange as P, type PlaceOrder as Q, type Range$1 as R, type SplitResult as S, type TagKey as T, type UnknownKey as U, type LinkedPersons as V, RelationType as W, PartnerType as X, Range as Y, type ProxyOriginal as Z, type SourType as _, isIntersectedRange as a,
|
|
1675
|
+
export { type RepoType as $, type Order as A, type OrderIterator as B, type Cases as C, type Group as D, type GroupMarker as E, type FamKey as F, type GroupDefinition as G, type GroupIterator as H, type IKinshipTranslator as I, type NestedGroup as J, type NameOrder as K, type Language as L, type MultiTag as M, type NonStandard as N, type ObjeKey as O, type PrimitiveRange as P, type PlaceOrder as Q, type Range$1 as R, type SplitResult as S, type TagKey as T, type UnknownKey as U, type LinkedPersons as V, RelationType as W, PartnerType as X, Range as Y, type ProxyOriginal as Z, type SourType as _, isIntersectedRange as a, Sour as a$, type SubmType as a0, type IndiType as a1, type TreeMember as a2, type GenealogyMember as a3, type IndiTree as a4, type IndiGenealogy as a5, type IndiMarker as a6, type MemberSide as a7, type MemberMain as a8, type GenerationSpouseType as a9, createCommonDate as aA, isCommonDate as aB, Fam as aC, createFam as aD, Families as aE, GedCom as aF, createGedCom as aG, isGedcomString as aH, validateGedcomContent as aI, mergeGedcoms as aJ, Indi as aK, type FamilySearchMatch as aL, type FamilySearchSource as aM, type ProfilePicture as aN, createIndi as aO, Individuals as aP, List as aQ, CommonName as aR, createCommonName as aS, CommonNote as aT, createCommonNote as aU, Obje as aV, createObje as aW, Objects as aX, Repo as aY, createRepo as aZ, Repositories as a_, type GenerationIndiType as aa, type IndiGenealogyGenerations as ab, type IndiGenealogyResult as ac, type NonNullIndiGenealogyResult as ad, type PathItem as ae, type Path as af, type ReducedPath as ag, type QueueItem as ah, type Queue as ai, type FamType as aj, type GedComType as ak, type ObjeType as al, Existed as am, CustomTags as an, Common as ao, createProxy as ap, createCommon as aq, isOnlyMainProp as ar, isValidKey as as, getValidKeys as at, getValidTag as au, getListTag as av, getValidKey as aw, isId as ax, idGetter as ay, CommonDate as az, isRangeContained as b, createSour as b0, Sources as b1, Subm as b2, createSubm as b3, Submitters as b4, type ICommon as b5, type IFam as b6, type IFamilies as b7, type IGedcom as b8, type IIndi as b9, type ISourceCitationStructure as bA, type ISourceRepositoryCitationStructure as bB, type ISourceStructure as bC, type Place as bD, PlaceType as bE, getPlaces as bF, type GeneratedIndiMethods as ba, type IIndividuals as bb, type IList as bc, type IObje as bd, type IRepo as be, type ISour as bf, type ISubm as bg, type IAddressStructure as bh, type IAssociationStructure as bi, type IChangeDateStructure as bj, type ICreationDateStructure as bk, type IDateStructure as bl, type IEventDetailStructure as bm, type IFamilyStructure as bn, type IGedComStructure as bo, type IIndividualEventDetailStructure as bp, type IIndividualEventStructure as bq, type IIndividualStructure as br, type ILdsOrdinanceDetailStructure as bs, type ILdsSpouseSealingStructure as bt, type IMarriageDateStructure as bu, type IMultimediaLinkStructure as bv, type INonEventStructure as bw, type INoteStructure as bx, type IPlaceStructure as by, type IRepositoryStructure as bz, splitOverlappingRanges as c, findMatchingRangeForSplitRange as d, extractSplitPoints as e, fromTuple as f, generateSplitRanges as g, extractSeparationYears as h, inRange as i, type CrossCase as j, type CrossCases as k, type Settings as l, type ConvertType as m, type IndiKey as n, type RepoKey as o, parseRangeBounds as p, type SourKey as q, type SubmKey as r, splitRange as s, type IdType as t, type Tag as u, type ListTag as v, type FilterIterator as w, type Filter as x, type RequiredFilter as y, type OrderDefinition as z };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
export { ACCEPTED_DATE_FORMATS, ACCEPTED_DATE_FORMATS_REGEX, GedcomTree, commonDateFormatter, create, dateFormatter,
|
|
1
|
+
export { A as ACCEPTED_DATE_FORMATS, a as ACCEPTED_DATE_FORMATS_REGEX, G as GedcomTree, b as commonDateFormatter, c as create, d as dateFormatter, G as default, e as getAllProp, f as getFamilyWith, j as getName, g as getRawSize, h as getVersion, q as hungarianOrdinalize, k as implemented, i as isDevelopment, m as marriageDateFormatter, o as nameFormatter, l as notImplemented, n as noteDateFormatter, p as ordinalize, r as placeTranslator, s as setNestedGroup } from './place-translator-CRiaOO9v.js';
|
|
2
2
|
export { CacheManagerFactory, DateLocaleProvider, I18nProvider, KinshipTranslatorConstructor, PlaceParserFunction, PlaceTranslatorFunction, getCacheManagerFactory, getDateLocale, getI18n, getKinshipTranslatorClass, getPlaceParserProvider, getPlaceTranslatorProvider, i18n, resetCacheManagerFactory, resetDateLocaleProvider, resetI18nProvider, resetKinshipTranslatorClass, resetPlaceParserProvider, resetPlaceTranslatorProvider, setCacheManagerFactory, setDateLocaleProvider, setI18nProvider, setKinshipTranslatorClass, setPlaceParserProvider, setPlaceTranslatorProvider } from './factories/index.js';
|
|
3
|
-
export { C as CacheRelatives, I as ICacheManager, P as PlaceParts, g as getPlaceParts, p as pathCache, a as relativesCache, r as resetRelativesCache } from './place-parser-
|
|
3
|
+
export { C as CacheRelatives, I as ICacheManager, P as PlaceParts, g as getPlaceParts, p as pathCache, a as relativesCache, r as resetRelativesCache } from './place-parser-CM0TJFj8.js';
|
|
4
4
|
export { KinshipTranslator, KinshipTranslatorBasic, KinshipTranslatorDE, KinshipTranslatorEN, KinshipTranslatorES, KinshipTranslatorFR, KinshipTranslatorHU, translators } from './kinship-translator/index.js';
|
|
5
|
-
export { C as Cases, ao as Common, az as CommonDate,
|
|
5
|
+
export { C as Cases, ao as Common, az as CommonDate, aR as CommonName, aT as CommonNote, m as ConvertType, j as CrossCase, k as CrossCases, an as CustomTags, am as Existed, aC as Fam, F as FamKey, aj as FamType, aE as Families, aL as FamilySearchMatch, aM as FamilySearchSource, x as Filter, w as FilterIterator, aF as GedCom, ak as GedComType, a3 as GenealogyMember, ba as GeneratedIndiMethods, aa as GenerationIndiType, a9 as GenerationSpouseType, D as Group, G as GroupDefinition, H as GroupIterator, E as GroupMarker, bh as IAddress, bi as IAssociation, bj as IChangeDate, b5 as ICommon, bk as ICreationDate, bl as IDate, bm as IEventDetail, bm as IEventDetailStructure, b6 as IFam, b7 as IFamilies, bn as IFamily, b8 as IGedCom, bo as IGedcomStructure, b9 as IIndi, br as IIndividual, bq as IIndividualEvent, bp as IIndividualEventDetail, br as IIndividualStructure, bb as IIndividuals, bs as ILdsOrdinanceDetail, bt as ILdsSpouseSealing, bc as IList, bu as IMarriageDate, bv as IMultimediaLink, bw as INonEvent, bx as INote, bd as IObje, by as IPlace, be as IRepo, bz as IRepository, bf as ISour, bC as ISource, bA as ISourceCitation, bB as ISourceRepositoryCitation, bg as ISubm, t as IdType, aK as Indi, a5 as IndiGenealogy, ab as IndiGenealogyGenerations, ac as IndiGenealogyResult, n as IndiKey, a6 as IndiMarker, a4 as IndiTree, a1 as IndiType, aP as Individuals, I as KinshipTranslatorInterface, L as Language, V as LinkedPersons, aQ as List, v as ListTag, a8 as MemberMain, a7 as MemberSide, M as MultiTag, K as NameOrder, J as NestedGroup, ad as NonNullIndiGenealogyResult, N as NonStandard, aV as Obje, O as ObjeKey, al as ObjeType, aX as Objects, A as Order, z as OrderDefinition, B as OrderIterator, X as PartnerType, af as Path, ae as PathItem, bD as Place, Q as PlaceOrder, bE as PlaceType, P as PrimitiveRange, aN as ProfilePicture, Z as ProxyOriginal, ai as Queue, ah as QueueItem, Y as Range, R as RangeType, ag as ReducedPath, W as RelationType, aY as Repo, o as RepoKey, $ as RepoType, a_ as Repositories, y as RequiredFilter, l as Settings, a$ as Sour, q as SourKey, _ as SourType, b1 as Sources, S as SplitResult, b2 as Subm, r as SubmKey, a0 as SubmType, b4 as Submitters, u as Tag, T as TagKey, a2 as TreeMember, U as UnknownKey, aq as createCommon, aA as createCommonDate, aS as createCommonName, aU as createCommonNote, aD as createFam, aG as createGedCom, aO as createIndi, aW as createObje, ap as createProxy, aZ as createRepo, b0 as createSour, b3 as createSubm, h as extractSeparationYears, e as extractSplitPoints, d as findMatchingRangeForSplitRange, f as fromTuple, g as generateSplitRanges, av as getListTag, bF as getPlaces, aw as getValidKey, at as getValidKeys, au as getValidTag, ay as idGetter, i as inRange, aB as isCommonDate, aH as isGedcomString, ax as isId, a as isIntersectedRange, ar as isOnlyMainProp, b as isRangeContained, as as isValidKey, aJ as mergeGedcoms, p as parseRangeBounds, c as splitOverlappingRanges, s as splitRange, aI as validateGedcomContent } from './index-BPEVN_DY.js';
|
|
6
6
|
export { AncestryMedia } from './types/index.js';
|
|
7
7
|
export { ADOPTED, BIOLOGICAL, BIRTH, BIRTH_ASC, BIRTH_DESC, DATE_ASC, DATE_DESC, DEATH_ASC, DEATH_DESC, DEFAULT, EVERY, FEMALE, FOSTER, FRIEND, ID_GETTER_REG, ID_REG, ID_SPLIT_REG, LINE_REG, MALE, MAX_FILE_SIZE_TO_SYNC, OTHER, PARTNER, REF_LINE_REG, SEALING, SINGLE, SPOUSE, STEP, UNKOWN, getBirthAsc, getMarriageAsc, getMarriageAscAndBirth, getMarriageAscAndChildBirth, getNameAsc, getNameAscAndBirth, getNameDesc } from './constants/index.js';
|
|
8
8
|
export { IPersonalName, IPersonalNamePieces } from './structures/index.js';
|
package/dist/index.js
CHANGED
|
@@ -1374,6 +1374,27 @@ var notImplemented = (type, ...args) => {
|
|
|
1374
1374
|
console.error(`[Not Implemented] ${type}`, ...args);
|
|
1375
1375
|
};
|
|
1376
1376
|
|
|
1377
|
+
// src/utils/media-utils.ts
|
|
1378
|
+
var getFileExtension = (filename) => {
|
|
1379
|
+
const match = filename.match(/\.([^.]+)$/);
|
|
1380
|
+
return match ? match[1] : "";
|
|
1381
|
+
};
|
|
1382
|
+
var isImageFormat = (format2) => {
|
|
1383
|
+
if (!format2) return false;
|
|
1384
|
+
const imageFormats = [
|
|
1385
|
+
"jpg",
|
|
1386
|
+
"jpeg",
|
|
1387
|
+
"png",
|
|
1388
|
+
"gif",
|
|
1389
|
+
"bmp",
|
|
1390
|
+
"webp",
|
|
1391
|
+
"svg",
|
|
1392
|
+
"tiff",
|
|
1393
|
+
"tif"
|
|
1394
|
+
];
|
|
1395
|
+
return imageFormats.includes(format2.toLowerCase());
|
|
1396
|
+
};
|
|
1397
|
+
|
|
1377
1398
|
// src/classes/name.ts
|
|
1378
1399
|
var CommonName = class extends Common {
|
|
1379
1400
|
constructor(gedcom, id, main, parent) {
|
|
@@ -2006,54 +2027,62 @@ var Indi = class extends Common {
|
|
|
2006
2027
|
}
|
|
2007
2028
|
async ancestryMedia(namespace) {
|
|
2008
2029
|
const list = {};
|
|
2009
|
-
const
|
|
2030
|
+
const objeList = this.get("OBJE")?.toList();
|
|
2010
2031
|
const www = this._gedcom?.HEAD?.SOUR?.CORP?.WWW?.value;
|
|
2011
2032
|
const tree = this.getAncestryTreeId();
|
|
2012
|
-
|
|
2013
|
-
|
|
2014
|
-
|
|
2015
|
-
|
|
2016
|
-
|
|
2017
|
-
|
|
2018
|
-
|
|
2019
|
-
|
|
2020
|
-
|
|
2021
|
-
let url = obje?.get("FILE")?.toValue();
|
|
2022
|
-
const title = obje?.get("TITL")?.toValue() ?? "";
|
|
2023
|
-
const type = obje?.get("FORM")?.toValue() ?? "raw";
|
|
2024
|
-
const imgId = clone || mser;
|
|
2025
|
-
if (!www || !tree || !this.id) {
|
|
2026
|
-
return;
|
|
2027
|
-
}
|
|
2028
|
-
if (!namespace && !url) {
|
|
2029
|
-
try {
|
|
2030
|
-
const mediaDetailsResponse = await fetch(
|
|
2031
|
-
`https://www.ancestry.com/api/media/viewer/v2/trees/${tree}/media?id=${media}`
|
|
2032
|
-
);
|
|
2033
|
-
const mediaDetails = await mediaDetailsResponse.json();
|
|
2034
|
-
if (mediaDetails.url) {
|
|
2035
|
-
url = `${mediaDetails.url}&imageQuality=hq`;
|
|
2033
|
+
if (objeList) {
|
|
2034
|
+
await Promise.all(
|
|
2035
|
+
objeList.map(async (objeRef) => {
|
|
2036
|
+
const key = objeRef?.id;
|
|
2037
|
+
const obje = objeRef?.standardizeMedia(
|
|
2038
|
+
namespace,
|
|
2039
|
+
true,
|
|
2040
|
+
(ns, iId) => {
|
|
2041
|
+
return ns && iId ? `https://mediasvc.ancestry.com/v2/image/namespaces/${ns}/media/${iId}?client=trees-mediaservice&imageQuality=hq` : void 0;
|
|
2036
2042
|
}
|
|
2037
|
-
|
|
2043
|
+
);
|
|
2044
|
+
const isPrimary = obje?.get("_PRIM")?.toValue() === "Y";
|
|
2045
|
+
const media = obje?.RIN?.value;
|
|
2046
|
+
const clone = obje?.get("_CLON._OID")?.toValue();
|
|
2047
|
+
const mser = obje?.get("_MSER._LKID")?.toValue();
|
|
2048
|
+
let url = obje?.get("FILE")?.toValue();
|
|
2049
|
+
const title = obje?.get("TITL")?.toValue() ?? "";
|
|
2050
|
+
const type = obje?.get("FORM")?.toValue() ?? "raw";
|
|
2051
|
+
const imgId = clone || mser;
|
|
2052
|
+
if (!www || !tree || !this.id) {
|
|
2053
|
+
return;
|
|
2038
2054
|
}
|
|
2039
|
-
|
|
2040
|
-
|
|
2041
|
-
|
|
2042
|
-
|
|
2043
|
-
|
|
2044
|
-
|
|
2045
|
-
|
|
2046
|
-
|
|
2047
|
-
|
|
2048
|
-
|
|
2049
|
-
|
|
2050
|
-
url
|
|
2051
|
-
|
|
2052
|
-
|
|
2053
|
-
|
|
2054
|
-
|
|
2055
|
-
|
|
2056
|
-
|
|
2055
|
+
if (!namespace && !url) {
|
|
2056
|
+
try {
|
|
2057
|
+
const mediaDetailsResponse = await fetch(
|
|
2058
|
+
`https://www.ancestry.com/api/media/viewer/v2/trees/${tree}/media?id=${media}`
|
|
2059
|
+
);
|
|
2060
|
+
const mediaDetails = await mediaDetailsResponse.json();
|
|
2061
|
+
if (mediaDetails.url) {
|
|
2062
|
+
url = `${mediaDetails.url}&imageQuality=hq`;
|
|
2063
|
+
}
|
|
2064
|
+
} catch (_e) {
|
|
2065
|
+
}
|
|
2066
|
+
url = url || `https://${www}/mediaui-viewer/tree/${tree}/media/${media}`;
|
|
2067
|
+
}
|
|
2068
|
+
if (url && imgId) {
|
|
2069
|
+
const id = `${tree}-${this.id}-${imgId}`;
|
|
2070
|
+
list[id] = {
|
|
2071
|
+
key,
|
|
2072
|
+
isPrimary,
|
|
2073
|
+
id,
|
|
2074
|
+
tree,
|
|
2075
|
+
imgId,
|
|
2076
|
+
person: this.id,
|
|
2077
|
+
title,
|
|
2078
|
+
url,
|
|
2079
|
+
contentType: type,
|
|
2080
|
+
downloadName: `${this.id.replaceAll("@", "")}_${this.toNaturalName().replaceAll(" ", "-") || ""}_${(title || key.replaceAll("@", "").toString()).replaceAll(" ", "-")}`
|
|
2081
|
+
};
|
|
2082
|
+
}
|
|
2083
|
+
})
|
|
2084
|
+
);
|
|
2085
|
+
}
|
|
2057
2086
|
return list;
|
|
2058
2087
|
}
|
|
2059
2088
|
myheritageLink(poolId = 0) {
|
|
@@ -2072,18 +2101,20 @@ var Indi = class extends Common {
|
|
|
2072
2101
|
if (!tree) {
|
|
2073
2102
|
return;
|
|
2074
2103
|
}
|
|
2075
|
-
const
|
|
2076
|
-
const
|
|
2077
|
-
const
|
|
2078
|
-
|
|
2104
|
+
const objeList = this.get("OBJE")?.toList();
|
|
2105
|
+
const birthObj = this.get("BIRT.OBJE")?.toList();
|
|
2106
|
+
const deathObj = this.get("DEAT.OBJE")?.toList();
|
|
2107
|
+
(this.get("FAMS")?.toValueList().values() ?? []).concat(this.get("FAMC")?.toValueList().values() ?? []).forEach((fam) => {
|
|
2108
|
+
objeList?.merge(birthObj).merge(deathObj).merge(fam?.get("MARR.OBJE"));
|
|
2079
2109
|
});
|
|
2080
|
-
|
|
2110
|
+
objeList?.forEach((o, index) => {
|
|
2081
2111
|
if (!o) {
|
|
2082
2112
|
return;
|
|
2083
2113
|
}
|
|
2084
2114
|
const obje = o;
|
|
2085
2115
|
const key = `@O${index}@`;
|
|
2086
2116
|
obje.standardizeMedia();
|
|
2117
|
+
const isPrimary = obje?.get("_PRIM")?.toValue() === "Y";
|
|
2087
2118
|
const url = obje?.get("FILE")?.toValue();
|
|
2088
2119
|
const title = obje?.get("NOTE")?.toValue() ?? "";
|
|
2089
2120
|
const type = obje?.get("FORM")?.toValue() ?? "raw";
|
|
@@ -2091,6 +2122,7 @@ var Indi = class extends Common {
|
|
|
2091
2122
|
if (url && imgId) {
|
|
2092
2123
|
const id = `${tree}-${this.id}-${imgId}`;
|
|
2093
2124
|
list[id] = {
|
|
2125
|
+
isPrimary,
|
|
2094
2126
|
key,
|
|
2095
2127
|
id,
|
|
2096
2128
|
tree,
|
|
@@ -2200,6 +2232,36 @@ var Indi = class extends Common {
|
|
|
2200
2232
|
}
|
|
2201
2233
|
return void 0;
|
|
2202
2234
|
}
|
|
2235
|
+
async getProfilePicture(namespace) {
|
|
2236
|
+
const mediaList = await this.multimedia(namespace);
|
|
2237
|
+
if (!mediaList) {
|
|
2238
|
+
return void 0;
|
|
2239
|
+
}
|
|
2240
|
+
const mediaArray = Object.values(mediaList);
|
|
2241
|
+
const primaryMedia = mediaArray.find(
|
|
2242
|
+
(media) => media.isPrimary && isImageFormat(media.contentType || getFileExtension(media.url))
|
|
2243
|
+
);
|
|
2244
|
+
if (primaryMedia) {
|
|
2245
|
+
return {
|
|
2246
|
+
file: primaryMedia.url,
|
|
2247
|
+
form: primaryMedia.contentType,
|
|
2248
|
+
title: primaryMedia.title,
|
|
2249
|
+
isPrimary: true
|
|
2250
|
+
};
|
|
2251
|
+
}
|
|
2252
|
+
const secondaryMedia = mediaArray.find(
|
|
2253
|
+
(media) => isImageFormat(media.contentType || getFileExtension(media.url))
|
|
2254
|
+
);
|
|
2255
|
+
if (secondaryMedia) {
|
|
2256
|
+
return {
|
|
2257
|
+
file: secondaryMedia.url,
|
|
2258
|
+
form: secondaryMedia.contentType,
|
|
2259
|
+
title: secondaryMedia.title,
|
|
2260
|
+
isPrimary: false
|
|
2261
|
+
};
|
|
2262
|
+
}
|
|
2263
|
+
return void 0;
|
|
2264
|
+
}
|
|
2203
2265
|
link(poolId) {
|
|
2204
2266
|
if (this?.isAncestry()) {
|
|
2205
2267
|
return this.ancestryLink();
|
|
@@ -6209,7 +6271,7 @@ var Families = class _Families extends List {
|
|
|
6209
6271
|
// package.json
|
|
6210
6272
|
var package_default = {
|
|
6211
6273
|
name: "@treeviz/gedcom-parser",
|
|
6212
|
-
version: "1.0.
|
|
6274
|
+
version: "1.0.22"};
|
|
6213
6275
|
|
|
6214
6276
|
// src/utils/get-product-details.ts
|
|
6215
6277
|
var isDevelopment = () => {
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { ba as GeneratedIndiMethods, b5 as ICommon, b6 as IFam, b7 as IFamilies, b8 as IGedCom, b9 as IIndi, bb as IIndividuals, bc as IList, bd as IObje, be as IRepo, bf as ISour, bg as ISubm } from '../index-BPEVN_DY.js';
|
|
2
2
|
import 'date-fns';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { I as IKinshipTranslator, af as Path, ae as PathItem, a1 as IndiType, n as IndiKey, L as Language } from '../index-
|
|
2
|
-
export { C as Cases, j as CrossCase, k as CrossCases } from '../index-
|
|
1
|
+
import { I as IKinshipTranslator, af as Path, ae as PathItem, a1 as IndiType, n as IndiKey, L as Language } from '../index-BPEVN_DY.js';
|
|
2
|
+
export { C as Cases, j as CrossCase, k as CrossCases } from '../index-BPEVN_DY.js';
|
|
3
3
|
import 'date-fns';
|
|
4
4
|
|
|
5
5
|
declare class KinshipTranslatorBasic implements IKinshipTranslator {
|