aifastdb 3.7.6 → 3.8.6-mac.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +137 -137
- package/{aifastdb.win32-x64-msvc.node → aifastdb.darwin-arm64.node} +0 -0
- package/dist/cli.js +30 -30
- package/dist/llm-gateway.d.ts +73 -6
- package/dist/llm-gateway.d.ts.map +1 -1
- package/dist/llm-gateway.js.map +1 -1
- package/dist/security/server/admin/crud-table.js +603 -603
- package/dist/security/server/admin/icons.js +64 -64
- package/dist/security/server/admin/styles.js +942 -942
- package/dist/security/server/admin/templates.js +866 -866
- package/dist/types.d.ts +19 -7
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +42 -4
- package/dist/types.js.map +1 -1
- package/package.json +1 -1
- package/aidb.win32-x64-msvc.node +0 -0
- package/dist/dev-plan-store.d.ts +0 -656
- package/dist/dev-plan-store.d.ts.map +0 -1
- package/dist/dev-plan-store.js +0 -1679
- package/dist/dev-plan-store.js.map +0 -1
- package/dist/migrate-federation-plan.d.ts +0 -16
- package/dist/migrate-federation-plan.d.ts.map +0 -1
- package/dist/migrate-federation-plan.js +0 -420
- package/dist/migrate-federation-plan.js.map +0 -1
- package/dist/social-graph.d.ts +0 -532
- package/dist/social-graph.d.ts.map +0 -1
- package/dist/social-graph.js +0 -997
- package/dist/social-graph.js.map +0 -1
- package/vibebase.node +0 -0
- package/vibebase.win32-x64-msvc.node +0 -0
package/dist/social-graph.d.ts
DELETED
|
@@ -1,532 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* SocialGraph - High-level TypeScript API for social network operations
|
|
3
|
-
*
|
|
4
|
-
* Provides a friendly API wrapper around the native Rust social graph implementation.
|
|
5
|
-
*/
|
|
6
|
-
import { AiFastDb } from './native';
|
|
7
|
-
import type { Entity, Relation, PersonInput, PersonFilter, FriendConfig, TagInput, ItemInput, AttributeInput, AttributeMatchConfig, PathOptions, PathResult, AllPathsResult, DegreeContacts, RelationshipStrength, ConnectionSuggestion, SuggestionConfig, NetworkStats, SharedItemResult, ItemMatchResult, SharedAttributeDetail, AttributeMatchResult, CompatibilityResult, SharedAttributeResult, BirthdayMatchResult, BirthdayStats, ExportedGraph, ExportGraphOptions, TagFilter, RelationFilter } from './social-types';
|
|
8
|
-
/**
|
|
9
|
-
* SocialGraph provides high-level APIs for social network operations.
|
|
10
|
-
*
|
|
11
|
-
* @example
|
|
12
|
-
* ```typescript
|
|
13
|
-
* const db = new AiFastDb({ path: './data', dimension: 768 });
|
|
14
|
-
* const social = new SocialGraph(db);
|
|
15
|
-
*
|
|
16
|
-
* // Add persons
|
|
17
|
-
* const alice = social.addPerson({ name: 'Alice' });
|
|
18
|
-
* const bob = social.addPerson({ name: 'Bob' });
|
|
19
|
-
*
|
|
20
|
-
* // Create friendship
|
|
21
|
-
* social.addFriend(alice.id, bob.id);
|
|
22
|
-
*
|
|
23
|
-
* // Find path between people
|
|
24
|
-
* const path = social.findPath(alice.id, someoneElse.id);
|
|
25
|
-
* ```
|
|
26
|
-
*/
|
|
27
|
-
export declare class SocialGraph {
|
|
28
|
-
private native;
|
|
29
|
-
constructor(db: InstanceType<typeof AiFastDb>);
|
|
30
|
-
/**
|
|
31
|
-
* Add a new person to the social graph
|
|
32
|
-
*/
|
|
33
|
-
addPerson(input: PersonInput): Entity;
|
|
34
|
-
/**
|
|
35
|
-
* Get a person by ID
|
|
36
|
-
*/
|
|
37
|
-
getPerson(id: string): Entity | null;
|
|
38
|
-
/**
|
|
39
|
-
* Update a person's information
|
|
40
|
-
*/
|
|
41
|
-
updatePerson(id: string, updates: Partial<PersonInput>): Entity | null;
|
|
42
|
-
/**
|
|
43
|
-
* Delete a person from the social graph
|
|
44
|
-
*/
|
|
45
|
-
deletePerson(id: string): boolean;
|
|
46
|
-
/**
|
|
47
|
-
* List all persons with optional filter
|
|
48
|
-
*/
|
|
49
|
-
listPersons(filter?: PersonFilter): Entity[];
|
|
50
|
-
/**
|
|
51
|
-
* Add a friend relationship between two persons
|
|
52
|
-
*/
|
|
53
|
-
addFriend(personA: string, personB: string, config?: FriendConfig): string | null;
|
|
54
|
-
/**
|
|
55
|
-
* Remove a friend relationship
|
|
56
|
-
*/
|
|
57
|
-
removeFriend(personA: string, personB: string): boolean;
|
|
58
|
-
/**
|
|
59
|
-
* Get all friends of a person
|
|
60
|
-
*/
|
|
61
|
-
getFriends(personId: string): Entity[];
|
|
62
|
-
/**
|
|
63
|
-
* Check if two persons are friends
|
|
64
|
-
*/
|
|
65
|
-
areFriends(personA: string, personB: string): boolean;
|
|
66
|
-
/**
|
|
67
|
-
* List all relations with optional filter
|
|
68
|
-
*
|
|
69
|
-
* Returns all relation edges including friend relations, person-tag relations, etc.
|
|
70
|
-
* Each relation includes full metadata (relation_type, weight, bidirectional, metadata).
|
|
71
|
-
*
|
|
72
|
-
* @param filter - Optional filter criteria
|
|
73
|
-
* @returns Array of relations
|
|
74
|
-
*
|
|
75
|
-
* @example
|
|
76
|
-
* ```typescript
|
|
77
|
-
* // Get all relations
|
|
78
|
-
* const allRelations = social.listRelations();
|
|
79
|
-
*
|
|
80
|
-
* // Get only friend relations
|
|
81
|
-
* const friendRelations = social.listRelations({ relationType: 'friend' });
|
|
82
|
-
*
|
|
83
|
-
* // Get relations for a specific person
|
|
84
|
-
* const personRelations = social.listRelations({ sourceId: alice.id });
|
|
85
|
-
* ```
|
|
86
|
-
*/
|
|
87
|
-
listRelations(filter?: RelationFilter): Relation[];
|
|
88
|
-
/**
|
|
89
|
-
* Get a specific relation by ID
|
|
90
|
-
*
|
|
91
|
-
* @param relationId - The relation ID
|
|
92
|
-
* @returns The relation if found, null otherwise
|
|
93
|
-
*/
|
|
94
|
-
getRelation(relationId: string): Relation | null;
|
|
95
|
-
/**
|
|
96
|
-
* Get relation between two specific entities
|
|
97
|
-
*
|
|
98
|
-
* @param entityA - First entity ID
|
|
99
|
-
* @param entityB - Second entity ID
|
|
100
|
-
* @returns The relation if found, null otherwise
|
|
101
|
-
*/
|
|
102
|
-
getRelationBetween(entityA: string, entityB: string): Relation | null;
|
|
103
|
-
/**
|
|
104
|
-
* Add a new tag
|
|
105
|
-
*/
|
|
106
|
-
addTag(input: TagInput): Entity;
|
|
107
|
-
/**
|
|
108
|
-
* Tag a person (add person to a tag/organization)
|
|
109
|
-
*/
|
|
110
|
-
tagPerson(personId: string, tagId: string): string | null;
|
|
111
|
-
/**
|
|
112
|
-
* Remove tag from person
|
|
113
|
-
*/
|
|
114
|
-
untagPerson(personId: string, tagId: string): boolean;
|
|
115
|
-
/**
|
|
116
|
-
* Get all tags of a person
|
|
117
|
-
*/
|
|
118
|
-
getPersonTags(personId: string): Entity[];
|
|
119
|
-
/**
|
|
120
|
-
* Get all members of a tag
|
|
121
|
-
*/
|
|
122
|
-
getTagMembers(tagId: string): Entity[];
|
|
123
|
-
/**
|
|
124
|
-
* List all tags with optional filter
|
|
125
|
-
*
|
|
126
|
-
* Returns all tag entities (including company, organization, skill, interest types).
|
|
127
|
-
* Use the filter to narrow down results by tagType or name.
|
|
128
|
-
*
|
|
129
|
-
* @param filter - Optional filter criteria
|
|
130
|
-
* @returns Array of tag entities
|
|
131
|
-
*
|
|
132
|
-
* @example
|
|
133
|
-
* ```typescript
|
|
134
|
-
* // Get all tags
|
|
135
|
-
* const allTags = social.listTags();
|
|
136
|
-
*
|
|
137
|
-
* // Get only companies
|
|
138
|
-
* const companies = social.listTags({ tagType: 'company' });
|
|
139
|
-
*
|
|
140
|
-
* // Get tags with name containing 'tech'
|
|
141
|
-
* const techTags = social.listTags({ name: 'tech' });
|
|
142
|
-
* ```
|
|
143
|
-
*/
|
|
144
|
-
listTags(filter?: TagFilter): Entity[];
|
|
145
|
-
/**
|
|
146
|
-
* Get a tag by ID
|
|
147
|
-
*/
|
|
148
|
-
getTag(tagId: string): Entity | null;
|
|
149
|
-
/**
|
|
150
|
-
* Add a new item
|
|
151
|
-
*/
|
|
152
|
-
addItem(input: ItemInput): Entity;
|
|
153
|
-
/**
|
|
154
|
-
* Add item to person (ownership)
|
|
155
|
-
*/
|
|
156
|
-
addItemToPerson(personId: string, itemId: string, relation?: string): string | null;
|
|
157
|
-
/**
|
|
158
|
-
* Get all items owned by a person
|
|
159
|
-
*/
|
|
160
|
-
getPersonItems(personId: string): Entity[];
|
|
161
|
-
/**
|
|
162
|
-
* Get all owners of an item
|
|
163
|
-
*/
|
|
164
|
-
getItemOwners(itemId: string): Entity[];
|
|
165
|
-
/**
|
|
166
|
-
* Add a new attribute
|
|
167
|
-
*/
|
|
168
|
-
addAttribute(input: AttributeInput): Entity;
|
|
169
|
-
/**
|
|
170
|
-
* Find or create an attribute by category and value
|
|
171
|
-
*/
|
|
172
|
-
findOrCreateAttribute(category: string, value: string): Entity;
|
|
173
|
-
/**
|
|
174
|
-
* Set a person's attribute
|
|
175
|
-
*/
|
|
176
|
-
setPersonAttribute(personId: string, attrId: string, relation?: string): string | null;
|
|
177
|
-
/**
|
|
178
|
-
* Get all attributes of a person
|
|
179
|
-
*/
|
|
180
|
-
getPersonAttributes(personId: string): Entity[];
|
|
181
|
-
/**
|
|
182
|
-
* Get all persons with a specific attribute
|
|
183
|
-
*/
|
|
184
|
-
getPersonsByAttribute(attrId: string): Entity[];
|
|
185
|
-
/**
|
|
186
|
-
* Find the shortest path between two persons
|
|
187
|
-
*
|
|
188
|
-
* @example
|
|
189
|
-
* ```typescript
|
|
190
|
-
* const path = social.findPath(alice.id, bob.id);
|
|
191
|
-
* if (path) {
|
|
192
|
-
* console.log(`Found path with ${path.hops} hops`);
|
|
193
|
-
* console.log('Intermediaries:', path.intermediaries.map(p => p.name));
|
|
194
|
-
* }
|
|
195
|
-
* ```
|
|
196
|
-
*/
|
|
197
|
-
findPath(fromId: string, toId: string, options?: PathOptions): PathResult | null;
|
|
198
|
-
/**
|
|
199
|
-
* Find all paths between two persons
|
|
200
|
-
*/
|
|
201
|
-
findAllPaths(fromId: string, toId: string, maxHops?: number, maxPaths?: number): AllPathsResult;
|
|
202
|
-
/**
|
|
203
|
-
* Find all intermediaries who can introduce two persons
|
|
204
|
-
*
|
|
205
|
-
* @example
|
|
206
|
-
* ```typescript
|
|
207
|
-
* const intermediaries = social.findIntermediaries(alice.id, bob.id);
|
|
208
|
-
* console.log('Can be introduced via:', intermediaries.map(p => p.name));
|
|
209
|
-
* ```
|
|
210
|
-
*/
|
|
211
|
-
findIntermediaries(personA: string, personB: string, maxHops?: number): Entity[];
|
|
212
|
-
/**
|
|
213
|
-
* Get N-degree contacts of a person
|
|
214
|
-
*
|
|
215
|
-
* @example
|
|
216
|
-
* ```typescript
|
|
217
|
-
* const contacts = social.getNthDegreeContacts(alice.id, 3);
|
|
218
|
-
* console.log('Direct friends:', contacts.degree1.length);
|
|
219
|
-
* console.log('Friends of friends:', contacts.degree2.length);
|
|
220
|
-
* console.log('3rd degree:', contacts.degree3.length);
|
|
221
|
-
* ```
|
|
222
|
-
*/
|
|
223
|
-
getNthDegreeContacts(personId: string, maxDegree?: number): DegreeContacts;
|
|
224
|
-
/**
|
|
225
|
-
* Get mutual friends between two persons
|
|
226
|
-
*/
|
|
227
|
-
getMutualFriends(personA: string, personB: string): Entity[];
|
|
228
|
-
/**
|
|
229
|
-
* Get mutual tags between two persons
|
|
230
|
-
*/
|
|
231
|
-
getMutualTags(personA: string, personB: string): Entity[];
|
|
232
|
-
/**
|
|
233
|
-
* Calculate relationship strength between two persons
|
|
234
|
-
*/
|
|
235
|
-
getRelationshipStrength(personA: string, personB: string): RelationshipStrength;
|
|
236
|
-
/**
|
|
237
|
-
* Get connection suggestions for a person
|
|
238
|
-
*
|
|
239
|
-
* @example
|
|
240
|
-
* ```typescript
|
|
241
|
-
* const suggestions = social.suggestConnections(alice.id, {
|
|
242
|
-
* maxResults: 10,
|
|
243
|
-
* minScore: 0.3,
|
|
244
|
-
* });
|
|
245
|
-
*
|
|
246
|
-
* for (const s of suggestions) {
|
|
247
|
-
* console.log(`Suggest: ${s.person.name} (score: ${s.score})`);
|
|
248
|
-
* for (const reason of s.reasons) {
|
|
249
|
-
* console.log(` - ${reason.type}`);
|
|
250
|
-
* }
|
|
251
|
-
* }
|
|
252
|
-
* ```
|
|
253
|
-
*/
|
|
254
|
-
suggestConnections(personId: string, config?: SuggestionConfig): ConnectionSuggestion[];
|
|
255
|
-
/**
|
|
256
|
-
* Get network statistics for a person
|
|
257
|
-
*/
|
|
258
|
-
getNetworkStats(personId: string): NetworkStats;
|
|
259
|
-
/**
|
|
260
|
-
* Find shared items between two people
|
|
261
|
-
*/
|
|
262
|
-
findSharedItems(personA: string, personB: string): Entity[];
|
|
263
|
-
/**
|
|
264
|
-
* Find people who share items with a given person
|
|
265
|
-
*
|
|
266
|
-
* @example
|
|
267
|
-
* ```typescript
|
|
268
|
-
* const carFriends = social.findPeopleBySharedItems(alice.id, 'vehicle');
|
|
269
|
-
* for (const match of carFriends) {
|
|
270
|
-
* console.log(`${match.person.name} shares ${match.sharedItems.length} items`);
|
|
271
|
-
* }
|
|
272
|
-
* ```
|
|
273
|
-
*/
|
|
274
|
-
findPeopleBySharedItems(personId: string, category?: string): ItemMatchResult[];
|
|
275
|
-
/**
|
|
276
|
-
* Find people who own items of a specific brand
|
|
277
|
-
*/
|
|
278
|
-
findPeopleByBrand(brand: string, category?: string): Entity[];
|
|
279
|
-
/**
|
|
280
|
-
* Get popular items (most owned)
|
|
281
|
-
*/
|
|
282
|
-
getPopularItems(category?: string, limit?: number): SharedItemResult[];
|
|
283
|
-
/**
|
|
284
|
-
* Find shared attributes between two people
|
|
285
|
-
*/
|
|
286
|
-
findSharedAttributes(personA: string, personB: string): SharedAttributeDetail[];
|
|
287
|
-
/**
|
|
288
|
-
* Find people who share attributes with a given person
|
|
289
|
-
*/
|
|
290
|
-
findPeopleBySharedAttributes(personId: string, config?: AttributeMatchConfig): AttributeMatchResult[];
|
|
291
|
-
/**
|
|
292
|
-
* Find alumni (people who went to the same school)
|
|
293
|
-
*/
|
|
294
|
-
findAlumni(personId: string): Entity[];
|
|
295
|
-
/**
|
|
296
|
-
* Find people in the same city
|
|
297
|
-
*/
|
|
298
|
-
findSameCity(personId: string): Entity[];
|
|
299
|
-
/**
|
|
300
|
-
* Find people with the same zodiac sign
|
|
301
|
-
*/
|
|
302
|
-
findSameZodiac(personId: string): Entity[];
|
|
303
|
-
/**
|
|
304
|
-
* Analyze compatibility between two people
|
|
305
|
-
*
|
|
306
|
-
* @example
|
|
307
|
-
* ```typescript
|
|
308
|
-
* const compat = social.analyzeCompatibility(alice.id, bob.id);
|
|
309
|
-
* console.log(`Compatibility: ${(compat.overallScore * 100).toFixed(0)}%`);
|
|
310
|
-
* console.log(compat.analysis);
|
|
311
|
-
* ```
|
|
312
|
-
*/
|
|
313
|
-
analyzeCompatibility(personA: string, personB: string): CompatibilityResult;
|
|
314
|
-
/**
|
|
315
|
-
* Get popular attributes in a category
|
|
316
|
-
*/
|
|
317
|
-
getPopularAttributes(category: string, limit?: number): SharedAttributeResult[];
|
|
318
|
-
/**
|
|
319
|
-
* Set a person's birthday (solar calendar, YYYY-MM-DD format)
|
|
320
|
-
*
|
|
321
|
-
* @param personId - The person's ID
|
|
322
|
-
* @param birthday - Birthday in YYYY-MM-DD format (e.g., "1990-05-15")
|
|
323
|
-
* @returns true if set successfully, false if person not found or invalid format
|
|
324
|
-
*
|
|
325
|
-
* @example
|
|
326
|
-
* ```typescript
|
|
327
|
-
* social.setBirthday(alice.id, '1990-05-15');
|
|
328
|
-
* ```
|
|
329
|
-
*/
|
|
330
|
-
setBirthday(personId: string, birthday: string): boolean;
|
|
331
|
-
/**
|
|
332
|
-
* Get a person's birthday
|
|
333
|
-
*
|
|
334
|
-
* @returns Birthday in YYYY-MM-DD format, or null if not set
|
|
335
|
-
*/
|
|
336
|
-
getBirthday(personId: string): string | null;
|
|
337
|
-
/**
|
|
338
|
-
* Remove a person's birthday
|
|
339
|
-
*/
|
|
340
|
-
removeBirthday(personId: string): boolean;
|
|
341
|
-
/**
|
|
342
|
-
* Find people with exact same birthday (same year-month-day)
|
|
343
|
-
*
|
|
344
|
-
* @param birthday - Birthday in YYYY-MM-DD format
|
|
345
|
-
*
|
|
346
|
-
* @example
|
|
347
|
-
* ```typescript
|
|
348
|
-
* const sameBirthday = social.findSameBirthdayExact('1990-05-15');
|
|
349
|
-
* // Returns people born on May 15, 1990
|
|
350
|
-
* ```
|
|
351
|
-
*/
|
|
352
|
-
findSameBirthdayExact(birthday: string): Entity[];
|
|
353
|
-
/**
|
|
354
|
-
* Find people with same month-day birthday (different years allowed)
|
|
355
|
-
*
|
|
356
|
-
* @param birthday - Birthday in YYYY-MM-DD or MM-DD format
|
|
357
|
-
*
|
|
358
|
-
* @example
|
|
359
|
-
* ```typescript
|
|
360
|
-
* const sameDayMonth = social.findSameBirthdayDayMonth('05-15');
|
|
361
|
-
* // Returns all people born on May 15 (any year)
|
|
362
|
-
* ```
|
|
363
|
-
*/
|
|
364
|
-
findSameBirthdayDayMonth(birthday: string): Entity[];
|
|
365
|
-
/**
|
|
366
|
-
* Find people with same birthday as a given person (exact match)
|
|
367
|
-
*
|
|
368
|
-
* @example
|
|
369
|
-
* ```typescript
|
|
370
|
-
* const twins = social.findSameBirthdayAsPersonExact(alice.id);
|
|
371
|
-
* // Returns people born on the exact same date as Alice
|
|
372
|
-
* ```
|
|
373
|
-
*/
|
|
374
|
-
findSameBirthdayAsPersonExact(personId: string): Entity[];
|
|
375
|
-
/**
|
|
376
|
-
* Find people with same month-day birthday as a given person
|
|
377
|
-
*
|
|
378
|
-
* @example
|
|
379
|
-
* ```typescript
|
|
380
|
-
* const sameDayPeople = social.findSameBirthdayAsPerson(alice.id);
|
|
381
|
-
* // Returns people who share Alice's birthday month and day
|
|
382
|
-
* ```
|
|
383
|
-
*/
|
|
384
|
-
findSameBirthdayAsPerson(personId: string): Entity[];
|
|
385
|
-
/**
|
|
386
|
-
* Recommend birthday matches with priority: exact > same_day_month
|
|
387
|
-
*
|
|
388
|
-
* @example
|
|
389
|
-
* ```typescript
|
|
390
|
-
* const recommendations = social.recommendBirthdayMatches(alice.id, 10);
|
|
391
|
-
* for (const match of recommendations) {
|
|
392
|
-
* console.log(`${match.person.name}: ${match.birthday} (${match.matchType})`);
|
|
393
|
-
* }
|
|
394
|
-
* ```
|
|
395
|
-
*/
|
|
396
|
-
recommendBirthdayMatches(personId: string, limit?: number): BirthdayMatchResult[];
|
|
397
|
-
/**
|
|
398
|
-
* Find people with birthdays in the next N days
|
|
399
|
-
*
|
|
400
|
-
* @example
|
|
401
|
-
* ```typescript
|
|
402
|
-
* const upcoming = social.findUpcomingBirthdays(7);
|
|
403
|
-
* // Returns people with birthdays in the next 7 days
|
|
404
|
-
* ```
|
|
405
|
-
*/
|
|
406
|
-
findUpcomingBirthdays(days: number): BirthdayMatchResult[];
|
|
407
|
-
/**
|
|
408
|
-
* Find people with birthdays today
|
|
409
|
-
*/
|
|
410
|
-
findTodayBirthdays(): Entity[];
|
|
411
|
-
/**
|
|
412
|
-
* Find people with birthdays in a specific month
|
|
413
|
-
*
|
|
414
|
-
* @param month - Month number (1-12)
|
|
415
|
-
*/
|
|
416
|
-
findBirthdaysInMonth(month: number): Entity[];
|
|
417
|
-
/**
|
|
418
|
-
* Get birthday statistics
|
|
419
|
-
*
|
|
420
|
-
* @example
|
|
421
|
-
* ```typescript
|
|
422
|
-
* const stats = social.getBirthdayStats();
|
|
423
|
-
* console.log(`Total: ${stats.totalWithBirthday}`);
|
|
424
|
-
* console.log('Most common dates:', stats.mostCommonDates);
|
|
425
|
-
* ```
|
|
426
|
-
*/
|
|
427
|
-
getBirthdayStats(): BirthdayStats;
|
|
428
|
-
/**
|
|
429
|
-
* Check if two people have the same birthday
|
|
430
|
-
*
|
|
431
|
-
* @param exact - If true, checks for same year-month-day. If false, same month-day only.
|
|
432
|
-
*
|
|
433
|
-
* @example
|
|
434
|
-
* ```typescript
|
|
435
|
-
* // Check if same year-month-day
|
|
436
|
-
* const exactSame = social.isSameBirthday(alice.id, bob.id, true);
|
|
437
|
-
*
|
|
438
|
-
* // Check if same month-day (different years allowed)
|
|
439
|
-
* const sameDayMonth = social.isSameBirthday(alice.id, bob.id, false);
|
|
440
|
-
* ```
|
|
441
|
-
*/
|
|
442
|
-
isSameBirthday(personId1: string, personId2: string, exact?: boolean): boolean;
|
|
443
|
-
/**
|
|
444
|
-
* Rebuild birthday index from all persons
|
|
445
|
-
*
|
|
446
|
-
* Call this after loading data to rebuild the in-memory index.
|
|
447
|
-
*/
|
|
448
|
-
rebuildBirthdayIndex(): void;
|
|
449
|
-
/**
|
|
450
|
-
* Export the entire social graph for visualization
|
|
451
|
-
*
|
|
452
|
-
* Returns nodes (persons, companies, tags) and edges (friend relations, person-tag relations)
|
|
453
|
-
* in a format suitable for vis-network or similar graph visualization libraries.
|
|
454
|
-
*
|
|
455
|
-
* @param options - Export options for filtering and limiting results
|
|
456
|
-
* @returns Exported graph data with nodes, edges, and statistics
|
|
457
|
-
*
|
|
458
|
-
* @example
|
|
459
|
-
* ```typescript
|
|
460
|
-
* const graph = social.exportGraph();
|
|
461
|
-
* console.log(`Nodes: ${graph.nodes.length}, Edges: ${graph.edges.length}`);
|
|
462
|
-
* console.log(`Stats:`, graph.stats);
|
|
463
|
-
*
|
|
464
|
-
* // With options
|
|
465
|
-
* const filteredGraph = social.exportGraph({
|
|
466
|
-
* maxNodes: 100,
|
|
467
|
-
* includeTags: true,
|
|
468
|
-
* includeCompanies: true,
|
|
469
|
-
* });
|
|
470
|
-
* ```
|
|
471
|
-
*/
|
|
472
|
-
exportGraph(options?: ExportGraphOptions): ExportedGraph;
|
|
473
|
-
/**
|
|
474
|
-
* Save changes to disk
|
|
475
|
-
*/
|
|
476
|
-
save(): void;
|
|
477
|
-
/**
|
|
478
|
-
* Diagnose WAL recovery and database state
|
|
479
|
-
*
|
|
480
|
-
* Returns diagnostic information about the database including:
|
|
481
|
-
* - Current entity/relation counts
|
|
482
|
-
* - Shard information
|
|
483
|
-
* - Recovery status
|
|
484
|
-
*
|
|
485
|
-
* @example
|
|
486
|
-
* ```typescript
|
|
487
|
-
* const diag = social.diagnose();
|
|
488
|
-
* console.log('Counts:', diag.counts);
|
|
489
|
-
* console.log('Message:', diag.message);
|
|
490
|
-
* ```
|
|
491
|
-
*/
|
|
492
|
-
diagnose(): DiagnoseResult;
|
|
493
|
-
/**
|
|
494
|
-
* Force re-recover from WAL files
|
|
495
|
-
*
|
|
496
|
-
* This can be used to reload data from WAL if the initial recovery failed.
|
|
497
|
-
*
|
|
498
|
-
* @example
|
|
499
|
-
* ```typescript
|
|
500
|
-
* const result = social.recover();
|
|
501
|
-
* if (result.success) {
|
|
502
|
-
* console.log('Recovered:', result.counts);
|
|
503
|
-
* } else {
|
|
504
|
-
* console.error('Recovery failed:', result.error);
|
|
505
|
-
* }
|
|
506
|
-
* ```
|
|
507
|
-
*/
|
|
508
|
-
recover(): RecoverResult;
|
|
509
|
-
}
|
|
510
|
-
export interface DiagnoseResult {
|
|
511
|
-
status: string;
|
|
512
|
-
counts: {
|
|
513
|
-
persons: number;
|
|
514
|
-
tags: number;
|
|
515
|
-
relations: number;
|
|
516
|
-
};
|
|
517
|
-
shards: {
|
|
518
|
-
count: number;
|
|
519
|
-
};
|
|
520
|
-
message: string;
|
|
521
|
-
}
|
|
522
|
-
export interface RecoverResult {
|
|
523
|
-
success: boolean;
|
|
524
|
-
counts?: {
|
|
525
|
-
persons: number;
|
|
526
|
-
tags: number;
|
|
527
|
-
relations: number;
|
|
528
|
-
};
|
|
529
|
-
error?: string;
|
|
530
|
-
}
|
|
531
|
-
export default SocialGraph;
|
|
532
|
-
//# sourceMappingURL=social-graph.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"social-graph.d.ts","sourceRoot":"","sources":["../ts/social-graph.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AACpC,OAAO,KAAK,EACV,MAAM,EACN,QAAQ,EACR,WAAW,EACX,YAAY,EACZ,YAAY,EACZ,QAAQ,EACR,SA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