@treeviz/gedcom-parser 1.0.23 → 2.0.0
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/README.md +45 -0
- package/dist/classes/index.d.ts +1 -1
- package/dist/classes/index.js +425 -59
- package/dist/cli/index.js +1613 -385
- package/dist/constants/index.d.ts +1 -1
- package/dist/constants/index.js +424 -58
- package/dist/factories/index.d.ts +2 -2
- package/dist/factories/index.js +424 -58
- package/dist/{index-CSjQRlxq.d.ts → index-CzYZg44D.d.ts} +30 -0
- package/dist/index.d.ts +3 -3
- package/dist/index.js +462 -63
- package/dist/interfaces/index.d.ts +1 -1
- package/dist/kinship-translator/index.d.ts +2 -2
- package/dist/kinship-translator/index.js +424 -58
- package/dist/place-parser-CJ3EbFmb.d.ts +40 -0
- package/dist/{place-translator-BYX8180A.d.ts → place-translator-Ci5rEY6p.d.ts} +3 -1
- package/dist/structures/index.d.ts +2 -2
- package/dist/types/index.d.ts +1 -1
- package/dist/utils/index.d.ts +3 -3
- package/dist/utils/index.js +460 -61
- package/package.json +1 -1
- package/dist/place-parser-Dl5iva3h.d.ts +0 -37
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { aT as RequiredFilter, aO as RelationType, n as Filter, aA as PartnerType, ax as Order, az as OrderIterator, af as IndiType, ac as IndiKey, ap as NameOrder } from '../index-
|
|
1
|
+
import { aT as RequiredFilter, aO as RelationType, n as Filter, aA as PartnerType, ax as Order, az as OrderIterator, af as IndiType, ac as IndiKey, ap as NameOrder } from '../index-CzYZg44D.js';
|
|
2
2
|
import 'date-fns';
|
|
3
3
|
|
|
4
4
|
/**
|
package/dist/constants/index.js
CHANGED
|
@@ -97,66 +97,125 @@ __export(translators_exports, {
|
|
|
97
97
|
fr: () => KinshipTranslatorFr,
|
|
98
98
|
hu: () => KinshipTranslatorHU
|
|
99
99
|
});
|
|
100
|
+
var getGedcomId = (gedcom) => {
|
|
101
|
+
if (!gedcom) {
|
|
102
|
+
return "unknown";
|
|
103
|
+
}
|
|
104
|
+
const treeId = gedcom.getTreeId?.() || "";
|
|
105
|
+
const treeName = gedcom.getTreeName?.() || "";
|
|
106
|
+
const sanitizedName = treeName.toLowerCase().replace(/[^a-z0-9]+/g, "_").replace(/^_+|_+$/g, "");
|
|
107
|
+
if (treeId && sanitizedName) {
|
|
108
|
+
return `${treeId}_${sanitizedName}`;
|
|
109
|
+
} else if (treeId) {
|
|
110
|
+
return treeId;
|
|
111
|
+
} else if (sanitizedName) {
|
|
112
|
+
return sanitizedName;
|
|
113
|
+
}
|
|
114
|
+
return `gedcom_${gedcom.refcount}`;
|
|
115
|
+
};
|
|
100
116
|
var caches = {
|
|
101
117
|
pathCache: {},
|
|
102
118
|
relativesOnDegreeCache: {},
|
|
103
|
-
relativesOnLevelCache: {}
|
|
119
|
+
relativesOnLevelCache: {},
|
|
120
|
+
profilePictureCache: {}
|
|
104
121
|
};
|
|
105
|
-
var
|
|
106
|
-
var
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
122
|
+
var cacheDbs;
|
|
123
|
+
var getCacheDbs = () => {
|
|
124
|
+
if (!cacheDbs) {
|
|
125
|
+
const getInstance = getCacheManagerFactory();
|
|
126
|
+
cacheDbs = {
|
|
127
|
+
pathCache: getInstance(
|
|
128
|
+
"ftv",
|
|
129
|
+
"Main",
|
|
130
|
+
"path",
|
|
131
|
+
true
|
|
132
|
+
),
|
|
133
|
+
relativesOnDegreeCache: getInstance("ftv", "Main", "path", true),
|
|
134
|
+
relativesOnLevelCache: getInstance(
|
|
135
|
+
"ftv",
|
|
136
|
+
"Main",
|
|
137
|
+
"path",
|
|
138
|
+
true
|
|
139
|
+
),
|
|
140
|
+
profilePictureCache: getInstance(
|
|
141
|
+
"ftv",
|
|
142
|
+
"Main",
|
|
143
|
+
"images",
|
|
144
|
+
false
|
|
145
|
+
)
|
|
146
|
+
};
|
|
147
|
+
}
|
|
148
|
+
return cacheDbs;
|
|
120
149
|
};
|
|
121
|
-
|
|
150
|
+
var storeCache = {
|
|
151
|
+
// NOTE: pathCache, relativesOnLevelCache, and relativesOnDegreeCache are intentionally
|
|
152
|
+
// kept in memory only. These debounced functions exist to satisfy the type system
|
|
153
|
+
// but are never called.
|
|
122
154
|
pathCache: debounce((value) => {
|
|
123
155
|
if (value) {
|
|
124
|
-
|
|
156
|
+
getCacheDbs().pathCache.setItem(value);
|
|
125
157
|
}
|
|
126
158
|
}, 50),
|
|
127
159
|
relativesOnLevelCache: debounce((value) => {
|
|
128
160
|
if (value) {
|
|
129
|
-
|
|
161
|
+
getCacheDbs().relativesOnLevelCache.setItem(value);
|
|
130
162
|
}
|
|
131
163
|
}, 50),
|
|
132
164
|
relativesOnDegreeCache: debounce((value) => {
|
|
133
165
|
if (value) {
|
|
134
|
-
|
|
166
|
+
getCacheDbs().relativesOnDegreeCache.setItem(value);
|
|
135
167
|
}
|
|
136
|
-
}, 50)
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
168
|
+
}, 50),
|
|
169
|
+
// profilePictureCache IS persisted to IndexedDB
|
|
170
|
+
profilePictureCache: debounce((value) => {
|
|
171
|
+
if (value) {
|
|
172
|
+
getCacheDbs().profilePictureCache.setItem(value);
|
|
173
|
+
}
|
|
174
|
+
}, 100)
|
|
175
|
+
};
|
|
176
|
+
var relativesCache = (cacheKey) => (gedcom, key, subKey, value) => {
|
|
177
|
+
const gedcomId = getGedcomId(gedcom);
|
|
178
|
+
const fullKey = `${gedcomId}:${key}`;
|
|
179
|
+
const cache = caches[cacheKey];
|
|
180
|
+
if (!cache) {
|
|
140
181
|
caches[cacheKey] = {};
|
|
141
182
|
}
|
|
142
|
-
if (value
|
|
143
|
-
|
|
144
|
-
|
|
183
|
+
if (value) {
|
|
184
|
+
const typedCache2 = caches[cacheKey];
|
|
185
|
+
if (!typedCache2[fullKey]) {
|
|
186
|
+
typedCache2[fullKey] = {};
|
|
145
187
|
}
|
|
146
|
-
|
|
147
|
-
return
|
|
188
|
+
typedCache2[fullKey][subKey] = value;
|
|
189
|
+
return typedCache2[fullKey][subKey];
|
|
148
190
|
}
|
|
149
|
-
|
|
191
|
+
const typedCache = caches[cacheKey];
|
|
192
|
+
return typedCache?.[fullKey]?.[subKey];
|
|
150
193
|
};
|
|
151
|
-
var pathCache = (key, value) => {
|
|
194
|
+
var pathCache = (gedcom, key, value) => {
|
|
195
|
+
const gedcomId = getGedcomId(gedcom);
|
|
196
|
+
const fullKey = `${gedcomId}:${key}`;
|
|
152
197
|
if (!caches.pathCache) {
|
|
153
198
|
caches.pathCache = {};
|
|
154
199
|
}
|
|
155
200
|
if (value && caches.pathCache) {
|
|
156
|
-
caches.pathCache[
|
|
157
|
-
return caches.pathCache[
|
|
201
|
+
caches.pathCache[fullKey] = value;
|
|
202
|
+
return caches.pathCache[fullKey];
|
|
158
203
|
}
|
|
159
|
-
return caches.pathCache?.[
|
|
204
|
+
return caches.pathCache?.[fullKey];
|
|
205
|
+
};
|
|
206
|
+
var profilePictureCache = (gedcom, key, value) => {
|
|
207
|
+
const gedcomId = getGedcomId(gedcom);
|
|
208
|
+
const fullKey = `${gedcomId}:${key}`;
|
|
209
|
+
if (!caches.profilePictureCache) {
|
|
210
|
+
caches.profilePictureCache = {};
|
|
211
|
+
}
|
|
212
|
+
if (value && caches.profilePictureCache) {
|
|
213
|
+
caches.profilePictureCache[fullKey] = value;
|
|
214
|
+
storeCache.profilePictureCache(caches.profilePictureCache);
|
|
215
|
+
return caches.profilePictureCache[fullKey];
|
|
216
|
+
}
|
|
217
|
+
const cached = caches.profilePictureCache?.[fullKey];
|
|
218
|
+
return cached;
|
|
160
219
|
};
|
|
161
220
|
|
|
162
221
|
// src/utils/get-all-prop.ts
|
|
@@ -707,11 +766,30 @@ var Common = class _Common {
|
|
|
707
766
|
const sour = get(head, "SOUR.value");
|
|
708
767
|
return !!sour?.toLowerCase()?.startsWith("myheritage");
|
|
709
768
|
}
|
|
769
|
+
/**
|
|
770
|
+
* Get the source type as a string (for prefixing tree IDs and names)
|
|
771
|
+
* Returns the detected source type or undefined if unknown
|
|
772
|
+
*/
|
|
773
|
+
getSourceType() {
|
|
774
|
+
if (this.isAncestry()) return "Ancestry";
|
|
775
|
+
if (this.isMyHeritage()) return "MyHeritage";
|
|
776
|
+
if (this.isFamilySearch()) return "FamilySearch";
|
|
777
|
+
if (this.isGNO2GED()) return "GNO2GED";
|
|
778
|
+
if (this.isGenoPro()) return "GenoPro";
|
|
779
|
+
if (this.isAhnenblatt()) return "Ahnenblatt";
|
|
780
|
+
if (this.isGeni()) return "Geni";
|
|
781
|
+
return void 0;
|
|
782
|
+
}
|
|
710
783
|
isFamilySearch() {
|
|
711
784
|
const head = get(this, "HEAD") || get(this.getGedcom(), "HEAD");
|
|
712
785
|
const sourName = get(head, "SOUR.NAME.value");
|
|
713
786
|
return sourName === "FamilySearch API";
|
|
714
787
|
}
|
|
788
|
+
isGNO2GED() {
|
|
789
|
+
const head = get(this, "HEAD") || get(this.getGedcom(), "HEAD");
|
|
790
|
+
const sour = get(head, "SOUR.value");
|
|
791
|
+
return sour === "GNO2GED";
|
|
792
|
+
}
|
|
715
793
|
getAncestryTreeId() {
|
|
716
794
|
const path = "HEAD.SOUR._TREE.RIN.value";
|
|
717
795
|
return get(this, path) || get(this.getGedcom(), path);
|
|
@@ -722,11 +800,34 @@ var Common = class _Common {
|
|
|
722
800
|
}
|
|
723
801
|
getTreeId() {
|
|
724
802
|
if (this?.isAncestry()) {
|
|
725
|
-
|
|
803
|
+
const id = this.getAncestryTreeId();
|
|
804
|
+
if (id !== void 0) return id;
|
|
726
805
|
}
|
|
727
806
|
if (this?.isMyHeritage()) {
|
|
728
|
-
|
|
807
|
+
const id = this.getMyHeritageTreeId();
|
|
808
|
+
if (id !== void 0) return id;
|
|
729
809
|
}
|
|
810
|
+
if (this?.isFamilySearch()) {
|
|
811
|
+
const id = this.getFamilySearchTreeId();
|
|
812
|
+
if (id !== void 0) return id;
|
|
813
|
+
}
|
|
814
|
+
if (this?.isGNO2GED()) {
|
|
815
|
+
const id = this.getGNO2GEDTreeId();
|
|
816
|
+
if (id !== void 0) return id;
|
|
817
|
+
}
|
|
818
|
+
if (this?.isAhnenblatt()) {
|
|
819
|
+
const id = this.getAhnenblattTreeId();
|
|
820
|
+
if (id !== void 0) return id;
|
|
821
|
+
}
|
|
822
|
+
if (this?.isGeni()) {
|
|
823
|
+
const id = this.getGeniTreeId();
|
|
824
|
+
if (id !== void 0) return id;
|
|
825
|
+
}
|
|
826
|
+
if (this?.isGenoPro()) {
|
|
827
|
+
const id = this.getGenoProTreeId();
|
|
828
|
+
if (id !== void 0) return id;
|
|
829
|
+
}
|
|
830
|
+
return this.getUniversalTreeId();
|
|
730
831
|
}
|
|
731
832
|
getAncestryTreeName() {
|
|
732
833
|
const path = "HEAD.SOUR._TREE.value";
|
|
@@ -739,13 +840,146 @@ var Common = class _Common {
|
|
|
739
840
|
/Exported by MyHeritage.com from (?<tree>.+) in.+$/
|
|
740
841
|
)?.groups?.tree;
|
|
741
842
|
}
|
|
843
|
+
getFamilySearchTreeId() {
|
|
844
|
+
const rin = get(this, "HEAD.SOUR._TREE.RIN.value") || get(this.getGedcom(), "HEAD.SOUR._TREE.RIN.value");
|
|
845
|
+
if (rin) {
|
|
846
|
+
return rin;
|
|
847
|
+
}
|
|
848
|
+
return "familysearch";
|
|
849
|
+
}
|
|
850
|
+
getFamilySearchTreeName() {
|
|
851
|
+
const treeName = get(this, "HEAD.SOUR._TREE.value") || get(this.getGedcom(), "HEAD.SOUR._TREE.value");
|
|
852
|
+
if (treeName) {
|
|
853
|
+
return treeName;
|
|
854
|
+
}
|
|
855
|
+
const fileName = get(this, "HEAD.FILE.value") || get(this.getGedcom(), "HEAD.FILE.value");
|
|
856
|
+
return fileName || "FamilySearch Import";
|
|
857
|
+
}
|
|
858
|
+
getAhnenblattTreeId() {
|
|
859
|
+
const fileName = get(this, "HEAD.FILE.value") || get(this.getGedcom(), "HEAD.FILE.value");
|
|
860
|
+
if (fileName) {
|
|
861
|
+
const idMatch = fileName.match(/_(\d+)/);
|
|
862
|
+
if (idMatch) {
|
|
863
|
+
return idMatch[1];
|
|
864
|
+
}
|
|
865
|
+
}
|
|
866
|
+
return void 0;
|
|
867
|
+
}
|
|
868
|
+
getAhnenblattTreeName() {
|
|
869
|
+
const fileName = get(this, "HEAD.FILE.value") || get(this.getGedcom(), "HEAD.FILE.value");
|
|
870
|
+
return fileName?.replace(/\.ged$/i, "").replace(/_/g, " ");
|
|
871
|
+
}
|
|
872
|
+
getGeniTreeId() {
|
|
873
|
+
const fileName = get(this, "HEAD.FILE.value") || get(this.getGedcom(), "HEAD.FILE.value");
|
|
874
|
+
if (fileName) {
|
|
875
|
+
const idMatch = fileName.match(/_(\d+)/);
|
|
876
|
+
if (idMatch) {
|
|
877
|
+
return idMatch[1];
|
|
878
|
+
}
|
|
879
|
+
}
|
|
880
|
+
return void 0;
|
|
881
|
+
}
|
|
882
|
+
getGeniTreeName() {
|
|
883
|
+
const fileName = get(this, "HEAD.FILE.value") || get(this.getGedcom(), "HEAD.FILE.value");
|
|
884
|
+
return fileName?.replace(/\.ged$/i, "").replace(/_/g, " ");
|
|
885
|
+
}
|
|
886
|
+
getGenoProTreeId() {
|
|
887
|
+
const fileName = get(this, "HEAD.FILE.value") || get(this.getGedcom(), "HEAD.FILE.value");
|
|
888
|
+
if (fileName) {
|
|
889
|
+
const idMatch = fileName.match(/_(\d+)/);
|
|
890
|
+
if (idMatch) {
|
|
891
|
+
return idMatch[1];
|
|
892
|
+
}
|
|
893
|
+
}
|
|
894
|
+
return void 0;
|
|
895
|
+
}
|
|
896
|
+
getGenoProTreeName() {
|
|
897
|
+
const fileName = get(this, "HEAD.FILE.value") || get(this.getGedcom(), "HEAD.FILE.value");
|
|
898
|
+
return fileName?.replace(/\.ged$/i, "").replace(/_/g, " ");
|
|
899
|
+
}
|
|
900
|
+
getGNO2GEDTreeId() {
|
|
901
|
+
const rin = get(this, "HEAD._TREE.RIN.value") || get(this.getGedcom(), "HEAD._TREE.RIN.value");
|
|
902
|
+
if (rin) {
|
|
903
|
+
return rin;
|
|
904
|
+
}
|
|
905
|
+
return `gno_${this._gedcom?.refcount || "unknown"}`;
|
|
906
|
+
}
|
|
907
|
+
getGNO2GEDTreeName() {
|
|
908
|
+
const treeName = get(this, "HEAD._TREE.value") || get(this.getGedcom(), "HEAD._TREE.value");
|
|
909
|
+
if (treeName) {
|
|
910
|
+
return treeName;
|
|
911
|
+
}
|
|
912
|
+
const fileName = get(this, "HEAD.FILE.value") || get(this.getGedcom(), "HEAD.FILE.value");
|
|
913
|
+
return fileName || "GNO2GED Export";
|
|
914
|
+
}
|
|
915
|
+
/**
|
|
916
|
+
* Universal tree ID getter for unknown/unrecognized GEDCOM sources
|
|
917
|
+
* Tries to extract an ID from various common locations
|
|
918
|
+
*/
|
|
919
|
+
getUniversalTreeId() {
|
|
920
|
+
const sourceType = this.getSourceType();
|
|
921
|
+
const prefix = sourceType ? sourceType.toLowerCase() : "tree";
|
|
922
|
+
const fileName = get(this, "HEAD.FILE.value") || get(this.getGedcom(), "HEAD.FILE.value");
|
|
923
|
+
if (fileName) {
|
|
924
|
+
const idMatch = fileName.match(/_(\d+)/);
|
|
925
|
+
if (idMatch) {
|
|
926
|
+
return `${prefix}_${idMatch[1]}`;
|
|
927
|
+
}
|
|
928
|
+
}
|
|
929
|
+
return `${prefix}_${this._gedcom?.refcount || "unknown"}`;
|
|
930
|
+
}
|
|
931
|
+
/**
|
|
932
|
+
* Universal tree name getter for unknown/unrecognized GEDCOM sources
|
|
933
|
+
* Tries to extract a name from various common locations
|
|
934
|
+
*/
|
|
935
|
+
getUniversalTreeName() {
|
|
936
|
+
const sourceType = this.getSourceType();
|
|
937
|
+
const prefix = sourceType ? `${sourceType}-` : "";
|
|
938
|
+
const fileName = get(this, "HEAD.FILE.value") || get(this.getGedcom(), "HEAD.FILE.value");
|
|
939
|
+
if (fileName) {
|
|
940
|
+
const cleanName = fileName.replace(/\.ged$/i, "").replace(/_/g, " ");
|
|
941
|
+
return `${prefix}${cleanName}`;
|
|
942
|
+
}
|
|
943
|
+
const sourName = get(this, "HEAD.SOUR.NAME.value") || get(this.getGedcom(), "HEAD.SOUR.NAME.value");
|
|
944
|
+
if (sourName) {
|
|
945
|
+
return `${prefix}${sourName}`;
|
|
946
|
+
}
|
|
947
|
+
const sourValue = get(this, "HEAD.SOUR.value") || get(this.getGedcom(), "HEAD.SOUR.value");
|
|
948
|
+
if (sourValue) {
|
|
949
|
+
return `${prefix}${sourValue}`;
|
|
950
|
+
}
|
|
951
|
+
return `${prefix}Unknown Tree`;
|
|
952
|
+
}
|
|
742
953
|
getTreeName() {
|
|
743
954
|
if (this?.isAncestry()) {
|
|
744
|
-
|
|
955
|
+
const name = this.getAncestryTreeName();
|
|
956
|
+
if (name) return name;
|
|
745
957
|
}
|
|
746
958
|
if (this?.isMyHeritage()) {
|
|
747
|
-
|
|
959
|
+
const name = this.getMyHeritageTreeName();
|
|
960
|
+
if (name) return name;
|
|
961
|
+
}
|
|
962
|
+
if (this?.isFamilySearch()) {
|
|
963
|
+
const name = this.getFamilySearchTreeName();
|
|
964
|
+
if (name) return name;
|
|
965
|
+
}
|
|
966
|
+
if (this?.isGNO2GED()) {
|
|
967
|
+
const name = this.getGNO2GEDTreeName();
|
|
968
|
+
if (name) return name;
|
|
748
969
|
}
|
|
970
|
+
if (this?.isAhnenblatt()) {
|
|
971
|
+
const name = this.getAhnenblattTreeName();
|
|
972
|
+
if (name) return name;
|
|
973
|
+
}
|
|
974
|
+
if (this?.isGeni()) {
|
|
975
|
+
const name = this.getGeniTreeName();
|
|
976
|
+
if (name) return name;
|
|
977
|
+
}
|
|
978
|
+
if (this?.isGenoPro()) {
|
|
979
|
+
const name = this.getGenoProTreeName();
|
|
980
|
+
if (name) return name;
|
|
981
|
+
}
|
|
982
|
+
return this.getUniversalTreeName();
|
|
749
983
|
}
|
|
750
984
|
};
|
|
751
985
|
var createProxy = (target) => {
|
|
@@ -2522,7 +2756,7 @@ var Indi = class extends Common {
|
|
|
2522
2756
|
}
|
|
2523
2757
|
async ancestryMedia(namespace) {
|
|
2524
2758
|
const list = {};
|
|
2525
|
-
const objeList = this.get("OBJE")?.toList();
|
|
2759
|
+
const objeList = this.get("OBJE")?.toList().copy();
|
|
2526
2760
|
const www = this._gedcom?.HEAD?.SOUR?.CORP?.WWW?.value;
|
|
2527
2761
|
const tree = this.getAncestryTreeId();
|
|
2528
2762
|
if (objeList) {
|
|
@@ -2596,11 +2830,12 @@ var Indi = class extends Common {
|
|
|
2596
2830
|
if (!tree) {
|
|
2597
2831
|
return;
|
|
2598
2832
|
}
|
|
2599
|
-
const objeList = this.get("OBJE")?.toList();
|
|
2600
|
-
const birthObj = this.get("BIRT.OBJE")?.toList();
|
|
2601
|
-
const deathObj = this.get("DEAT.OBJE")?.toList();
|
|
2833
|
+
const objeList = this.get("OBJE")?.toList().copy();
|
|
2834
|
+
const birthObj = this.get("BIRT.OBJE")?.toList().copy();
|
|
2835
|
+
const deathObj = this.get("DEAT.OBJE")?.toList().copy();
|
|
2836
|
+
objeList?.merge(birthObj).merge(deathObj);
|
|
2602
2837
|
(this.get("FAMS")?.toValueList().values() ?? []).concat(this.get("FAMC")?.toValueList().values() ?? []).forEach((fam) => {
|
|
2603
|
-
objeList
|
|
2838
|
+
objeList.merge(fam?.get("MARR.OBJE"));
|
|
2604
2839
|
});
|
|
2605
2840
|
objeList?.forEach((o, index) => {
|
|
2606
2841
|
if (!o) {
|
|
@@ -2718,6 +2953,88 @@ var Indi = class extends Common {
|
|
|
2718
2953
|
};
|
|
2719
2954
|
});
|
|
2720
2955
|
}
|
|
2956
|
+
geniMedia() {
|
|
2957
|
+
const list = {};
|
|
2958
|
+
const objeList = this.get("OBJE")?.toList().copy();
|
|
2959
|
+
const sourList = this.get("SOUR")?.toList().copy();
|
|
2960
|
+
sourList?.forEach((sour) => {
|
|
2961
|
+
const sourObje = sour?.get("OBJE")?.toList();
|
|
2962
|
+
objeList.merge(sourObje);
|
|
2963
|
+
});
|
|
2964
|
+
if (!objeList || objeList.length === 0) {
|
|
2965
|
+
return void 0;
|
|
2966
|
+
}
|
|
2967
|
+
const rfn = this.get("RFN")?.toValue();
|
|
2968
|
+
const geniId = rfn?.replace(/^geni:/, "") || "unknown";
|
|
2969
|
+
objeList.forEach((obje, index) => {
|
|
2970
|
+
if (!obje) {
|
|
2971
|
+
return;
|
|
2972
|
+
}
|
|
2973
|
+
const key = `@O${index}@`;
|
|
2974
|
+
const isPrimary = obje?.get("_PRIM")?.toValue() === "Y";
|
|
2975
|
+
const url = obje?.get("FILE")?.toValue();
|
|
2976
|
+
const title = obje?.get("TITL")?.toValue() ?? "";
|
|
2977
|
+
const type = obje?.get("FORM")?.toValue() ?? "raw";
|
|
2978
|
+
if (url) {
|
|
2979
|
+
const urlMatch = url.match(/\/([^/]+)\?hash=/);
|
|
2980
|
+
const imgId = urlMatch?.[1] || `img-${index}-${Date.now().toString(36)}`;
|
|
2981
|
+
const id = `geni-${geniId}-${imgId}`;
|
|
2982
|
+
list[id] = {
|
|
2983
|
+
isPrimary,
|
|
2984
|
+
key,
|
|
2985
|
+
id,
|
|
2986
|
+
tree: geniId,
|
|
2987
|
+
imgId,
|
|
2988
|
+
person: this.id,
|
|
2989
|
+
title,
|
|
2990
|
+
url,
|
|
2991
|
+
contentType: type,
|
|
2992
|
+
downloadName: `${this.id.replaceAll("@", "")}_${this.toNaturalName()?.replaceAll(" ", "-") || ""}_${(title || key.replaceAll("@", "").toString()).replaceAll(" ", "-")}`
|
|
2993
|
+
};
|
|
2994
|
+
}
|
|
2995
|
+
});
|
|
2996
|
+
return list;
|
|
2997
|
+
}
|
|
2998
|
+
universalMedia() {
|
|
2999
|
+
const list = {};
|
|
3000
|
+
if (!this.id) {
|
|
3001
|
+
return list;
|
|
3002
|
+
}
|
|
3003
|
+
const objeList = this.get("OBJE")?.toList().copy();
|
|
3004
|
+
if (!objeList || objeList.length === 0) {
|
|
3005
|
+
return list;
|
|
3006
|
+
}
|
|
3007
|
+
const rfn = this.get("RFN")?.toValue();
|
|
3008
|
+
const treeId = rfn || "universal";
|
|
3009
|
+
objeList.forEach((obje, index) => {
|
|
3010
|
+
if (!obje) {
|
|
3011
|
+
return;
|
|
3012
|
+
}
|
|
3013
|
+
const key = `@O${index}@`;
|
|
3014
|
+
obje.standardizeMedia();
|
|
3015
|
+
const isPrimary = obje?.get("_PRIM")?.toValue() === "Y";
|
|
3016
|
+
const url = obje?.get("FILE")?.toValue();
|
|
3017
|
+
const title = obje?.get("TITL")?.toValue() ?? "";
|
|
3018
|
+
const type = obje?.get("FORM")?.toValue() ?? "raw";
|
|
3019
|
+
if (url) {
|
|
3020
|
+
const imgId = `media-${index}-${url.split("/").pop()?.split("?")[0]?.substring(0, 20) || Date.now().toString(36)}`;
|
|
3021
|
+
const id = `${treeId}-${this.id}-${imgId}`;
|
|
3022
|
+
list[id] = {
|
|
3023
|
+
isPrimary,
|
|
3024
|
+
key,
|
|
3025
|
+
id,
|
|
3026
|
+
tree: treeId,
|
|
3027
|
+
imgId,
|
|
3028
|
+
person: this.id,
|
|
3029
|
+
title,
|
|
3030
|
+
url,
|
|
3031
|
+
contentType: type,
|
|
3032
|
+
downloadName: `${this.id.replaceAll("@", "")}_${this.toNaturalName()?.replaceAll(" ", "-") || ""}_${(title || key.replaceAll("@", "").toString()).replaceAll(" ", "-")}`
|
|
3033
|
+
};
|
|
3034
|
+
}
|
|
3035
|
+
});
|
|
3036
|
+
return list;
|
|
3037
|
+
}
|
|
2721
3038
|
async multimedia(namespace) {
|
|
2722
3039
|
if (this?.isAncestry()) {
|
|
2723
3040
|
return await this.ancestryMedia(namespace);
|
|
@@ -2725,11 +3042,30 @@ var Indi = class extends Common {
|
|
|
2725
3042
|
if (this?.isMyHeritage()) {
|
|
2726
3043
|
return this.myheritageMedia();
|
|
2727
3044
|
}
|
|
2728
|
-
|
|
3045
|
+
if (this?.isGeni()) {
|
|
3046
|
+
return this.geniMedia();
|
|
3047
|
+
}
|
|
3048
|
+
return this.universalMedia();
|
|
2729
3049
|
}
|
|
2730
3050
|
async getProfilePicture(namespace, onlyPrimary = true) {
|
|
3051
|
+
if (!this.id) {
|
|
3052
|
+
return void 0;
|
|
3053
|
+
}
|
|
3054
|
+
const cacheKey = this.id;
|
|
3055
|
+
const cached = profilePictureCache(
|
|
3056
|
+
this._gedcom,
|
|
3057
|
+
cacheKey
|
|
3058
|
+
);
|
|
3059
|
+
if (cached !== void 0) {
|
|
3060
|
+
return cached;
|
|
3061
|
+
}
|
|
2731
3062
|
const mediaList = await this.multimedia(namespace);
|
|
2732
3063
|
if (!mediaList) {
|
|
3064
|
+
profilePictureCache(
|
|
3065
|
+
this._gedcom,
|
|
3066
|
+
cacheKey,
|
|
3067
|
+
void 0
|
|
3068
|
+
);
|
|
2733
3069
|
return void 0;
|
|
2734
3070
|
}
|
|
2735
3071
|
const mediaArray = Object.values(mediaList);
|
|
@@ -2737,27 +3073,41 @@ var Indi = class extends Common {
|
|
|
2737
3073
|
(media) => media.isPrimary && isImageFormat(media.contentType || getFileExtension(media.url))
|
|
2738
3074
|
);
|
|
2739
3075
|
if (primaryMedia) {
|
|
2740
|
-
|
|
3076
|
+
const result = {
|
|
2741
3077
|
file: primaryMedia.url,
|
|
2742
3078
|
form: primaryMedia.contentType,
|
|
2743
3079
|
title: primaryMedia.title,
|
|
2744
3080
|
isPrimary: true
|
|
2745
3081
|
};
|
|
2746
|
-
|
|
2747
|
-
|
|
3082
|
+
profilePictureCache(this._gedcom, cacheKey, result);
|
|
3083
|
+
return result;
|
|
3084
|
+
}
|
|
3085
|
+
if (onlyPrimary) {
|
|
3086
|
+
profilePictureCache(
|
|
3087
|
+
this._gedcom,
|
|
3088
|
+
cacheKey,
|
|
3089
|
+
void 0
|
|
3090
|
+
);
|
|
2748
3091
|
return void 0;
|
|
2749
3092
|
}
|
|
2750
3093
|
const secondaryMedia = mediaArray.find(
|
|
2751
3094
|
(media) => isImageFormat(media.contentType || getFileExtension(media.url))
|
|
2752
3095
|
);
|
|
2753
3096
|
if (secondaryMedia) {
|
|
2754
|
-
|
|
3097
|
+
const result = {
|
|
2755
3098
|
file: secondaryMedia.url,
|
|
2756
3099
|
form: secondaryMedia.contentType,
|
|
2757
3100
|
title: secondaryMedia.title,
|
|
2758
3101
|
isPrimary: false
|
|
2759
3102
|
};
|
|
3103
|
+
profilePictureCache(this._gedcom, cacheKey, result);
|
|
3104
|
+
return result;
|
|
2760
3105
|
}
|
|
3106
|
+
profilePictureCache(
|
|
3107
|
+
this._gedcom,
|
|
3108
|
+
cacheKey,
|
|
3109
|
+
void 0
|
|
3110
|
+
);
|
|
2761
3111
|
return void 0;
|
|
2762
3112
|
}
|
|
2763
3113
|
link(poolId) {
|
|
@@ -3125,7 +3475,7 @@ var Indi = class extends Common {
|
|
|
3125
3475
|
return;
|
|
3126
3476
|
}
|
|
3127
3477
|
const cacheKey = `${this.id}|${usedIndi.id}`;
|
|
3128
|
-
const cache = pathCache(cacheKey);
|
|
3478
|
+
const cache = pathCache(this._gedcom, cacheKey);
|
|
3129
3479
|
if (cache) {
|
|
3130
3480
|
return cache;
|
|
3131
3481
|
}
|
|
@@ -3170,7 +3520,7 @@ var Indi = class extends Common {
|
|
|
3170
3520
|
if (breakOnNext) {
|
|
3171
3521
|
return void 0;
|
|
3172
3522
|
}
|
|
3173
|
-
pathCache(cacheKey, path2);
|
|
3523
|
+
pathCache(this._gedcom, cacheKey, path2);
|
|
3174
3524
|
return path2;
|
|
3175
3525
|
}
|
|
3176
3526
|
visited.append(indi);
|
|
@@ -3340,7 +3690,7 @@ var Indi = class extends Common {
|
|
|
3340
3690
|
}
|
|
3341
3691
|
getRelativesOnDegree(degree = 0) {
|
|
3342
3692
|
this.id = this.id || `@I${Math.random()}@`;
|
|
3343
|
-
const cache = relativesOnDegreeCache(this.id, degree);
|
|
3693
|
+
const cache = relativesOnDegreeCache(this._gedcom, this.id, degree);
|
|
3344
3694
|
if (cache) {
|
|
3345
3695
|
return cache;
|
|
3346
3696
|
}
|
|
@@ -3348,6 +3698,7 @@ var Indi = class extends Common {
|
|
|
3348
3698
|
const excludes = persons;
|
|
3349
3699
|
if (!Math.abs(degree)) {
|
|
3350
3700
|
return relativesOnDegreeCache(
|
|
3701
|
+
this._gedcom,
|
|
3351
3702
|
this.id,
|
|
3352
3703
|
degree,
|
|
3353
3704
|
persons.except(this)
|
|
@@ -3358,11 +3709,11 @@ var Indi = class extends Common {
|
|
|
3358
3709
|
excludes.merge(persons);
|
|
3359
3710
|
persons = this.getRelativesOnLevel(validDegree).getRelativesOnDegree(-validDegree).copy().exclude(excludes);
|
|
3360
3711
|
}
|
|
3361
|
-
return relativesOnDegreeCache(this.id, degree, persons);
|
|
3712
|
+
return relativesOnDegreeCache(this._gedcom, this.id, degree, persons);
|
|
3362
3713
|
}
|
|
3363
3714
|
getRelativesOnLevel(level = 0, filter) {
|
|
3364
3715
|
this.id = this.id || `@I${Math.random()}@`;
|
|
3365
|
-
const cache = relativesOnLevelCache(this.id, level);
|
|
3716
|
+
const cache = relativesOnLevelCache(this._gedcom, this.id, level);
|
|
3366
3717
|
if (cache) {
|
|
3367
3718
|
return cache;
|
|
3368
3719
|
}
|
|
@@ -3373,7 +3724,7 @@ var Indi = class extends Common {
|
|
|
3373
3724
|
};
|
|
3374
3725
|
let families = this.get(config.key)?.toValueList();
|
|
3375
3726
|
if (!families) {
|
|
3376
|
-
return relativesOnLevelCache(this.id, level, persons);
|
|
3727
|
+
return relativesOnLevelCache(this._gedcom, this.id, level, persons);
|
|
3377
3728
|
}
|
|
3378
3729
|
if (filter) {
|
|
3379
3730
|
families = families.filter(filter);
|
|
@@ -3384,7 +3735,12 @@ var Indi = class extends Common {
|
|
|
3384
3735
|
persons = this.toFamilies(families).getParents();
|
|
3385
3736
|
}
|
|
3386
3737
|
if (level >= -1 && level <= 1) {
|
|
3387
|
-
return relativesOnLevelCache(
|
|
3738
|
+
return relativesOnLevelCache(
|
|
3739
|
+
this._gedcom,
|
|
3740
|
+
this.id,
|
|
3741
|
+
level,
|
|
3742
|
+
persons.except(this)
|
|
3743
|
+
);
|
|
3388
3744
|
}
|
|
3389
3745
|
for (let i = 1; i < Math.abs(level); i++) {
|
|
3390
3746
|
if (config.isAscendant) {
|
|
@@ -3393,7 +3749,12 @@ var Indi = class extends Common {
|
|
|
3393
3749
|
persons = persons.getParents();
|
|
3394
3750
|
}
|
|
3395
3751
|
}
|
|
3396
|
-
return relativesOnLevelCache(
|
|
3752
|
+
return relativesOnLevelCache(
|
|
3753
|
+
this._gedcom,
|
|
3754
|
+
this.id,
|
|
3755
|
+
level,
|
|
3756
|
+
persons.except(this)
|
|
3757
|
+
);
|
|
3397
3758
|
}
|
|
3398
3759
|
getAscendants(level = 0, filter) {
|
|
3399
3760
|
if (!level) {
|
|
@@ -3432,7 +3793,12 @@ var Indi = class extends Common {
|
|
|
3432
3793
|
}
|
|
3433
3794
|
currentGen++;
|
|
3434
3795
|
generations[currentGen] = descentants;
|
|
3435
|
-
relativesOnLevelCache(
|
|
3796
|
+
relativesOnLevelCache(
|
|
3797
|
+
this._gedcom,
|
|
3798
|
+
this.id,
|
|
3799
|
+
-currentGen,
|
|
3800
|
+
descentants
|
|
3801
|
+
);
|
|
3436
3802
|
descentants && relatives.merge(descentants);
|
|
3437
3803
|
}
|
|
3438
3804
|
return { relatives, generations };
|
|
@@ -3465,7 +3831,7 @@ var Indi = class extends Common {
|
|
|
3465
3831
|
}
|
|
3466
3832
|
currentGen++;
|
|
3467
3833
|
generations[currentGen] = parents;
|
|
3468
|
-
relativesOnLevelCache(this.id, currentGen, parents);
|
|
3834
|
+
relativesOnLevelCache(this._gedcom, this.id, currentGen, parents);
|
|
3469
3835
|
parents && relatives.merge(parents);
|
|
3470
3836
|
}
|
|
3471
3837
|
return { relatives, generations };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { I as ICacheManager, P as PlaceParts } from '../place-parser-
|
|
1
|
+
import { I as ICacheManager, P as PlaceParts } from '../place-parser-CJ3EbFmb.js';
|
|
2
2
|
import { Locale } from 'date-fns';
|
|
3
|
-
import { af as IndiType, ac as IndiKey, ai as Language } from '../index-
|
|
3
|
+
import { af as IndiType, ac as IndiKey, ai as Language } from '../index-CzYZg44D.js';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Factory function type for creating cache manager instances.
|