@treeviz/gedcom-parser 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +954 -0
- package/dist/classes/common.d.ts +87 -0
- package/dist/classes/common.d.ts.map +1 -0
- package/dist/classes/common.js +481 -0
- package/dist/classes/date.d.ts +26 -0
- package/dist/classes/date.d.ts.map +1 -0
- package/dist/classes/date.js +176 -0
- package/dist/classes/fam.d.ts +19 -0
- package/dist/classes/fam.d.ts.map +1 -0
- package/dist/classes/fam.js +38 -0
- package/dist/classes/fams.d.ts +16 -0
- package/dist/classes/fams.d.ts.map +1 -0
- package/dist/classes/fams.js +41 -0
- package/dist/classes/gedcom.d.ts +89 -0
- package/dist/classes/gedcom.d.ts.map +1 -0
- package/dist/classes/gedcom.js +421 -0
- package/dist/classes/index.d.ts +19 -0
- package/dist/classes/index.d.ts.map +1 -0
- package/dist/classes/index.js +19 -0
- package/dist/classes/indi.d.ts +298 -0
- package/dist/classes/indi.d.ts.map +1 -0
- package/dist/classes/indi.js +2049 -0
- package/dist/classes/indis.d.ts +54 -0
- package/dist/classes/indis.d.ts.map +1 -0
- package/dist/classes/indis.js +439 -0
- package/dist/classes/list.d.ts +55 -0
- package/dist/classes/list.d.ts.map +1 -0
- package/dist/classes/list.js +440 -0
- package/dist/classes/name.d.ts +20 -0
- package/dist/classes/name.d.ts.map +1 -0
- package/dist/classes/name.js +48 -0
- package/dist/classes/note.d.ts +12 -0
- package/dist/classes/note.d.ts.map +1 -0
- package/dist/classes/note.js +46 -0
- package/dist/classes/obje.d.ts +12 -0
- package/dist/classes/obje.d.ts.map +1 -0
- package/dist/classes/obje.js +81 -0
- package/dist/classes/objes.d.ts +8 -0
- package/dist/classes/objes.d.ts.map +1 -0
- package/dist/classes/objes.js +13 -0
- package/dist/classes/repo.d.ts +11 -0
- package/dist/classes/repo.d.ts.map +1 -0
- package/dist/classes/repo.js +6 -0
- package/dist/classes/repos.d.ts +8 -0
- package/dist/classes/repos.d.ts.map +1 -0
- package/dist/classes/repos.js +13 -0
- package/dist/classes/sour.d.ts +11 -0
- package/dist/classes/sour.d.ts.map +1 -0
- package/dist/classes/sour.js +6 -0
- package/dist/classes/sours.d.ts +8 -0
- package/dist/classes/sours.d.ts.map +1 -0
- package/dist/classes/sours.js +13 -0
- package/dist/classes/subm.d.ts +10 -0
- package/dist/classes/subm.d.ts.map +1 -0
- package/dist/classes/subm.js +6 -0
- package/dist/classes/subms.d.ts +8 -0
- package/dist/classes/subms.d.ts.map +1 -0
- package/dist/classes/subms.js +13 -0
- package/dist/constants/constants.d.ts +14 -0
- package/dist/constants/constants.d.ts.map +1 -0
- package/dist/constants/constants.js +13 -0
- package/dist/constants/filters.d.ts +17 -0
- package/dist/constants/filters.d.ts.map +1 -0
- package/dist/constants/filters.js +44 -0
- package/dist/constants/index.d.ts +4 -0
- package/dist/constants/index.d.ts.map +1 -0
- package/dist/constants/index.js +4 -0
- package/dist/constants/orders.d.ts +17 -0
- package/dist/constants/orders.d.ts.map +1 -0
- package/dist/constants/orders.js +240 -0
- package/dist/factories/cache-factory.d.ts +30 -0
- package/dist/factories/cache-factory.d.ts.map +1 -0
- package/dist/factories/cache-factory.js +43 -0
- package/dist/factories/date-locale-factory.d.ts +30 -0
- package/dist/factories/date-locale-factory.d.ts.map +1 -0
- package/dist/factories/date-locale-factory.js +34 -0
- package/dist/factories/i18n-factory.d.ts +40 -0
- package/dist/factories/i18n-factory.d.ts.map +1 -0
- package/dist/factories/i18n-factory.js +44 -0
- package/dist/factories/index.d.ts +5 -0
- package/dist/factories/index.d.ts.map +1 -0
- package/dist/factories/index.js +5 -0
- package/dist/factories/kinship-factory.d.ts +38 -0
- package/dist/factories/kinship-factory.d.ts.map +1 -0
- package/dist/factories/kinship-factory.js +35 -0
- package/dist/factories/place-parser-provider.d.ts +32 -0
- package/dist/factories/place-parser-provider.d.ts.map +1 -0
- package/dist/factories/place-parser-provider.js +35 -0
- package/dist/factories/place-translator-provider.d.ts +32 -0
- package/dist/factories/place-translator-provider.d.ts.map +1 -0
- package/dist/factories/place-translator-provider.js +35 -0
- package/dist/index.d.ts +78 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +44 -0
- package/dist/interfaces/common.d.ts +43 -0
- package/dist/interfaces/common.d.ts.map +1 -0
- package/dist/interfaces/common.js +1 -0
- package/dist/interfaces/fam.d.ts +11 -0
- package/dist/interfaces/fam.d.ts.map +1 -0
- package/dist/interfaces/fam.js +1 -0
- package/dist/interfaces/fams.d.ts +9 -0
- package/dist/interfaces/fams.d.ts.map +1 -0
- package/dist/interfaces/fams.js +1 -0
- package/dist/interfaces/gedcom.d.ts +30 -0
- package/dist/interfaces/gedcom.d.ts.map +1 -0
- package/dist/interfaces/gedcom.js +1 -0
- package/dist/interfaces/index.d.ts +12 -0
- package/dist/interfaces/index.d.ts.map +1 -0
- package/dist/interfaces/index.js +1 -0
- package/dist/interfaces/indi.d.ts +109 -0
- package/dist/interfaces/indi.d.ts.map +1 -0
- package/dist/interfaces/indi.js +1 -0
- package/dist/interfaces/indis.d.ts +31 -0
- package/dist/interfaces/indis.d.ts.map +1 -0
- package/dist/interfaces/indis.js +1 -0
- package/dist/interfaces/list.d.ts +52 -0
- package/dist/interfaces/list.d.ts.map +1 -0
- package/dist/interfaces/list.js +1 -0
- package/dist/interfaces/obje.d.ts +7 -0
- package/dist/interfaces/obje.d.ts.map +1 -0
- package/dist/interfaces/obje.js +1 -0
- package/dist/interfaces/repo.d.ts +7 -0
- package/dist/interfaces/repo.d.ts.map +1 -0
- package/dist/interfaces/repo.js +1 -0
- package/dist/interfaces/sour.d.ts +7 -0
- package/dist/interfaces/sour.d.ts.map +1 -0
- package/dist/interfaces/sour.js +1 -0
- package/dist/interfaces/subm.d.ts +6 -0
- package/dist/interfaces/subm.d.ts.map +1 -0
- package/dist/interfaces/subm.js +1 -0
- package/dist/kinship-translator/index.d.ts +11 -0
- package/dist/kinship-translator/index.d.ts.map +1 -0
- package/dist/kinship-translator/index.js +10 -0
- package/dist/kinship-translator/kinship-translator.basic.d.ts +30 -0
- package/dist/kinship-translator/kinship-translator.basic.d.ts.map +1 -0
- package/dist/kinship-translator/kinship-translator.basic.js +74 -0
- package/dist/kinship-translator/kinship-translator.d.ts +26 -0
- package/dist/kinship-translator/kinship-translator.d.ts.map +1 -0
- package/dist/kinship-translator/kinship-translator.de.d.ts +18 -0
- package/dist/kinship-translator/kinship-translator.de.d.ts.map +1 -0
- package/dist/kinship-translator/kinship-translator.de.js +180 -0
- package/dist/kinship-translator/kinship-translator.en.d.ts +18 -0
- package/dist/kinship-translator/kinship-translator.en.d.ts.map +1 -0
- package/dist/kinship-translator/kinship-translator.en.js +182 -0
- package/dist/kinship-translator/kinship-translator.es.d.ts +18 -0
- package/dist/kinship-translator/kinship-translator.es.d.ts.map +1 -0
- package/dist/kinship-translator/kinship-translator.es.js +181 -0
- package/dist/kinship-translator/kinship-translator.fr.d.ts +18 -0
- package/dist/kinship-translator/kinship-translator.fr.d.ts.map +1 -0
- package/dist/kinship-translator/kinship-translator.fr.js +181 -0
- package/dist/kinship-translator/kinship-translator.hu.d.ts +19 -0
- package/dist/kinship-translator/kinship-translator.hu.d.ts.map +1 -0
- package/dist/kinship-translator/kinship-translator.hu.js +226 -0
- package/dist/kinship-translator/kinship-translator.interface.d.ts +19 -0
- package/dist/kinship-translator/kinship-translator.interface.d.ts.map +1 -0
- package/dist/kinship-translator/kinship-translator.interface.js +1 -0
- package/dist/kinship-translator/kinship-translator.js +103 -0
- package/dist/kinship-translator/patterns.de.d.ts +2 -0
- package/dist/kinship-translator/patterns.de.d.ts.map +1 -0
- package/dist/kinship-translator/patterns.de.js +14 -0
- package/dist/kinship-translator/patterns.en.d.ts +2 -0
- package/dist/kinship-translator/patterns.en.d.ts.map +1 -0
- package/dist/kinship-translator/patterns.en.js +14 -0
- package/dist/kinship-translator/patterns.es.d.ts +2 -0
- package/dist/kinship-translator/patterns.es.d.ts.map +1 -0
- package/dist/kinship-translator/patterns.es.js +14 -0
- package/dist/kinship-translator/patterns.fr.d.ts +2 -0
- package/dist/kinship-translator/patterns.fr.d.ts.map +1 -0
- package/dist/kinship-translator/patterns.fr.js +14 -0
- package/dist/kinship-translator/patterns.hu.d.ts +6 -0
- package/dist/kinship-translator/patterns.hu.d.ts.map +1 -0
- package/dist/kinship-translator/patterns.hu.js +97 -0
- package/dist/kinship-translator/translators.d.ts +6 -0
- package/dist/kinship-translator/translators.d.ts.map +1 -0
- package/dist/kinship-translator/translators.js +5 -0
- package/dist/kinship-translator/types.d.ts +9 -0
- package/dist/kinship-translator/types.d.ts.map +1 -0
- package/dist/kinship-translator/types.js +1 -0
- package/dist/structures/address.d.ts +14 -0
- package/dist/structures/address.d.ts.map +1 -0
- package/dist/structures/address.js +1 -0
- package/dist/structures/association.d.ts +13 -0
- package/dist/structures/association.d.ts.map +1 -0
- package/dist/structures/association.js +1 -0
- package/dist/structures/change-date.d.ts +8 -0
- package/dist/structures/change-date.d.ts.map +1 -0
- package/dist/structures/change-date.js +1 -0
- package/dist/structures/creation-date.d.ts +7 -0
- package/dist/structures/creation-date.d.ts.map +1 -0
- package/dist/structures/creation-date.js +1 -0
- package/dist/structures/date.d.ts +9 -0
- package/dist/structures/date.d.ts.map +1 -0
- package/dist/structures/date.js +1 -0
- package/dist/structures/event-detail-structure.d.ts +25 -0
- package/dist/structures/event-detail-structure.d.ts.map +1 -0
- package/dist/structures/event-detail-structure.js +1 -0
- package/dist/structures/family.d.ts +34 -0
- package/dist/structures/family.d.ts.map +1 -0
- package/dist/structures/family.js +1 -0
- package/dist/structures/gedcom.d.ts +60 -0
- package/dist/structures/gedcom.d.ts.map +1 -0
- package/dist/structures/gedcom.js +1 -0
- package/dist/structures/index.d.ts +25 -0
- package/dist/structures/index.d.ts.map +1 -0
- package/dist/structures/index.js +1 -0
- package/dist/structures/individual-event-detail-structure.d.ts +9 -0
- package/dist/structures/individual-event-detail-structure.d.ts.map +1 -0
- package/dist/structures/individual-event-detail-structure.js +1 -0
- package/dist/structures/individual-event-structure.d.ts +83 -0
- package/dist/structures/individual-event-structure.d.ts.map +1 -0
- package/dist/structures/individual-event-structure.js +1 -0
- package/dist/structures/individual.d.ts +40 -0
- package/dist/structures/individual.d.ts.map +1 -0
- package/dist/structures/individual.js +1 -0
- package/dist/structures/lds-ordinance-detail.d.ts +17 -0
- package/dist/structures/lds-ordinance-detail.d.ts.map +1 -0
- package/dist/structures/lds-ordinance-detail.js +1 -0
- package/dist/structures/lds-spouse-sealing.d.ts +7 -0
- package/dist/structures/lds-spouse-sealing.d.ts.map +1 -0
- package/dist/structures/lds-spouse-sealing.js +1 -0
- package/dist/structures/marriage-date.d.ts +11 -0
- package/dist/structures/marriage-date.d.ts.map +1 -0
- package/dist/structures/marriage-date.js +1 -0
- package/dist/structures/multimedia-link.d.ts +16 -0
- package/dist/structures/multimedia-link.d.ts.map +1 -0
- package/dist/structures/multimedia-link.js +1 -0
- package/dist/structures/non-event.d.ts +12 -0
- package/dist/structures/non-event.d.ts.map +1 -0
- package/dist/structures/non-event.js +1 -0
- package/dist/structures/note.d.ts +16 -0
- package/dist/structures/note.d.ts.map +1 -0
- package/dist/structures/note.js +1 -0
- package/dist/structures/personal-name-pieces.d.ts +11 -0
- package/dist/structures/personal-name-pieces.d.ts.map +1 -0
- package/dist/structures/personal-name-pieces.js +1 -0
- package/dist/structures/personal-name.d.ts +16 -0
- package/dist/structures/personal-name.d.ts.map +1 -0
- package/dist/structures/personal-name.js +1 -0
- package/dist/structures/place.d.ts +20 -0
- package/dist/structures/place.d.ts.map +1 -0
- package/dist/structures/place.js +1 -0
- package/dist/structures/repository.d.ts +6 -0
- package/dist/structures/repository.d.ts.map +1 -0
- package/dist/structures/repository.js +1 -0
- package/dist/structures/source-citation.d.ts +27 -0
- package/dist/structures/source-citation.d.ts.map +1 -0
- package/dist/structures/source-citation.js +1 -0
- package/dist/structures/source-repository-citation.d.ts +13 -0
- package/dist/structures/source-repository-citation.d.ts.map +1 -0
- package/dist/structures/source-repository-citation.js +1 -0
- package/dist/structures/source.d.ts +28 -0
- package/dist/structures/source.d.ts.map +1 -0
- package/dist/structures/source.js +1 -0
- package/dist/types/ancestry-media.d.ts +65 -0
- package/dist/types/ancestry-media.d.ts.map +1 -0
- package/dist/types/ancestry-media.js +1 -0
- package/dist/types/index.d.ts +4 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +4 -0
- package/dist/types/settings.d.ts +12 -0
- package/dist/types/settings.d.ts.map +1 -0
- package/dist/types/settings.js +1 -0
- package/dist/types/types.d.ts +220 -0
- package/dist/types/types.d.ts.map +1 -0
- package/dist/types/types.js +26 -0
- package/dist/utils/cache.d.ts +22 -0
- package/dist/utils/cache.d.ts.map +1 -0
- package/dist/utils/cache.js +57 -0
- package/dist/utils/common-creator.d.ts +13 -0
- package/dist/utils/common-creator.d.ts.map +1 -0
- package/dist/utils/common-creator.js +72 -0
- package/dist/utils/date-formatter.d.ts +35 -0
- package/dist/utils/date-formatter.d.ts.map +1 -0
- package/dist/utils/date-formatter.js +207 -0
- package/dist/utils/get-all-prop.d.ts +4 -0
- package/dist/utils/get-all-prop.d.ts.map +1 -0
- package/dist/utils/get-all-prop.js +5 -0
- package/dist/utils/get-family-with.d.ts +5 -0
- package/dist/utils/get-family-with.d.ts.map +1 -0
- package/dist/utils/get-family-with.js +11 -0
- package/dist/utils/get-places.d.ts +21 -0
- package/dist/utils/get-places.d.ts.map +1 -0
- package/dist/utils/get-places.js +77 -0
- package/dist/utils/get-product-details.d.ts +4 -0
- package/dist/utils/get-product-details.d.ts.map +1 -0
- package/dist/utils/get-product-details.js +6 -0
- package/dist/utils/get-raw-size.d.ts +2 -0
- package/dist/utils/get-raw-size.d.ts.map +1 -0
- package/dist/utils/get-raw-size.js +3 -0
- package/dist/utils/index.d.ts +17 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/index.js +18 -0
- package/dist/utils/logger.d.ts +3 -0
- package/dist/utils/logger.d.ts.map +1 -0
- package/dist/utils/logger.js +11 -0
- package/dist/utils/name-formatter.d.ts +10 -0
- package/dist/utils/name-formatter.d.ts.map +1 -0
- package/dist/utils/name-formatter.js +45 -0
- package/dist/utils/nested-group.d.ts +4 -0
- package/dist/utils/nested-group.d.ts.map +1 -0
- package/dist/utils/nested-group.js +34 -0
- package/dist/utils/ordinalize.d.ts +3 -0
- package/dist/utils/ordinalize.d.ts.map +1 -0
- package/dist/utils/ordinalize.js +104 -0
- package/dist/utils/parser.d.ts +17 -0
- package/dist/utils/parser.d.ts.map +1 -0
- package/dist/utils/parser.js +322 -0
- package/dist/utils/place-parser.d.ts +16 -0
- package/dist/utils/place-parser.d.ts.map +1 -0
- package/dist/utils/place-parser.js +46 -0
- package/dist/utils/place-translator.d.ts +6 -0
- package/dist/utils/place-translator.d.ts.map +1 -0
- package/dist/utils/place-translator.js +8 -0
- package/dist/utils/place-types.d.ts +27 -0
- package/dist/utils/place-types.d.ts.map +1 -0
- package/dist/utils/place-types.js +14 -0
- package/dist/utils/range.d.ts +19 -0
- package/dist/utils/range.d.ts.map +1 -0
- package/dist/utils/range.js +265 -0
- package/package.json +153 -0
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { type Path } from "../classes/indi";
|
|
2
|
+
import { type Individuals } from "../classes/indis";
|
|
3
|
+
import { type IndiKey } from "../types/types";
|
|
4
|
+
/**
|
|
5
|
+
* Cache manager interface for pluggable cache implementations.
|
|
6
|
+
* The main project can inject custom implementations (e.g., IndexedDB) via setCacheManagerFactory.
|
|
7
|
+
*/
|
|
8
|
+
export interface ICacheManager<T> {
|
|
9
|
+
getItem: () => Promise<T | null>;
|
|
10
|
+
setItem: (value: T) => Promise<void>;
|
|
11
|
+
}
|
|
12
|
+
interface Caches {
|
|
13
|
+
pathCache: Record<`${IndiKey}|${IndiKey}`, Path> | undefined;
|
|
14
|
+
relativesOnLevelCache: Record<IndiKey, Record<number, Individuals>> | undefined;
|
|
15
|
+
relativesOnDegreeCache: Record<IndiKey, Record<number, Individuals>> | undefined;
|
|
16
|
+
}
|
|
17
|
+
export type CacheRelatives<O extends keyof Caches = "pathCache"> = <T extends keyof Omit<Caches, O>, K extends keyof NonNullable<Omit<Caches, O>[T]>>(cacheKey: T) => (key: K, subKey: number, ...values: [keyof NonNullable<Omit<Caches, O>[T]>[K]]) => NonNullable<Omit<Caches, O>[T]>[K];
|
|
18
|
+
export declare const resetRelativesCache: () => void;
|
|
19
|
+
export declare const relativesCache: (cacheKey: keyof Omit<Caches, "pathCache">) => <T extends Individuals | undefined>(key: IndiKey, subKey: number, value?: T) => T;
|
|
20
|
+
export declare const pathCache: <T extends Path | undefined>(key: `${IndiKey}|${IndiKey}`, value?: T) => T;
|
|
21
|
+
export {};
|
|
22
|
+
//# sourceMappingURL=cache.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cache.d.ts","sourceRoot":"","sources":["../../src/utils/cache.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAEpD,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAE9C;;;GAGG;AACH,MAAM,WAAW,aAAa,CAAC,CAAC;IAC/B,OAAO,EAAE,MAAM,OAAO,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC;IACjC,OAAO,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CACrC;AAED,UAAU,MAAM;IACf,SAAS,EAAE,MAAM,CAAC,GAAG,OAAO,IAAI,OAAO,EAAE,EAAE,IAAI,CAAC,GAAG,SAAS,CAAC;IAC7D,qBAAqB,EAClB,MAAM,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC,GAC5C,SAAS,CAAC;IACb,sBAAsB,EACnB,MAAM,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC,GAC5C,SAAS,CAAC;CACb;AAoDD,MAAM,MAAM,cAAc,CAAC,CAAC,SAAS,MAAM,MAAM,GAAG,WAAW,IAAI,CAClE,CAAC,SAAS,MAAM,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC,EAC/B,CAAC,SAAS,MAAM,WAAW,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAE/C,QAAQ,EAAE,CAAC,KACP,CACJ,GAAG,EAAE,CAAC,EACN,MAAM,EAAE,MAAM,EACd,GAAG,MAAM,EAAE,CAAC,MAAM,WAAW,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KACjD,WAAW,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAExC,eAAO,MAAM,mBAAmB,YAG/B,CAAC;AAEF,eAAO,MAAM,cAAc,GACzB,UAAU,MAAM,IAAI,CAAC,MAAM,EAAE,WAAW,CAAC,MACzC,CAAC,SAAS,WAAW,GAAG,SAAS,EACjC,KAAK,OAAO,EACZ,QAAQ,MAAM,EACd,QAAQ,CAAC,MAiBT,CAAC;AAEH,eAAO,MAAM,SAAS,GAAI,CAAC,SAAS,IAAI,GAAG,SAAS,EACnD,KAAK,GAAG,OAAO,IAAI,OAAO,EAAE,EAC5B,QAAQ,CAAC,MAaT,CAAC"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import debounce from "lodash/debounce";
|
|
2
|
+
import { getCacheManagerFactory } from "../factories/cache-factory";
|
|
3
|
+
const caches = {
|
|
4
|
+
pathCache: {},
|
|
5
|
+
relativesOnDegreeCache: {},
|
|
6
|
+
relativesOnLevelCache: {},
|
|
7
|
+
};
|
|
8
|
+
const getInstance = getCacheManagerFactory();
|
|
9
|
+
const cacheDbs = {
|
|
10
|
+
pathCache: getInstance("ftv", "Main", "path", true),
|
|
11
|
+
relativesOnDegreeCache: getInstance("ftv", "Main", "path", true),
|
|
12
|
+
relativesOnLevelCache: getInstance("ftv", "Main", "path", true),
|
|
13
|
+
};
|
|
14
|
+
const _storeCache = {
|
|
15
|
+
pathCache: debounce((value) => {
|
|
16
|
+
if (value) {
|
|
17
|
+
cacheDbs.pathCache.setItem(value);
|
|
18
|
+
}
|
|
19
|
+
}, 50),
|
|
20
|
+
relativesOnLevelCache: debounce((value) => {
|
|
21
|
+
if (value) {
|
|
22
|
+
cacheDbs.relativesOnLevelCache.setItem(value);
|
|
23
|
+
}
|
|
24
|
+
}, 50),
|
|
25
|
+
relativesOnDegreeCache: debounce((value) => {
|
|
26
|
+
if (value) {
|
|
27
|
+
cacheDbs.relativesOnDegreeCache.setItem(value);
|
|
28
|
+
}
|
|
29
|
+
}, 50),
|
|
30
|
+
};
|
|
31
|
+
export const resetRelativesCache = () => {
|
|
32
|
+
caches.relativesOnDegreeCache = {};
|
|
33
|
+
caches.relativesOnLevelCache = {};
|
|
34
|
+
};
|
|
35
|
+
export const relativesCache = (cacheKey) => (key, subKey, value) => {
|
|
36
|
+
if (!caches[cacheKey]) {
|
|
37
|
+
caches[cacheKey] = {};
|
|
38
|
+
}
|
|
39
|
+
if (value && caches[cacheKey]) {
|
|
40
|
+
if (!caches[cacheKey][key]) {
|
|
41
|
+
caches[cacheKey][key] = {};
|
|
42
|
+
}
|
|
43
|
+
caches[cacheKey][key][subKey] = value;
|
|
44
|
+
return caches[cacheKey][key][subKey];
|
|
45
|
+
}
|
|
46
|
+
return caches[cacheKey]?.[key]?.[subKey];
|
|
47
|
+
};
|
|
48
|
+
export const pathCache = (key, value) => {
|
|
49
|
+
if (!caches.pathCache) {
|
|
50
|
+
caches.pathCache = {};
|
|
51
|
+
}
|
|
52
|
+
if (value && caches.pathCache) {
|
|
53
|
+
caches.pathCache[key] = value;
|
|
54
|
+
return caches.pathCache[key];
|
|
55
|
+
}
|
|
56
|
+
return caches.pathCache?.[key];
|
|
57
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { Common } from "../classes/common";
|
|
2
|
+
import type { GedComType } from "../classes/gedcom";
|
|
3
|
+
import type { MultiTag, IdType } from "../types/types";
|
|
4
|
+
export declare const create: (gedcom: GedComType, type: MultiTag, id?: string, nodes?: {
|
|
5
|
+
mainNode?: Common;
|
|
6
|
+
curNode?: Common;
|
|
7
|
+
prevNode?: Common;
|
|
8
|
+
}) => {
|
|
9
|
+
prevNode: Common<string, IdType>;
|
|
10
|
+
curNode: Common<string, IdType>;
|
|
11
|
+
mainNode: Common<string, IdType>;
|
|
12
|
+
};
|
|
13
|
+
//# sourceMappingURL=common-creator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"common-creator.d.ts","sourceRoot":"","sources":["../../src/utils/common-creator.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAIhD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAQpD,OAAO,KAAK,EACX,QAAQ,EACR,MAAM,EAQN,MAAM,gBAAgB,CAAC;AAExB,eAAO,MAAM,MAAM,GAClB,QAAQ,UAAU,EAClB,MAAM,QAAQ,EACd,KAAK,MAAM,EACX,QAAQ;IACP,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;CAClB;;;;CAgDD,CAAC"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { createCommon } from "../classes/common";
|
|
2
|
+
import { createCommonDate } from "../classes/date";
|
|
3
|
+
import { createFam } from "../classes/fam";
|
|
4
|
+
import { GedCom } from "../classes/gedcom";
|
|
5
|
+
import { createIndi, Indi } from "../classes/indi";
|
|
6
|
+
import { createCommonName } from "../classes/name";
|
|
7
|
+
import { createCommonNote } from "../classes/note";
|
|
8
|
+
import { createObje } from "../classes/obje";
|
|
9
|
+
import { createRepo } from "../classes/repo";
|
|
10
|
+
import { createSour } from "../classes/sour";
|
|
11
|
+
import { createSubm } from "../classes/subm";
|
|
12
|
+
export const create = (gedcom, type, id, nodes) => {
|
|
13
|
+
let mainNode = nodes?.mainNode;
|
|
14
|
+
const curNode = nodes?.curNode;
|
|
15
|
+
let prevNode = nodes?.prevNode;
|
|
16
|
+
if (id) {
|
|
17
|
+
const convertType = type;
|
|
18
|
+
if (convertType === "REPO") {
|
|
19
|
+
prevNode = createRepo(gedcom, id);
|
|
20
|
+
}
|
|
21
|
+
else if (convertType === "SUBM") {
|
|
22
|
+
prevNode = createSubm(gedcom, id);
|
|
23
|
+
}
|
|
24
|
+
else if (convertType === "SOUR") {
|
|
25
|
+
prevNode = createSour(gedcom, id);
|
|
26
|
+
}
|
|
27
|
+
else if (convertType === "OBJE" && curNode instanceof GedCom) {
|
|
28
|
+
prevNode = createObje(gedcom, id);
|
|
29
|
+
}
|
|
30
|
+
else if (convertType === "INDI") {
|
|
31
|
+
prevNode = createIndi(gedcom, id);
|
|
32
|
+
}
|
|
33
|
+
else if (convertType === "_INDI") {
|
|
34
|
+
prevNode = createIndi(gedcom, id);
|
|
35
|
+
}
|
|
36
|
+
else if (convertType === "FAM") {
|
|
37
|
+
prevNode = createFam(gedcom, id);
|
|
38
|
+
}
|
|
39
|
+
else {
|
|
40
|
+
prevNode = createCommon(gedcom, id);
|
|
41
|
+
}
|
|
42
|
+
mainNode = prevNode;
|
|
43
|
+
}
|
|
44
|
+
else {
|
|
45
|
+
if (type === "REPO") {
|
|
46
|
+
prevNode = createRepo(gedcom, undefined, mainNode, curNode);
|
|
47
|
+
}
|
|
48
|
+
else if (type === "SUBM") {
|
|
49
|
+
prevNode = createSubm(gedcom, undefined, mainNode, curNode);
|
|
50
|
+
}
|
|
51
|
+
else if (type === "SOUR") {
|
|
52
|
+
prevNode = createSour(gedcom, undefined, mainNode, curNode);
|
|
53
|
+
}
|
|
54
|
+
else if (type === "OBJE") {
|
|
55
|
+
prevNode = createObje(gedcom, undefined, mainNode, curNode);
|
|
56
|
+
}
|
|
57
|
+
else if (type === "DATE") {
|
|
58
|
+
prevNode = createCommonDate(gedcom, undefined, mainNode, curNode);
|
|
59
|
+
}
|
|
60
|
+
else if (type === "NOTE") {
|
|
61
|
+
prevNode = createCommonNote(gedcom, undefined, mainNode, curNode);
|
|
62
|
+
}
|
|
63
|
+
else if (type === "NAME" && mainNode instanceof Indi) {
|
|
64
|
+
prevNode = createCommonName(gedcom, undefined, mainNode, curNode);
|
|
65
|
+
}
|
|
66
|
+
else {
|
|
67
|
+
prevNode = createCommon(gedcom, undefined, mainNode, curNode);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
prevNode.type = type;
|
|
71
|
+
return { prevNode, curNode, mainNode };
|
|
72
|
+
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { CommonDate } from "../classes/date";
|
|
2
|
+
import { type FamType } from "../classes/fam";
|
|
3
|
+
import { type IndiType } from "../classes/indi";
|
|
4
|
+
import type IDateStructure from "../structures/date";
|
|
5
|
+
import type { IndiKey } from "../types/types";
|
|
6
|
+
export declare const ACCEPTED_DATE_FORMATS: string[];
|
|
7
|
+
export declare const ACCEPTED_DATE_FORMATS_REGEX: RegExp;
|
|
8
|
+
export declare const commonDateFormatter: (date?: IDateStructure["DATE"], format?: string, prefix?: string) => string;
|
|
9
|
+
export declare const noteDateFormatter: (date?: IDateStructure["DATE"], format?: string, prefix?: string, shortNote?: boolean, showNote?: boolean) => string;
|
|
10
|
+
export declare const marriageDateFormatter: (fam?: FamType, showDays?: boolean, showPlaces?: boolean, shortNote?: boolean, showNote?: boolean, showDisplayTextIfNoDate?: boolean, showAllEvents?: boolean, dateFormatPattern?: string) => {
|
|
11
|
+
marriages?: string[];
|
|
12
|
+
marriagePlaces?: string[];
|
|
13
|
+
rawArray: CommonDate[];
|
|
14
|
+
inArray: string[];
|
|
15
|
+
inOrder: string;
|
|
16
|
+
places: string[];
|
|
17
|
+
marriage: string[];
|
|
18
|
+
};
|
|
19
|
+
export declare const dateFormatter: (indi?: IndiType, showMarriages?: boolean, showDays?: boolean, showPlaces?: boolean, shortNote?: boolean, showNote?: boolean, isOnStage?: (key: IndiKey) => boolean, showAllEvents?: boolean, dateFormatPattern?: string) => {
|
|
20
|
+
births?: string[];
|
|
21
|
+
birthPlaces?: string[];
|
|
22
|
+
deaths?: string[];
|
|
23
|
+
deathPlaces?: string[];
|
|
24
|
+
marriages?: string[];
|
|
25
|
+
marriagePlaces?: string[];
|
|
26
|
+
birthPlace?: string;
|
|
27
|
+
deathPlace?: string;
|
|
28
|
+
inArray: string[];
|
|
29
|
+
inOrder: string;
|
|
30
|
+
places: string[];
|
|
31
|
+
birth: string;
|
|
32
|
+
marriage: string[];
|
|
33
|
+
death: string;
|
|
34
|
+
};
|
|
35
|
+
//# sourceMappingURL=date-formatter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"date-formatter.d.ts","sourceRoot":"","sources":["../../src/utils/date-formatter.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,KAAK,cAAc,MAAM,oBAAoB,CAAC;AAErD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAI9C,eAAO,MAAM,qBAAqB,UAIjC,CAAC;AACF,eAAO,MAAM,2BAA2B,QAKvC,CAAC;AACF,eAAO,MAAM,mBAAmB,GAC/B,OAAO,cAAc,CAAC,MAAM,CAAC,EAC7B,eAAe,EACf,eAAW,WAQX,CAAC;AAEF,eAAO,MAAM,iBAAiB,GAC7B,OAAO,cAAc,CAAC,MAAM,CAAC,EAC7B,eAAe,EACf,eAAW,EACX,mBAAgB,EAChB,kBAAe,WAef,CAAC;AAEF,eAAO,MAAM,qBAAqB,GACjC,MAAM,OAAO,EACb,kBAAgB,EAChB,oBAAkB,EAClB,mBAAgB,EAChB,kBAAe,EACf,iCAA8B,EAC9B,uBAAqB,EACrB,oBAAoB,MAAM;;;;;;;;CA2F1B,CAAC;AAEF,eAAO,MAAM,aAAa,GACzB,OAAO,QAAQ,EACf,uBAAqB,EACrB,kBAAgB,EAChB,oBAAkB,EAClB,mBAAgB,EAChB,kBAAe,EACf,YAAY,CAAC,GAAG,EAAE,OAAO,KAAK,OAAO,EACrC,uBAAqB,EACrB,oBAAoB,MAAM;;;;;;;;;;;;;;;CAkK1B,CAAC"}
|
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
import { createCommonDate } from "../classes/date";
|
|
2
|
+
import { i18n } from "../factories/i18n-factory";
|
|
3
|
+
import { getAllProp } from "./get-all-prop";
|
|
4
|
+
export const ACCEPTED_DATE_FORMATS = [
|
|
5
|
+
"yyyy.MM.dd.",
|
|
6
|
+
"yyyy-MM-dd",
|
|
7
|
+
"MM/dd/yyyy",
|
|
8
|
+
];
|
|
9
|
+
export const ACCEPTED_DATE_FORMATS_REGEX = new RegExp(`(${ACCEPTED_DATE_FORMATS.map((acceptedFormat) => acceptedFormat.replace(/[^.\-/]/g, "\\d")).join("|")})`, "gi");
|
|
10
|
+
export const commonDateFormatter = (date, format = "yyyy", prefix = "") => {
|
|
11
|
+
const formattedDate = date?.toValue(format);
|
|
12
|
+
if (!formattedDate) {
|
|
13
|
+
return undefined;
|
|
14
|
+
}
|
|
15
|
+
return `${prefix}${formattedDate}`.trim();
|
|
16
|
+
};
|
|
17
|
+
export const noteDateFormatter = (date, format = "yyyy", prefix = "", shortNote = true, showNote = true) => {
|
|
18
|
+
const rawDate = commonDateFormatter(date, format, "");
|
|
19
|
+
if (!rawDate) {
|
|
20
|
+
return undefined;
|
|
21
|
+
}
|
|
22
|
+
const note = date?.toNote(shortNote) ?? "";
|
|
23
|
+
return `${prefix}${note && showNote
|
|
24
|
+
? i18n.t(`${note} {{date}}`, { date: rawDate })
|
|
25
|
+
: rawDate}`;
|
|
26
|
+
};
|
|
27
|
+
export const marriageDateFormatter = (fam, showDays = false, showPlaces = false, shortNote = true, showNote = true, showDisplayTextIfNoDate = true, showAllEvents = false, dateFormatPattern) => {
|
|
28
|
+
// Determine the format to use for full dates
|
|
29
|
+
const fullDateFormat = dateFormatPattern ?? i18n.t("dateFormat");
|
|
30
|
+
const marriageDates = [];
|
|
31
|
+
const marriagePlaces = [];
|
|
32
|
+
const marriages = (fam?.toValueList().values() ?? []).flatMap((fam) => {
|
|
33
|
+
const family = fam;
|
|
34
|
+
// Get all MARR events for this family
|
|
35
|
+
const marrEvents = (family?.MARR?.toList().values() ?? []).filter(Boolean);
|
|
36
|
+
if (marrEvents.length === 0) {
|
|
37
|
+
// Handle displayText for families without MARR events
|
|
38
|
+
const displayText = (family?.get("DISPLAYTEXT")?.toValue() ??
|
|
39
|
+
"");
|
|
40
|
+
if (showDisplayTextIfNoDate && displayText) {
|
|
41
|
+
const displayDate = displayText.match(ACCEPTED_DATE_FORMATS_REGEX)?.[0];
|
|
42
|
+
if (displayDate) {
|
|
43
|
+
marriagePlaces.push(displayText.replace(displayDate, ""));
|
|
44
|
+
const marriageDate = createCommonDate(fam?.getGedcom(), undefined, family);
|
|
45
|
+
marriageDate.value = displayDate;
|
|
46
|
+
marriageDates.push(marriageDate);
|
|
47
|
+
}
|
|
48
|
+
else {
|
|
49
|
+
marriagePlaces.push(displayText);
|
|
50
|
+
marriageDates.push(undefined);
|
|
51
|
+
return ["∞"];
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
return [];
|
|
55
|
+
}
|
|
56
|
+
// Process all MARR events
|
|
57
|
+
const eventsToProcess = showAllEvents
|
|
58
|
+
? marrEvents
|
|
59
|
+
: marrEvents.slice(0, 1);
|
|
60
|
+
return eventsToProcess.map((marrEvent) => {
|
|
61
|
+
const marriageEventDetail = marrEvent;
|
|
62
|
+
const marriageDate = marriageEventDetail?.DATE;
|
|
63
|
+
const marriagePlace = showPlaces
|
|
64
|
+
? marriageEventDetail?.PLAC?.value
|
|
65
|
+
: undefined;
|
|
66
|
+
marriagePlaces.push(marriagePlace);
|
|
67
|
+
marriageDates.push(marriageDate);
|
|
68
|
+
const formattedDate = noteDateFormatter(marriageDate, showDays ? fullDateFormat : "yyyy", "∞", shortNote, showNote);
|
|
69
|
+
return formattedDate ? formattedDate : undefined;
|
|
70
|
+
});
|
|
71
|
+
});
|
|
72
|
+
const marriageArray = marriages.length
|
|
73
|
+
? marriages.filter(Boolean)
|
|
74
|
+
: [];
|
|
75
|
+
const datesArray = marriageArray.filter(Boolean);
|
|
76
|
+
const placesArray = marriagePlaces.filter(Boolean);
|
|
77
|
+
const dates = datesArray.join(" ").trim();
|
|
78
|
+
return {
|
|
79
|
+
rawArray: marriageDates,
|
|
80
|
+
inArray: datesArray,
|
|
81
|
+
inOrder: dates,
|
|
82
|
+
places: placesArray,
|
|
83
|
+
marriage: marriageArray,
|
|
84
|
+
...(showPlaces
|
|
85
|
+
? {
|
|
86
|
+
marriages,
|
|
87
|
+
marriagePlaces,
|
|
88
|
+
}
|
|
89
|
+
: {}),
|
|
90
|
+
};
|
|
91
|
+
};
|
|
92
|
+
export const dateFormatter = (indi, showMarriages = false, showDays = false, showPlaces = false, shortNote = true, showNote = true, isOnStage, showAllEvents = false, dateFormatPattern) => {
|
|
93
|
+
// Determine the format to use for full dates
|
|
94
|
+
const fullDateFormat = dateFormatPattern ?? i18n.t("dateFormat");
|
|
95
|
+
// Get all birth events
|
|
96
|
+
const birthEvents = getAllProp(indi, "BIRT");
|
|
97
|
+
const firstBirthValue = birthEvents[0];
|
|
98
|
+
// Get all death events
|
|
99
|
+
const deathEvents = getAllProp(indi, "DEAT");
|
|
100
|
+
const firstDeathValue = deathEvents[0];
|
|
101
|
+
const birth = commonDateFormatter(firstBirthValue?.DATE, showDays ? fullDateFormat : "yyyy");
|
|
102
|
+
const birthPlace = showPlaces ? firstBirthValue?.PLAC?.value : undefined;
|
|
103
|
+
const death = commonDateFormatter(firstDeathValue?.DATE, showDays ? fullDateFormat : "yyyy");
|
|
104
|
+
const deathPlace = showPlaces ? firstDeathValue?.PLAC?.value : undefined;
|
|
105
|
+
const marriagePlaces = [];
|
|
106
|
+
const marriages = [];
|
|
107
|
+
if (showMarriages || isOnStage) {
|
|
108
|
+
(indi?.get("FAMS")?.toValueList().values() ?? []).forEach((fam) => {
|
|
109
|
+
const famRef = fam?.ref;
|
|
110
|
+
if (isOnStage && famRef) {
|
|
111
|
+
let partner;
|
|
112
|
+
if (famRef.HUSB && indi && famRef.HUSB.value === indi.id) {
|
|
113
|
+
partner = famRef.WIFE?.value;
|
|
114
|
+
}
|
|
115
|
+
else if (famRef.WIFE &&
|
|
116
|
+
indi &&
|
|
117
|
+
famRef.WIFE.value === indi.id) {
|
|
118
|
+
partner = famRef.HUSB?.value;
|
|
119
|
+
}
|
|
120
|
+
if (partner && isOnStage(partner)) {
|
|
121
|
+
return;
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
const marriageDates = marriageDateFormatter(famRef, showDays, showPlaces, shortNote, showNote, true, showAllEvents, dateFormatPattern);
|
|
125
|
+
marriages.push(...(marriageDates?.marriage ?? []));
|
|
126
|
+
marriagePlaces.push(...(marriageDates?.marriagePlaces ?? []));
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
// Process all birth events
|
|
130
|
+
const birthStrings = [];
|
|
131
|
+
const birthPlaces = [];
|
|
132
|
+
const eventsToProcess = showAllEvents
|
|
133
|
+
? birthEvents
|
|
134
|
+
: birthEvents.slice(0, 1);
|
|
135
|
+
eventsToProcess.forEach((birthEvent) => {
|
|
136
|
+
const birthDate = commonDateFormatter(birthEvent?.DATE, showDays ? fullDateFormat : "yyyy");
|
|
137
|
+
const birthEventNote = birthEvent?.DATE?.toNote(shortNote) ?? "";
|
|
138
|
+
const birthEventPlace = showPlaces
|
|
139
|
+
? birthEvent?.PLAC?.value
|
|
140
|
+
: undefined;
|
|
141
|
+
if (birthDate) {
|
|
142
|
+
birthStrings.push(`*${birthEventNote && showNote
|
|
143
|
+
? i18n.t(`${birthEventNote} {{date}}`, {
|
|
144
|
+
date: birthDate,
|
|
145
|
+
})
|
|
146
|
+
: birthDate}`);
|
|
147
|
+
}
|
|
148
|
+
birthPlaces.push(birthEventPlace);
|
|
149
|
+
});
|
|
150
|
+
// Process all death events
|
|
151
|
+
const deathStrings = [];
|
|
152
|
+
const deathPlaces = [];
|
|
153
|
+
const deathEventsToProcess = showAllEvents
|
|
154
|
+
? deathEvents
|
|
155
|
+
: deathEvents.slice(0, 1);
|
|
156
|
+
deathEventsToProcess.forEach((deathEvent) => {
|
|
157
|
+
const deathDate = commonDateFormatter(deathEvent?.DATE, showDays ? fullDateFormat : "yyyy");
|
|
158
|
+
const deathEventNote = deathEvent?.DATE?.toNote(shortNote) ?? "";
|
|
159
|
+
const deathEventPlace = showPlaces
|
|
160
|
+
? deathEvent?.PLAC?.value
|
|
161
|
+
: undefined;
|
|
162
|
+
if (deathDate) {
|
|
163
|
+
deathStrings.push(`†${deathEventNote && showNote
|
|
164
|
+
? i18n.t(`${deathEventNote} {{date}}`, {
|
|
165
|
+
date: deathDate,
|
|
166
|
+
})
|
|
167
|
+
: deathDate}`);
|
|
168
|
+
}
|
|
169
|
+
deathPlaces.push(deathEventPlace);
|
|
170
|
+
});
|
|
171
|
+
const birthString = birthStrings[0] ?? "";
|
|
172
|
+
const deathString = deathStrings[0] ?? "";
|
|
173
|
+
const marriageArray = marriages.length
|
|
174
|
+
? marriages.filter(Boolean)
|
|
175
|
+
: [];
|
|
176
|
+
const datesArray = !birth && !death
|
|
177
|
+
? marriageArray
|
|
178
|
+
: [...birthStrings, ...marriageArray, ...deathStrings];
|
|
179
|
+
const placesArray = !birth && !death
|
|
180
|
+
? marriagePlaces
|
|
181
|
+
: [...birthPlaces, ...marriagePlaces, ...deathPlaces];
|
|
182
|
+
const nonNullDatesArray = datesArray.filter(Boolean);
|
|
183
|
+
const dates = nonNullDatesArray.join(" ").trim();
|
|
184
|
+
return {
|
|
185
|
+
inArray: nonNullDatesArray,
|
|
186
|
+
inOrder: dates,
|
|
187
|
+
places: placesArray,
|
|
188
|
+
birth: birthString,
|
|
189
|
+
marriage: marriageArray,
|
|
190
|
+
death: deathString,
|
|
191
|
+
...(showPlaces
|
|
192
|
+
? {
|
|
193
|
+
birthPlace,
|
|
194
|
+
deathPlace,
|
|
195
|
+
...(showMarriages ? { marriages, marriagePlaces } : {}),
|
|
196
|
+
}
|
|
197
|
+
: {}),
|
|
198
|
+
...(showAllEvents
|
|
199
|
+
? {
|
|
200
|
+
births: birthStrings,
|
|
201
|
+
birthPlaces,
|
|
202
|
+
deaths: deathStrings,
|
|
203
|
+
deathPlaces,
|
|
204
|
+
}
|
|
205
|
+
: {}),
|
|
206
|
+
};
|
|
207
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-all-prop.d.ts","sourceRoot":"","sources":["../../src/utils/get-all-prop.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAE/C,eAAO,MAAM,UAAU,GAAI,CAAC,EAAE,OAAO,QAAQ,EAAE,OAAO,QAAQ,KAGrD,CAAC,EACT,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { type FamType } from "../classes/fam";
|
|
2
|
+
import { type IndiType } from "../classes/indi";
|
|
3
|
+
import { type IndiKey } from "../types/types";
|
|
4
|
+
export declare const getFamilyWith: (person1: IndiType, person2?: IndiKey, famType?: "FAMS" | "FAMC") => FamType | undefined;
|
|
5
|
+
//# sourceMappingURL=get-family-with.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-family-with.d.ts","sourceRoot":"","sources":["../../src/utils/get-family-with.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAE9C,eAAO,MAAM,aAAa,GACzB,SAAS,QAAQ,EACjB,UAAU,OAAO,EACjB,UAAS,MAAM,GAAG,MAAe,KAY1B,OAAO,GAAG,SACjB,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export const getFamilyWith = (person1, person2, famType = "FAMS") => {
|
|
2
|
+
return person1
|
|
3
|
+
?.get(famType)
|
|
4
|
+
?.toValueList()
|
|
5
|
+
.find((fam) => {
|
|
6
|
+
const family = fam;
|
|
7
|
+
return (famType === "FAMC" ||
|
|
8
|
+
family?.HUSB?.value === person2 ||
|
|
9
|
+
family?.WIFE?.value === person2);
|
|
10
|
+
});
|
|
11
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { Common } from "../classes/common";
|
|
2
|
+
import { List } from "../classes/list";
|
|
3
|
+
import type { Tag } from "../types/types";
|
|
4
|
+
export interface Place {
|
|
5
|
+
key: string;
|
|
6
|
+
index: number;
|
|
7
|
+
obj?: Common;
|
|
8
|
+
ref?: Common;
|
|
9
|
+
place?: string;
|
|
10
|
+
}
|
|
11
|
+
export declare enum PlaceType {
|
|
12
|
+
All = "ALL",
|
|
13
|
+
Birth = "BIRT",
|
|
14
|
+
Marriage = "MARR",
|
|
15
|
+
Death = "DEAT",
|
|
16
|
+
Events = "EVEN",
|
|
17
|
+
Military = "_MILT",
|
|
18
|
+
MilitaryId = "_MILTID"
|
|
19
|
+
}
|
|
20
|
+
export declare const getPlaces: (common: Common | List, type?: PlaceType | Tag | Array<PlaceType | Tag>, maxLevel?: number, level?: number, mainKey?: string) => Place[];
|
|
21
|
+
//# sourceMappingURL=get-places.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-places.d.ts","sourceRoot":"","sources":["../../src/utils/get-places.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AACvC,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAC;AAE1C,MAAM,WAAW,KAAK;IACrB,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;CACf;AAED,oBAAY,SAAS;IACpB,GAAG,QAAQ;IACX,KAAK,SAAS;IACd,QAAQ,SAAS;IACjB,KAAK,SAAS;IACd,MAAM,SAAS;IACf,QAAQ,UAAU;IAClB,UAAU,YAAY;CACtB;AAED,eAAO,MAAM,SAAS,GACrB,QAAQ,MAAM,GAAG,IAAI,EACrB,OAAM,SAAS,GAAG,GAAG,GAAG,KAAK,CAAC,SAAS,GAAG,GAAG,CAAmB,EAChE,iBAAY,EACZ,cAAS,EACT,UAAU,MAAM,YA+EhB,CAAC"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { List } from "../classes/list";
|
|
2
|
+
export var PlaceType;
|
|
3
|
+
(function (PlaceType) {
|
|
4
|
+
PlaceType["All"] = "ALL";
|
|
5
|
+
PlaceType["Birth"] = "BIRT";
|
|
6
|
+
PlaceType["Marriage"] = "MARR";
|
|
7
|
+
PlaceType["Death"] = "DEAT";
|
|
8
|
+
PlaceType["Events"] = "EVEN";
|
|
9
|
+
PlaceType["Military"] = "_MILT";
|
|
10
|
+
PlaceType["MilitaryId"] = "_MILTID";
|
|
11
|
+
})(PlaceType || (PlaceType = {}));
|
|
12
|
+
export const getPlaces = (common, type = [PlaceType.All], maxLevel = 1, level = 0, mainKey) => {
|
|
13
|
+
const types = Array.isArray(type) ? type : [type];
|
|
14
|
+
const places = [];
|
|
15
|
+
if (!common?.toList || level > maxLevel) {
|
|
16
|
+
return places;
|
|
17
|
+
}
|
|
18
|
+
const commonList = common.toList();
|
|
19
|
+
commonList.forEach((item, _, index) => {
|
|
20
|
+
Object.entries(item).forEach(([key, value]) => {
|
|
21
|
+
if (!/^[_A-Z0-9]+$/.test(key)) {
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
if (level === 0 &&
|
|
25
|
+
!types.includes(PlaceType.All) &&
|
|
26
|
+
((!types.includes(key) &&
|
|
27
|
+
[
|
|
28
|
+
PlaceType.Birth,
|
|
29
|
+
PlaceType.Marriage,
|
|
30
|
+
PlaceType.Death,
|
|
31
|
+
].includes(key)) ||
|
|
32
|
+
(!types.includes(PlaceType.Events) &&
|
|
33
|
+
![
|
|
34
|
+
PlaceType.Birth,
|
|
35
|
+
PlaceType.Marriage,
|
|
36
|
+
PlaceType.Death,
|
|
37
|
+
PlaceType.Military,
|
|
38
|
+
PlaceType.MilitaryId,
|
|
39
|
+
].includes(key)) ||
|
|
40
|
+
(!types.includes(PlaceType.Military) &&
|
|
41
|
+
!types.includes(PlaceType.MilitaryId) &&
|
|
42
|
+
![
|
|
43
|
+
PlaceType.Birth,
|
|
44
|
+
PlaceType.Marriage,
|
|
45
|
+
PlaceType.Death,
|
|
46
|
+
PlaceType.Events,
|
|
47
|
+
].includes(key)))) {
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
if (key === "PLAC") {
|
|
51
|
+
value.toList().forEach((place) => {
|
|
52
|
+
places.push({
|
|
53
|
+
index,
|
|
54
|
+
place: place.toValue(),
|
|
55
|
+
obj: place,
|
|
56
|
+
key: mainKey || key,
|
|
57
|
+
});
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
else {
|
|
61
|
+
getPlaces(value, types, maxLevel, level + 1, mainKey || key).forEach((place) => {
|
|
62
|
+
const usedValue = value instanceof List
|
|
63
|
+
? value.index(place.index)
|
|
64
|
+
: value;
|
|
65
|
+
places.push({
|
|
66
|
+
place: place.place,
|
|
67
|
+
obj: usedValue,
|
|
68
|
+
ref: place.obj,
|
|
69
|
+
index: place.index,
|
|
70
|
+
key: place.key,
|
|
71
|
+
});
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
});
|
|
76
|
+
return places;
|
|
77
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-product-details.d.ts","sourceRoot":"","sources":["../../src/utils/get-product-details.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,aAAa,eAEzB,CAAC;AAEF,eAAO,MAAM,UAAU,cAAoB,CAAC;AAE5C,eAAO,MAAM,OAAO,cAAiB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-raw-size.d.ts","sourceRoot":"","sources":["../../src/utils/get-raw-size.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,UAAU,GAAI,MAAM,MAAM,WAEtC,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export * from "./cache";
|
|
2
|
+
export * from "./common-creator";
|
|
3
|
+
export * from "./date-formatter";
|
|
4
|
+
export * from "./get-all-prop";
|
|
5
|
+
export * from "./get-family-with";
|
|
6
|
+
export * from "./get-places";
|
|
7
|
+
export * from "./get-product-details";
|
|
8
|
+
export { getRawSize } from "./get-raw-size";
|
|
9
|
+
export * from "./logger";
|
|
10
|
+
export * from "./name-formatter";
|
|
11
|
+
export * from "./nested-group";
|
|
12
|
+
export * from "./ordinalize";
|
|
13
|
+
export { default as GedcomTree } from "./parser";
|
|
14
|
+
export * from "./place-parser";
|
|
15
|
+
export * from "./place-translator";
|
|
16
|
+
export * from "./range";
|
|
17
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AACA,cAAc,SAAS,CAAC;AACxB,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC;AACjC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,mBAAmB,CAAC;AAClC,cAAc,cAAc,CAAC;AAC7B,cAAc,uBAAuB,CAAC;AACtC,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC5C,cAAc,UAAU,CAAC;AACzB,cAAc,kBAAkB,CAAC;AACjC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,cAAc,CAAC;AAC7B,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,UAAU,CAAC;AACjD,cAAc,gBAAgB,CAAC;AAC/B,cAAc,oBAAoB,CAAC;AAEnC,cAAc,SAAS,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
// Utils exports - barrel file for easier imports
|
|
2
|
+
export * from "./cache";
|
|
3
|
+
export * from "./common-creator";
|
|
4
|
+
export * from "./date-formatter";
|
|
5
|
+
export * from "./get-all-prop";
|
|
6
|
+
export * from "./get-family-with";
|
|
7
|
+
export * from "./get-places";
|
|
8
|
+
export * from "./get-product-details";
|
|
9
|
+
export { getRawSize } from "./get-raw-size";
|
|
10
|
+
export * from "./logger";
|
|
11
|
+
export * from "./name-formatter";
|
|
12
|
+
export * from "./nested-group";
|
|
13
|
+
export * from "./ordinalize";
|
|
14
|
+
export { default as GedcomTree } from "./parser";
|
|
15
|
+
export * from "./place-parser";
|
|
16
|
+
export * from "./place-translator";
|
|
17
|
+
// Note: place-types is already exported by get-places
|
|
18
|
+
export * from "./range";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../src/utils/logger.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,WAAW,GAAI,MAAM,MAAM,EAAE,GAAG,MAAM,GAAG,EAAE,SAEvD,CAAC;AAEF,eAAO,MAAM,cAAc,GAAI,MAAM,MAAM,EAAE,GAAG,MAAM,GAAG,EAAE,SAG1D,CAAC"}
|