@treeviz/familysearch-sdk 2.0.8 → 2.0.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -6068,6 +6068,16 @@ var PedigreeAPI = class {
6068
6068
  }
6069
6069
  };
6070
6070
 
6071
+ // src/utils/headers.ts
6072
+ var isLatin1 = (value) => [...value].every((char) => char.charCodeAt(0) <= 255);
6073
+ var toLatin1HeaderValue = (value) => [...value].map((char) => {
6074
+ if (char.charCodeAt(0) <= 255) {
6075
+ return char;
6076
+ }
6077
+ const stripped = char.normalize("NFKD").replace(/\p{M}/gu, "");
6078
+ return stripped && isLatin1(stripped) ? stripped : "?";
6079
+ }).join("");
6080
+
6071
6081
  // src/client.ts
6072
6082
  var ENVIRONMENT_CONFIGS = {
6073
6083
  production: {
@@ -6208,6 +6218,9 @@ var FamilySearchSDK = class {
6208
6218
  if (this.appKey) {
6209
6219
  headers["X-FS-App-Key"] = this.appKey;
6210
6220
  }
6221
+ for (const key of Object.keys(headers)) {
6222
+ headers[key] = toLatin1HeaderValue(headers[key]);
6223
+ }
6211
6224
  this.logger.log(
6212
6225
  `[FamilySearch SDK] ${options.method || "GET"} ${fullUrl}`
6213
6226
  );
@@ -7414,6 +7427,7 @@ exports.searchParentPlaces = searchParentPlaces;
7414
7427
  exports.searchPlaces = searchPlaces;
7415
7428
  exports.storeOAuthState = storeOAuthState;
7416
7429
  exports.storeTokens = storeTokens;
7430
+ exports.toLatin1HeaderValue = toLatin1HeaderValue;
7417
7431
  exports.transformFamilySearchUrl = transformFamilySearchUrl;
7418
7432
  exports.validateAccessToken = validateAccessToken;
7419
7433
  exports.validateOAuthState = validateOAuthState;
package/dist/index.d.cts CHANGED
@@ -4,7 +4,7 @@ import { F as FamilySearchApiResponse } from './index-0PpnEPuZ.cjs';
4
4
  export { E as EnvironmentConfig, a as FamilySearchApiError, b as FamilySearchEnvironment, c as FamilySearchSDKConfig, O as OAUTH_ENDPOINTS, d as OAUTH_STORAGE_KEYS, e as OAuthAPI, f as OAuthConfig, g as OAuthEndpoints, h as OAuthStateValidation, i as OAuthTokenResponse, P as ProgressCallback, R as RateLimiterConfig, S as SDKLogger, j as buildAuthorizationUrl, k as clearAllTokens, l as clearStoredTokens, m as exchangeCodeForToken, n as generateOAuthState, o as getOAuthEndpoints, p as getStoredAccessToken, q as getStoredRefreshToken, r as getTokenStorageKey, s as getUserInfo, t as openOAuthPopup, u as parseCallbackParams, v as refreshAccessToken, w as storeOAuthState, x as storeTokens, y as validateAccessToken, z as validateOAuthState } from './index-0PpnEPuZ.cjs';
5
5
  export { A as AttachSourceInput, a as AttachSourceResponse, C as ChangeEntry, b as ChildAndParentsRelationship, c as CreateChildAndParentsRelationshipInput, d as CreateCoupleRelationshipInput, e as CreatePersonResponse, f as CreateRelationshipResponse, D as DeletePersonResponse, g as Discussion, h as DiscussionComment, E as EnhancedPedigreeData, i as EnhancedPerson, F as FamilySearchPerson, M as MatchesResponse, N as NameForm, j as Note, k as NoteInput, l as NoteResponse, P as PedigreeData, m as PedigreeResponse, n as PersonChangeHistoryResponse, o as PersonData, p as PersonDiscussionsResponse, q as PersonDisplay, r as PersonFact, s as PersonInput, t as PersonMatchInput, u as PersonMatchOptions, v as PersonMergeAnalysis, w as PersonMergeInput, x as PersonMergeResponse, y as PersonNotesResponse, z as PersonPortrait, B as PersonPortraitsResponse, G as PersonSearchResponse, H as PersonSearchResult, I as PersonSourcesResponse, J as PersonWithRelationships, R as Relationship, K as RelationshipDetails, S as SourceDescription, L as SourceDescriptionDetail, O as SourceDescriptionResponse, Q as SourceDescriptionsResponse, T as SourceReference, U as TreePersonMatchEntry, V as TreePersonMatchesOptions, W as TreePersonMatchesResponse, X as UpdatePersonResponse, Y as UpdateRelationshipResponse } from './tree-D7X-beAQ.cjs';
6
6
  export { FamilySearchPlacePayload, extractGazetteerPlaceId, familySearchResearchPlaceUrl, numericPlaceIdFromRef, pickBestPlaceSearchResult } from './places/index.cjs';
7
- export { GedcomConversionOptions, convertFamilySearchToGedcom, convertToGedcom, transformFamilySearchUrl } from './utils/index.cjs';
7
+ export { GedcomConversionOptions, convertFamilySearchToGedcom, convertToGedcom, toLatin1HeaderValue, transformFamilySearchUrl } from './utils/index.cjs';
8
8
  export { i as TreeAPI } from './index-BfeojAOm.cjs';
9
9
 
10
10
  /**
package/dist/index.d.ts CHANGED
@@ -4,7 +4,7 @@ import { F as FamilySearchApiResponse } from './index-0PpnEPuZ.js';
4
4
  export { E as EnvironmentConfig, a as FamilySearchApiError, b as FamilySearchEnvironment, c as FamilySearchSDKConfig, O as OAUTH_ENDPOINTS, d as OAUTH_STORAGE_KEYS, e as OAuthAPI, f as OAuthConfig, g as OAuthEndpoints, h as OAuthStateValidation, i as OAuthTokenResponse, P as ProgressCallback, R as RateLimiterConfig, S as SDKLogger, j as buildAuthorizationUrl, k as clearAllTokens, l as clearStoredTokens, m as exchangeCodeForToken, n as generateOAuthState, o as getOAuthEndpoints, p as getStoredAccessToken, q as getStoredRefreshToken, r as getTokenStorageKey, s as getUserInfo, t as openOAuthPopup, u as parseCallbackParams, v as refreshAccessToken, w as storeOAuthState, x as storeTokens, y as validateAccessToken, z as validateOAuthState } from './index-0PpnEPuZ.js';
5
5
  export { A as AttachSourceInput, a as AttachSourceResponse, C as ChangeEntry, b as ChildAndParentsRelationship, c as CreateChildAndParentsRelationshipInput, d as CreateCoupleRelationshipInput, e as CreatePersonResponse, f as CreateRelationshipResponse, D as DeletePersonResponse, g as Discussion, h as DiscussionComment, E as EnhancedPedigreeData, i as EnhancedPerson, F as FamilySearchPerson, M as MatchesResponse, N as NameForm, j as Note, k as NoteInput, l as NoteResponse, P as PedigreeData, m as PedigreeResponse, n as PersonChangeHistoryResponse, o as PersonData, p as PersonDiscussionsResponse, q as PersonDisplay, r as PersonFact, s as PersonInput, t as PersonMatchInput, u as PersonMatchOptions, v as PersonMergeAnalysis, w as PersonMergeInput, x as PersonMergeResponse, y as PersonNotesResponse, z as PersonPortrait, B as PersonPortraitsResponse, G as PersonSearchResponse, H as PersonSearchResult, I as PersonSourcesResponse, J as PersonWithRelationships, R as Relationship, K as RelationshipDetails, S as SourceDescription, L as SourceDescriptionDetail, O as SourceDescriptionResponse, Q as SourceDescriptionsResponse, T as SourceReference, U as TreePersonMatchEntry, V as TreePersonMatchesOptions, W as TreePersonMatchesResponse, X as UpdatePersonResponse, Y as UpdateRelationshipResponse } from './tree-D7X-beAQ.js';
6
6
  export { FamilySearchPlacePayload, extractGazetteerPlaceId, familySearchResearchPlaceUrl, numericPlaceIdFromRef, pickBestPlaceSearchResult } from './places/index.js';
7
- export { GedcomConversionOptions, convertFamilySearchToGedcom, convertToGedcom, transformFamilySearchUrl } from './utils/index.js';
7
+ export { GedcomConversionOptions, convertFamilySearchToGedcom, convertToGedcom, toLatin1HeaderValue, transformFamilySearchUrl } from './utils/index.js';
8
8
  export { i as TreeAPI } from './index-CgIsZu6a.js';
9
9
 
10
10
  /**
package/dist/index.js CHANGED
@@ -6066,6 +6066,16 @@ var PedigreeAPI = class {
6066
6066
  }
6067
6067
  };
6068
6068
 
6069
+ // src/utils/headers.ts
6070
+ var isLatin1 = (value) => [...value].every((char) => char.charCodeAt(0) <= 255);
6071
+ var toLatin1HeaderValue = (value) => [...value].map((char) => {
6072
+ if (char.charCodeAt(0) <= 255) {
6073
+ return char;
6074
+ }
6075
+ const stripped = char.normalize("NFKD").replace(/\p{M}/gu, "");
6076
+ return stripped && isLatin1(stripped) ? stripped : "?";
6077
+ }).join("");
6078
+
6069
6079
  // src/client.ts
6070
6080
  var ENVIRONMENT_CONFIGS = {
6071
6081
  production: {
@@ -6206,6 +6216,9 @@ var FamilySearchSDK = class {
6206
6216
  if (this.appKey) {
6207
6217
  headers["X-FS-App-Key"] = this.appKey;
6208
6218
  }
6219
+ for (const key of Object.keys(headers)) {
6220
+ headers[key] = toLatin1HeaderValue(headers[key]);
6221
+ }
6209
6222
  this.logger.log(
6210
6223
  `[FamilySearch SDK] ${options.method || "GET"} ${fullUrl}`
6211
6224
  );
@@ -7347,4 +7360,4 @@ function addMarriageFacts(lines, relationships, person1, person2) {
7347
7360
  }
7348
7361
  var convertFamilySearchToGedcom = convertToGedcom;
7349
7362
 
7350
- export { AuthenticationError, ENVIRONMENT_CONFIGS, FamilySearchError, FamilySearchSDK, genealogies_exports as GenealogiesAPI, memories_exports as MemoriesAPI, NetworkError, NotFoundError, OAUTH_ENDPOINTS, OAUTH_STORAGE_KEYS, OAuthAPI, PedigreeAPI, PlacesAPI, RateLimitError, ServerError, standards_exports as StandardsAPI, tree_exports as TreeAPI, user_exports as UserAPI, ValidationError, vocab_exports as VocabAPI, buildAuthorizationUrl, checkPlaceIsChild, clearAllTokens, clearStoredTokens, convertFamilySearchToGedcom, convertToGedcom, createErrorFromResponse, createFamilySearchSDK, createNetworkError, exchangeCodeForToken, extractGazetteerPlaceId, familySearchResearchPlaceUrl, fetchMultiplePersons, fetchPedigree, generateOAuthState, getFamilySearchSDK, getOAuthEndpoints, getStoredAccessToken, getStoredRefreshToken, getTokenStorageKey, getUserInfo, initFamilySearchSDK, isRetryableError, numericPlaceIdFromRef, openOAuthPopup, parseCallbackParams, pickBestPlaceSearchResult, readCurrentUser2 as readCurrentUser, readPlaceAttributes, readPlaceChildren, readPlaceDescription, readPlaceDescriptionWithRelated, readPlaceDescriptions, readPlaceDescriptionsGroup, readPlaceDetails, readPlaceType, readPlaceTypeGroup, readPlaceTypeGroups, readPlaceTypes, refreshAccessToken, resetFamilySearchSDK, searchParentPlaces, searchPlaces, storeOAuthState, storeTokens, transformFamilySearchUrl, validateAccessToken, validateOAuthState };
7363
+ export { AuthenticationError, ENVIRONMENT_CONFIGS, FamilySearchError, FamilySearchSDK, genealogies_exports as GenealogiesAPI, memories_exports as MemoriesAPI, NetworkError, NotFoundError, OAUTH_ENDPOINTS, OAUTH_STORAGE_KEYS, OAuthAPI, PedigreeAPI, PlacesAPI, RateLimitError, ServerError, standards_exports as StandardsAPI, tree_exports as TreeAPI, user_exports as UserAPI, ValidationError, vocab_exports as VocabAPI, buildAuthorizationUrl, checkPlaceIsChild, clearAllTokens, clearStoredTokens, convertFamilySearchToGedcom, convertToGedcom, createErrorFromResponse, createFamilySearchSDK, createNetworkError, exchangeCodeForToken, extractGazetteerPlaceId, familySearchResearchPlaceUrl, fetchMultiplePersons, fetchPedigree, generateOAuthState, getFamilySearchSDK, getOAuthEndpoints, getStoredAccessToken, getStoredRefreshToken, getTokenStorageKey, getUserInfo, initFamilySearchSDK, isRetryableError, numericPlaceIdFromRef, openOAuthPopup, parseCallbackParams, pickBestPlaceSearchResult, readCurrentUser2 as readCurrentUser, readPlaceAttributes, readPlaceChildren, readPlaceDescription, readPlaceDescriptionWithRelated, readPlaceDescriptions, readPlaceDescriptionsGroup, readPlaceDetails, readPlaceType, readPlaceTypeGroup, readPlaceTypeGroups, readPlaceTypes, refreshAccessToken, resetFamilySearchSDK, searchParentPlaces, searchPlaces, storeOAuthState, storeTokens, toLatin1HeaderValue, transformFamilySearchUrl, validateAccessToken, validateOAuthState };
@@ -937,6 +937,17 @@ function addMarriageFacts(lines, relationships, person1, person2) {
937
937
  }
938
938
  var convertFamilySearchToGedcom = convertToGedcom;
939
939
 
940
+ // src/utils/headers.ts
941
+ var isLatin1 = (value) => [...value].every((char) => char.charCodeAt(0) <= 255);
942
+ var toLatin1HeaderValue = (value) => [...value].map((char) => {
943
+ if (char.charCodeAt(0) <= 255) {
944
+ return char;
945
+ }
946
+ const stripped = char.normalize("NFKD").replace(/\p{M}/gu, "");
947
+ return stripped && isLatin1(stripped) ? stripped : "?";
948
+ }).join("");
949
+
940
950
  exports.convertFamilySearchToGedcom = convertFamilySearchToGedcom;
941
951
  exports.convertToGedcom = convertToGedcom;
952
+ exports.toLatin1HeaderValue = toLatin1HeaderValue;
942
953
  exports.transformFamilySearchUrl = transformFamilySearchUrl;
@@ -49,4 +49,6 @@ interface GedcomConversionOptions {
49
49
  declare function convertToGedcom(pedigreeData: EnhancedPedigreeData, options?: GedcomConversionOptions): string;
50
50
  declare const convertFamilySearchToGedcom: typeof convertToGedcom;
51
51
 
52
- export { type GedcomConversionOptions, convertFamilySearchToGedcom, convertToGedcom, transformFamilySearchUrl };
52
+ declare const toLatin1HeaderValue: (value: string) => string;
53
+
54
+ export { type GedcomConversionOptions, convertFamilySearchToGedcom, convertToGedcom, toLatin1HeaderValue, transformFamilySearchUrl };
@@ -49,4 +49,6 @@ interface GedcomConversionOptions {
49
49
  declare function convertToGedcom(pedigreeData: EnhancedPedigreeData, options?: GedcomConversionOptions): string;
50
50
  declare const convertFamilySearchToGedcom: typeof convertToGedcom;
51
51
 
52
- export { type GedcomConversionOptions, convertFamilySearchToGedcom, convertToGedcom, transformFamilySearchUrl };
52
+ declare const toLatin1HeaderValue: (value: string) => string;
53
+
54
+ export { type GedcomConversionOptions, convertFamilySearchToGedcom, convertToGedcom, toLatin1HeaderValue, transformFamilySearchUrl };
@@ -935,4 +935,14 @@ function addMarriageFacts(lines, relationships, person1, person2) {
935
935
  }
936
936
  var convertFamilySearchToGedcom = convertToGedcom;
937
937
 
938
- export { convertFamilySearchToGedcom, convertToGedcom, transformFamilySearchUrl };
938
+ // src/utils/headers.ts
939
+ var isLatin1 = (value) => [...value].every((char) => char.charCodeAt(0) <= 255);
940
+ var toLatin1HeaderValue = (value) => [...value].map((char) => {
941
+ if (char.charCodeAt(0) <= 255) {
942
+ return char;
943
+ }
944
+ const stripped = char.normalize("NFKD").replace(/\p{M}/gu, "");
945
+ return stripped && isLatin1(stripped) ? stripped : "?";
946
+ }).join("");
947
+
948
+ export { convertFamilySearchToGedcom, convertToGedcom, toLatin1HeaderValue, transformFamilySearchUrl };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@treeviz/familysearch-sdk",
3
- "version": "2.0.8",
3
+ "version": "2.0.9",
4
4
  "description": "Modern TypeScript SDK for FamilySearch API v3 - OAuth, Places API, Tree API, and GEDCOM utilities",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",