@treeviz/familysearch-sdk 1.0.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +227 -0
- package/dist/auth/index.cjs +313 -0
- package/dist/auth/index.cjs.map +1 -0
- package/dist/auth/index.d.cts +124 -0
- package/dist/auth/index.d.ts +124 -0
- package/dist/auth/index.js +293 -0
- package/dist/auth/index.js.map +1 -0
- package/dist/client-DIpYSHtx.d.ts +162 -0
- package/dist/client-ohjqX4t5.d.cts +162 -0
- package/dist/index-D6H-lvis.d.cts +484 -0
- package/dist/index-D6H-lvis.d.ts +484 -0
- package/dist/index.cjs +1689 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +6 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +1653 -0
- package/dist/index.js.map +1 -0
- package/dist/places/index.cjs +94 -0
- package/dist/places/index.cjs.map +1 -0
- package/dist/places/index.d.cts +69 -0
- package/dist/places/index.d.ts +69 -0
- package/dist/places/index.js +89 -0
- package/dist/places/index.js.map +1 -0
- package/dist/tree/index.cjs +191 -0
- package/dist/tree/index.cjs.map +1 -0
- package/dist/tree/index.d.cts +47 -0
- package/dist/tree/index.d.ts +47 -0
- package/dist/tree/index.js +186 -0
- package/dist/tree/index.js.map +1 -0
- package/dist/utils/index.cjs +663 -0
- package/dist/utils/index.cjs.map +1 -0
- package/dist/utils/index.d.cts +46 -0
- package/dist/utils/index.d.ts +46 -0
- package/dist/utils/index.js +660 -0
- package/dist/utils/index.js.map +1 -0
- package/package.json +78 -0
|
@@ -0,0 +1,484 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* FamilySearch SDK Types
|
|
3
|
+
*
|
|
4
|
+
* Core type definitions for the FamilySearch API
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* FamilySearch API environment
|
|
8
|
+
*/
|
|
9
|
+
type FamilySearchEnvironment = "production" | "beta" | "integration";
|
|
10
|
+
/**
|
|
11
|
+
* Environment-specific endpoint configuration
|
|
12
|
+
*/
|
|
13
|
+
interface EnvironmentConfig {
|
|
14
|
+
/** Identity server host for OAuth */
|
|
15
|
+
identHost: string;
|
|
16
|
+
/** Platform API host for data operations */
|
|
17
|
+
platformHost: string;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* SDK initialization options
|
|
21
|
+
*/
|
|
22
|
+
interface FamilySearchSDKConfig {
|
|
23
|
+
/** API environment (default: "integration") */
|
|
24
|
+
environment?: FamilySearchEnvironment;
|
|
25
|
+
/** OAuth access token */
|
|
26
|
+
accessToken?: string;
|
|
27
|
+
/** Application key for API requests */
|
|
28
|
+
appKey?: string;
|
|
29
|
+
/** Optional logger for debugging */
|
|
30
|
+
logger?: SDKLogger;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Logger interface for SDK debugging
|
|
34
|
+
*/
|
|
35
|
+
interface SDKLogger {
|
|
36
|
+
log: (message: string, ...args: unknown[]) => void;
|
|
37
|
+
warn: (message: string, ...args: unknown[]) => void;
|
|
38
|
+
error: (message: string, ...args: unknown[]) => void;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Generic API response wrapper
|
|
42
|
+
*/
|
|
43
|
+
interface FamilySearchApiResponse<T> {
|
|
44
|
+
/** Response data */
|
|
45
|
+
data?: T;
|
|
46
|
+
/** HTTP status code */
|
|
47
|
+
statusCode: number;
|
|
48
|
+
/** HTTP status text */
|
|
49
|
+
statusText: string;
|
|
50
|
+
/** Response headers */
|
|
51
|
+
headers: Record<string, string>;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* API error with additional context
|
|
55
|
+
*/
|
|
56
|
+
interface FamilySearchApiError extends Error {
|
|
57
|
+
/** HTTP status code if available */
|
|
58
|
+
statusCode?: number;
|
|
59
|
+
/** Full response object */
|
|
60
|
+
response?: FamilySearchApiResponse<unknown>;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* FamilySearch user information
|
|
64
|
+
*/
|
|
65
|
+
interface FamilySearchUser {
|
|
66
|
+
/** User ID */
|
|
67
|
+
id: string;
|
|
68
|
+
/** Contact name */
|
|
69
|
+
contactName?: string;
|
|
70
|
+
/** Display name */
|
|
71
|
+
displayName?: string;
|
|
72
|
+
/** Given/first name */
|
|
73
|
+
givenName?: string;
|
|
74
|
+
/** Family/last name */
|
|
75
|
+
familyName?: string;
|
|
76
|
+
/** Email address */
|
|
77
|
+
email?: string;
|
|
78
|
+
/** Gender */
|
|
79
|
+
gender?: string;
|
|
80
|
+
/** Birth date */
|
|
81
|
+
birthDate?: string;
|
|
82
|
+
/** Person ID in the tree */
|
|
83
|
+
personId?: string;
|
|
84
|
+
/** Tree user ID */
|
|
85
|
+
treeUserId?: string;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* FamilySearch person in the tree
|
|
89
|
+
*/
|
|
90
|
+
interface FamilySearchPerson {
|
|
91
|
+
/** Person ID */
|
|
92
|
+
id: string;
|
|
93
|
+
/** Full name */
|
|
94
|
+
name?: string;
|
|
95
|
+
/** Given/first name */
|
|
96
|
+
givenName?: string;
|
|
97
|
+
/** Family/last name */
|
|
98
|
+
familyName?: string;
|
|
99
|
+
/** Gender (Male, Female, Unknown) */
|
|
100
|
+
gender?: string;
|
|
101
|
+
/** Birth date */
|
|
102
|
+
birthDate?: string;
|
|
103
|
+
/** Birth place */
|
|
104
|
+
birthPlace?: string;
|
|
105
|
+
/** Death date */
|
|
106
|
+
deathDate?: string;
|
|
107
|
+
/** Death place */
|
|
108
|
+
deathPlace?: string;
|
|
109
|
+
/** Lifespan string (e.g., "1900-1980") */
|
|
110
|
+
lifespan?: string;
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Display information for a person
|
|
114
|
+
*/
|
|
115
|
+
interface PersonDisplay {
|
|
116
|
+
name?: string;
|
|
117
|
+
gender?: string;
|
|
118
|
+
birthDate?: string;
|
|
119
|
+
birthPlace?: string;
|
|
120
|
+
deathDate?: string;
|
|
121
|
+
deathPlace?: string;
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* Name form with parts
|
|
125
|
+
*/
|
|
126
|
+
interface NameForm {
|
|
127
|
+
fullText?: string;
|
|
128
|
+
parts?: Array<{
|
|
129
|
+
type?: string;
|
|
130
|
+
value?: string;
|
|
131
|
+
}>;
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Fact/event information
|
|
135
|
+
*/
|
|
136
|
+
interface PersonFact {
|
|
137
|
+
type?: string;
|
|
138
|
+
date?: {
|
|
139
|
+
formal?: string;
|
|
140
|
+
original?: string;
|
|
141
|
+
};
|
|
142
|
+
place?: {
|
|
143
|
+
original?: string;
|
|
144
|
+
};
|
|
145
|
+
value?: string;
|
|
146
|
+
links?: {
|
|
147
|
+
conclusion?: {
|
|
148
|
+
href?: string;
|
|
149
|
+
};
|
|
150
|
+
person?: {
|
|
151
|
+
href?: string;
|
|
152
|
+
};
|
|
153
|
+
};
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* Full person data from API
|
|
157
|
+
*/
|
|
158
|
+
interface PersonData {
|
|
159
|
+
id: string;
|
|
160
|
+
display?: PersonDisplay;
|
|
161
|
+
names?: Array<{
|
|
162
|
+
nameForms?: NameForm[];
|
|
163
|
+
}>;
|
|
164
|
+
gender?: {
|
|
165
|
+
type?: string;
|
|
166
|
+
};
|
|
167
|
+
facts?: PersonFact[];
|
|
168
|
+
links?: {
|
|
169
|
+
person?: {
|
|
170
|
+
href?: string;
|
|
171
|
+
};
|
|
172
|
+
};
|
|
173
|
+
identifiers?: Record<string, string[]>;
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* Relationship between persons (couple relationships)
|
|
177
|
+
*/
|
|
178
|
+
/**
|
|
179
|
+
* Person reference in a relationship (can have different structures from API)
|
|
180
|
+
*/
|
|
181
|
+
interface PersonReference {
|
|
182
|
+
resourceId?: string;
|
|
183
|
+
resource?: {
|
|
184
|
+
resourceId?: string;
|
|
185
|
+
};
|
|
186
|
+
}
|
|
187
|
+
interface Relationship {
|
|
188
|
+
id: string;
|
|
189
|
+
type?: string;
|
|
190
|
+
person1?: PersonReference;
|
|
191
|
+
person2?: PersonReference;
|
|
192
|
+
parent1?: {
|
|
193
|
+
resourceId?: string;
|
|
194
|
+
};
|
|
195
|
+
parent2?: {
|
|
196
|
+
resourceId?: string;
|
|
197
|
+
};
|
|
198
|
+
child?: {
|
|
199
|
+
resourceId?: string;
|
|
200
|
+
};
|
|
201
|
+
facts?: PersonFact[];
|
|
202
|
+
details?: RelationshipDetails;
|
|
203
|
+
}
|
|
204
|
+
/**
|
|
205
|
+
* Child and parents relationship
|
|
206
|
+
*/
|
|
207
|
+
interface ChildAndParentsRelationship {
|
|
208
|
+
id: string;
|
|
209
|
+
parent1?: {
|
|
210
|
+
resourceId?: string;
|
|
211
|
+
};
|
|
212
|
+
parent2?: {
|
|
213
|
+
resourceId?: string;
|
|
214
|
+
};
|
|
215
|
+
child?: {
|
|
216
|
+
resourceId?: string;
|
|
217
|
+
};
|
|
218
|
+
parent1Facts?: PersonFact[];
|
|
219
|
+
parent2Facts?: PersonFact[];
|
|
220
|
+
sources?: Array<{
|
|
221
|
+
description?: string;
|
|
222
|
+
}>;
|
|
223
|
+
notes?: Array<{
|
|
224
|
+
text?: string;
|
|
225
|
+
}>;
|
|
226
|
+
}
|
|
227
|
+
/**
|
|
228
|
+
* Detailed relationship information
|
|
229
|
+
*/
|
|
230
|
+
interface RelationshipDetails {
|
|
231
|
+
facts?: PersonFact[];
|
|
232
|
+
persons?: Array<{
|
|
233
|
+
facts?: PersonFact[];
|
|
234
|
+
}>;
|
|
235
|
+
}
|
|
236
|
+
/**
|
|
237
|
+
* Person memories response from FamilySearch API
|
|
238
|
+
*/
|
|
239
|
+
interface PersonMemoriesResponse {
|
|
240
|
+
/** Array of source descriptions (memories) */
|
|
241
|
+
sourceDescriptions?: SourceDescription[];
|
|
242
|
+
/** Pagination info */
|
|
243
|
+
links?: Record<string, {
|
|
244
|
+
href: string;
|
|
245
|
+
}>;
|
|
246
|
+
}
|
|
247
|
+
/**
|
|
248
|
+
* Person search response from FamilySearch API
|
|
249
|
+
*/
|
|
250
|
+
interface PersonSearchResponse {
|
|
251
|
+
/** Search results */
|
|
252
|
+
results?: Array<{
|
|
253
|
+
/** Person ID */
|
|
254
|
+
id?: string;
|
|
255
|
+
/** Title (person's name) */
|
|
256
|
+
title?: string;
|
|
257
|
+
/** Score */
|
|
258
|
+
score?: number;
|
|
259
|
+
/** Person data */
|
|
260
|
+
person?: PersonData;
|
|
261
|
+
}>;
|
|
262
|
+
/** Pagination info */
|
|
263
|
+
links?: Record<string, {
|
|
264
|
+
href: string;
|
|
265
|
+
}>;
|
|
266
|
+
}
|
|
267
|
+
/**
|
|
268
|
+
* FamilySearch place
|
|
269
|
+
*/
|
|
270
|
+
interface FamilySearchPlace {
|
|
271
|
+
/** Place ID */
|
|
272
|
+
id: string;
|
|
273
|
+
/** Place name */
|
|
274
|
+
name: string;
|
|
275
|
+
/** Fully qualified name */
|
|
276
|
+
fullName?: string;
|
|
277
|
+
/** Place type */
|
|
278
|
+
type?: string;
|
|
279
|
+
/** Latitude coordinate */
|
|
280
|
+
latitude?: number;
|
|
281
|
+
/** Longitude coordinate */
|
|
282
|
+
longitude?: number;
|
|
283
|
+
}
|
|
284
|
+
/**
|
|
285
|
+
* Place description from API
|
|
286
|
+
*/
|
|
287
|
+
interface PlaceDescription {
|
|
288
|
+
id?: string;
|
|
289
|
+
names?: Array<{
|
|
290
|
+
lang?: string;
|
|
291
|
+
value?: string;
|
|
292
|
+
}>;
|
|
293
|
+
type?: string;
|
|
294
|
+
temporalDescription?: {
|
|
295
|
+
original?: string;
|
|
296
|
+
formal?: string;
|
|
297
|
+
};
|
|
298
|
+
latitude?: number;
|
|
299
|
+
longitude?: number;
|
|
300
|
+
place?: {
|
|
301
|
+
original?: string;
|
|
302
|
+
description?: string;
|
|
303
|
+
};
|
|
304
|
+
jurisdiction?: {
|
|
305
|
+
id?: string;
|
|
306
|
+
name?: string;
|
|
307
|
+
};
|
|
308
|
+
spatialDescription?: {
|
|
309
|
+
type?: string;
|
|
310
|
+
geojson?: unknown;
|
|
311
|
+
};
|
|
312
|
+
}
|
|
313
|
+
/**
|
|
314
|
+
* Place search result
|
|
315
|
+
*/
|
|
316
|
+
interface PlaceSearchResult {
|
|
317
|
+
id?: string;
|
|
318
|
+
title?: string;
|
|
319
|
+
fullyQualifiedName?: string;
|
|
320
|
+
names?: Array<{
|
|
321
|
+
lang?: string;
|
|
322
|
+
value?: string;
|
|
323
|
+
}>;
|
|
324
|
+
standardized?: {
|
|
325
|
+
id?: string;
|
|
326
|
+
fullyQualifiedName?: string;
|
|
327
|
+
};
|
|
328
|
+
jurisdiction?: {
|
|
329
|
+
id?: string;
|
|
330
|
+
name?: string;
|
|
331
|
+
};
|
|
332
|
+
temporalDescription?: {
|
|
333
|
+
formal?: string;
|
|
334
|
+
original?: string;
|
|
335
|
+
};
|
|
336
|
+
}
|
|
337
|
+
/**
|
|
338
|
+
* Place search API response
|
|
339
|
+
*/
|
|
340
|
+
interface PlaceSearchResponse {
|
|
341
|
+
entries?: Array<{
|
|
342
|
+
id?: string;
|
|
343
|
+
title?: string;
|
|
344
|
+
content?: {
|
|
345
|
+
gedcomx?: {
|
|
346
|
+
places?: PlaceDescription[];
|
|
347
|
+
};
|
|
348
|
+
};
|
|
349
|
+
}>;
|
|
350
|
+
results?: number;
|
|
351
|
+
}
|
|
352
|
+
/**
|
|
353
|
+
* Place details API response
|
|
354
|
+
*/
|
|
355
|
+
interface PlaceDetailsResponse {
|
|
356
|
+
places?: PlaceDescription[];
|
|
357
|
+
}
|
|
358
|
+
/**
|
|
359
|
+
* Pedigree data from ancestry API
|
|
360
|
+
*/
|
|
361
|
+
interface PedigreeData {
|
|
362
|
+
persons?: PersonData[];
|
|
363
|
+
relationships?: Relationship[];
|
|
364
|
+
}
|
|
365
|
+
/**
|
|
366
|
+
* Person notes response from API
|
|
367
|
+
*/
|
|
368
|
+
interface PersonNotesResponse {
|
|
369
|
+
persons?: Array<{
|
|
370
|
+
notes?: Array<{
|
|
371
|
+
id?: string;
|
|
372
|
+
subject?: string;
|
|
373
|
+
text?: string;
|
|
374
|
+
attribution?: {
|
|
375
|
+
contributor?: {
|
|
376
|
+
resourceId?: string;
|
|
377
|
+
};
|
|
378
|
+
modified?: string;
|
|
379
|
+
};
|
|
380
|
+
}>;
|
|
381
|
+
}>;
|
|
382
|
+
}
|
|
383
|
+
/**
|
|
384
|
+
* Enhanced person with additional details
|
|
385
|
+
*/
|
|
386
|
+
interface EnhancedPerson extends PersonData {
|
|
387
|
+
fullDetails?: PersonWithRelationships;
|
|
388
|
+
notes?: PersonNotesResponse;
|
|
389
|
+
}
|
|
390
|
+
/**
|
|
391
|
+
* Person with relationships response from getPersonWithDetails API
|
|
392
|
+
*/
|
|
393
|
+
interface PersonWithRelationships {
|
|
394
|
+
persons?: PersonData[];
|
|
395
|
+
relationships?: Relationship[];
|
|
396
|
+
childAndParentsRelationships?: ChildAndParentsRelationship[];
|
|
397
|
+
sourceDescriptions?: SourceDescription[];
|
|
398
|
+
sources?: SourceReference[];
|
|
399
|
+
}
|
|
400
|
+
/**
|
|
401
|
+
* FamilySearch Source Description
|
|
402
|
+
*/
|
|
403
|
+
interface SourceDescription {
|
|
404
|
+
id: string;
|
|
405
|
+
about?: string;
|
|
406
|
+
titles?: Array<{
|
|
407
|
+
value: string;
|
|
408
|
+
}>;
|
|
409
|
+
citations?: Array<{
|
|
410
|
+
value: string;
|
|
411
|
+
}>;
|
|
412
|
+
resourceType?: string;
|
|
413
|
+
}
|
|
414
|
+
/**
|
|
415
|
+
* FamilySearch Source Reference
|
|
416
|
+
*/
|
|
417
|
+
interface SourceReference {
|
|
418
|
+
description?: string;
|
|
419
|
+
descriptionId?: string;
|
|
420
|
+
qualifiers?: Array<{
|
|
421
|
+
name: string;
|
|
422
|
+
value: string;
|
|
423
|
+
}>;
|
|
424
|
+
}
|
|
425
|
+
/**
|
|
426
|
+
* Enhanced pedigree with full details
|
|
427
|
+
*/
|
|
428
|
+
interface EnhancedPedigreeData {
|
|
429
|
+
persons: EnhancedPerson[];
|
|
430
|
+
relationships: Relationship[];
|
|
431
|
+
environment?: FamilySearchEnvironment;
|
|
432
|
+
/**
|
|
433
|
+
* IDs of persons in the direct ancestry before fullTree expansion.
|
|
434
|
+
* These are the persons returned by the ancestry API (typically 8-15 persons for 4 generations).
|
|
435
|
+
* Used to determine which persons are "connectable" to the root person.
|
|
436
|
+
*/
|
|
437
|
+
ancestryPersonIds?: string[];
|
|
438
|
+
}
|
|
439
|
+
/**
|
|
440
|
+
* OAuth token response
|
|
441
|
+
*/
|
|
442
|
+
interface OAuthTokenResponse {
|
|
443
|
+
access_token: string;
|
|
444
|
+
token_type: string;
|
|
445
|
+
expires_in?: number;
|
|
446
|
+
refresh_token?: string;
|
|
447
|
+
id_token?: string;
|
|
448
|
+
}
|
|
449
|
+
/**
|
|
450
|
+
* OAuth endpoints for an environment
|
|
451
|
+
*/
|
|
452
|
+
interface OAuthEndpoints {
|
|
453
|
+
authorization: string;
|
|
454
|
+
token: string;
|
|
455
|
+
currentUser: string;
|
|
456
|
+
}
|
|
457
|
+
/**
|
|
458
|
+
* OAuth configuration
|
|
459
|
+
*/
|
|
460
|
+
interface OAuthConfig {
|
|
461
|
+
clientId: string;
|
|
462
|
+
redirectUri: string;
|
|
463
|
+
environment?: FamilySearchEnvironment;
|
|
464
|
+
}
|
|
465
|
+
/**
|
|
466
|
+
* OAuth state validation result
|
|
467
|
+
*/
|
|
468
|
+
interface OAuthStateValidation {
|
|
469
|
+
valid: boolean;
|
|
470
|
+
isLinkMode: boolean;
|
|
471
|
+
lang?: string;
|
|
472
|
+
parentUid?: string;
|
|
473
|
+
}
|
|
474
|
+
/**
|
|
475
|
+
* Progress callback for long operations
|
|
476
|
+
*/
|
|
477
|
+
type ProgressCallback = (progress: {
|
|
478
|
+
stage: string;
|
|
479
|
+
current: number;
|
|
480
|
+
total: number;
|
|
481
|
+
percent: number;
|
|
482
|
+
}) => void;
|
|
483
|
+
|
|
484
|
+
export type { ChildAndParentsRelationship as C, EnvironmentConfig as E, FamilySearchEnvironment as F, NameForm as N, OAuthTokenResponse as O, PersonDisplay as P, Relationship as R, SDKLogger as S, FamilySearchSDKConfig as a, FamilySearchApiResponse as b, FamilySearchApiError as c, FamilySearchUser as d, FamilySearchPerson as e, PersonFact as f, PersonData as g, RelationshipDetails as h, PersonWithRelationships as i, PersonNotesResponse as j, FamilySearchPlace as k, PlaceDescription as l, PlaceSearchResult as m, PlaceSearchResponse as n, PlaceDetailsResponse as o, PedigreeData as p, EnhancedPerson as q, EnhancedPedigreeData as r, OAuthEndpoints as s, OAuthConfig as t, OAuthStateValidation as u, ProgressCallback as v, PersonMemoriesResponse as w, PersonSearchResponse as x };
|