aifastdb 0.2.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/aidb.win32-x64-msvc.node +0 -0
- package/aifastdb.win32-x64-msvc.node +0 -0
- package/dist/client.d.ts +140 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +270 -0
- package/dist/client.js.map +1 -0
- package/dist/connectme-adapter.d.ts +76 -0
- package/dist/connectme-adapter.d.ts.map +1 -0
- package/dist/connectme-adapter.js +456 -0
- package/dist/connectme-adapter.js.map +1 -0
- package/dist/family-tree.d.ts +482 -0
- package/dist/family-tree.d.ts.map +1 -0
- package/dist/family-tree.js +676 -0
- package/dist/family-tree.js.map +1 -0
- package/dist/family-types.d.ts +228 -0
- package/dist/family-types.d.ts.map +1 -0
- package/dist/family-types.js +108 -0
- package/dist/family-types.js.map +1 -0
- package/dist/index.d.ts +25 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +70 -0
- package/dist/index.js.map +1 -0
- package/dist/memory-manager.d.ts +82 -0
- package/dist/memory-manager.d.ts.map +1 -0
- package/dist/memory-manager.js +273 -0
- package/dist/memory-manager.js.map +1 -0
- package/dist/native.d.ts +352 -0
- package/dist/native.d.ts.map +1 -0
- package/dist/native.js +35 -0
- package/dist/native.js.map +1 -0
- package/dist/query-builder.d.ts +143 -0
- package/dist/query-builder.d.ts.map +1 -0
- package/dist/query-builder.js +240 -0
- package/dist/query-builder.js.map +1 -0
- package/dist/social-graph.d.ts +392 -0
- package/dist/social-graph.d.ts.map +1 -0
- package/dist/social-graph.js +545 -0
- package/dist/social-graph.js.map +1 -0
- package/dist/social-types.d.ts +379 -0
- package/dist/social-types.d.ts.map +1 -0
- package/dist/social-types.js +34 -0
- package/dist/social-types.js.map +1 -0
- package/dist/types.d.ts +475 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +161 -0
- package/dist/types.js.map +1 -0
- package/dist/vibe-synapse.d.ts +174 -0
- package/dist/vibe-synapse.d.ts.map +1 -0
- package/dist/vibe-synapse.js +509 -0
- package/dist/vibe-synapse.js.map +1 -0
- package/package.json +61 -0
- package/vibebase.node +0 -0
- package/vibebase.win32-x64-msvc.node +0 -0
|
@@ -0,0 +1,482 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* FamilyTree - High-level TypeScript API for family tree (genealogy) operations
|
|
3
|
+
*
|
|
4
|
+
* Provides a friendly API wrapper around the native Rust family tree implementation.
|
|
5
|
+
* Supports family relationship management, ancestor/descendant traversal,
|
|
6
|
+
* relationship calculation, and Chinese kinship title derivation.
|
|
7
|
+
*/
|
|
8
|
+
import type { Entity, Relation } from './social-types';
|
|
9
|
+
import type { Gender, FamilyPath, FamilyTree as FamilyTreeData, FamilyStats, SpouseInfo, BuildFamilyTreeOptions, TraversalOptions } from './family-types';
|
|
10
|
+
/**
|
|
11
|
+
* FamilyTreeManager provides high-level APIs for family tree operations.
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```typescript
|
|
15
|
+
* const db = new AiFastDb({ path: './data', dimension: 768 });
|
|
16
|
+
* const social = db.socialGraph();
|
|
17
|
+
* const family = new FamilyTreeManager(social);
|
|
18
|
+
*
|
|
19
|
+
* // Add family members with gender
|
|
20
|
+
* const father = social.addPerson({ name: '张明', properties: { gender: 'male' } });
|
|
21
|
+
* const mother = social.addPerson({ name: '李芳', properties: { gender: 'female' } });
|
|
22
|
+
* const child = social.addPerson({ name: '张小明', properties: { gender: 'male' } });
|
|
23
|
+
*
|
|
24
|
+
* // Create family relationships
|
|
25
|
+
* family.addParentChild(father.id, child.id);
|
|
26
|
+
* family.addParentChild(mother.id, child.id);
|
|
27
|
+
* family.addSpouse(father.id, mother.id);
|
|
28
|
+
*
|
|
29
|
+
* // Query relationships
|
|
30
|
+
* const parents = family.getParents(child.id);
|
|
31
|
+
* const title = family.getRelationshipTitle(child.id, father.id); // "父亲"
|
|
32
|
+
* ```
|
|
33
|
+
*/
|
|
34
|
+
export declare class FamilyTreeManager {
|
|
35
|
+
private native;
|
|
36
|
+
/**
|
|
37
|
+
* Create a new FamilyTreeManager
|
|
38
|
+
* @param socialGraph - The SocialGraph instance (from db.socialGraph())
|
|
39
|
+
*/
|
|
40
|
+
constructor(socialGraph: any);
|
|
41
|
+
/**
|
|
42
|
+
* Add parent-child relationship
|
|
43
|
+
*
|
|
44
|
+
* Creates a directed relationship from parent to child.
|
|
45
|
+
* Automatically determines father/mother based on parent's gender property.
|
|
46
|
+
*
|
|
47
|
+
* @param parentId - The parent's ID
|
|
48
|
+
* @param childId - The child's ID
|
|
49
|
+
* @returns The created relation, or null if failed
|
|
50
|
+
*/
|
|
51
|
+
addParentChild(parentId: string, childId: string): Relation | null;
|
|
52
|
+
/**
|
|
53
|
+
* Add spouse relationship (bidirectional)
|
|
54
|
+
*
|
|
55
|
+
* @param personA - First person's ID
|
|
56
|
+
* @param personB - Second person's ID
|
|
57
|
+
* @returns The created relation, or null if failed
|
|
58
|
+
*/
|
|
59
|
+
addSpouse(personA: string, personB: string): Relation | null;
|
|
60
|
+
/**
|
|
61
|
+
* Add sibling relationship (bidirectional)
|
|
62
|
+
*
|
|
63
|
+
* @param personA - First person's ID
|
|
64
|
+
* @param personB - Second person's ID
|
|
65
|
+
* @param halfSibling - Whether this is a half-sibling relationship (default: false)
|
|
66
|
+
* @returns The created relation, or null if failed
|
|
67
|
+
*/
|
|
68
|
+
addSibling(personA: string, personB: string, halfSibling?: boolean): Relation | null;
|
|
69
|
+
/**
|
|
70
|
+
* Remove family relationship between two people
|
|
71
|
+
*
|
|
72
|
+
* @param personA - First person's ID
|
|
73
|
+
* @param personB - Second person's ID
|
|
74
|
+
* @returns True if any relationship was removed
|
|
75
|
+
*/
|
|
76
|
+
removeFamilyRelation(personA: string, personB: string): boolean;
|
|
77
|
+
/**
|
|
78
|
+
* Add step-parent to step-child relationship (继父母-继子女)
|
|
79
|
+
*
|
|
80
|
+
* Used for remarriage families where one spouse brings children from previous marriage.
|
|
81
|
+
*/
|
|
82
|
+
addStepParentChild(stepParentId: string, stepChildId: string): Relation | null;
|
|
83
|
+
/**
|
|
84
|
+
* Add adoptive parent to adopted child relationship (养父母-养子女)
|
|
85
|
+
*/
|
|
86
|
+
addAdoptiveParentChild(adoptiveParentId: string, adoptedChildId: string): Relation | null;
|
|
87
|
+
/**
|
|
88
|
+
* Add ex-spouse relationship (前配偶/前夫/前妻)
|
|
89
|
+
*/
|
|
90
|
+
addExSpouse(personA: string, personB: string): Relation | null;
|
|
91
|
+
/**
|
|
92
|
+
* Get parents of a person
|
|
93
|
+
*/
|
|
94
|
+
getParents(personId: string): Entity[];
|
|
95
|
+
/**
|
|
96
|
+
* Get father of a person
|
|
97
|
+
*/
|
|
98
|
+
getFather(personId: string): Entity | null;
|
|
99
|
+
/**
|
|
100
|
+
* Get mother of a person
|
|
101
|
+
*/
|
|
102
|
+
getMother(personId: string): Entity | null;
|
|
103
|
+
/**
|
|
104
|
+
* Get children of a person
|
|
105
|
+
*/
|
|
106
|
+
getChildren(personId: string): Entity[];
|
|
107
|
+
/**
|
|
108
|
+
* Get sons of a person
|
|
109
|
+
*/
|
|
110
|
+
getSons(personId: string): Entity[];
|
|
111
|
+
/**
|
|
112
|
+
* Get daughters of a person
|
|
113
|
+
*/
|
|
114
|
+
getDaughters(personId: string): Entity[];
|
|
115
|
+
/**
|
|
116
|
+
* Get spouse of a person (current, not ex)
|
|
117
|
+
*/
|
|
118
|
+
getSpouse(personId: string): Entity | null;
|
|
119
|
+
/**
|
|
120
|
+
* Get all spouses including ex-spouses
|
|
121
|
+
*
|
|
122
|
+
* @returns Array of spouse info with isEx flag
|
|
123
|
+
*/
|
|
124
|
+
getAllSpouses(personId: string): SpouseInfo[];
|
|
125
|
+
/**
|
|
126
|
+
* Get step-parents (继父母)
|
|
127
|
+
*/
|
|
128
|
+
getStepParents(personId: string): Entity[];
|
|
129
|
+
/**
|
|
130
|
+
* Get step-father (继父)
|
|
131
|
+
*/
|
|
132
|
+
getStepFather(personId: string): Entity | null;
|
|
133
|
+
/**
|
|
134
|
+
* Get step-mother (继母)
|
|
135
|
+
*/
|
|
136
|
+
getStepMother(personId: string): Entity | null;
|
|
137
|
+
/**
|
|
138
|
+
* Get step-children (继子女)
|
|
139
|
+
*/
|
|
140
|
+
getStepChildren(personId: string): Entity[];
|
|
141
|
+
/**
|
|
142
|
+
* Get adoptive parents (养父母)
|
|
143
|
+
*/
|
|
144
|
+
getAdoptiveParents(personId: string): Entity[];
|
|
145
|
+
/**
|
|
146
|
+
* Get adoptive father (养父)
|
|
147
|
+
*/
|
|
148
|
+
getAdoptiveFather(personId: string): Entity | null;
|
|
149
|
+
/**
|
|
150
|
+
* Get adoptive mother (养母)
|
|
151
|
+
*/
|
|
152
|
+
getAdoptiveMother(personId: string): Entity | null;
|
|
153
|
+
/**
|
|
154
|
+
* Get adopted children (养子女)
|
|
155
|
+
*/
|
|
156
|
+
getAdoptedChildren(personId: string): Entity[];
|
|
157
|
+
/**
|
|
158
|
+
* Get all parents with type (biological/step/adoptive)
|
|
159
|
+
*
|
|
160
|
+
* Returns all parents including biological, step, and adoptive parents
|
|
161
|
+
* with their relationship type.
|
|
162
|
+
*/
|
|
163
|
+
getAllParentsWithType(personId: string): Array<{
|
|
164
|
+
person: Entity;
|
|
165
|
+
type: 'biological' | 'step' | 'adoptive';
|
|
166
|
+
}>;
|
|
167
|
+
/**
|
|
168
|
+
* Get all children with type (biological/step/adopted)
|
|
169
|
+
*
|
|
170
|
+
* Returns all children including biological, step, and adopted children
|
|
171
|
+
* with their relationship type.
|
|
172
|
+
*/
|
|
173
|
+
getAllChildrenWithType(personId: string): Array<{
|
|
174
|
+
person: Entity;
|
|
175
|
+
type: 'biological' | 'step' | 'adopted';
|
|
176
|
+
}>;
|
|
177
|
+
/**
|
|
178
|
+
* Get siblings of a person
|
|
179
|
+
*/
|
|
180
|
+
getSiblings(personId: string): Entity[];
|
|
181
|
+
/**
|
|
182
|
+
* Get brothers of a person
|
|
183
|
+
*/
|
|
184
|
+
getBrothers(personId: string): Entity[];
|
|
185
|
+
/**
|
|
186
|
+
* Get sisters of a person
|
|
187
|
+
*/
|
|
188
|
+
getSisters(personId: string): Entity[];
|
|
189
|
+
/**
|
|
190
|
+
* Get all ancestors (traversing upward)
|
|
191
|
+
*
|
|
192
|
+
* @param personId - The person's ID
|
|
193
|
+
* @param options - Traversal options
|
|
194
|
+
*/
|
|
195
|
+
getAncestors(personId: string, options?: TraversalOptions): Entity[];
|
|
196
|
+
/**
|
|
197
|
+
* Get all descendants (traversing downward)
|
|
198
|
+
*
|
|
199
|
+
* @param personId - The person's ID
|
|
200
|
+
* @param options - Traversal options
|
|
201
|
+
*/
|
|
202
|
+
getDescendants(personId: string, options?: TraversalOptions): Entity[];
|
|
203
|
+
/**
|
|
204
|
+
* Get grandparents of a person
|
|
205
|
+
*/
|
|
206
|
+
getGrandparents(personId: string): Entity[];
|
|
207
|
+
/**
|
|
208
|
+
* Get paternal grandfather (爷爷)
|
|
209
|
+
*/
|
|
210
|
+
getPaternalGrandfather(personId: string): Entity | null;
|
|
211
|
+
/**
|
|
212
|
+
* Get paternal grandmother (奶奶)
|
|
213
|
+
*/
|
|
214
|
+
getPaternalGrandmother(personId: string): Entity | null;
|
|
215
|
+
/**
|
|
216
|
+
* Get maternal grandfather (外公/姥爷)
|
|
217
|
+
*/
|
|
218
|
+
getMaternalGrandfather(personId: string): Entity | null;
|
|
219
|
+
/**
|
|
220
|
+
* Get maternal grandmother (外婆/姥姥)
|
|
221
|
+
*/
|
|
222
|
+
getMaternalGrandmother(personId: string): Entity | null;
|
|
223
|
+
/**
|
|
224
|
+
* Get grandchildren of a person
|
|
225
|
+
*/
|
|
226
|
+
getGrandchildren(personId: string): Entity[];
|
|
227
|
+
/**
|
|
228
|
+
* Get uncles and aunts (叔伯姑姨舅)
|
|
229
|
+
*/
|
|
230
|
+
getUnclesAunts(personId: string): Entity[];
|
|
231
|
+
/**
|
|
232
|
+
* Get paternal uncles (叔叔/伯伯)
|
|
233
|
+
*/
|
|
234
|
+
getPaternalUncles(personId: string): Entity[];
|
|
235
|
+
/**
|
|
236
|
+
* Get paternal aunts (姑姑)
|
|
237
|
+
*/
|
|
238
|
+
getPaternalAunts(personId: string): Entity[];
|
|
239
|
+
/**
|
|
240
|
+
* Get maternal uncles (舅舅)
|
|
241
|
+
*/
|
|
242
|
+
getMaternalUncles(personId: string): Entity[];
|
|
243
|
+
/**
|
|
244
|
+
* Get maternal aunts (姨妈)
|
|
245
|
+
*/
|
|
246
|
+
getMaternalAunts(personId: string): Entity[];
|
|
247
|
+
/**
|
|
248
|
+
* Get nephews and nieces (侄子/侄女/外甥/外甥女)
|
|
249
|
+
*/
|
|
250
|
+
getNephewsNieces(personId: string): Entity[];
|
|
251
|
+
/**
|
|
252
|
+
* Get cousins (堂/表兄弟姐妹)
|
|
253
|
+
*/
|
|
254
|
+
getCousins(personId: string): Entity[];
|
|
255
|
+
/**
|
|
256
|
+
* Get paternal cousins (堂兄弟姐妹)
|
|
257
|
+
*/
|
|
258
|
+
getPaternalCousins(personId: string): Entity[];
|
|
259
|
+
/**
|
|
260
|
+
* Get maternal cousins (表兄弟姐妹)
|
|
261
|
+
*/
|
|
262
|
+
getMaternalCousins(personId: string): Entity[];
|
|
263
|
+
/**
|
|
264
|
+
* Get father-in-law (公公/岳父)
|
|
265
|
+
*/
|
|
266
|
+
getFatherInLaw(personId: string): Entity | null;
|
|
267
|
+
/**
|
|
268
|
+
* Get mother-in-law (婆婆/岳母)
|
|
269
|
+
*/
|
|
270
|
+
getMotherInLaw(personId: string): Entity | null;
|
|
271
|
+
/**
|
|
272
|
+
* Get siblings-in-law
|
|
273
|
+
*/
|
|
274
|
+
getSiblingsInLaw(personId: string): Entity[];
|
|
275
|
+
/**
|
|
276
|
+
* Get children-in-law (儿媳/女婿)
|
|
277
|
+
*/
|
|
278
|
+
getChildrenInLaw(personId: string): Entity[];
|
|
279
|
+
/**
|
|
280
|
+
* Calculate the family relationship between two people
|
|
281
|
+
*
|
|
282
|
+
* Returns the full path including Chinese relationship title,
|
|
283
|
+
* generation difference, and blood distance.
|
|
284
|
+
*
|
|
285
|
+
* @param fromId - Starting person's ID
|
|
286
|
+
* @param toId - Ending person's ID
|
|
287
|
+
* @returns The family path, or null if no relationship found
|
|
288
|
+
*/
|
|
289
|
+
calculateRelationship(fromId: string, toId: string): FamilyPath | null;
|
|
290
|
+
/**
|
|
291
|
+
* Get the Chinese relationship title between two people
|
|
292
|
+
*
|
|
293
|
+
* @example
|
|
294
|
+
* ```typescript
|
|
295
|
+
* const title = family.getRelationshipTitle(child.id, father.id);
|
|
296
|
+
* // Returns: "父亲"
|
|
297
|
+
* ```
|
|
298
|
+
*
|
|
299
|
+
* @param fromId - The person asking about the relationship
|
|
300
|
+
* @param toId - The person being referred to
|
|
301
|
+
* @returns The relationship title in Chinese, or null if not related
|
|
302
|
+
*/
|
|
303
|
+
getRelationshipTitle(fromId: string, toId: string): string | null;
|
|
304
|
+
/**
|
|
305
|
+
* Find the common ancestor of two people
|
|
306
|
+
*
|
|
307
|
+
* @returns The closest common ancestor, or null if none found
|
|
308
|
+
*/
|
|
309
|
+
findCommonAncestor(personA: string, personB: string): Entity | null;
|
|
310
|
+
/**
|
|
311
|
+
* Calculate the blood distance between two people
|
|
312
|
+
*
|
|
313
|
+
* Blood distance is the number of parent-child links needed
|
|
314
|
+
* to connect two people through their common ancestor.
|
|
315
|
+
*
|
|
316
|
+
* @returns The blood distance, or null if not blood-related
|
|
317
|
+
*/
|
|
318
|
+
calculateBloodDistance(personA: string, personB: string): number | null;
|
|
319
|
+
/**
|
|
320
|
+
* Check if two people are direct blood relatives
|
|
321
|
+
*
|
|
322
|
+
* Returns true if one is an ancestor or descendant of the other.
|
|
323
|
+
*/
|
|
324
|
+
isDirectBloodRelative(personA: string, personB: string): boolean;
|
|
325
|
+
/**
|
|
326
|
+
* Build a family tree centered on a person
|
|
327
|
+
*
|
|
328
|
+
* @param personId - The center person's ID
|
|
329
|
+
* @param options - Build options (generationsUp, generationsDown)
|
|
330
|
+
* @returns The family tree structure, or null if person not found
|
|
331
|
+
*/
|
|
332
|
+
buildFamilyTree(personId: string, options?: BuildFamilyTreeOptions): FamilyTreeData | null;
|
|
333
|
+
/**
|
|
334
|
+
* Get the generation number of a person relative to a root
|
|
335
|
+
*
|
|
336
|
+
* @param personId - The person's ID
|
|
337
|
+
* @param rootId - The root person's ID (reference point)
|
|
338
|
+
* @returns The generation number (0 = same as root, positive = younger, negative = older)
|
|
339
|
+
*/
|
|
340
|
+
getGeneration(personId: string, rootId: string): number | null;
|
|
341
|
+
/**
|
|
342
|
+
* Get all people in the same generation as a person
|
|
343
|
+
*
|
|
344
|
+
* Includes siblings, cousins, and spouse.
|
|
345
|
+
*/
|
|
346
|
+
getSameGeneration(personId: string): Entity[];
|
|
347
|
+
/**
|
|
348
|
+
* Get paternal lineage (父系血统)
|
|
349
|
+
*
|
|
350
|
+
* Traces the paternal line: father -> grandfather -> great-grandfather -> ...
|
|
351
|
+
* Returns ancestors in order from closest (father) to farthest.
|
|
352
|
+
*
|
|
353
|
+
* @param personId - The person's ID
|
|
354
|
+
* @param maxGenerations - Maximum generations to trace (default: 10)
|
|
355
|
+
* @returns Array of paternal ancestors in order
|
|
356
|
+
*
|
|
357
|
+
* @example
|
|
358
|
+
* ```typescript
|
|
359
|
+
* const lineage = family.getPaternalLineage(me.id);
|
|
360
|
+
* // Returns: [父亲, 爷爷, 曾祖父, ...]
|
|
361
|
+
* ```
|
|
362
|
+
*/
|
|
363
|
+
getPaternalLineage(personId: string, maxGenerations?: number): Entity[];
|
|
364
|
+
/**
|
|
365
|
+
* Get maternal lineage (母系血统)
|
|
366
|
+
*
|
|
367
|
+
* Traces the maternal line: mother -> grandmother -> great-grandmother -> ...
|
|
368
|
+
* Returns ancestors in order from closest (mother) to farthest.
|
|
369
|
+
*
|
|
370
|
+
* @param personId - The person's ID
|
|
371
|
+
* @param maxGenerations - Maximum generations to trace (default: 10)
|
|
372
|
+
* @returns Array of maternal ancestors in order
|
|
373
|
+
*
|
|
374
|
+
* @example
|
|
375
|
+
* ```typescript
|
|
376
|
+
* const lineage = family.getMaternalLineage(me.id);
|
|
377
|
+
* // Returns: [母亲, 外婆, 外曾祖母, ...]
|
|
378
|
+
* ```
|
|
379
|
+
*/
|
|
380
|
+
getMaternalLineage(personId: string, maxGenerations?: number): Entity[];
|
|
381
|
+
/**
|
|
382
|
+
* Get same surname relatives (同姓族人)
|
|
383
|
+
*
|
|
384
|
+
* Finds all relatives who share the same family_name property.
|
|
385
|
+
* Requires the person to have a `family_name` property set.
|
|
386
|
+
*
|
|
387
|
+
* @param personId - The person's ID
|
|
388
|
+
* @returns Array of relatives with the same surname
|
|
389
|
+
*
|
|
390
|
+
* @example
|
|
391
|
+
* ```typescript
|
|
392
|
+
* // Person needs family_name property
|
|
393
|
+
* const person = social.addPerson({
|
|
394
|
+
* name: '张小明',
|
|
395
|
+
* properties: { gender: 'male', family_name: '张' }
|
|
396
|
+
* });
|
|
397
|
+
*
|
|
398
|
+
* const zhangFamily = family.getSameSurnameRelatives(person.id);
|
|
399
|
+
* ```
|
|
400
|
+
*/
|
|
401
|
+
getSameSurnameRelatives(personId: string): Entity[];
|
|
402
|
+
/**
|
|
403
|
+
* Get paternal clan members (父系宗族成员)
|
|
404
|
+
*
|
|
405
|
+
* Gets all members connected through paternal lineage:
|
|
406
|
+
* - Paternal ancestors (father, grandfather, etc.)
|
|
407
|
+
* - Paternal uncles/aunts and their descendants
|
|
408
|
+
* - Siblings and their descendants (through father)
|
|
409
|
+
*
|
|
410
|
+
* This represents the traditional Chinese concept of "宗族" (patrilineal clan).
|
|
411
|
+
*
|
|
412
|
+
* @param personId - The person's ID
|
|
413
|
+
* @param maxGenerations - Maximum generations to include (default: 5)
|
|
414
|
+
* @returns Array of all paternal clan members
|
|
415
|
+
*
|
|
416
|
+
* @example
|
|
417
|
+
* ```typescript
|
|
418
|
+
* const clan = family.getPaternalClan(me.id);
|
|
419
|
+
* // Returns all members of the patrilineal clan
|
|
420
|
+
* ```
|
|
421
|
+
*/
|
|
422
|
+
getPaternalClan(personId: string, maxGenerations?: number): Entity[];
|
|
423
|
+
/**
|
|
424
|
+
* Get family statistics
|
|
425
|
+
*
|
|
426
|
+
* @param rootId - The root person's ID for the family tree
|
|
427
|
+
* @returns Family statistics, or null if root not found
|
|
428
|
+
*/
|
|
429
|
+
getFamilyStats(rootId: string): FamilyStats | null;
|
|
430
|
+
/**
|
|
431
|
+
* Set the gender of a person
|
|
432
|
+
*
|
|
433
|
+
* @param personId - The person's ID
|
|
434
|
+
* @param gender - The gender ('male', 'female', or 'unknown')
|
|
435
|
+
* @returns True if successful
|
|
436
|
+
*/
|
|
437
|
+
setPersonGender(personId: string, gender: Gender): boolean;
|
|
438
|
+
/**
|
|
439
|
+
* Add a family member with gender
|
|
440
|
+
*
|
|
441
|
+
* Convenience method that creates a person with gender set in properties.
|
|
442
|
+
*
|
|
443
|
+
* @param social - The SocialGraph instance to use for creating the person
|
|
444
|
+
* @param name - The person's name
|
|
445
|
+
* @param gender - The person's gender
|
|
446
|
+
* @param properties - Additional properties
|
|
447
|
+
* @returns The created entity
|
|
448
|
+
*/
|
|
449
|
+
static addFamilyMember(social: any, name: string, gender: Gender, properties?: Record<string, unknown>): Entity;
|
|
450
|
+
/**
|
|
451
|
+
* Create a nuclear family (parents + children)
|
|
452
|
+
*
|
|
453
|
+
* Convenience method to create a basic family structure.
|
|
454
|
+
*
|
|
455
|
+
* @param father - Father entity
|
|
456
|
+
* @param mother - Mother entity
|
|
457
|
+
* @param children - Array of child entities
|
|
458
|
+
*/
|
|
459
|
+
createNuclearFamily(father: Entity, mother: Entity, children: Entity[]): void;
|
|
460
|
+
/**
|
|
461
|
+
* Get immediate family of a person
|
|
462
|
+
*
|
|
463
|
+
* Returns parents, spouse, siblings, and children.
|
|
464
|
+
*/
|
|
465
|
+
getImmediateFamily(personId: string): {
|
|
466
|
+
parents: Entity[];
|
|
467
|
+
spouse: Entity | null;
|
|
468
|
+
siblings: Entity[];
|
|
469
|
+
children: Entity[];
|
|
470
|
+
};
|
|
471
|
+
/**
|
|
472
|
+
* Check if two people are family members (related by blood or marriage)
|
|
473
|
+
*
|
|
474
|
+
* @param personA - First person's ID
|
|
475
|
+
* @param personB - Second person's ID
|
|
476
|
+
* @param maxDistance - Maximum relationship distance to check (default: 6)
|
|
477
|
+
* @returns True if related within the specified distance
|
|
478
|
+
*/
|
|
479
|
+
areRelated(personA: string, personB: string, maxDistance?: number): boolean;
|
|
480
|
+
}
|
|
481
|
+
export * from './family-types';
|
|
482
|
+
//# sourceMappingURL=family-tree.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"family-tree.d.ts","sourceRoot":"","sources":["../ts/family-tree.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAe,MAAM,gBAAgB,CAAC;AACpE,OAAO,KAAK,EACV,MAAM,EACN,UAAU,EACV,UAAU,IAAI,cAAc,EAC5B,WAAW,EACX,UAAU,EACV,sBAAsB,EACtB,gBAAgB,EACjB,MAAM,gBAAgB,CAAC;AAExB;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,qBAAa,iBAAiB;IAC5B,OAAO,CAAC,MAAM,CAAM;IAEpB;;;OAGG;gBACS,WAAW,EAAE,GAAG;IAQ5B;;;;;;;;;OASG;IACH,cAAc,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,QAAQ,GAAG,IAAI;IAIlE;;;;;;OAMG;IACH,SAAS,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,QAAQ,GAAG,IAAI;IAI5D;;;;;;;OAOG;IACH,UAAU,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,WAAW,UAAQ,GAAG,QAAQ,GAAG,IAAI;IAIlF;;;;;;OAMG;IACH,oBAAoB,CAAC,OAAO,E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