@treeviz/gedcom-parser 1.0.13 → 1.0.15
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 +2 -28
- package/dist/classes/index.js +6713 -21
- package/dist/classes/index.js.map +1 -0
- package/dist/cli/index.d.ts +0 -2
- package/dist/cli/index.js +7826 -24
- package/dist/cli/index.js.map +1 -0
- package/dist/constants/index.d.ts +49 -4
- package/dist/constants/index.js +5797 -4
- package/dist/constants/index.js.map +1 -0
- package/dist/factories/index.d.ts +202 -13
- package/dist/factories/index.js +5782 -8
- package/dist/factories/index.js.map +1 -0
- package/dist/index-BvW-KWJP.d.ts +1654 -0
- package/dist/index.d.ts +9 -28
- package/dist/index.js +7380 -35
- package/dist/index.js.map +1 -0
- package/dist/interfaces/index.d.ts +2 -12
- package/dist/interfaces/index.js +3 -1
- package/dist/interfaces/index.js.map +1 -0
- package/dist/kinship-translator/index.d.ts +146 -11
- package/dist/kinship-translator/index.js +5727 -9
- package/dist/kinship-translator/index.js.map +1 -0
- package/dist/place-parser-RlXCXZ8F.d.ts +37 -0
- package/dist/structures/index.d.ts +25 -27
- package/dist/structures/index.js +3 -1
- package/dist/structures/index.js.map +1 -0
- package/dist/types/index.d.ts +69 -8
- package/dist/types/index.js +31 -6
- package/dist/types/index.js.map +1 -0
- package/dist/utils/index.d.ts +91 -18
- package/dist/utils/index.js +6953 -17
- package/dist/utils/index.js.map +1 -0
- package/package.json +4 -3
- package/dist/classes/common.d.ts +0 -91
- package/dist/classes/common.d.ts.map +0 -1
- package/dist/classes/common.js +0 -488
- package/dist/classes/date.d.ts +0 -27
- package/dist/classes/date.d.ts.map +0 -1
- package/dist/classes/date.js +0 -178
- package/dist/classes/fam.d.ts +0 -19
- package/dist/classes/fam.d.ts.map +0 -1
- package/dist/classes/fam.js +0 -38
- package/dist/classes/fams.d.ts +0 -16
- package/dist/classes/fams.d.ts.map +0 -1
- package/dist/classes/fams.js +0 -41
- package/dist/classes/gedcom.d.ts +0 -139
- package/dist/classes/gedcom.d.ts.map +0 -1
- package/dist/classes/gedcom.js +0 -910
- package/dist/classes/index.d.ts.map +0 -1
- package/dist/classes/indi.d.ts +0 -323
- package/dist/classes/indi.d.ts.map +0 -1
- package/dist/classes/indi.js +0 -2131
- package/dist/classes/indis.d.ts +0 -55
- package/dist/classes/indis.d.ts.map +0 -1
- package/dist/classes/indis.js +0 -457
- package/dist/classes/list.d.ts +0 -55
- package/dist/classes/list.d.ts.map +0 -1
- package/dist/classes/list.js +0 -440
- package/dist/classes/name.d.ts +0 -20
- package/dist/classes/name.d.ts.map +0 -1
- package/dist/classes/name.js +0 -48
- package/dist/classes/note.d.ts +0 -12
- package/dist/classes/note.d.ts.map +0 -1
- package/dist/classes/note.js +0 -46
- package/dist/classes/obje.d.ts +0 -12
- package/dist/classes/obje.d.ts.map +0 -1
- package/dist/classes/obje.js +0 -81
- package/dist/classes/objes.d.ts +0 -8
- package/dist/classes/objes.d.ts.map +0 -1
- package/dist/classes/objes.js +0 -13
- package/dist/classes/repo.d.ts +0 -11
- package/dist/classes/repo.d.ts.map +0 -1
- package/dist/classes/repo.js +0 -6
- package/dist/classes/repos.d.ts +0 -8
- package/dist/classes/repos.d.ts.map +0 -1
- package/dist/classes/repos.js +0 -13
- package/dist/classes/sour.d.ts +0 -11
- package/dist/classes/sour.d.ts.map +0 -1
- package/dist/classes/sour.js +0 -6
- package/dist/classes/sours.d.ts +0 -8
- package/dist/classes/sours.d.ts.map +0 -1
- package/dist/classes/sours.js +0 -13
- package/dist/classes/subm.d.ts +0 -10
- package/dist/classes/subm.d.ts.map +0 -1
- package/dist/classes/subm.js +0 -6
- package/dist/classes/subms.d.ts +0 -8
- package/dist/classes/subms.d.ts.map +0 -1
- package/dist/classes/subms.js +0 -13
- package/dist/cli/commands/convert.d.ts +0 -3
- package/dist/cli/commands/convert.d.ts.map +0 -1
- package/dist/cli/commands/convert.js +0 -83
- package/dist/cli/commands/extract.d.ts +0 -3
- package/dist/cli/commands/extract.d.ts.map +0 -1
- package/dist/cli/commands/extract.js +0 -85
- package/dist/cli/commands/find.d.ts +0 -3
- package/dist/cli/commands/find.d.ts.map +0 -1
- package/dist/cli/commands/find.js +0 -97
- package/dist/cli/commands/info.d.ts +0 -3
- package/dist/cli/commands/info.d.ts.map +0 -1
- package/dist/cli/commands/info.js +0 -80
- package/dist/cli/commands/merge.d.ts +0 -3
- package/dist/cli/commands/merge.d.ts.map +0 -1
- package/dist/cli/commands/merge.js +0 -61
- package/dist/cli/commands/relatives.d.ts +0 -3
- package/dist/cli/commands/relatives.d.ts.map +0 -1
- package/dist/cli/commands/relatives.js +0 -107
- package/dist/cli/commands/show.d.ts +0 -3
- package/dist/cli/commands/show.d.ts.map +0 -1
- package/dist/cli/commands/show.js +0 -176
- package/dist/cli/commands/stats.d.ts +0 -3
- package/dist/cli/commands/stats.d.ts.map +0 -1
- package/dist/cli/commands/stats.js +0 -59
- package/dist/cli/commands/validate.d.ts +0 -3
- package/dist/cli/commands/validate.d.ts.map +0 -1
- package/dist/cli/commands/validate.js +0 -148
- package/dist/cli/index.d.ts.map +0 -1
- package/dist/cli/utils/formatters.d.ts +0 -69
- package/dist/cli/utils/formatters.d.ts.map +0 -1
- package/dist/cli/utils/formatters.js +0 -125
- package/dist/cli/utils/helpers.d.ts +0 -21
- package/dist/cli/utils/helpers.d.ts.map +0 -1
- package/dist/cli/utils/helpers.js +0 -58
- package/dist/constants/constants.d.ts +0 -14
- package/dist/constants/constants.d.ts.map +0 -1
- package/dist/constants/constants.js +0 -13
- package/dist/constants/filters.d.ts +0 -18
- package/dist/constants/filters.d.ts.map +0 -1
- package/dist/constants/filters.js +0 -44
- package/dist/constants/index.d.ts.map +0 -1
- package/dist/constants/orders.d.ts +0 -17
- package/dist/constants/orders.d.ts.map +0 -1
- package/dist/constants/orders.js +0 -240
- package/dist/factories/cache-factory.d.ts +0 -30
- package/dist/factories/cache-factory.d.ts.map +0 -1
- package/dist/factories/cache-factory.js +0 -43
- package/dist/factories/date-locale-factory.d.ts +0 -30
- package/dist/factories/date-locale-factory.d.ts.map +0 -1
- package/dist/factories/date-locale-factory.js +0 -34
- package/dist/factories/i18n-factory.d.ts +0 -40
- package/dist/factories/i18n-factory.d.ts.map +0 -1
- package/dist/factories/i18n-factory.js +0 -44
- package/dist/factories/index.d.ts.map +0 -1
- package/dist/factories/kinship-factory.d.ts +0 -38
- package/dist/factories/kinship-factory.d.ts.map +0 -1
- package/dist/factories/kinship-factory.js +0 -35
- package/dist/factories/place-parser-provider.d.ts +0 -32
- package/dist/factories/place-parser-provider.d.ts.map +0 -1
- package/dist/factories/place-parser-provider.js +0 -35
- package/dist/factories/place-translator-provider.d.ts +0 -32
- package/dist/factories/place-translator-provider.d.ts.map +0 -1
- package/dist/factories/place-translator-provider.js +0 -35
- package/dist/index.d.ts.map +0 -1
- package/dist/interfaces/common.d.ts +0 -43
- package/dist/interfaces/common.d.ts.map +0 -1
- package/dist/interfaces/common.js +0 -1
- package/dist/interfaces/fam.d.ts +0 -11
- package/dist/interfaces/fam.d.ts.map +0 -1
- package/dist/interfaces/fam.js +0 -1
- package/dist/interfaces/fams.d.ts +0 -9
- package/dist/interfaces/fams.d.ts.map +0 -1
- package/dist/interfaces/fams.js +0 -1
- package/dist/interfaces/gedcom.d.ts +0 -30
- package/dist/interfaces/gedcom.d.ts.map +0 -1
- package/dist/interfaces/gedcom.js +0 -1
- package/dist/interfaces/index.d.ts.map +0 -1
- package/dist/interfaces/indi.d.ts +0 -113
- package/dist/interfaces/indi.d.ts.map +0 -1
- package/dist/interfaces/indi.js +0 -1
- package/dist/interfaces/indis.d.ts +0 -31
- package/dist/interfaces/indis.d.ts.map +0 -1
- package/dist/interfaces/indis.js +0 -1
- package/dist/interfaces/list.d.ts +0 -52
- package/dist/interfaces/list.d.ts.map +0 -1
- package/dist/interfaces/list.js +0 -1
- package/dist/interfaces/obje.d.ts +0 -7
- package/dist/interfaces/obje.d.ts.map +0 -1
- package/dist/interfaces/obje.js +0 -1
- package/dist/interfaces/repo.d.ts +0 -7
- package/dist/interfaces/repo.d.ts.map +0 -1
- package/dist/interfaces/repo.js +0 -1
- package/dist/interfaces/sour.d.ts +0 -7
- package/dist/interfaces/sour.d.ts.map +0 -1
- package/dist/interfaces/sour.js +0 -1
- package/dist/interfaces/subm.d.ts +0 -6
- package/dist/interfaces/subm.d.ts.map +0 -1
- package/dist/interfaces/subm.js +0 -1
- package/dist/kinship-translator/index.d.ts.map +0 -1
- package/dist/kinship-translator/kinship-translator.basic.d.ts +0 -30
- package/dist/kinship-translator/kinship-translator.basic.d.ts.map +0 -1
- package/dist/kinship-translator/kinship-translator.basic.js +0 -74
- package/dist/kinship-translator/kinship-translator.d.ts +0 -26
- package/dist/kinship-translator/kinship-translator.d.ts.map +0 -1
- package/dist/kinship-translator/kinship-translator.de.d.ts +0 -18
- package/dist/kinship-translator/kinship-translator.de.d.ts.map +0 -1
- package/dist/kinship-translator/kinship-translator.de.js +0 -180
- package/dist/kinship-translator/kinship-translator.en.d.ts +0 -18
- package/dist/kinship-translator/kinship-translator.en.d.ts.map +0 -1
- package/dist/kinship-translator/kinship-translator.en.js +0 -182
- package/dist/kinship-translator/kinship-translator.es.d.ts +0 -18
- package/dist/kinship-translator/kinship-translator.es.d.ts.map +0 -1
- package/dist/kinship-translator/kinship-translator.es.js +0 -181
- package/dist/kinship-translator/kinship-translator.fr.d.ts +0 -18
- package/dist/kinship-translator/kinship-translator.fr.d.ts.map +0 -1
- package/dist/kinship-translator/kinship-translator.fr.js +0 -181
- package/dist/kinship-translator/kinship-translator.hu.d.ts +0 -19
- package/dist/kinship-translator/kinship-translator.hu.d.ts.map +0 -1
- package/dist/kinship-translator/kinship-translator.hu.js +0 -226
- package/dist/kinship-translator/kinship-translator.interface.d.ts +0 -19
- package/dist/kinship-translator/kinship-translator.interface.d.ts.map +0 -1
- package/dist/kinship-translator/kinship-translator.interface.js +0 -1
- package/dist/kinship-translator/kinship-translator.js +0 -103
- package/dist/kinship-translator/patterns.de.d.ts +0 -2
- package/dist/kinship-translator/patterns.de.d.ts.map +0 -1
- package/dist/kinship-translator/patterns.de.js +0 -14
- package/dist/kinship-translator/patterns.en.d.ts +0 -2
- package/dist/kinship-translator/patterns.en.d.ts.map +0 -1
- package/dist/kinship-translator/patterns.en.js +0 -14
- package/dist/kinship-translator/patterns.es.d.ts +0 -2
- package/dist/kinship-translator/patterns.es.d.ts.map +0 -1
- package/dist/kinship-translator/patterns.es.js +0 -14
- package/dist/kinship-translator/patterns.fr.d.ts +0 -2
- package/dist/kinship-translator/patterns.fr.d.ts.map +0 -1
- package/dist/kinship-translator/patterns.fr.js +0 -14
- package/dist/kinship-translator/patterns.hu.d.ts +0 -6
- package/dist/kinship-translator/patterns.hu.d.ts.map +0 -1
- package/dist/kinship-translator/patterns.hu.js +0 -97
- package/dist/kinship-translator/translators.d.ts +0 -6
- package/dist/kinship-translator/translators.d.ts.map +0 -1
- package/dist/kinship-translator/translators.js +0 -5
- package/dist/kinship-translator/types.d.ts +0 -9
- package/dist/kinship-translator/types.d.ts.map +0 -1
- package/dist/kinship-translator/types.js +0 -1
- package/dist/structures/address.d.ts +0 -14
- package/dist/structures/address.d.ts.map +0 -1
- package/dist/structures/address.js +0 -1
- package/dist/structures/association.d.ts +0 -13
- package/dist/structures/association.d.ts.map +0 -1
- package/dist/structures/association.js +0 -1
- package/dist/structures/change-date.d.ts +0 -8
- package/dist/structures/change-date.d.ts.map +0 -1
- package/dist/structures/change-date.js +0 -1
- package/dist/structures/creation-date.d.ts +0 -7
- package/dist/structures/creation-date.d.ts.map +0 -1
- package/dist/structures/creation-date.js +0 -1
- package/dist/structures/date.d.ts +0 -9
- package/dist/structures/date.d.ts.map +0 -1
- package/dist/structures/date.js +0 -1
- package/dist/structures/event-detail-structure.d.ts +0 -25
- package/dist/structures/event-detail-structure.d.ts.map +0 -1
- package/dist/structures/event-detail-structure.js +0 -1
- package/dist/structures/family.d.ts +0 -34
- package/dist/structures/family.d.ts.map +0 -1
- package/dist/structures/family.js +0 -1
- package/dist/structures/gedcom.d.ts +0 -59
- package/dist/structures/gedcom.d.ts.map +0 -1
- package/dist/structures/gedcom.js +0 -1
- package/dist/structures/index.d.ts.map +0 -1
- package/dist/structures/individual-event-detail-structure.d.ts +0 -9
- package/dist/structures/individual-event-detail-structure.d.ts.map +0 -1
- package/dist/structures/individual-event-detail-structure.js +0 -1
- package/dist/structures/individual-event-structure.d.ts +0 -83
- package/dist/structures/individual-event-structure.d.ts.map +0 -1
- package/dist/structures/individual-event-structure.js +0 -1
- package/dist/structures/individual.d.ts +0 -40
- package/dist/structures/individual.d.ts.map +0 -1
- package/dist/structures/individual.js +0 -1
- package/dist/structures/lds-ordinance-detail.d.ts +0 -17
- package/dist/structures/lds-ordinance-detail.d.ts.map +0 -1
- package/dist/structures/lds-ordinance-detail.js +0 -1
- package/dist/structures/lds-spouse-sealing.d.ts +0 -7
- package/dist/structures/lds-spouse-sealing.d.ts.map +0 -1
- package/dist/structures/lds-spouse-sealing.js +0 -1
- package/dist/structures/marriage-date.d.ts +0 -11
- package/dist/structures/marriage-date.d.ts.map +0 -1
- package/dist/structures/marriage-date.js +0 -1
- package/dist/structures/multimedia-link.d.ts +0 -16
- package/dist/structures/multimedia-link.d.ts.map +0 -1
- package/dist/structures/multimedia-link.js +0 -1
- package/dist/structures/non-event.d.ts +0 -12
- package/dist/structures/non-event.d.ts.map +0 -1
- package/dist/structures/non-event.js +0 -1
- package/dist/structures/note.d.ts +0 -16
- package/dist/structures/note.d.ts.map +0 -1
- package/dist/structures/note.js +0 -1
- package/dist/structures/personal-name-pieces.d.ts +0 -11
- package/dist/structures/personal-name-pieces.d.ts.map +0 -1
- package/dist/structures/personal-name-pieces.js +0 -1
- package/dist/structures/personal-name.d.ts +0 -16
- package/dist/structures/personal-name.d.ts.map +0 -1
- package/dist/structures/personal-name.js +0 -1
- package/dist/structures/place.d.ts +0 -20
- package/dist/structures/place.d.ts.map +0 -1
- package/dist/structures/place.js +0 -1
- package/dist/structures/repository.d.ts +0 -6
- package/dist/structures/repository.d.ts.map +0 -1
- package/dist/structures/repository.js +0 -1
- package/dist/structures/source-citation.d.ts +0 -27
- package/dist/structures/source-citation.d.ts.map +0 -1
- package/dist/structures/source-citation.js +0 -1
- package/dist/structures/source-repository-citation.d.ts +0 -13
- package/dist/structures/source-repository-citation.d.ts.map +0 -1
- package/dist/structures/source-repository-citation.js +0 -1
- package/dist/structures/source.d.ts +0 -28
- package/dist/structures/source.d.ts.map +0 -1
- package/dist/structures/source.js +0 -1
- package/dist/types/ancestry-media.d.ts +0 -65
- package/dist/types/ancestry-media.d.ts.map +0 -1
- package/dist/types/ancestry-media.js +0 -1
- package/dist/types/index.d.ts.map +0 -1
- package/dist/types/settings.d.ts +0 -12
- package/dist/types/settings.d.ts.map +0 -1
- package/dist/types/settings.js +0 -1
- package/dist/types/types.d.ts +0 -225
- package/dist/types/types.d.ts.map +0 -1
- package/dist/types/types.js +0 -26
- package/dist/utils/cache.d.ts +0 -22
- package/dist/utils/cache.d.ts.map +0 -1
- package/dist/utils/cache.js +0 -57
- package/dist/utils/common-creator.d.ts +0 -13
- package/dist/utils/common-creator.d.ts.map +0 -1
- package/dist/utils/common-creator.js +0 -72
- package/dist/utils/date-formatter.d.ts +0 -35
- package/dist/utils/date-formatter.d.ts.map +0 -1
- package/dist/utils/date-formatter.js +0 -207
- package/dist/utils/get-all-prop.d.ts +0 -4
- package/dist/utils/get-all-prop.d.ts.map +0 -1
- package/dist/utils/get-all-prop.js +0 -5
- package/dist/utils/get-family-with.d.ts +0 -5
- package/dist/utils/get-family-with.d.ts.map +0 -1
- package/dist/utils/get-family-with.js +0 -11
- package/dist/utils/get-places.d.ts +0 -21
- package/dist/utils/get-places.d.ts.map +0 -1
- package/dist/utils/get-places.js +0 -77
- package/dist/utils/get-product-details.d.ts +0 -4
- package/dist/utils/get-product-details.d.ts.map +0 -1
- package/dist/utils/get-product-details.js +0 -6
- package/dist/utils/get-raw-size.d.ts +0 -2
- package/dist/utils/get-raw-size.d.ts.map +0 -1
- package/dist/utils/get-raw-size.js +0 -3
- package/dist/utils/index.d.ts.map +0 -1
- package/dist/utils/logger.d.ts +0 -3
- package/dist/utils/logger.d.ts.map +0 -1
- package/dist/utils/logger.js +0 -11
- package/dist/utils/name-formatter.d.ts +0 -10
- package/dist/utils/name-formatter.d.ts.map +0 -1
- package/dist/utils/name-formatter.js +0 -45
- package/dist/utils/nested-group.d.ts +0 -4
- package/dist/utils/nested-group.d.ts.map +0 -1
- package/dist/utils/nested-group.js +0 -34
- package/dist/utils/ordinalize.d.ts +0 -3
- package/dist/utils/ordinalize.d.ts.map +0 -1
- package/dist/utils/ordinalize.js +0 -104
- package/dist/utils/parser.d.ts +0 -17
- package/dist/utils/parser.d.ts.map +0 -1
- package/dist/utils/parser.js +0 -321
- package/dist/utils/place-parser.d.ts +0 -16
- package/dist/utils/place-parser.d.ts.map +0 -1
- package/dist/utils/place-parser.js +0 -46
- package/dist/utils/place-translator.d.ts +0 -6
- package/dist/utils/place-translator.d.ts.map +0 -1
- package/dist/utils/place-translator.js +0 -8
- package/dist/utils/place-types.d.ts +0 -27
- package/dist/utils/place-types.d.ts.map +0 -1
- package/dist/utils/place-types.js +0 -14
- package/dist/utils/range.d.ts +0 -19
- package/dist/utils/range.d.ts.map +0 -1
- package/dist/utils/range.js +0 -265
package/dist/classes/objes.js
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { List } from "./list.js";
|
|
2
|
-
export class Objects extends List {
|
|
3
|
-
copy() {
|
|
4
|
-
const newList = new Objects();
|
|
5
|
-
this.entries().forEach(([key, value]) => {
|
|
6
|
-
newList.item(key, value);
|
|
7
|
-
});
|
|
8
|
-
return newList;
|
|
9
|
-
}
|
|
10
|
-
except(item) {
|
|
11
|
-
return this.copy().delete(item);
|
|
12
|
-
}
|
|
13
|
-
}
|
package/dist/classes/repo.d.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type IRepo from "../interfaces/repo";
|
|
2
|
-
import type IRepositoryStructure from "../structures/repository";
|
|
3
|
-
import type { RepoKey } from "../types/types";
|
|
4
|
-
import { Common } from "./common";
|
|
5
|
-
import type { ProxyOriginal } from "./common";
|
|
6
|
-
import type { GedComType } from "./gedcom";
|
|
7
|
-
export declare class Repo extends Common<string, RepoKey> implements IRepo {
|
|
8
|
-
}
|
|
9
|
-
export type RepoType = Repo & IRepositoryStructure;
|
|
10
|
-
export declare const createRepo: (gedcom: GedComType, id?: RepoKey, main?: Common, parent?: Common) => ProxyOriginal<RepoType>;
|
|
11
|
-
//# sourceMappingURL=repo.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"repo.d.ts","sourceRoot":"","sources":["../../src/classes/repo.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,oBAAoB,CAAC;AAC5C,OAAO,KAAK,oBAAoB,MAAM,0BAA0B,CAAC;AACjE,OAAO,KAAK,EAAC,OAAO,EAAC,MAAM,gBAAgB,CAAC;AAE5C,OAAO,EAAE,MAAM,EAAe,MAAM,UAAU,CAAC;AAC/C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAC9C,OAAO,KAAK,EAAC,UAAU,EAAC,MAAM,UAAU,CAAC;AAEzC,qBAAa,IAAK,SAAQ,MAAM,CAAC,MAAM,EAAE,OAAO,CAAE,YAAW,KAAK;CAAG;AAErE,MAAM,MAAM,QAAQ,GAAG,IAAI,GAAG,oBAAoB,CAAC;AACnD,eAAO,MAAM,UAAU,GACtB,QAAQ,UAAU,EAClB,KAAK,OAAO,EACZ,OAAO,MAAM,EACb,SAAS,MAAM,KACb,aAAa,CAAC,QAAQ,CAIxB,CAAC"}
|
package/dist/classes/repo.js
DELETED
package/dist/classes/repos.d.ts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type { RepoKey } from "../types/types";
|
|
2
|
-
import { List } from "./list";
|
|
3
|
-
import type { RepoType } from "./repo";
|
|
4
|
-
export declare class Repositories extends List<RepoKey, RepoType> {
|
|
5
|
-
copy(): Repositories;
|
|
6
|
-
except(item: RepoType): Repositories;
|
|
7
|
-
}
|
|
8
|
-
//# sourceMappingURL=repos.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"repos.d.ts","sourceRoot":"","sources":["../../src/classes/repos.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,OAAO,EAAC,MAAM,gBAAgB,CAAC;AAE5C,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,OAAO,KAAK,EAAC,QAAQ,EAAC,MAAM,QAAQ,CAAC;AAErC,qBAAa,YAAa,SAAQ,IAAI,CAAC,OAAO,EAAE,QAAQ,CAAC;IACxD,IAAI;IAUJ,MAAM,CAAC,IAAI,EAAE,QAAQ;CAGrB"}
|
package/dist/classes/repos.js
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { List } from "./list.js";
|
|
2
|
-
export class Repositories extends List {
|
|
3
|
-
copy() {
|
|
4
|
-
const newList = new Repositories();
|
|
5
|
-
this.entries().forEach(([key, value]) => {
|
|
6
|
-
newList.item(key, value);
|
|
7
|
-
});
|
|
8
|
-
return newList;
|
|
9
|
-
}
|
|
10
|
-
except(item) {
|
|
11
|
-
return this.copy().delete(item);
|
|
12
|
-
}
|
|
13
|
-
}
|
package/dist/classes/sour.d.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type ISour from "../interfaces/sour";
|
|
2
|
-
import type ISourceStructure from "../structures/source";
|
|
3
|
-
import type { SourKey } from "../types/types";
|
|
4
|
-
import { Common } from "./common";
|
|
5
|
-
import type { ProxyOriginal } from "./common";
|
|
6
|
-
import type { GedComType } from "./gedcom";
|
|
7
|
-
export declare class Sour extends Common<string, SourKey> implements ISour {
|
|
8
|
-
}
|
|
9
|
-
export type SourType = Sour & ISourceStructure;
|
|
10
|
-
export declare const createSour: (gedcom: GedComType, id?: SourKey, main?: Common, parent?: Common) => ProxyOriginal<SourType>;
|
|
11
|
-
//# sourceMappingURL=sour.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"sour.d.ts","sourceRoot":"","sources":["../../src/classes/sour.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,oBAAoB,CAAC;AAC5C,OAAO,KAAK,gBAAgB,MAAM,sBAAsB,CAAC;AACzD,OAAO,KAAK,EAAC,OAAO,EAAC,MAAM,gBAAgB,CAAC;AAE5C,OAAO,EAAE,MAAM,EAAe,MAAM,UAAU,CAAC;AAC/C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAC9C,OAAO,KAAK,EAAC,UAAU,EAAC,MAAM,UAAU,CAAC;AAEzC,qBAAa,IAAK,SAAQ,MAAM,CAAC,MAAM,EAAE,OAAO,CAAE,YAAW,KAAK;CAAG;AAErE,MAAM,MAAM,QAAQ,GAAG,IAAI,GAAG,gBAAgB,CAAC;AAC/C,eAAO,MAAM,UAAU,GACtB,QAAQ,UAAU,EAClB,KAAK,OAAO,EACZ,OAAO,MAAM,EACb,SAAS,MAAM,KACb,aAAa,CAAC,QAAQ,CAIxB,CAAC"}
|
package/dist/classes/sour.js
DELETED
package/dist/classes/sours.d.ts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type { SourKey } from "../types/types";
|
|
2
|
-
import { List } from "./list";
|
|
3
|
-
import type { SourType } from "./sour";
|
|
4
|
-
export declare class Sources extends List<SourKey, SourType> {
|
|
5
|
-
copy(): Sources;
|
|
6
|
-
except(item: SourType): Sources;
|
|
7
|
-
}
|
|
8
|
-
//# sourceMappingURL=sours.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"sours.d.ts","sourceRoot":"","sources":["../../src/classes/sours.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,OAAO,EAAC,MAAM,gBAAgB,CAAC;AAE5C,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,OAAO,KAAK,EAAC,QAAQ,EAAC,MAAM,QAAQ,CAAC;AAErC,qBAAa,OAAQ,SAAQ,IAAI,CAAC,OAAO,EAAE,QAAQ,CAAC;IACnD,IAAI;IAUJ,MAAM,CAAC,IAAI,EAAE,QAAQ;CAGrB"}
|
package/dist/classes/sours.js
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { List } from "./list.js";
|
|
2
|
-
export class Sources extends List {
|
|
3
|
-
copy() {
|
|
4
|
-
const newList = new Sources();
|
|
5
|
-
this.entries().forEach(([key, value]) => {
|
|
6
|
-
newList.item(key, value);
|
|
7
|
-
});
|
|
8
|
-
return newList;
|
|
9
|
-
}
|
|
10
|
-
except(item) {
|
|
11
|
-
return this.copy().delete(item);
|
|
12
|
-
}
|
|
13
|
-
}
|
package/dist/classes/subm.d.ts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import type ISubm from "../interfaces/subm";
|
|
2
|
-
import type { SubmKey } from "../types/types";
|
|
3
|
-
import { Common } from "./common";
|
|
4
|
-
import type { ProxyOriginal } from "./common";
|
|
5
|
-
import type { GedComType } from "./gedcom";
|
|
6
|
-
export declare class Subm extends Common<string, SubmKey> implements ISubm {
|
|
7
|
-
}
|
|
8
|
-
export type SubmType = Subm & ISubm;
|
|
9
|
-
export declare const createSubm: (gedcom: GedComType, id?: SubmKey, main?: Common, parent?: Common) => ProxyOriginal<SubmType>;
|
|
10
|
-
//# sourceMappingURL=subm.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"subm.d.ts","sourceRoot":"","sources":["../../src/classes/subm.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,oBAAoB,CAAC;AAC5C,OAAO,KAAK,EAAC,OAAO,EAAC,MAAM,gBAAgB,CAAC;AAE5C,OAAO,EAAE,MAAM,EAAe,MAAM,UAAU,CAAC;AAC/C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAC9C,OAAO,KAAK,EAAC,UAAU,EAAC,MAAM,UAAU,CAAC;AAEzC,qBAAa,IAAK,SAAQ,MAAM,CAAC,MAAM,EAAE,OAAO,CAAE,YAAW,KAAK;CAAG;AAErE,MAAM,MAAM,QAAQ,GAAG,IAAI,GAAG,KAAK,CAAC;AACpC,eAAO,MAAM,UAAU,GACtB,QAAQ,UAAU,EAClB,KAAK,OAAO,EACZ,OAAO,MAAM,EACb,SAAS,MAAM,KACb,aAAa,CAAC,QAAQ,CAIxB,CAAC"}
|
package/dist/classes/subm.js
DELETED
package/dist/classes/subms.d.ts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type { SubmKey } from "../types/types";
|
|
2
|
-
import { List } from "./list";
|
|
3
|
-
import type { SubmType } from "./subm";
|
|
4
|
-
export declare class Submitters extends List<SubmKey, SubmType> {
|
|
5
|
-
copy(): Submitters;
|
|
6
|
-
except(item: SubmType): Submitters;
|
|
7
|
-
}
|
|
8
|
-
//# sourceMappingURL=subms.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"subms.d.ts","sourceRoot":"","sources":["../../src/classes/subms.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,OAAO,EAAC,MAAM,gBAAgB,CAAC;AAE5C,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,OAAO,KAAK,EAAC,QAAQ,EAAC,MAAM,QAAQ,CAAC;AAErC,qBAAa,UAAW,SAAQ,IAAI,CAAC,OAAO,EAAE,QAAQ,CAAC;IACtD,IAAI;IAUJ,MAAM,CAAC,IAAI,EAAE,QAAQ;CAGrB"}
|
package/dist/classes/subms.js
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { List } from "./list.js";
|
|
2
|
-
export class Submitters extends List {
|
|
3
|
-
copy() {
|
|
4
|
-
const newList = new Submitters();
|
|
5
|
-
this.entries().forEach(([key, value]) => {
|
|
6
|
-
newList.item(key, value);
|
|
7
|
-
});
|
|
8
|
-
return newList;
|
|
9
|
-
}
|
|
10
|
-
except(item) {
|
|
11
|
-
return this.copy().delete(item);
|
|
12
|
-
}
|
|
13
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"convert.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/convert.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAUzC,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAiF7D"}
|
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
import { writeFileSync } from 'fs';
|
|
2
|
-
import GedcomTree from '../../utils/parser.js';
|
|
3
|
-
import { formatSuccess, formatJson } from '../utils/formatters.js';
|
|
4
|
-
import { readGedcomFile, handleError, cleanGedcomName } from '../utils/helpers.js';
|
|
5
|
-
export function registerConvertCommand(program) {
|
|
6
|
-
program
|
|
7
|
-
.command('convert <file>')
|
|
8
|
-
.description('Convert GEDCOM to another format')
|
|
9
|
-
.requiredOption('-f, --format <format>', 'Output format: json, csv, markdown')
|
|
10
|
-
.option('-o, --output <file>', 'Output file path')
|
|
11
|
-
.action((file, options) => {
|
|
12
|
-
try {
|
|
13
|
-
const content = readGedcomFile(file);
|
|
14
|
-
const { gedcom: tree } = GedcomTree.parse(content);
|
|
15
|
-
const individuals = tree.indis();
|
|
16
|
-
let outputContent = '';
|
|
17
|
-
if (options.format === 'json') {
|
|
18
|
-
const jsonData = individuals.map(indi => ({
|
|
19
|
-
id: indi.id,
|
|
20
|
-
name: cleanGedcomName(indi.NAME?.toValue()),
|
|
21
|
-
sex: indi.SEX?.value || null,
|
|
22
|
-
birthDate: indi.BIRT?.DATE?.toValue() || null,
|
|
23
|
-
birthPlace: indi.BIRT?.PLAC?.value || null,
|
|
24
|
-
deathDate: indi.DEAT?.DATE?.toValue() || null,
|
|
25
|
-
deathPlace: indi.DEAT?.PLAC?.value || null,
|
|
26
|
-
}));
|
|
27
|
-
outputContent = formatJson(jsonData);
|
|
28
|
-
}
|
|
29
|
-
else if (options.format === 'csv') {
|
|
30
|
-
const lines = [];
|
|
31
|
-
lines.push('ID,Name,Sex,Birth Date,Birth Place,Death Date,Death Place');
|
|
32
|
-
individuals.forEach(indi => {
|
|
33
|
-
const csvEscape = (str) => {
|
|
34
|
-
if (!str)
|
|
35
|
-
return '';
|
|
36
|
-
if (str.includes(',') || str.includes('"')) {
|
|
37
|
-
return `"${str.replace(/"/g, '""')}"`;
|
|
38
|
-
}
|
|
39
|
-
return str;
|
|
40
|
-
};
|
|
41
|
-
lines.push([
|
|
42
|
-
csvEscape(indi.id),
|
|
43
|
-
csvEscape(cleanGedcomName(indi.NAME?.toValue())),
|
|
44
|
-
csvEscape(indi.SEX?.value),
|
|
45
|
-
csvEscape(indi.BIRT?.DATE?.toValue()),
|
|
46
|
-
csvEscape(indi.BIRT?.PLAC?.value),
|
|
47
|
-
csvEscape(indi.DEAT?.DATE?.toValue()),
|
|
48
|
-
csvEscape(indi.DEAT?.PLAC?.value),
|
|
49
|
-
].join(','));
|
|
50
|
-
});
|
|
51
|
-
outputContent = lines.join('\n');
|
|
52
|
-
}
|
|
53
|
-
else if (options.format === 'markdown') {
|
|
54
|
-
const lines = [];
|
|
55
|
-
lines.push('# GEDCOM Individuals\n');
|
|
56
|
-
lines.push('| ID | Name | Sex | Birth | Death |');
|
|
57
|
-
lines.push('|----|------|-----|-------|-------|');
|
|
58
|
-
individuals.forEach(indi => {
|
|
59
|
-
const name = cleanGedcomName(indi.NAME?.toValue()) || '?';
|
|
60
|
-
const sex = indi.SEX?.value || '?';
|
|
61
|
-
const birth = indi.BIRT?.DATE?.toValue() || '?';
|
|
62
|
-
const death = indi.DEAT?.DATE?.toValue() || '?';
|
|
63
|
-
lines.push(`| ${indi.id} | ${name} | ${sex} | ${birth} | ${death} |`);
|
|
64
|
-
});
|
|
65
|
-
outputContent = lines.join('\n');
|
|
66
|
-
}
|
|
67
|
-
else {
|
|
68
|
-
console.error(`Unsupported format: ${options.format}`);
|
|
69
|
-
process.exit(1);
|
|
70
|
-
}
|
|
71
|
-
if (options.output) {
|
|
72
|
-
writeFileSync(options.output, outputContent, 'utf-8');
|
|
73
|
-
console.log(formatSuccess(`Converted to ${options.format} and saved to ${options.output}`));
|
|
74
|
-
}
|
|
75
|
-
else {
|
|
76
|
-
console.log(outputContent);
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
catch (error) {
|
|
80
|
-
handleError(error, 'Failed to convert GEDCOM file');
|
|
81
|
-
}
|
|
82
|
-
});
|
|
83
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"extract.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/extract.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAczC,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CA4F7D"}
|
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
import { writeFileSync } from 'fs';
|
|
2
|
-
import GedcomTree from '../../utils/parser.js';
|
|
3
|
-
import { formatError, formatSuccess } from '../utils/formatters.js';
|
|
4
|
-
import { readGedcomFile, handleError, cleanGedcomName } from '../utils/helpers.js';
|
|
5
|
-
export function registerExtractCommand(program) {
|
|
6
|
-
program
|
|
7
|
-
.command('extract <file>')
|
|
8
|
-
.description('Extract a subset of individuals to a new GEDCOM file')
|
|
9
|
-
.requiredOption('-o, --output <file>', 'Output file path (required)')
|
|
10
|
-
.option('--surname <name>', 'Filter by surname')
|
|
11
|
-
.option('--birth-after <year>', 'Include individuals born after this year')
|
|
12
|
-
.option('--birth-before <year>', 'Include individuals born before this year')
|
|
13
|
-
.option('--death-after <year>', 'Include individuals who died after this year')
|
|
14
|
-
.option('--death-before <year>', 'Include individuals who died before this year')
|
|
15
|
-
.action((file, options) => {
|
|
16
|
-
try {
|
|
17
|
-
const content = readGedcomFile(file);
|
|
18
|
-
const { gedcom: tree } = GedcomTree.parse(content);
|
|
19
|
-
const individuals = tree.indis();
|
|
20
|
-
const results = [];
|
|
21
|
-
// Collect individuals that match all filters
|
|
22
|
-
individuals.forEach(indi => {
|
|
23
|
-
let matches = true;
|
|
24
|
-
// Filter by surname
|
|
25
|
-
if (options.surname && matches) {
|
|
26
|
-
const searchSurname = options.surname.toLowerCase();
|
|
27
|
-
const name = cleanGedcomName(indi.NAME?.toValue()).toLowerCase();
|
|
28
|
-
matches = name.includes(searchSurname);
|
|
29
|
-
}
|
|
30
|
-
// Filter by birth year
|
|
31
|
-
if (options.birthAfter && matches) {
|
|
32
|
-
const year = parseInt(options.birthAfter, 10);
|
|
33
|
-
const birthDate = indi.BIRT?.DATE?.toValue();
|
|
34
|
-
const match = birthDate?.match(/\d{4}/);
|
|
35
|
-
matches = match && parseInt(match[0], 10) > year;
|
|
36
|
-
}
|
|
37
|
-
if (options.birthBefore && matches) {
|
|
38
|
-
const year = parseInt(options.birthBefore, 10);
|
|
39
|
-
const birthDate = indi.BIRT?.DATE?.toValue();
|
|
40
|
-
const match = birthDate?.match(/\d{4}/);
|
|
41
|
-
matches = match && parseInt(match[0], 10) < year;
|
|
42
|
-
}
|
|
43
|
-
// Filter by death year
|
|
44
|
-
if (options.deathAfter && matches) {
|
|
45
|
-
const year = parseInt(options.deathAfter, 10);
|
|
46
|
-
const deathDate = indi.DEAT?.DATE?.toValue();
|
|
47
|
-
const match = deathDate?.match(/\d{4}/);
|
|
48
|
-
matches = match && parseInt(match[0], 10) > year;
|
|
49
|
-
}
|
|
50
|
-
if (options.deathBefore && matches) {
|
|
51
|
-
const year = parseInt(options.deathBefore, 10);
|
|
52
|
-
const deathDate = indi.DEAT?.DATE?.toValue();
|
|
53
|
-
const match = deathDate?.match(/\d{4}/);
|
|
54
|
-
matches = match && parseInt(match[0], 10) < year;
|
|
55
|
-
}
|
|
56
|
-
if (matches) {
|
|
57
|
-
results.push(indi);
|
|
58
|
-
}
|
|
59
|
-
});
|
|
60
|
-
if (results.length === 0) {
|
|
61
|
-
console.log(formatError('No individuals match the criteria'));
|
|
62
|
-
process.exit(1);
|
|
63
|
-
}
|
|
64
|
-
// Create subset GEDCOM
|
|
65
|
-
const lines = [];
|
|
66
|
-
lines.push('0 HEAD');
|
|
67
|
-
lines.push('1 SOUR gedcom-parser CLI');
|
|
68
|
-
lines.push('1 GEDC');
|
|
69
|
-
lines.push('2 VERS 5.5.1');
|
|
70
|
-
lines.push('1 CHAR UTF-8');
|
|
71
|
-
results.forEach(indi => {
|
|
72
|
-
const raw = indi.raw();
|
|
73
|
-
if (raw) {
|
|
74
|
-
lines.push(...raw.split('\n').filter(line => line.trim()));
|
|
75
|
-
}
|
|
76
|
-
});
|
|
77
|
-
lines.push('0 TRLR');
|
|
78
|
-
writeFileSync(options.output, lines.join('\n'), 'utf-8');
|
|
79
|
-
console.log(formatSuccess(`Extracted ${results.length} individuals to ${options.output}`));
|
|
80
|
-
}
|
|
81
|
-
catch (error) {
|
|
82
|
-
handleError(error, 'Failed to extract individuals');
|
|
83
|
-
}
|
|
84
|
-
});
|
|
85
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"find.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/find.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAqBzC,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CA0G1D"}
|
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
import GedcomTree from '../../utils/parser.js';
|
|
2
|
-
import { formatHeader, formatListItem, formatJson, formatId, formatName, formatDate, formatWarning, } from '../utils/formatters.js';
|
|
3
|
-
import { readGedcomFile, handleError, cleanGedcomName, formatLifespan } from '../utils/helpers.js';
|
|
4
|
-
export function registerFindCommand(program) {
|
|
5
|
-
program
|
|
6
|
-
.command('find <file> [query]')
|
|
7
|
-
.description('Find individuals in a GEDCOM file')
|
|
8
|
-
.option('--id <id>', 'Find by GEDCOM ID')
|
|
9
|
-
.option('--name <name>', 'Find by name (substring search)')
|
|
10
|
-
.option('--birth-year <year>', 'Filter by birth year')
|
|
11
|
-
.option('--death-year <year>', 'Filter by death year')
|
|
12
|
-
.option('-j, --json', 'Output in JSON format')
|
|
13
|
-
.action((file, query, options) => {
|
|
14
|
-
try {
|
|
15
|
-
const content = readGedcomFile(file);
|
|
16
|
-
const { gedcom: tree } = GedcomTree.parse(content);
|
|
17
|
-
const individuals = tree.indis();
|
|
18
|
-
const results = [];
|
|
19
|
-
// Collect all individuals that match filters
|
|
20
|
-
individuals.forEach((indi) => {
|
|
21
|
-
let matches = true;
|
|
22
|
-
// Filter by ID
|
|
23
|
-
if (options.id && indi.id !== options.id) {
|
|
24
|
-
matches = false;
|
|
25
|
-
}
|
|
26
|
-
// Filter by name (substring search, case insensitive)
|
|
27
|
-
if ((options.name || query) && matches) {
|
|
28
|
-
const searchName = (options.name || query || '').toLowerCase();
|
|
29
|
-
const name = cleanGedcomName(indi.NAME?.toValue()).toLowerCase();
|
|
30
|
-
if (!name.includes(searchName)) {
|
|
31
|
-
matches = false;
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
// Filter by birth year
|
|
35
|
-
if (options.birthYear && matches) {
|
|
36
|
-
const year = options.birthYear;
|
|
37
|
-
const birthDate = indi.BIRT?.DATE?.toValue();
|
|
38
|
-
if (!birthDate?.includes(String(year))) {
|
|
39
|
-
matches = false;
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
// Filter by death year
|
|
43
|
-
if (options.deathYear && matches) {
|
|
44
|
-
const year = options.deathYear;
|
|
45
|
-
const deathDate = indi.DEAT?.DATE?.toValue();
|
|
46
|
-
if (!deathDate?.includes(String(year))) {
|
|
47
|
-
matches = false;
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
if (matches) {
|
|
51
|
-
results.push(indi);
|
|
52
|
-
}
|
|
53
|
-
});
|
|
54
|
-
if (options.json) {
|
|
55
|
-
const jsonResults = results.map(indi => ({
|
|
56
|
-
id: indi.id,
|
|
57
|
-
name: cleanGedcomName(indi.NAME?.toValue()),
|
|
58
|
-
birthDate: indi.BIRT?.DATE?.toValue() || null,
|
|
59
|
-
birthPlace: indi.BIRT?.PLAC?.value || null,
|
|
60
|
-
deathDate: indi.DEAT?.DATE?.toValue() || null,
|
|
61
|
-
deathPlace: indi.DEAT?.PLAC?.value || null,
|
|
62
|
-
sex: indi.SEX?.value || null,
|
|
63
|
-
}));
|
|
64
|
-
console.log(formatJson({ count: jsonResults.length, individuals: jsonResults }));
|
|
65
|
-
}
|
|
66
|
-
else {
|
|
67
|
-
if (results.length === 0) {
|
|
68
|
-
console.log(formatWarning('No individuals found matching the criteria'));
|
|
69
|
-
}
|
|
70
|
-
else {
|
|
71
|
-
console.log(formatHeader(`Found ${results.length} individual(s)\n`));
|
|
72
|
-
results.forEach(indi => {
|
|
73
|
-
const name = cleanGedcomName(indi.NAME?.toValue());
|
|
74
|
-
const birthDate = indi.BIRT?.DATE?.toValue();
|
|
75
|
-
const deathDate = indi.DEAT?.DATE?.toValue();
|
|
76
|
-
const lifespan = formatLifespan(birthDate, deathDate);
|
|
77
|
-
console.log(formatListItem(`${formatId(indi.id)} ${formatName(name)} ${lifespan}`));
|
|
78
|
-
// Show birth place if available
|
|
79
|
-
const birthPlace = indi.BIRT?.PLAC?.value;
|
|
80
|
-
if (birthPlace) {
|
|
81
|
-
console.log(formatListItem(`Birth: ${formatDate(birthDate)} in ${birthPlace}`, 1));
|
|
82
|
-
}
|
|
83
|
-
// Show death place if available
|
|
84
|
-
const deathPlace = indi.DEAT?.PLAC?.value;
|
|
85
|
-
if (deathPlace) {
|
|
86
|
-
console.log(formatListItem(`Death: ${formatDate(deathDate)} in ${deathPlace}`, 1));
|
|
87
|
-
}
|
|
88
|
-
console.log();
|
|
89
|
-
});
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
catch (error) {
|
|
94
|
-
handleError(error, 'Failed to search GEDCOM file');
|
|
95
|
-
}
|
|
96
|
-
});
|
|
97
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"info.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/info.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAiBzC,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAkF1D"}
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
import GedcomTree from '../../utils/parser.js';
|
|
2
|
-
import { formatHeader, formatLabel, formatValue, formatCount, formatJson, formatSuccess, } from '../utils/formatters.js';
|
|
3
|
-
import { readGedcomFile, handleError } from '../utils/helpers.js';
|
|
4
|
-
export function registerInfoCommand(program) {
|
|
5
|
-
program
|
|
6
|
-
.command('info <file>')
|
|
7
|
-
.description('Display basic information about a GEDCOM file')
|
|
8
|
-
.option('-j, --json', 'Output in JSON format')
|
|
9
|
-
.option('-v, --verbose', 'Show detailed information')
|
|
10
|
-
.action((file, options) => {
|
|
11
|
-
try {
|
|
12
|
-
const content = readGedcomFile(file);
|
|
13
|
-
const { gedcom: tree } = GedcomTree.parse(content);
|
|
14
|
-
const individuals = tree.indis();
|
|
15
|
-
const families = tree.fams();
|
|
16
|
-
const sources = tree.sours();
|
|
17
|
-
const repos = tree.repos();
|
|
18
|
-
const objes = tree.objes();
|
|
19
|
-
const submitters = tree.subms();
|
|
20
|
-
// Get GEDCOM version from header
|
|
21
|
-
const header = tree.HEAD;
|
|
22
|
-
const version = header?.GEDC?.VERS?.value || 'Unknown';
|
|
23
|
-
const info = {
|
|
24
|
-
file,
|
|
25
|
-
version,
|
|
26
|
-
individuals: individuals?.length || 0,
|
|
27
|
-
families: families?.length || 0,
|
|
28
|
-
sources: sources?.length || 0,
|
|
29
|
-
repositories: repos?.length || 0,
|
|
30
|
-
mediaObjects: objes?.length || 0,
|
|
31
|
-
submitters: submitters?.length || 0,
|
|
32
|
-
};
|
|
33
|
-
if (options.json) {
|
|
34
|
-
console.log(formatJson(info));
|
|
35
|
-
}
|
|
36
|
-
else {
|
|
37
|
-
console.log(formatSuccess('GEDCOM file parsed successfully\n'));
|
|
38
|
-
console.log(formatHeader('File Information'));
|
|
39
|
-
console.log(`${formatLabel('File')} ${formatValue(file)}`);
|
|
40
|
-
console.log(`${formatLabel('GEDCOM Version')} ${formatValue(version)}`);
|
|
41
|
-
console.log();
|
|
42
|
-
console.log(formatHeader('Statistics'));
|
|
43
|
-
console.log(`${formatLabel('Individuals')} ${formatCount(individuals?.length || 0)}`);
|
|
44
|
-
console.log(`${formatLabel('Families')} ${formatCount(families?.length || 0)}`);
|
|
45
|
-
console.log(`${formatLabel('Sources')} ${formatCount(sources?.length || 0)}`);
|
|
46
|
-
console.log(`${formatLabel('Repositories')} ${formatCount(repos?.length || 0)}`);
|
|
47
|
-
console.log(`${formatLabel('Media Objects')} ${formatCount(objes?.length || 0)}`);
|
|
48
|
-
console.log(`${formatLabel('Submitters')} ${formatCount(submitters?.length || 0)}`);
|
|
49
|
-
if (options.verbose) {
|
|
50
|
-
console.log();
|
|
51
|
-
console.log(formatHeader('Additional Details'));
|
|
52
|
-
// Most common surnames
|
|
53
|
-
const surnames = new Map();
|
|
54
|
-
individuals.forEach((indi) => {
|
|
55
|
-
const name = indi.NAME?.toValue();
|
|
56
|
-
if (name) {
|
|
57
|
-
const match = name.match(/\/(.+?)\//);
|
|
58
|
-
if (match) {
|
|
59
|
-
const surname = match[1];
|
|
60
|
-
surnames.set(surname, (surnames.get(surname) || 0) + 1);
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
});
|
|
64
|
-
const topSurnames = Array.from(surnames.entries())
|
|
65
|
-
.sort((a, b) => b[1] - a[1])
|
|
66
|
-
.slice(0, 5);
|
|
67
|
-
if (topSurnames.length > 0) {
|
|
68
|
-
console.log(`${formatLabel('Most Common Surnames')}`);
|
|
69
|
-
topSurnames.forEach(([surname, count]) => {
|
|
70
|
-
console.log(` - ${surname}: ${formatCount(count)}`);
|
|
71
|
-
});
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
catch (error) {
|
|
77
|
-
handleError(error, 'Failed to parse GEDCOM file');
|
|
78
|
-
}
|
|
79
|
-
});
|
|
80
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"merge.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/merge.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAwBzC,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAoE3D"}
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
import { writeFileSync } from 'fs';
|
|
2
|
-
import { mergeGedcoms } from '../../classes/gedcom.js';
|
|
3
|
-
import GedcomTree from '../../utils/parser.js';
|
|
4
|
-
import { formatSuccess } from '../utils/formatters.js';
|
|
5
|
-
import { readGedcomFile, handleError } from '../utils/helpers.js';
|
|
6
|
-
/**
|
|
7
|
-
* Helper to get and validate the merge strategy
|
|
8
|
-
*/
|
|
9
|
-
function getMergeStrategy(options) {
|
|
10
|
-
if (options.dedupe) {
|
|
11
|
-
console.warn('Warning: --dedupe option is deprecated. Use --strategy NAME instead.');
|
|
12
|
-
return 'NAME';
|
|
13
|
-
}
|
|
14
|
-
return (options.strategy || 'id');
|
|
15
|
-
}
|
|
16
|
-
export function registerMergeCommand(program) {
|
|
17
|
-
program
|
|
18
|
-
.command('merge <files...>')
|
|
19
|
-
.description('Merge multiple GEDCOM files')
|
|
20
|
-
.requiredOption('-o, --output <file>', 'Output file path (required)')
|
|
21
|
-
.option('--dedupe', 'Attempt to detect and merge duplicates (deprecated, use --strategy NAME)')
|
|
22
|
-
.option('--strategy <strategy>', 'Matching strategy: "id" (match by ID) or a tag like "NAME" (match by name). Default: "id"', 'id')
|
|
23
|
-
.action((files, options) => {
|
|
24
|
-
try {
|
|
25
|
-
if (files.length < 2) {
|
|
26
|
-
console.error('At least 2 files are required for merging');
|
|
27
|
-
process.exit(1);
|
|
28
|
-
}
|
|
29
|
-
// For 2 files, use the new mergeGedcoms function
|
|
30
|
-
if (files.length === 2) {
|
|
31
|
-
const targetContent = readGedcomFile(files[0]);
|
|
32
|
-
const sourceContent = readGedcomFile(files[1]);
|
|
33
|
-
const { gedcom: targetGedcom } = GedcomTree.parse(targetContent);
|
|
34
|
-
const { gedcom: sourceGedcom } = GedcomTree.parse(sourceContent);
|
|
35
|
-
const strategy = getMergeStrategy(options);
|
|
36
|
-
const merged = mergeGedcoms(targetGedcom, sourceGedcom, strategy);
|
|
37
|
-
const mergedContent = merged.toGedcom();
|
|
38
|
-
writeFileSync(options.output, mergedContent, 'utf-8');
|
|
39
|
-
console.log(formatSuccess(`Merged 2 files using strategy "${strategy}" (${merged.indis()?.length} individuals, ${merged.fams()?.length} families) into ${options.output}`));
|
|
40
|
-
return;
|
|
41
|
-
}
|
|
42
|
-
// For more than 2 files, use iterative merging
|
|
43
|
-
console.log(`Merging ${files.length} files iteratively...`);
|
|
44
|
-
const targetContent = readGedcomFile(files[0]);
|
|
45
|
-
let { gedcom: targetGedcom } = GedcomTree.parse(targetContent);
|
|
46
|
-
const strategy = getMergeStrategy(options);
|
|
47
|
-
for (let i = 1; i < files.length; i++) {
|
|
48
|
-
const sourceContent = readGedcomFile(files[i]);
|
|
49
|
-
const { gedcom: sourceGedcom } = GedcomTree.parse(sourceContent);
|
|
50
|
-
targetGedcom = mergeGedcoms(targetGedcom, sourceGedcom, strategy);
|
|
51
|
-
console.log(` Merged file ${i + 1}/${files.length}: ${files[i]}`);
|
|
52
|
-
}
|
|
53
|
-
const mergedContent = targetGedcom.toGedcom();
|
|
54
|
-
writeFileSync(options.output, mergedContent, 'utf-8');
|
|
55
|
-
console.log(formatSuccess(`Merged ${files.length} files (${targetGedcom.indis()?.length} individuals, ${targetGedcom.fams()?.length} families) into ${options.output}`));
|
|
56
|
-
}
|
|
57
|
-
catch (error) {
|
|
58
|
-
handleError(error, 'Failed to merge GEDCOM files');
|
|
59
|
-
}
|
|
60
|
-
});
|
|
61
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"relatives.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/relatives.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAsBzC,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAwF/D"}
|