@octo-cyber/kinship-calc 0.5.2
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/.turbo/turbo-build.log +22 -0
- package/dist/controllers/family-tree.controller.d.ts +27 -0
- package/dist/controllers/family-tree.controller.d.ts.map +1 -0
- package/dist/controllers/family-tree.controller.js +88 -0
- package/dist/controllers/family-tree.controller.js.map +1 -0
- package/dist/controllers/kinship-calc.controller.d.ts +15 -0
- package/dist/controllers/kinship-calc.controller.d.ts.map +1 -0
- package/dist/controllers/kinship-calc.controller.js +45 -0
- package/dist/controllers/kinship-calc.controller.js.map +1 -0
- package/dist/engine/index.d.ts +7 -0
- package/dist/engine/index.d.ts.map +1 -0
- package/dist/engine/index.js +15 -0
- package/dist/engine/index.js.map +1 -0
- package/dist/engine/kinship-data.d.ts +31 -0
- package/dist/engine/kinship-data.d.ts.map +1 -0
- package/dist/engine/kinship-data.js +150 -0
- package/dist/engine/kinship-data.js.map +1 -0
- package/dist/engine/kinship-engine.d.ts +44 -0
- package/dist/engine/kinship-engine.d.ts.map +1 -0
- package/dist/engine/kinship-engine.js +184 -0
- package/dist/engine/kinship-engine.js.map +1 -0
- package/dist/engine/relation-path.d.ts +37 -0
- package/dist/engine/relation-path.d.ts.map +1 -0
- package/dist/engine/relation-path.js +60 -0
- package/dist/engine/relation-path.js.map +1 -0
- package/dist/entities/family-tree-person.entity.d.ts +12 -0
- package/dist/entities/family-tree-person.entity.d.ts.map +1 -0
- package/dist/entities/family-tree-person.entity.js +61 -0
- package/dist/entities/family-tree-person.entity.js.map +1 -0
- package/dist/entities/family-tree-relation.entity.d.ts +15 -0
- package/dist/entities/family-tree-relation.entity.d.ts.map +1 -0
- package/dist/entities/family-tree-relation.entity.js +58 -0
- package/dist/entities/family-tree-relation.entity.js.map +1 -0
- package/dist/entities/family-tree.entity.d.ts +9 -0
- package/dist/entities/family-tree.entity.d.ts.map +1 -0
- package/dist/entities/family-tree.entity.js +50 -0
- package/dist/entities/family-tree.entity.js.map +1 -0
- package/dist/entities/index.d.ts +12 -0
- package/dist/entities/index.d.ts.map +1 -0
- package/dist/entities/index.js +22 -0
- package/dist/entities/index.js.map +1 -0
- package/dist/entities/kinship-title.entity.d.ts +18 -0
- package/dist/entities/kinship-title.entity.d.ts.map +1 -0
- package/dist/entities/kinship-title.entity.js +59 -0
- package/dist/entities/kinship-title.entity.js.map +1 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +33 -0
- package/dist/index.js.map +1 -0
- package/dist/kinship-calc.module.d.ts +9 -0
- package/dist/kinship-calc.module.d.ts.map +1 -0
- package/dist/kinship-calc.module.js +45 -0
- package/dist/kinship-calc.module.js.map +1 -0
- package/dist/schemas/kinship.schema.d.ts +129 -0
- package/dist/schemas/kinship.schema.d.ts.map +1 -0
- package/dist/schemas/kinship.schema.js +50 -0
- package/dist/schemas/kinship.schema.js.map +1 -0
- package/dist/services/family-tree.service.d.ts +38 -0
- package/dist/services/family-tree.service.d.ts.map +1 -0
- package/dist/services/family-tree.service.js +179 -0
- package/dist/services/family-tree.service.js.map +1 -0
- package/dist/services/kinship-calc.service.d.ts +26 -0
- package/dist/services/kinship-calc.service.d.ts.map +1 -0
- package/dist/services/kinship-calc.service.js +66 -0
- package/dist/services/kinship-calc.service.js.map +1 -0
- package/package.json +60 -0
- package/src/controllers/family-tree.controller.ts +102 -0
- package/src/controllers/kinship-calc.controller.ts +50 -0
- package/src/engine/index.ts +6 -0
- package/src/engine/kinship-data.ts +188 -0
- package/src/engine/kinship-engine.ts +230 -0
- package/src/engine/relation-path.ts +63 -0
- package/src/entities/family-tree-person.entity.ts +37 -0
- package/src/entities/family-tree-relation.entity.ts +36 -0
- package/src/entities/family-tree.entity.ts +28 -0
- package/src/entities/index.ts +18 -0
- package/src/entities/kinship-title.entity.ts +38 -0
- package/src/index.ts +33 -0
- package/src/kinship-calc.module.ts +51 -0
- package/src/schemas/kinship.schema.ts +70 -0
- package/src/services/family-tree.service.ts +211 -0
- package/src/services/kinship-calc.service.ts +68 -0
- package/tsconfig.build.json +4 -0
- package/tsconfig.json +10 -0
- package/web/components/FamilyTreeCanvas.tsx +177 -0
- package/web/components/FamilyTreeDialogs.tsx +275 -0
- package/web/components/KinshipResultCard.tsx +98 -0
- package/web/components/RegionSelector.tsx +32 -0
- package/web/components/RelationChainBuilder.tsx +104 -0
- package/web/index.ts +29 -0
- package/web/manifest.ts +24 -0
- package/web/messages/en-US.json +108 -0
- package/web/messages/zh-CN.json +108 -0
- package/web/pages/FamilyTreePage.tsx +240 -0
- package/web/pages/KinshipCalcPage.tsx +140 -0
- package/web/services/kinship-service.ts +140 -0
- package/web/stores/kinship-store.ts +80 -0
- package/web/types/kinship.ts +85 -0
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
|
|
2
|
+
> @octo-cyber/kinship-calc@0.5.0 build /Users/zangjiafu/Work/project/Octo/packages/kinship-calc
|
|
3
|
+
> tsc -p tsconfig.build.json
|
|
4
|
+
|
|
5
|
+
src/controllers/family-tree.controller.ts(1,56): error TS2307: Cannot find module '@octo-cyber/core' or its corresponding type declarations.
|
|
6
|
+
src/controllers/family-tree.controller.ts(2,64): error TS2307: Cannot find module '@octo-cyber/core' or its corresponding type declarations.
|
|
7
|
+
src/controllers/kinship-calc.controller.ts(1,56): error TS2307: Cannot find module '@octo-cyber/core' or its corresponding type declarations.
|
|
8
|
+
src/controllers/kinship-calc.controller.ts(2,64): error TS2307: Cannot find module '@octo-cyber/core' or its corresponding type declarations.
|
|
9
|
+
src/entities/family-tree-person.entity.ts(7,8): error TS2307: Cannot find module '@octo-cyber/core' or its corresponding type declarations.
|
|
10
|
+
src/entities/family-tree-relation.entity.ts(7,8): error TS2307: Cannot find module '@octo-cyber/core' or its corresponding type declarations.
|
|
11
|
+
src/entities/family-tree.entity.ts(7,8): error TS2307: Cannot find module '@octo-cyber/core' or its corresponding type declarations.
|
|
12
|
+
src/entities/kinship-title.entity.ts(6,8): error TS2307: Cannot find module '@octo-cyber/core' or its corresponding type declarations.
|
|
13
|
+
src/kinship-calc.module.ts(1,30): error TS2307: Cannot find module '@octo-cyber/core' or its corresponding type declarations.
|
|
14
|
+
src/kinship-calc.module.ts(2,46): error TS2307: Cannot find module '@octo-cyber/core' or its corresponding type declarations.
|
|
15
|
+
src/kinship-calc.module.ts(3,42): error TS2307: Cannot find module '@octo-cyber/core' or its corresponding type declarations.
|
|
16
|
+
src/kinship-calc.module.ts(4,32): error TS2307: Cannot find module '@octo-cyber/auth' or its corresponding type declarations.
|
|
17
|
+
src/schemas/kinship.schema.ts(1,19): error TS2307: Cannot find module 'zod' or its corresponding type declarations.
|
|
18
|
+
src/services/family-tree.service.ts(1,78): error TS2307: Cannot find module '@octo-cyber/core' or its corresponding type declarations.
|
|
19
|
+
src/services/family-tree.service.ts(2,33): error TS2307: Cannot find module '@octo-cyber/core' or its corresponding type declarations.
|
|
20
|
+
src/services/kinship-calc.service.ts(1,51): error TS2307: Cannot find module '@octo-cyber/core' or its corresponding type declarations.
|
|
21
|
+
ELIFECYCLE Command failed with exit code 2.
|
|
22
|
+
WARN Local package.json exists, but node_modules missing, did you mean to install?
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { RequestHandler } from '@octo-cyber/core';
|
|
2
|
+
export declare class FamilyTreeController {
|
|
3
|
+
private readonly service;
|
|
4
|
+
/** GET /api/v1/kinship/trees */
|
|
5
|
+
listTrees: RequestHandler;
|
|
6
|
+
/** GET /api/v1/kinship/trees/:id */
|
|
7
|
+
getTree: RequestHandler;
|
|
8
|
+
/** POST /api/v1/kinship/trees */
|
|
9
|
+
createTree: RequestHandler;
|
|
10
|
+
/** PUT /api/v1/kinship/trees/:id */
|
|
11
|
+
updateTree: RequestHandler;
|
|
12
|
+
/** DELETE /api/v1/kinship/trees/:id */
|
|
13
|
+
deleteTree: RequestHandler;
|
|
14
|
+
/** POST /api/v1/kinship/persons */
|
|
15
|
+
addPerson: RequestHandler;
|
|
16
|
+
/** PUT /api/v1/kinship/persons/:id?treeId= */
|
|
17
|
+
updatePerson: RequestHandler;
|
|
18
|
+
/** DELETE /api/v1/kinship/persons/:id?treeId= */
|
|
19
|
+
deletePerson: RequestHandler;
|
|
20
|
+
/** POST /api/v1/kinship/relations */
|
|
21
|
+
addRelation: RequestHandler;
|
|
22
|
+
/** DELETE /api/v1/kinship/relations/:id?treeId= */
|
|
23
|
+
deleteRelation: RequestHandler;
|
|
24
|
+
/** POST /api/v1/kinship/resolve */
|
|
25
|
+
resolveKinship: RequestHandler;
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=family-tree.controller.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"family-tree.controller.d.ts","sourceRoot":"","sources":["../../src/controllers/family-tree.controller.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAqB,cAAc,EAAE,MAAM,kBAAkB,CAAA;AAoBzE,qBAAa,oBAAoB;IAC/B,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAmC;IAE3D,gCAAgC;IAChC,SAAS,EAAE,cAAc,CAGvB;IAEF,oCAAoC;IACpC,OAAO,EAAE,cAAc,CAGrB;IAEF,iCAAiC;IACjC,UAAU,EAAE,cAAc,CAIxB;IAEF,oCAAoC;IACpC,UAAU,EAAE,cAAc,CAIxB;IAEF,uCAAuC;IACvC,UAAU,EAAE,cAAc,CAGxB;IAEF,mCAAmC;IACnC,SAAS,EAAE,cAAc,CAIvB;IAEF,8CAA8C;IAC9C,YAAY,EAAE,cAAc,CAO1B;IAEF,iDAAiD;IACjD,YAAY,EAAE,cAAc,CAK1B;IAEF,qCAAqC;IACrC,WAAW,EAAE,cAAc,CAIzB;IAEF,mDAAmD;IACnD,cAAc,EAAE,cAAc,CAK5B;IAEF,mCAAmC;IACnC,cAAc,EAAE,cAAc,CAI5B;CACH"}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FamilyTreeController = void 0;
|
|
4
|
+
const core_1 = require("@octo-cyber/core");
|
|
5
|
+
const family_tree_service_js_1 = require("../services/family-tree.service.js");
|
|
6
|
+
const kinship_schema_js_1 = require("../schemas/kinship.schema.js");
|
|
7
|
+
function ownerId(req) {
|
|
8
|
+
const id = req.user?.userId;
|
|
9
|
+
if (!id)
|
|
10
|
+
throw new core_1.AppError('未认证', 401);
|
|
11
|
+
return id;
|
|
12
|
+
}
|
|
13
|
+
class FamilyTreeController {
|
|
14
|
+
service = core_1.Container.get(family_tree_service_js_1.FamilyTreeService);
|
|
15
|
+
/** GET /api/v1/kinship/trees */
|
|
16
|
+
listTrees = (0, core_1.asyncHandler)(async (req, res) => {
|
|
17
|
+
const trees = await this.service.listTrees(ownerId(req));
|
|
18
|
+
res.json(core_1.ApiResponse.ok(trees));
|
|
19
|
+
});
|
|
20
|
+
/** GET /api/v1/kinship/trees/:id */
|
|
21
|
+
getTree = (0, core_1.asyncHandler)(async (req, res) => {
|
|
22
|
+
const graph = await this.service.getTree(Number(req.params.id), ownerId(req));
|
|
23
|
+
res.json(core_1.ApiResponse.ok(graph));
|
|
24
|
+
});
|
|
25
|
+
/** POST /api/v1/kinship/trees */
|
|
26
|
+
createTree = (0, core_1.asyncHandler)(async (req, res) => {
|
|
27
|
+
const dto = kinship_schema_js_1.CreateFamilyTreeSchema.parse(req.body);
|
|
28
|
+
const tree = await this.service.createTree(dto, ownerId(req));
|
|
29
|
+
res.status(201).json(core_1.ApiResponse.ok(tree));
|
|
30
|
+
});
|
|
31
|
+
/** PUT /api/v1/kinship/trees/:id */
|
|
32
|
+
updateTree = (0, core_1.asyncHandler)(async (req, res) => {
|
|
33
|
+
const dto = kinship_schema_js_1.UpdateFamilyTreeSchema.parse(req.body);
|
|
34
|
+
const tree = await this.service.updateTree(Number(req.params.id), dto, ownerId(req));
|
|
35
|
+
res.json(core_1.ApiResponse.ok(tree));
|
|
36
|
+
});
|
|
37
|
+
/** DELETE /api/v1/kinship/trees/:id */
|
|
38
|
+
deleteTree = (0, core_1.asyncHandler)(async (req, res) => {
|
|
39
|
+
await this.service.deleteTree(Number(req.params.id), ownerId(req));
|
|
40
|
+
res.json(core_1.ApiResponse.ok(null));
|
|
41
|
+
});
|
|
42
|
+
/** POST /api/v1/kinship/persons */
|
|
43
|
+
addPerson = (0, core_1.asyncHandler)(async (req, res) => {
|
|
44
|
+
const dto = kinship_schema_js_1.CreatePersonSchema.parse(req.body);
|
|
45
|
+
const person = await this.service.addPerson(dto, ownerId(req));
|
|
46
|
+
res.status(201).json(core_1.ApiResponse.ok(person));
|
|
47
|
+
});
|
|
48
|
+
/** PUT /api/v1/kinship/persons/:id?treeId= */
|
|
49
|
+
updatePerson = (0, core_1.asyncHandler)(async (req, res) => {
|
|
50
|
+
const personId = Number(req.params.id);
|
|
51
|
+
const treeId = Number(req.query.treeId);
|
|
52
|
+
if (!treeId)
|
|
53
|
+
throw new core_1.AppError('缺少 treeId 参数', 400);
|
|
54
|
+
const dto = kinship_schema_js_1.UpdatePersonSchema.parse(req.body);
|
|
55
|
+
const person = await this.service.updatePerson(personId, treeId, dto, ownerId(req));
|
|
56
|
+
res.json(core_1.ApiResponse.ok(person));
|
|
57
|
+
});
|
|
58
|
+
/** DELETE /api/v1/kinship/persons/:id?treeId= */
|
|
59
|
+
deletePerson = (0, core_1.asyncHandler)(async (req, res) => {
|
|
60
|
+
const treeId = Number(req.query.treeId);
|
|
61
|
+
if (!treeId)
|
|
62
|
+
throw new core_1.AppError('缺少 treeId 参数', 400);
|
|
63
|
+
await this.service.deletePerson(Number(req.params.id), treeId, ownerId(req));
|
|
64
|
+
res.json(core_1.ApiResponse.ok(null));
|
|
65
|
+
});
|
|
66
|
+
/** POST /api/v1/kinship/relations */
|
|
67
|
+
addRelation = (0, core_1.asyncHandler)(async (req, res) => {
|
|
68
|
+
const dto = kinship_schema_js_1.CreateRelationSchema.parse(req.body);
|
|
69
|
+
const relation = await this.service.addRelation(dto, ownerId(req));
|
|
70
|
+
res.status(201).json(core_1.ApiResponse.ok(relation));
|
|
71
|
+
});
|
|
72
|
+
/** DELETE /api/v1/kinship/relations/:id?treeId= */
|
|
73
|
+
deleteRelation = (0, core_1.asyncHandler)(async (req, res) => {
|
|
74
|
+
const treeId = Number(req.query.treeId);
|
|
75
|
+
if (!treeId)
|
|
76
|
+
throw new core_1.AppError('缺少 treeId 参数', 400);
|
|
77
|
+
await this.service.deleteRelation(Number(req.params.id), treeId, ownerId(req));
|
|
78
|
+
res.json(core_1.ApiResponse.ok(null));
|
|
79
|
+
});
|
|
80
|
+
/** POST /api/v1/kinship/resolve */
|
|
81
|
+
resolveKinship = (0, core_1.asyncHandler)(async (req, res) => {
|
|
82
|
+
const dto = kinship_schema_js_1.ResolveTreePathSchema.parse(req.body);
|
|
83
|
+
const result = await this.service.resolveKinship(dto, ownerId(req));
|
|
84
|
+
res.json(core_1.ApiResponse.ok(result));
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
exports.FamilyTreeController = FamilyTreeController;
|
|
88
|
+
//# sourceMappingURL=family-tree.controller.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"family-tree.controller.js","sourceRoot":"","sources":["../../src/controllers/family-tree.controller.ts"],"names":[],"mappings":";;;AACA,2CAAiF;AACjF,+EAAsE;AACtE,oEAOqC;AAIrC,SAAS,OAAO,CAAC,GAAY;IAC3B,MAAM,EAAE,GAAI,GAAmB,CAAC,IAAI,EAAE,MAAM,CAAA;IAC5C,IAAI,CAAC,EAAE;QAAE,MAAM,IAAI,eAAQ,CAAC,KAAK,EAAE,GAAG,CAAC,CAAA;IACvC,OAAO,EAAE,CAAA;AACX,CAAC;AAED,MAAa,oBAAoB;IACd,OAAO,GAAG,gBAAS,CAAC,GAAG,CAAC,0CAAiB,CAAC,CAAA;IAE3D,gCAAgC;IAChC,SAAS,GAAmB,IAAA,mBAAY,EAAC,KAAK,EAAE,GAAY,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AAA;QAClE,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,kBAAW,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAA;IAChD,CAAC,CAAC,CAAA;IAEF,mDAAmD;IACnD,cAAc,GAAmB,IAAA,mBAAY,EAAC,KAAK,EAAE,GAAY,EAAE,GAAa,EAAE,EAAE;QAClF,MAAM,MAAM,GAAG,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,CAAA;QACvC,IAAI,CAAC,MAAM;YAAE,MAAM,IAAI,eAAQ,CAAC,cAAc,EAAE,GAAG,CAAC,CAAA;QACpD,MAAM,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC,MAAM,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,GAAG,CAAC,CAAC,CAAA;QAC9E,GAAG,CAAC,IAAI,CAAC,kBAAW,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,CAAA;IAChC,CAAC,CAAC,CAAA;IAEF,mCAAmC;IACnC,cAAc,GAAmB,IAAA,mBAAY,EAAC,KAAK,EAAE,GAAY,EAAE,GAAa,EAAE,EAAE;QAClF,MAAM,GAAG,GAAG,yCAAqB,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,CAAA;QACjD,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC,GAAG,EAAE,OAAO,CAAC,GAAG,CAAC,CAAC,CAAA;QACnE,GAAG,CAAC,IAAI,CAAC,kBAAW,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC,CAAA;IAClC,CAAC,CAAC,CAAA;CACH;AAjFD,oDAiFC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { RequestHandler } from '@octo-cyber/core';
|
|
2
|
+
export declare class KinshipCalcController {
|
|
3
|
+
private readonly service;
|
|
4
|
+
/** POST /api/kinship/calculate */
|
|
5
|
+
calculate: RequestHandler;
|
|
6
|
+
/** POST /api/kinship/chain */
|
|
7
|
+
calculateFromChain: RequestHandler;
|
|
8
|
+
/** POST /api/kinship/conflict-check */
|
|
9
|
+
checkConflict: RequestHandler;
|
|
10
|
+
/** GET /api/kinship/titles?region=standard */
|
|
11
|
+
listTitles: RequestHandler;
|
|
12
|
+
/** GET /api/kinship/atoms */
|
|
13
|
+
getAtoms: RequestHandler;
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=kinship-calc.controller.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"kinship-calc.controller.d.ts","sourceRoot":"","sources":["../../src/controllers/kinship-calc.controller.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAqB,cAAc,EAAE,MAAM,kBAAkB,CAAA;AAWzE,qBAAa,qBAAqB;IAChC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAoC;IAE5D,kCAAkC;IAClC,SAAS,EAAE,cAAc,CAIvB;IAEF,8BAA8B;IAC9B,kBAAkB,EAAE,cAAc,CAIhC;IAEF,uCAAuC;IACvC,aAAa,EAAE,cAAc,CAK3B;IAEF,8CAA8C;IAC9C,UAAU,EAAE,cAAc,CAKxB;IAEF,6BAA6B;IAC7B,QAAQ,EAAE,cAAc,CAGtB;CACH"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.KinshipCalcController = void 0;
|
|
4
|
+
const core_1 = require("@octo-cyber/core");
|
|
5
|
+
const kinship_calc_service_js_1 = require("../services/kinship-calc.service.js");
|
|
6
|
+
const kinship_schema_js_1 = require("../schemas/kinship.schema.js");
|
|
7
|
+
const VALID_REGIONS = ['standard', 'northern', 'southern', 'cantonese', 'minnan', 'wu'];
|
|
8
|
+
class KinshipCalcController {
|
|
9
|
+
service = core_1.Container.get(kinship_calc_service_js_1.KinshipCalcService);
|
|
10
|
+
/** POST /api/kinship/calculate */
|
|
11
|
+
calculate = (0, core_1.asyncHandler)(async (req, res) => {
|
|
12
|
+
const dto = kinship_schema_js_1.CalculateKinshipSchema.parse(req.body);
|
|
13
|
+
const result = this.service.calculate(dto);
|
|
14
|
+
res.json(core_1.ApiResponse.ok(result));
|
|
15
|
+
});
|
|
16
|
+
/** POST /api/kinship/chain */
|
|
17
|
+
calculateFromChain = (0, core_1.asyncHandler)(async (req, res) => {
|
|
18
|
+
const dto = kinship_schema_js_1.PathFromChainSchema.parse(req.body);
|
|
19
|
+
const result = this.service.calculateFromChain(dto);
|
|
20
|
+
res.json(core_1.ApiResponse.ok(result));
|
|
21
|
+
});
|
|
22
|
+
/** POST /api/kinship/conflict-check */
|
|
23
|
+
checkConflict = (0, core_1.asyncHandler)(async (req, res) => {
|
|
24
|
+
const { paths } = req.body;
|
|
25
|
+
if (!Array.isArray(paths))
|
|
26
|
+
throw core_1.AppError.badRequest('paths 必须是数组');
|
|
27
|
+
const result = this.service.checkConflict(paths);
|
|
28
|
+
res.json(core_1.ApiResponse.ok(result));
|
|
29
|
+
});
|
|
30
|
+
/** GET /api/kinship/titles?region=standard */
|
|
31
|
+
listTitles = (0, core_1.asyncHandler)(async (req, res) => {
|
|
32
|
+
const region = (req.query.region || 'standard');
|
|
33
|
+
if (!VALID_REGIONS.includes(region))
|
|
34
|
+
throw core_1.AppError.badRequest(`不支持的地区:${region}`);
|
|
35
|
+
const list = this.service.listAllTitles(region);
|
|
36
|
+
res.json(core_1.ApiResponse.ok(list));
|
|
37
|
+
});
|
|
38
|
+
/** GET /api/kinship/atoms */
|
|
39
|
+
getAtoms = (0, core_1.asyncHandler)(async (_req, res) => {
|
|
40
|
+
const atoms = this.service.getRelationAtoms();
|
|
41
|
+
res.json(core_1.ApiResponse.ok(atoms));
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
exports.KinshipCalcController = KinshipCalcController;
|
|
45
|
+
//# sourceMappingURL=kinship-calc.controller.js.map
|
|
@@ -0,0 +1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I,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;YAAE,MAAM,eAAQ,CAAC,UAAU,CAAC,aAAa,CAAC,CAAA;QACnE,MAAM,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,KAAK,CAAC,CAAA;QAChD,GAAG,CAAC,IAAI,CAAC,kBAAW,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC,CAAA;IAClC,CAAC,CAAC,CAAA;IAEF,8CAA8C;IAC9C,UAAU,GAAmB,IAAA,mBAAY,EAAC,KAAK,EAAE,GAAY,EAAE,GAAa,EAAE,EAAE;QAC9E,MAAM,MAAM,GAAG,CAAE,GAAG,CAAC,KAAK,CAAC,MAAiB,IAAI,UAAU,CAAW,CAAA;QACrE,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,MAAM,CAAC;YAAE,MAAM,eAAQ,CAAC,UAAU,CAAC,UAAU,MAAM,EAAE,CAAC,CAAA;QAClF,MAAM,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,CAAA;QAC/C,GAAG,CAAC,IAAI,CAAC,kBAAW,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,CAAA;IAChC,CAAC,CAAC,CAAA;IAEF,6BAA6B;IAC7B,QAAQ,GAAmB,IAAA,mBAAY,EAAC,KAAK,EAAE,IAAa,EAAE,GAAa,EAAE,EAAE;QAC7E,MAAM,KAAK,GAAG,IAAI,CAAC,OAAO,CAAC,gBAAgB,EAAE,CAAA;QAC7C,GAAG,CAAC,IAAI,CAAC,kBAAW,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAA;IACjC,CAAC,CAAC,CAAA;CACH;AAtCD,sDAsCC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { calculateKinship, detectGenerationConflict } from './kinship-engine.js';
|
|
2
|
+
export type { KinshipResult, CalcOptions, Region } from './kinship-engine.js';
|
|
3
|
+
export { KINSHIP_TABLE, KINSHIP_LOOKUP } from './kinship-data.js';
|
|
4
|
+
export type { KinshipEntry } from './kinship-data.js';
|
|
5
|
+
export { encodePath, decodePath, pathGenerationDelta, atomGender } from './relation-path.js';
|
|
6
|
+
export type { RelationAtom, EgoGender } from './relation-path.js';
|
|
7
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/engine/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,wBAAwB,EAAE,MAAM,qBAAqB,CAAA;AAChF,YAAY,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAA;AAC7E,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAA;AACjE,YAAY,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AACrD,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,mBAAmB,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAA;AAC5F,YAAY,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAA"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.atomGender = exports.pathGenerationDelta = exports.decodePath = exports.encodePath = exports.KINSHIP_LOOKUP = exports.KINSHIP_TABLE = exports.detectGenerationConflict = exports.calculateKinship = void 0;
|
|
4
|
+
var kinship_engine_js_1 = require("./kinship-engine.js");
|
|
5
|
+
Object.defineProperty(exports, "calculateKinship", { enumerable: true, get: function () { return kinship_engine_js_1.calculateKinship; } });
|
|
6
|
+
Object.defineProperty(exports, "detectGenerationConflict", { enumerable: true, get: function () { return kinship_engine_js_1.detectGenerationConflict; } });
|
|
7
|
+
var kinship_data_js_1 = require("./kinship-data.js");
|
|
8
|
+
Object.defineProperty(exports, "KINSHIP_TABLE", { enumerable: true, get: function () { return kinship_data_js_1.KINSHIP_TABLE; } });
|
|
9
|
+
Object.defineProperty(exports, "KINSHIP_LOOKUP", { enumerable: true, get: function () { return kinship_data_js_1.KINSHIP_LOOKUP; } });
|
|
10
|
+
var relation_path_js_1 = require("./relation-path.js");
|
|
11
|
+
Object.defineProperty(exports, "encodePath", { enumerable: true, get: function () { return relation_path_js_1.encodePath; } });
|
|
12
|
+
Object.defineProperty(exports, "decodePath", { enumerable: true, get: function () { return relation_path_js_1.decodePath; } });
|
|
13
|
+
Object.defineProperty(exports, "pathGenerationDelta", { enumerable: true, get: function () { return relation_path_js_1.pathGenerationDelta; } });
|
|
14
|
+
Object.defineProperty(exports, "atomGender", { enumerable: true, get: function () { return relation_path_js_1.atomGender; } });
|
|
15
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/engine/index.ts"],"names":[],"mappings":";;;AAAA,yDAAgF;AAAvE,qHAAA,gBAAgB,OAAA;AAAE,6HAAA,wBAAwB,OAAA;AAEnD,qDAAiE;AAAxD,gHAAA,aAAa,OAAA;AAAE,iHAAA,cAAc,OAAA;AAEtC,uDAA4F;AAAnF,8GAAA,UAAU,OAAA;AAAE,8GAAA,UAAU,OAAA;AAAE,uHAAA,mBAAmB,OAAA;AAAE,8GAAA,UAAU,OAAA"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Comprehensive Chinese kinship term lookup table.
|
|
3
|
+
*
|
|
4
|
+
* Each entry: { path, standard, northern?, southern?, cantonese?, minnan?, wu?, reverse?, note? }
|
|
5
|
+
*
|
|
6
|
+
* path: encoded relation path (dot-separated atoms)
|
|
7
|
+
* standard: standard Mandarin title (普通话)
|
|
8
|
+
* northern: northern dialect variant (北方)
|
|
9
|
+
* southern: southern Mandarin variant (南方官话)
|
|
10
|
+
* cantonese: Cantonese variant (粤语)
|
|
11
|
+
* minnan: Min-nan / Hokkien variant (闽南语)
|
|
12
|
+
* wu: Wu dialect variant (吴语/上海话)
|
|
13
|
+
* reverse: how the relative addresses ego (男/女 separated by /)
|
|
14
|
+
* note: explanatory note
|
|
15
|
+
*/
|
|
16
|
+
export interface KinshipEntry {
|
|
17
|
+
path: string;
|
|
18
|
+
standard: string;
|
|
19
|
+
northern?: string;
|
|
20
|
+
southern?: string;
|
|
21
|
+
cantonese?: string;
|
|
22
|
+
minnan?: string;
|
|
23
|
+
wu?: string;
|
|
24
|
+
reverse?: string;
|
|
25
|
+
note?: string;
|
|
26
|
+
}
|
|
27
|
+
export declare const KINSHIP_TABLE: KinshipEntry[];
|
|
28
|
+
/** Build a lookup map for O(1) access */
|
|
29
|
+
export declare function buildLookupMap(table: KinshipEntry[]): Map<string, KinshipEntry>;
|
|
30
|
+
export declare const KINSHIP_LOOKUP: Map<string, KinshipEntry>;
|
|
31
|
+
//# sourceMappingURL=kinship-data.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"kinship-data.d.ts","sourceRoot":"","sources":["../../src/engine/kinship-data.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAA;IACZ,QAAQ,EAAE,MAAM,CAAA;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,EAAE,CAAC,EAAE,MAAM,CAAA;IACX,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,IAAI,CAAC,EAAE,MAAM,CAAA;CACd;AAED,eAAO,MAAM,aAAa,EAAE,YAAY,EAoJvC,CAAA;AAED,yCAAyC;AACzC,wBAAgB,cAAc,CAAC,KAAK,EAAE,YAAY,EAAE,GAAG,GAAG,CAAC,MAAM,EAAE,YAAY,CAAC,CAM/E;AAED,eAAO,MAAM,cAAc,2BAAgC,CAAA"}
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Comprehensive Chinese kinship term lookup table.
|
|
4
|
+
*
|
|
5
|
+
* Each entry: { path, standard, northern?, southern?, cantonese?, minnan?, wu?, reverse?, note? }
|
|
6
|
+
*
|
|
7
|
+
* path: encoded relation path (dot-separated atoms)
|
|
8
|
+
* standard: standard Mandarin title (普通话)
|
|
9
|
+
* northern: northern dialect variant (北方)
|
|
10
|
+
* southern: southern Mandarin variant (南方官话)
|
|
11
|
+
* cantonese: Cantonese variant (粤语)
|
|
12
|
+
* minnan: Min-nan / Hokkien variant (闽南语)
|
|
13
|
+
* wu: Wu dialect variant (吴语/上海话)
|
|
14
|
+
* reverse: how the relative addresses ego (男/女 separated by /)
|
|
15
|
+
* note: explanatory note
|
|
16
|
+
*/
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
exports.KINSHIP_LOOKUP = exports.KINSHIP_TABLE = void 0;
|
|
19
|
+
exports.buildLookupMap = buildLookupMap;
|
|
20
|
+
exports.KINSHIP_TABLE = [
|
|
21
|
+
// ── 直系 ─────────────────────────────────────────────────────────
|
|
22
|
+
// Parents
|
|
23
|
+
{ path: 'F', standard: '父亲', northern: '爸', cantonese: '爸爸', reverse: '孩子', note: '父' },
|
|
24
|
+
{ path: 'M', standard: '母亲', northern: '妈', cantonese: '妈妈', reverse: '孩子', note: '母' },
|
|
25
|
+
// Grandparents (paternal)
|
|
26
|
+
{ path: 'F.F', standard: '祖父', northern: '爷爷', southern: '公公', cantonese: '爺爺', minnan: '阿公', wu: '阿爷', reverse: '孙子/孙女', note: '父父' },
|
|
27
|
+
{ path: 'F.M', standard: '祖母', northern: '奶奶', southern: '婆婆', cantonese: '嫲嫲', minnan: '阿嬷', wu: '阿嬶', reverse: '孙子/孙女', note: '父母' },
|
|
28
|
+
// Grandparents (maternal)
|
|
29
|
+
{ path: 'M.F', standard: '外祖父', northern: '姥爷', southern: '外公', cantonese: '外公', minnan: '阿公', wu: '外公', reverse: '外孙/外孙女', note: '母父' },
|
|
30
|
+
{ path: 'M.M', standard: '外祖母', northern: '姥姥', southern: '外婆', cantonese: '外婆', minnan: '阿妈', wu: '外婆', reverse: '外孙/外孙女', note: '母母' },
|
|
31
|
+
// Great-grandparents (paternal)
|
|
32
|
+
{ path: 'F.F.F', standard: '曾祖父', northern: '太爷爷', reverse: '曾孙/曾孙女' },
|
|
33
|
+
{ path: 'F.F.M', standard: '曾祖母', northern: '太奶奶', reverse: '曾孙/曾孙女' },
|
|
34
|
+
{ path: 'M.M.F', standard: '外曾祖父', northern: '太姥爷', reverse: '曾外孙/曾外孙女' },
|
|
35
|
+
{ path: 'M.M.M', standard: '外曾祖母', northern: '太姥姥', reverse: '曾外孙/曾外孙女' },
|
|
36
|
+
// Great-great-grandparents
|
|
37
|
+
{ path: 'F.F.F.F', standard: '高祖父', reverse: '玄孙/玄孙女' },
|
|
38
|
+
{ path: 'F.F.F.M', standard: '高祖母', reverse: '玄孙/玄孙女' },
|
|
39
|
+
// Children
|
|
40
|
+
{ path: 'S', standard: '儿子', northern: '儿子', cantonese: '仔', minnan: '囝', reverse: '父亲/母亲' },
|
|
41
|
+
{ path: 'D', standard: '女儿', northern: '闺女', cantonese: '囡', reverse: '父亲/母亲' },
|
|
42
|
+
// Grandchildren (paternal line)
|
|
43
|
+
{ path: 'S.S', standard: '孙子', cantonese: '孙仔', reverse: '祖父/祖母' },
|
|
44
|
+
{ path: 'S.D', standard: '孙女', cantonese: '孙囡', reverse: '祖父/祖母' },
|
|
45
|
+
{ path: 'D.S', standard: '外孙', reverse: '外祖父/外祖母' },
|
|
46
|
+
{ path: 'D.D', standard: '外孙女', reverse: '外祖父/外祖母' },
|
|
47
|
+
// Great-grandchildren
|
|
48
|
+
{ path: 'S.S.S', standard: '曾孙', reverse: '曾祖父/曾祖母' },
|
|
49
|
+
{ path: 'S.S.D', standard: '曾孙女', reverse: '曾祖父/曾祖母' },
|
|
50
|
+
// Spouse
|
|
51
|
+
{ path: 'H', standard: '丈夫', northern: '老公', cantonese: '老公', reverse: '妻子/老婆' },
|
|
52
|
+
{ path: 'W', standard: '妻子', northern: '老婆', cantonese: '老婆', reverse: '丈夫/老公' },
|
|
53
|
+
// ── 旁系 (collateral) ────────────────────────────────────────────
|
|
54
|
+
// Father's brothers
|
|
55
|
+
{ path: 'F.B+', standard: '伯父', northern: '大爷', cantonese: '伯父', minnan: '阿伯', wu: '伯伯', reverse: '侄子/侄女', note: '父之兄' },
|
|
56
|
+
{ path: 'F.B-', standard: '叔父', northern: '叔叔', cantonese: '叔父', minnan: '阿叔', wu: '叔叔', reverse: '侄子/侄女', note: '父之弟' },
|
|
57
|
+
// Father's sisters
|
|
58
|
+
{ path: 'F.Z+', standard: '姑母', northern: '大姑', cantonese: '姑母', minnan: '阿姑', wu: '姑妈', reverse: '侄子/侄女', note: '父之姐' },
|
|
59
|
+
{ path: 'F.Z-', standard: '姑母', northern: '姑姑', cantonese: '姑母', minnan: '阿姑', wu: '姑姑', reverse: '侄子/侄女', note: '父之妹' },
|
|
60
|
+
// Mother's brothers
|
|
61
|
+
{ path: 'M.B+', standard: '舅父', northern: '大舅', cantonese: '舅父', minnan: '阿舅', wu: '舅舅', reverse: '外甥/外甥女', note: '母之兄' },
|
|
62
|
+
{ path: 'M.B-', standard: '舅父', northern: '舅舅', cantonese: '舅父', minnan: '阿舅', wu: '舅舅', reverse: '外甥/外甥女', note: '母之弟' },
|
|
63
|
+
// Mother's sisters
|
|
64
|
+
{ path: 'M.Z+', standard: '姨母', northern: '大姨', cantonese: '姨母', minnan: '阿姨', wu: '阿姨', reverse: '外甥/外甥女', note: '母之姐' },
|
|
65
|
+
{ path: 'M.Z-', standard: '姨母', northern: '阿姨', cantonese: '姨母', minnan: '阿姨', wu: '阿姨', reverse: '外甥/外甥女', note: '母之妹' },
|
|
66
|
+
// Siblings
|
|
67
|
+
{ path: 'B+', standard: '兄长', northern: '哥哥', cantonese: '大佬', minnan: '阿兄', wu: '阿哥', reverse: '弟弟/妹妹' },
|
|
68
|
+
{ path: 'B-', standard: '弟弟', northern: '弟弟', cantonese: '细佬', minnan: '小弟', wu: '阿弟', reverse: '哥哥/姐姐' },
|
|
69
|
+
{ path: 'Z+', standard: '姐姐', northern: '姐姐', cantonese: '家姐', minnan: '阿姐', wu: '阿姐', reverse: '弟弟/妹妹' },
|
|
70
|
+
{ path: 'Z-', standard: '妹妹', northern: '妹妹', cantonese: '妹妹', minnan: '小妹', wu: '阿妹', reverse: '哥哥/姐姐' },
|
|
71
|
+
// Paternal cousins (堂)
|
|
72
|
+
{ path: 'F.B+.S', standard: '堂兄', northern: '堂哥', note: '伯父之子(年长)' },
|
|
73
|
+
{ path: 'F.B+.D', standard: '堂姐', northern: '堂姐', note: '伯父之女(年长)' },
|
|
74
|
+
{ path: 'F.B-.S', standard: '堂弟', northern: '堂弟', note: '叔叔之子(年幼)' },
|
|
75
|
+
{ path: 'F.B-.D', standard: '堂妹', northern: '堂妹', note: '叔叔之女(年幼)' },
|
|
76
|
+
{ path: 'F.Z+.S', standard: '表兄', northern: '表哥', note: '姑母之子(年长)' },
|
|
77
|
+
{ path: 'F.Z+.D', standard: '表姐', northern: '表姐', note: '姑母之女(年长)' },
|
|
78
|
+
{ path: 'F.Z-.S', standard: '表弟', northern: '表弟', note: '姑母之子(年幼)' },
|
|
79
|
+
{ path: 'F.Z-.D', standard: '表妹', northern: '表妹', note: '姑母之女(年幼)' },
|
|
80
|
+
// Maternal cousins (表)
|
|
81
|
+
{ path: 'M.B+.S', standard: '表兄', northern: '表哥', note: '舅父之子(年长)' },
|
|
82
|
+
{ path: 'M.B+.D', standard: '表姐', northern: '表姐', note: '舅父之女(年长)' },
|
|
83
|
+
{ path: 'M.B-.S', standard: '表弟', northern: '表弟', note: '舅父之子(年幼)' },
|
|
84
|
+
{ path: 'M.B-.D', standard: '表妹', northern: '表妹', note: '舅父之女(年幼)' },
|
|
85
|
+
{ path: 'M.Z+.S', standard: '表兄', northern: '表哥', note: '姨母之子(年长)' },
|
|
86
|
+
{ path: 'M.Z+.D', standard: '表姐', northern: '表姐', note: '姨母之女(年长)' },
|
|
87
|
+
{ path: 'M.Z-.S', standard: '表弟', northern: '表弟', note: '姨母之子(年幼)' },
|
|
88
|
+
{ path: 'M.Z-.D', standard: '表妹', northern: '表妹', note: '姨母之女(年幼)' },
|
|
89
|
+
// Nephews/nieces (siblings' children)
|
|
90
|
+
{ path: 'B+.S', standard: '侄子', reverse: '伯父/伯母' },
|
|
91
|
+
{ path: 'B+.D', standard: '侄女', reverse: '伯父/伯母' },
|
|
92
|
+
{ path: 'B-.S', standard: '侄子', reverse: '叔叔/婶婶' },
|
|
93
|
+
{ path: 'B-.D', standard: '侄女', reverse: '叔叔/婶婶' },
|
|
94
|
+
{ path: 'Z+.S', standard: '外甥', northern: '外甥', note: '姐之子', reverse: '舅父/舅母' },
|
|
95
|
+
{ path: 'Z+.D', standard: '外甥女', northern: '外甥女', note: '姐之女', reverse: '舅父/舅母' },
|
|
96
|
+
{ path: 'Z-.S', standard: '外甥', northern: '外甥', note: '妹之子', reverse: '舅父/舅母' },
|
|
97
|
+
{ path: 'Z-.D', standard: '外甥女', northern: '外甥女', note: '妹之女', reverse: '舅父/舅母' },
|
|
98
|
+
// ── 姻亲 (in-laws) ───────────────────────────────────────────────
|
|
99
|
+
// Spouse's parents
|
|
100
|
+
{ path: 'W.F', standard: '岳父', northern: '老丈人', cantonese: '外父', wu: '丈人', reverse: '女婿' },
|
|
101
|
+
{ path: 'W.M', standard: '岳母', northern: '丈母娘', cantonese: '外母', wu: '丈母', reverse: '女婿' },
|
|
102
|
+
{ path: 'H.F', standard: '公公', cantonese: '家翁', wu: '阿公', reverse: '儿媳' },
|
|
103
|
+
{ path: 'H.M', standard: '婆婆', cantonese: '家姑', wu: '阿婆', reverse: '儿媳' },
|
|
104
|
+
// Children's spouses
|
|
105
|
+
{ path: 'S.W', standard: '儿媳妇', northern: '儿媳', reverse: '公公/婆婆' },
|
|
106
|
+
{ path: 'D.H', standard: '女婿', reverse: '岳父/岳母' },
|
|
107
|
+
// Siblings' spouses
|
|
108
|
+
{ path: 'B+.W', standard: '嫂子', northern: '嫂嫂', cantonese: '大嫂', reverse: '小叔/小姑' },
|
|
109
|
+
{ path: 'B-.W', standard: '弟媳', northern: '弟妹', cantonese: '弟妇', reverse: '大伯/大姑' },
|
|
110
|
+
{ path: 'Z+.H', standard: '姐夫', cantonese: '姐夫', reverse: '小舅/小姨' },
|
|
111
|
+
{ path: 'Z-.H', standard: '妹夫', cantonese: '妹夫', reverse: '大舅/大姨' },
|
|
112
|
+
// Spouse's siblings
|
|
113
|
+
{ path: 'H.B+', standard: '大伯子', northern: '大伯', note: '夫之兄' },
|
|
114
|
+
{ path: 'H.B-', standard: '小叔子', northern: '小叔', note: '夫之弟' },
|
|
115
|
+
{ path: 'H.Z+', standard: '大姑子', northern: '大姑', note: '夫之姐' },
|
|
116
|
+
{ path: 'H.Z-', standard: '小姑子', northern: '小姑', note: '夫之妹' },
|
|
117
|
+
{ path: 'W.B+', standard: '大舅子', northern: '大舅哥', note: '妻之兄' },
|
|
118
|
+
{ path: 'W.B-', standard: '小舅子', northern: '小舅子', note: '妻之弟' },
|
|
119
|
+
{ path: 'W.Z+', standard: '大姨子', northern: '大姨姐', note: '妻之姐' },
|
|
120
|
+
{ path: 'W.Z-', standard: '小姨子', northern: '小姨妹', note: '妻之妹' },
|
|
121
|
+
// Father's brothers' wives
|
|
122
|
+
{ path: 'F.B+.W', standard: '伯母', northern: '大娘', cantonese: '伯娘', minnan: '阿婶', wu: '伯娘', reverse: '侄子/侄女' },
|
|
123
|
+
{ path: 'F.B-.W', standard: '婶母', northern: '婶婶', cantonese: '婶母', minnan: '阿婶', wu: '阿婶', reverse: '侄子/侄女' },
|
|
124
|
+
// Father's sisters' husbands
|
|
125
|
+
{ path: 'F.Z+.H', standard: '姑父', northern: '姑父', reverse: '外甥/外甥女' },
|
|
126
|
+
{ path: 'F.Z-.H', standard: '姑父', northern: '姑父', reverse: '外甥/外甥女' },
|
|
127
|
+
// Mother's brothers' wives
|
|
128
|
+
{ path: 'M.B+.W', standard: '舅母', northern: '大妗', note: '舅父之妻' },
|
|
129
|
+
{ path: 'M.B-.W', standard: '舅母', northern: '舅妈', note: '舅父之妻' },
|
|
130
|
+
// Mother's sisters' husbands
|
|
131
|
+
{ path: 'M.Z+.H', standard: '姨父', northern: '姨夫', reverse: '外甥/外甥女' },
|
|
132
|
+
{ path: 'M.Z-.H', standard: '姨父', northern: '姨夫', reverse: '外甥/外甥女' },
|
|
133
|
+
// Grandparents' siblings (祖父/祖母的兄弟姐妹)
|
|
134
|
+
{ path: 'F.F.B+', standard: '伯祖父', northern: '老爷爷' },
|
|
135
|
+
{ path: 'F.F.B-', standard: '叔祖父', northern: '老爷爷' },
|
|
136
|
+
{ path: 'F.F.Z+', standard: '姑祖母', northern: '姑奶奶' },
|
|
137
|
+
{ path: 'F.F.Z-', standard: '姑祖母', northern: '姑奶奶' },
|
|
138
|
+
{ path: 'F.M.B+', standard: '舅祖父', northern: '舅太爷' },
|
|
139
|
+
{ path: 'F.M.Z+', standard: '姨祖母', northern: '姨奶奶' },
|
|
140
|
+
];
|
|
141
|
+
/** Build a lookup map for O(1) access */
|
|
142
|
+
function buildLookupMap(table) {
|
|
143
|
+
const map = new Map();
|
|
144
|
+
for (const entry of table) {
|
|
145
|
+
map.set(entry.path, entry);
|
|
146
|
+
}
|
|
147
|
+
return map;
|
|
148
|
+
}
|
|
149
|
+
exports.KINSHIP_LOOKUP = buildLookupMap(exports.KINSHIP_TABLE);
|
|
150
|
+
//# sourceMappingURL=kinship-data.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"kinship-data.js","sourceRoot":"","sources":["../../src/engine/kinship-data.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAqKH,wCAMC;AA7JY,QAAA,aAAa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GAAG,GAAG,IAAI,GAAG,EAAwB,CAAA;IAC3C,KAAK,MAAM,KAAK,IAAI,KAAK,EAAE,CAAC;QAC1B,GAAG,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,CAAA;IAC5B,CAAC;IACD,OAAO,GAAG,CAAA;AACZ,CAAC;AAEY,QAAA,cAAc,GAAG,cAAc,CAAC,qBAAa,CAAC,CAAA"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Kinship Engine — core calculation logic.
|
|
3
|
+
*
|
|
4
|
+
* Given a relation path (sequence of atoms) and ego's gender,
|
|
5
|
+
* returns the appropriate Chinese kinship title with regional variants.
|
|
6
|
+
*/
|
|
7
|
+
export type Region = 'standard' | 'northern' | 'southern' | 'cantonese' | 'minnan' | 'wu';
|
|
8
|
+
export interface KinshipResult {
|
|
9
|
+
/** The canonical relation path used for lookup */
|
|
10
|
+
path: string;
|
|
11
|
+
/** Title in requested region */
|
|
12
|
+
title: string;
|
|
13
|
+
/** Standard Mandarin title for reference */
|
|
14
|
+
standardTitle: string;
|
|
15
|
+
/** How the relative addresses ego */
|
|
16
|
+
reverseTitle: string | null;
|
|
17
|
+
/** Generation delta: positive = elder, negative = younger */
|
|
18
|
+
generationDelta: number;
|
|
19
|
+
/** Gender of the relative */
|
|
20
|
+
relativeGender: 'male' | 'female' | 'unknown';
|
|
21
|
+
/** Whether this is a known/exact match (false = estimated) */
|
|
22
|
+
isExact: boolean;
|
|
23
|
+
/** Brief note */
|
|
24
|
+
note: string | null;
|
|
25
|
+
/** All available regional variants */
|
|
26
|
+
variants: Partial<Record<Region, string>>;
|
|
27
|
+
}
|
|
28
|
+
export interface CalcOptions {
|
|
29
|
+
region?: Region;
|
|
30
|
+
egoGender?: 'male' | 'female';
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Calculate the kinship title for a given relation path.
|
|
34
|
+
* @param path dot-separated atom path, e.g. "F.B-.W"
|
|
35
|
+
* @param options region and ego gender
|
|
36
|
+
*/
|
|
37
|
+
export declare function calculateKinship(path: string, options?: CalcOptions): KinshipResult;
|
|
38
|
+
/**
|
|
39
|
+
* Detect generational conflict — returns true if the path creates an
|
|
40
|
+
* impossible or paradoxical family structure.
|
|
41
|
+
* Example: ego being uncle AND father to the same person would be a conflict.
|
|
42
|
+
*/
|
|
43
|
+
export declare function detectGenerationConflict(paths: string[]): string | null;
|
|
44
|
+
//# sourceMappingURL=kinship-engine.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"kinship-engine.d.ts","sourceRoot":"","sources":["../../src/engine/kinship-engine.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAKH,MAAM,MAAM,MAAM,GAAG,UAAU,GAAG,UAAU,GAAG,UAAU,GAAG,WAAW,GAAG,QAAQ,GAAG,IAAI,CAAA;AAEzF,MAAM,WAAW,aAAa;IAC5B,kDAAkD;IAClD,IAAI,EAAE,MAAM,CAAA;IACZ,gCAAgC;IAChC,KAAK,EAAE,MAAM,CAAA;IACb,4CAA4C;IAC5C,aAAa,EAAE,MAAM,CAAA;IACrB,qCAAqC;IACrC,YAAY,EAAE,MAAM,GAAG,IAAI,CAAA;IAC3B,6DAA6D;IAC7D,eAAe,EAAE,MAAM,CAAA;IACvB,6BAA6B;IAC7B,cAAc,EAAE,MAAM,GAAG,QAAQ,GAAG,SAAS,CAAA;IAC7C,8DAA8D;IAC9D,OAAO,EAAE,OAAO,CAAA;IAChB,iBAAiB;IACjB,IAAI,EAAE,MAAM,GAAG,IAAI,CAAA;IACnB,sCAAsC;IACtC,QAAQ,EAAE,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAA;CAC1C;AAED,MAAM,WAAW,WAAW;IAC1B,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,SAAS,CAAC,EAAE,MAAM,GAAG,QAAQ,CAAA;CAC9B;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,GAAE,WAAgB,GAAG,aAAa,CAmBvF;AAuJD;;;;GAIG;AACH,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,MAAM,GAAG,IAAI,CAWvE"}
|