@treeviz/gedcom-parser 1.0.20 → 1.0.21
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 +105 -45
- package/dist/cli/index.js +105 -45
- package/dist/constants/index.d.ts +1 -1
- package/dist/constants/index.js +104 -44
- package/dist/factories/index.d.ts +2 -2
- package/dist/factories/index.js +104 -44
- package/dist/{index-DOapi7nN.d.ts → index-BPEVN_DY.d.ts} +9 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.js +105 -45
- package/dist/interfaces/index.d.ts +1 -1
- package/dist/kinship-translator/index.d.ts +2 -2
- package/dist/kinship-translator/index.js +104 -44
- 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 +106 -46
- 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) {
|
|
@@ -3013,6 +3042,7 @@ var Indi = class extends Common {
|
|
|
3013
3042
|
if (url && imgId) {
|
|
3014
3043
|
const id = `${tree}-${this.id}-${imgId}`;
|
|
3015
3044
|
list[id] = {
|
|
3045
|
+
isPrimary: false,
|
|
3016
3046
|
key,
|
|
3017
3047
|
id,
|
|
3018
3048
|
tree,
|
|
@@ -3122,6 +3152,36 @@ var Indi = class extends Common {
|
|
|
3122
3152
|
}
|
|
3123
3153
|
return void 0;
|
|
3124
3154
|
}
|
|
3155
|
+
async getProfilePicture(namespace) {
|
|
3156
|
+
const mediaList = await this.multimedia(namespace);
|
|
3157
|
+
if (!mediaList) {
|
|
3158
|
+
return void 0;
|
|
3159
|
+
}
|
|
3160
|
+
const mediaArray = Object.values(mediaList);
|
|
3161
|
+
const primaryMedia = mediaArray.find(
|
|
3162
|
+
(media) => media.isPrimary && isImageFormat(media.contentType || getFileExtension(media.url))
|
|
3163
|
+
);
|
|
3164
|
+
if (primaryMedia) {
|
|
3165
|
+
return {
|
|
3166
|
+
file: primaryMedia.url,
|
|
3167
|
+
form: primaryMedia.contentType,
|
|
3168
|
+
title: primaryMedia.title,
|
|
3169
|
+
isPrimary: true
|
|
3170
|
+
};
|
|
3171
|
+
}
|
|
3172
|
+
const secondaryMedia = mediaArray.find(
|
|
3173
|
+
(media) => isImageFormat(media.contentType || getFileExtension(media.url))
|
|
3174
|
+
);
|
|
3175
|
+
if (secondaryMedia) {
|
|
3176
|
+
return {
|
|
3177
|
+
file: secondaryMedia.url,
|
|
3178
|
+
form: secondaryMedia.contentType,
|
|
3179
|
+
title: secondaryMedia.title,
|
|
3180
|
+
isPrimary: false
|
|
3181
|
+
};
|
|
3182
|
+
}
|
|
3183
|
+
return void 0;
|
|
3184
|
+
}
|
|
3125
3185
|
link(poolId) {
|
|
3126
3186
|
if (this?.isAncestry()) {
|
|
3127
3187
|
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) {
|
|
@@ -2091,6 +2120,7 @@ var Indi = class extends Common {
|
|
|
2091
2120
|
if (url && imgId) {
|
|
2092
2121
|
const id = `${tree}-${this.id}-${imgId}`;
|
|
2093
2122
|
list[id] = {
|
|
2123
|
+
isPrimary: false,
|
|
2094
2124
|
key,
|
|
2095
2125
|
id,
|
|
2096
2126
|
tree,
|
|
@@ -2200,6 +2230,36 @@ var Indi = class extends Common {
|
|
|
2200
2230
|
}
|
|
2201
2231
|
return void 0;
|
|
2202
2232
|
}
|
|
2233
|
+
async getProfilePicture(namespace) {
|
|
2234
|
+
const mediaList = await this.multimedia(namespace);
|
|
2235
|
+
if (!mediaList) {
|
|
2236
|
+
return void 0;
|
|
2237
|
+
}
|
|
2238
|
+
const mediaArray = Object.values(mediaList);
|
|
2239
|
+
const primaryMedia = mediaArray.find(
|
|
2240
|
+
(media) => media.isPrimary && isImageFormat(media.contentType || getFileExtension(media.url))
|
|
2241
|
+
);
|
|
2242
|
+
if (primaryMedia) {
|
|
2243
|
+
return {
|
|
2244
|
+
file: primaryMedia.url,
|
|
2245
|
+
form: primaryMedia.contentType,
|
|
2246
|
+
title: primaryMedia.title,
|
|
2247
|
+
isPrimary: true
|
|
2248
|
+
};
|
|
2249
|
+
}
|
|
2250
|
+
const secondaryMedia = mediaArray.find(
|
|
2251
|
+
(media) => isImageFormat(media.contentType || getFileExtension(media.url))
|
|
2252
|
+
);
|
|
2253
|
+
if (secondaryMedia) {
|
|
2254
|
+
return {
|
|
2255
|
+
file: secondaryMedia.url,
|
|
2256
|
+
form: secondaryMedia.contentType,
|
|
2257
|
+
title: secondaryMedia.title,
|
|
2258
|
+
isPrimary: false
|
|
2259
|
+
};
|
|
2260
|
+
}
|
|
2261
|
+
return void 0;
|
|
2262
|
+
}
|
|
2203
2263
|
link(poolId) {
|
|
2204
2264
|
if (this?.isAncestry()) {
|
|
2205
2265
|
return this.ancestryLink();
|
|
@@ -6209,7 +6269,7 @@ var Families = class _Families extends List {
|
|
|
6209
6269
|
// package.json
|
|
6210
6270
|
var package_default = {
|
|
6211
6271
|
name: "@treeviz/gedcom-parser",
|
|
6212
|
-
version: "1.0.
|
|
6272
|
+
version: "1.0.21"};
|
|
6213
6273
|
|
|
6214
6274
|
// src/utils/get-product-details.ts
|
|
6215
6275
|
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 {
|
|
@@ -2882,6 +2882,27 @@ var getPlaces = (common, type = ["ALL" /* All */], maxLevel = 1, level = 0, main
|
|
|
2882
2882
|
};
|
|
2883
2883
|
var implemented = (type, ...args) => {
|
|
2884
2884
|
};
|
|
2885
|
+
|
|
2886
|
+
// src/utils/media-utils.ts
|
|
2887
|
+
var getFileExtension = (filename) => {
|
|
2888
|
+
const match = filename.match(/\.([^.]+)$/);
|
|
2889
|
+
return match ? match[1] : "";
|
|
2890
|
+
};
|
|
2891
|
+
var isImageFormat = (format2) => {
|
|
2892
|
+
if (!format2) return false;
|
|
2893
|
+
const imageFormats = [
|
|
2894
|
+
"jpg",
|
|
2895
|
+
"jpeg",
|
|
2896
|
+
"png",
|
|
2897
|
+
"gif",
|
|
2898
|
+
"bmp",
|
|
2899
|
+
"webp",
|
|
2900
|
+
"svg",
|
|
2901
|
+
"tiff",
|
|
2902
|
+
"tif"
|
|
2903
|
+
];
|
|
2904
|
+
return imageFormats.includes(format2.toLowerCase());
|
|
2905
|
+
};
|
|
2885
2906
|
var uniqueItemsCache = /* @__PURE__ */ new WeakMap();
|
|
2886
2907
|
var setNestedGroup = (obj, key, value, uniqueCounting = true) => {
|
|
2887
2908
|
const parts = Array.isArray(key) ? key : key.split(/,\s*/);
|
|
@@ -4092,54 +4113,62 @@ var Indi = class extends Common {
|
|
|
4092
4113
|
}
|
|
4093
4114
|
async ancestryMedia(namespace) {
|
|
4094
4115
|
const list = {};
|
|
4095
|
-
const
|
|
4116
|
+
const objeList = this.get("OBJE")?.toList();
|
|
4096
4117
|
const www = this._gedcom?.HEAD?.SOUR?.CORP?.WWW?.value;
|
|
4097
4118
|
const tree = this.getAncestryTreeId();
|
|
4098
|
-
|
|
4099
|
-
|
|
4100
|
-
|
|
4101
|
-
|
|
4102
|
-
|
|
4103
|
-
|
|
4104
|
-
|
|
4105
|
-
|
|
4106
|
-
|
|
4107
|
-
let url = obje?.get("FILE")?.toValue();
|
|
4108
|
-
const title = obje?.get("TITL")?.toValue() ?? "";
|
|
4109
|
-
const type = obje?.get("FORM")?.toValue() ?? "raw";
|
|
4110
|
-
const imgId = clone || mser;
|
|
4111
|
-
if (!www || !tree || !this.id) {
|
|
4112
|
-
return;
|
|
4113
|
-
}
|
|
4114
|
-
if (!namespace && !url) {
|
|
4115
|
-
try {
|
|
4116
|
-
const mediaDetailsResponse = await fetch(
|
|
4117
|
-
`https://www.ancestry.com/api/media/viewer/v2/trees/${tree}/media?id=${media}`
|
|
4118
|
-
);
|
|
4119
|
-
const mediaDetails = await mediaDetailsResponse.json();
|
|
4120
|
-
if (mediaDetails.url) {
|
|
4121
|
-
url = `${mediaDetails.url}&imageQuality=hq`;
|
|
4119
|
+
if (objeList) {
|
|
4120
|
+
await Promise.all(
|
|
4121
|
+
objeList.map(async (objeRef) => {
|
|
4122
|
+
const key = objeRef?.id;
|
|
4123
|
+
const obje = objeRef?.standardizeMedia(
|
|
4124
|
+
namespace,
|
|
4125
|
+
true,
|
|
4126
|
+
(ns, iId) => {
|
|
4127
|
+
return ns && iId ? `https://mediasvc.ancestry.com/v2/image/namespaces/${ns}/media/${iId}?client=trees-mediaservice&imageQuality=hq` : void 0;
|
|
4122
4128
|
}
|
|
4123
|
-
|
|
4129
|
+
);
|
|
4130
|
+
const isPrimary = obje?.get("_PRIM")?.toValue() === "Y";
|
|
4131
|
+
const media = obje?.RIN?.value;
|
|
4132
|
+
const clone = obje?.get("_CLON._OID")?.toValue();
|
|
4133
|
+
const mser = obje?.get("_MSER._LKID")?.toValue();
|
|
4134
|
+
let url = obje?.get("FILE")?.toValue();
|
|
4135
|
+
const title = obje?.get("TITL")?.toValue() ?? "";
|
|
4136
|
+
const type = obje?.get("FORM")?.toValue() ?? "raw";
|
|
4137
|
+
const imgId = clone || mser;
|
|
4138
|
+
if (!www || !tree || !this.id) {
|
|
4139
|
+
return;
|
|
4124
4140
|
}
|
|
4125
|
-
|
|
4126
|
-
|
|
4127
|
-
|
|
4128
|
-
|
|
4129
|
-
|
|
4130
|
-
|
|
4131
|
-
|
|
4132
|
-
|
|
4133
|
-
|
|
4134
|
-
|
|
4135
|
-
|
|
4136
|
-
url
|
|
4137
|
-
|
|
4138
|
-
|
|
4139
|
-
|
|
4140
|
-
|
|
4141
|
-
|
|
4142
|
-
|
|
4141
|
+
if (!namespace && !url) {
|
|
4142
|
+
try {
|
|
4143
|
+
const mediaDetailsResponse = await fetch(
|
|
4144
|
+
`https://www.ancestry.com/api/media/viewer/v2/trees/${tree}/media?id=${media}`
|
|
4145
|
+
);
|
|
4146
|
+
const mediaDetails = await mediaDetailsResponse.json();
|
|
4147
|
+
if (mediaDetails.url) {
|
|
4148
|
+
url = `${mediaDetails.url}&imageQuality=hq`;
|
|
4149
|
+
}
|
|
4150
|
+
} catch (_e) {
|
|
4151
|
+
}
|
|
4152
|
+
url = url || `https://${www}/mediaui-viewer/tree/${tree}/media/${media}`;
|
|
4153
|
+
}
|
|
4154
|
+
if (url && imgId) {
|
|
4155
|
+
const id = `${tree}-${this.id}-${imgId}`;
|
|
4156
|
+
list[id] = {
|
|
4157
|
+
key,
|
|
4158
|
+
isPrimary,
|
|
4159
|
+
id,
|
|
4160
|
+
tree,
|
|
4161
|
+
imgId,
|
|
4162
|
+
person: this.id,
|
|
4163
|
+
title,
|
|
4164
|
+
url,
|
|
4165
|
+
contentType: type,
|
|
4166
|
+
downloadName: `${this.id.replaceAll("@", "")}_${this.toNaturalName().replaceAll(" ", "-") || ""}_${(title || key.replaceAll("@", "").toString()).replaceAll(" ", "-")}`
|
|
4167
|
+
};
|
|
4168
|
+
}
|
|
4169
|
+
})
|
|
4170
|
+
);
|
|
4171
|
+
}
|
|
4143
4172
|
return list;
|
|
4144
4173
|
}
|
|
4145
4174
|
myheritageLink(poolId = 0) {
|
|
@@ -4177,6 +4206,7 @@ var Indi = class extends Common {
|
|
|
4177
4206
|
if (url && imgId) {
|
|
4178
4207
|
const id = `${tree}-${this.id}-${imgId}`;
|
|
4179
4208
|
list[id] = {
|
|
4209
|
+
isPrimary: false,
|
|
4180
4210
|
key,
|
|
4181
4211
|
id,
|
|
4182
4212
|
tree,
|
|
@@ -4286,6 +4316,36 @@ var Indi = class extends Common {
|
|
|
4286
4316
|
}
|
|
4287
4317
|
return void 0;
|
|
4288
4318
|
}
|
|
4319
|
+
async getProfilePicture(namespace) {
|
|
4320
|
+
const mediaList = await this.multimedia(namespace);
|
|
4321
|
+
if (!mediaList) {
|
|
4322
|
+
return void 0;
|
|
4323
|
+
}
|
|
4324
|
+
const mediaArray = Object.values(mediaList);
|
|
4325
|
+
const primaryMedia = mediaArray.find(
|
|
4326
|
+
(media) => media.isPrimary && isImageFormat(media.contentType || getFileExtension(media.url))
|
|
4327
|
+
);
|
|
4328
|
+
if (primaryMedia) {
|
|
4329
|
+
return {
|
|
4330
|
+
file: primaryMedia.url,
|
|
4331
|
+
form: primaryMedia.contentType,
|
|
4332
|
+
title: primaryMedia.title,
|
|
4333
|
+
isPrimary: true
|
|
4334
|
+
};
|
|
4335
|
+
}
|
|
4336
|
+
const secondaryMedia = mediaArray.find(
|
|
4337
|
+
(media) => isImageFormat(media.contentType || getFileExtension(media.url))
|
|
4338
|
+
);
|
|
4339
|
+
if (secondaryMedia) {
|
|
4340
|
+
return {
|
|
4341
|
+
file: secondaryMedia.url,
|
|
4342
|
+
form: secondaryMedia.contentType,
|
|
4343
|
+
title: secondaryMedia.title,
|
|
4344
|
+
isPrimary: false
|
|
4345
|
+
};
|
|
4346
|
+
}
|
|
4347
|
+
return void 0;
|
|
4348
|
+
}
|
|
4289
4349
|
link(poolId) {
|
|
4290
4350
|
if (this?.isAncestry()) {
|
|
4291
4351
|
return this.ancestryLink();
|