@singi-labs/sifa-sdk 0.11.18 → 0.11.20

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.d.cts CHANGED
@@ -482,9 +482,36 @@ declare function getCalendarEventStatusLabel(value: string | undefined | null):
482
482
  * It is intentionally not a canonicalizer: acronyms it can't know about stay
483
483
  * word-cased ("gmbh" -> "Gmbh"). The user's own custom display name is the
484
484
  * escape hatch when the heuristic is wrong.
485
+ *
486
+ * Scoped to ASCII-Latin case-bearing strings (decision D8): any name
487
+ * containing a non-ASCII letter (accented Latin, Cyrillic, Greek, CJK,
488
+ * Turkish dotted/dotless i, etc) is returned unchanged. Locale-dependent
489
+ * casing rules (Turkish i/İ vs ı/I is the canonical trap) make naive
490
+ * `toUpperCase`/`toLowerCase` unsafe outside ASCII, and this formatter has
491
+ * no reliable way to pick the right locale for an arbitrary company name.
492
+ *
493
+ * Known limitation: this does not (and cannot) distinguish an intentional
494
+ * all-lowercase ASCII wordmark ("adidas", "thyssenkrupp") from a
495
+ * PDL-lowercased name that should be title-cased ("spryker" -> "Spryker").
496
+ * Both are pure ASCII, so both still get title-cased. See sifa-workspace#235.
485
497
  */
486
498
  declare function formatCompanyName(name: string): string;
487
499
 
500
+ /**
501
+ * Build a stable dedup/prefix key for a company name (decision D8).
502
+ *
503
+ * NFC-normalizes, case-folds, and strips Latin diacritics so that visually
504
+ * or logically equivalent spellings collapse to one key: "Nestlé", "Nestle",
505
+ * and "NESTLE" all produce the same value. Non-Latin scripts (Cyrillic, CJK,
506
+ * etc) have no Latin diacritics to strip, so they pass through case-folded
507
+ * and NFC-normalized only.
508
+ *
509
+ * This is a pure SDK helper for the in-memory/dedup key. Persisting it as a
510
+ * dedicated column on the sifa-api side is tracked separately
511
+ * (sifa-workspace#229) and out of scope here.
512
+ */
513
+ declare function normalizeCompanyKey(name: string): string;
514
+
488
515
  /**
489
516
  * Format a date string as a relative time (e.g. "5m ago", "3d ago").
490
517
  * Returns an empty string for invalid or future dates.
@@ -1056,6 +1083,34 @@ declare function searchResultDisambiguation(result: EntitySearchResult): string;
1056
1083
  /** Stable per-row identity for React keys and dedupe (entity id or PDL id). */
1057
1084
  declare function entityResultKey(result: EntitySearchResult): string;
1058
1085
 
1086
+ /**
1087
+ * Anchor-quality classification for a position's `entityRef` pointer (#159).
1088
+ *
1089
+ * A durable company link tiers by the quality of its anchor, which drives the
1090
+ * link indicator in the UI (registry-backed reads stronger than a Sifa-scoped
1091
+ * PDL pointer, per the ratified D5 chip policy). The classification is derived
1092
+ * purely from the ref URI's host, so it is a shared, cross-platform predicate
1093
+ * (web today, the native app later).
1094
+ *
1095
+ * registry -- a portable external id any atproto app can resolve
1096
+ * (Wikidata / ROR / GLEIF). Renders as a full "Linked" indicator.
1097
+ * sifa -- a Sifa-scoped `sifa.id/company/<publicId>` pointer for a
1098
+ * PDL-only company. Renders as a muted "Linked" (no glyph).
1099
+ * unlinked -- no ref, a malformed URL, or an unrecognized host. Free text.
1100
+ *
1101
+ * NEVER surfaced as "verified": a link is not a verification.
1102
+ */
1103
+ declare const ENTITY_REF_ANCHORS: readonly ["registry", "sifa", "unlinked"];
1104
+ type EntityRefAnchor = (typeof ENTITY_REF_ANCHORS)[number];
1105
+ /**
1106
+ * Classify an entityRef by anchor quality. Uses strict host parsing (never
1107
+ * substring matching) so a hostile URL that merely contains a registry host in a
1108
+ * query string is treated as unlinked, not falsely linked.
1109
+ */
1110
+ declare function classifyEntityRef(entityRef: string | null | undefined): EntityRefAnchor;
1111
+ /** Whether a position carries a durable link of any anchor quality. */
1112
+ declare function isLinked(entityRef: string | null | undefined): boolean;
1113
+
1059
1114
  /**
1060
1115
  * Sifa SDK -- public client library for the Sifa AppView on AT Protocol.
1061
1116
  *
@@ -1065,4 +1120,4 @@ declare function entityResultKey(result: EntitySearchResult): string;
1065
1120
  */
1066
1121
  declare const SIFA_SDK_VERSION: string;
1067
1122
 
1068
- export { ACTIVITY_TIERS, ACTIVITY_VISIBILITY_RULES, APP_CATEGORIES, APP_CATEGORY_IDS, APP_CATEGORY_MAP, APP_URL_PATTERNS, type ActivityItemForUrl, type ActivityTaxonomy, type ActivityTier, type AppCategoryId, type AppUrlPatterns, CALENDAR_EVENT_MODE_LABELS, CALENDAR_EVENT_STATUS_LABELS, CATEGORY_LABELS, CATEGORY_ORDER, COLLECTION_TO_APP, COMPANY_OPTIONAL_EMPLOYMENT_TYPES, COMPLETENESS_MAX_SCORE, CONTINENTS, COUNTRIES, type CardHealth, type CardHealthStrategy, type ContinentCode, type CsvRow, DIMENSIONS_MAX_SCORE, type DimensionKey, type DimensionMap, type DisambiguationFields, EMPLOYMENT_TYPE_GROUPS, EMPLOYMENT_TYPE_LABELS, type EmploymentTypeGroup, type EmploymentTypeOption, EntitySearchResult, INDUSTRY_OPTIONS, type IndustryOption, type KnownAppId, type LexiconEntry, LocationValue, MIN_SKILLS, type MergedProfileSkill, OPEN_TO_OPTIONS, OPEN_TO_TOKENS, OPEN_TO_TOKEN_TO_VALUE, OPEN_TO_VALUE_TO_TOKEN, type OpenToGroup, type OpenToOption, PLATFORM_LABELS, PLATFORM_OPTIONS, PRESENTATION_LINK_TYPE_LABELS, PRESENTATION_LINK_TYPE_OPTIONS, PRESENTATION_ROLE_LABELS, PRESENTATION_ROLE_OPTIONS, PUBLISHERS, type ParsedDelivery, type ParsedPresentation, type PdsProvider, PdsProviderInfo, type PlatformId, type PresentationDeliverySummary, PresentationDuration, type PresentationLinkTypeOption, type PresentationRoleOption, type PrimaryPositionCandidate, Profile, type ProfileCompletion, type ProfileDimensionInputs, ProfilePresentationDelivery, ProfilePresentationDeliveryRecord, ProfilePresentationRecord, ProfileSkill, type Publisher, type RgbColor, SIFA_SDK_VERSION, SKILL_CATEGORIES, STANDARD_PUBLISHER_ID, type SkillCategory, type TierMeta, WORKPLACE_TYPE_LABELS, WORKPLACE_TYPE_OPTIONS, type WorkplaceTypeOption, categoryForApp, certDateExtractor, completenessPercent, completenessScore, contrastRatio, countFilledDimensions, countryCodeToFlag, dateRangeExtractor, dedupeSkills, detectPdsProvider, dimensionsFromInputs, durationFromMinutes, entityDisambiguationLabel, entityResultKey, findIndustry, formatCompanyName, formatDistanceToNow, formatLocation, formatPresentationDuration, formatRelativeTime, getActivityTaxonomyVersion, getActivityTier, getAppCategoryIcon, getAppIdForCollection, getCalendarEventModeLabel, getCalendarEventStatusLabel, getContinent, getDisplayLabel, getEmploymentTypeLabel, getFaviconUrl, getFilledDimensionsMap, getHandleStem, getIndustryLabelKey, getLexiconEntry, getOpenToLabelKey, getPdsDisplayName, getPlatformLabel, getPresentationLinkTypeLabel, getPresentationRoleLabel, getPublisherByHost, getPublisherById, getPublisherFromSiteUrl, getTierMeta, getWorkplaceTypeLabel, groupSkillsByCategory, isAppCategory, isCompanyRequired, isKnownAppId, isKnownPlatform, isPseudoEmployer, isValidRgbColor, isVisibleActivityItem, lexiconDateExtractor, limitCombiningMarks, meetsContrastAA, normalizeOpenTo, normalizePlatformId, normalizePresentationMode, normalizePresentationRole, normalizeWorkplaceTypes, openToTokenToValue, openToValueToToken, parseIntendedAudiences, parseLocationString, parsePresentationDuration, pdsProviderFromApi, pickPrimaryPosition, presentationCsvRowToRecord, presentationDeliveryCsvRowToRecord, profileToDimensionInputs, relativeLuminance, resolveCardHealth, resolveCardUrl, rgbToString, sanitizeDisplayText, sanitizeHandleInput, searchResultDisambiguation, singleDateExtractor, sortByDateDesc, stripHtmlToText, summarizePresentationDeliveries, truncateGraphemes };
1123
+ export { ACTIVITY_TIERS, ACTIVITY_VISIBILITY_RULES, APP_CATEGORIES, APP_CATEGORY_IDS, APP_CATEGORY_MAP, APP_URL_PATTERNS, type ActivityItemForUrl, type ActivityTaxonomy, type ActivityTier, type AppCategoryId, type AppUrlPatterns, CALENDAR_EVENT_MODE_LABELS, CALENDAR_EVENT_STATUS_LABELS, CATEGORY_LABELS, CATEGORY_ORDER, COLLECTION_TO_APP, COMPANY_OPTIONAL_EMPLOYMENT_TYPES, COMPLETENESS_MAX_SCORE, CONTINENTS, COUNTRIES, type CardHealth, type CardHealthStrategy, type ContinentCode, type CsvRow, DIMENSIONS_MAX_SCORE, type DimensionKey, type DimensionMap, type DisambiguationFields, EMPLOYMENT_TYPE_GROUPS, EMPLOYMENT_TYPE_LABELS, ENTITY_REF_ANCHORS, type EmploymentTypeGroup, type EmploymentTypeOption, type EntityRefAnchor, EntitySearchResult, INDUSTRY_OPTIONS, type IndustryOption, type KnownAppId, type LexiconEntry, LocationValue, MIN_SKILLS, type MergedProfileSkill, OPEN_TO_OPTIONS, OPEN_TO_TOKENS, OPEN_TO_TOKEN_TO_VALUE, OPEN_TO_VALUE_TO_TOKEN, type OpenToGroup, type OpenToOption, PLATFORM_LABELS, PLATFORM_OPTIONS, PRESENTATION_LINK_TYPE_LABELS, PRESENTATION_LINK_TYPE_OPTIONS, PRESENTATION_ROLE_LABELS, PRESENTATION_ROLE_OPTIONS, PUBLISHERS, type ParsedDelivery, type ParsedPresentation, type PdsProvider, PdsProviderInfo, type PlatformId, type PresentationDeliverySummary, PresentationDuration, type PresentationLinkTypeOption, type PresentationRoleOption, type PrimaryPositionCandidate, Profile, type ProfileCompletion, type ProfileDimensionInputs, ProfilePresentationDelivery, ProfilePresentationDeliveryRecord, ProfilePresentationRecord, ProfileSkill, type Publisher, type RgbColor, SIFA_SDK_VERSION, SKILL_CATEGORIES, STANDARD_PUBLISHER_ID, type SkillCategory, type TierMeta, WORKPLACE_TYPE_LABELS, WORKPLACE_TYPE_OPTIONS, type WorkplaceTypeOption, categoryForApp, certDateExtractor, classifyEntityRef, completenessPercent, completenessScore, contrastRatio, countFilledDimensions, countryCodeToFlag, dateRangeExtractor, dedupeSkills, detectPdsProvider, dimensionsFromInputs, durationFromMinutes, entityDisambiguationLabel, entityResultKey, findIndustry, formatCompanyName, formatDistanceToNow, formatLocation, formatPresentationDuration, formatRelativeTime, getActivityTaxonomyVersion, getActivityTier, getAppCategoryIcon, getAppIdForCollection, getCalendarEventModeLabel, getCalendarEventStatusLabel, getContinent, getDisplayLabel, getEmploymentTypeLabel, getFaviconUrl, getFilledDimensionsMap, getHandleStem, getIndustryLabelKey, getLexiconEntry, getOpenToLabelKey, getPdsDisplayName, getPlatformLabel, getPresentationLinkTypeLabel, getPresentationRoleLabel, getPublisherByHost, getPublisherById, getPublisherFromSiteUrl, getTierMeta, getWorkplaceTypeLabel, groupSkillsByCategory, isAppCategory, isCompanyRequired, isKnownAppId, isKnownPlatform, isLinked, isPseudoEmployer, isValidRgbColor, isVisibleActivityItem, lexiconDateExtractor, limitCombiningMarks, meetsContrastAA, normalizeCompanyKey, normalizeOpenTo, normalizePlatformId, normalizePresentationMode, normalizePresentationRole, normalizeWorkplaceTypes, openToTokenToValue, openToValueToToken, parseIntendedAudiences, parseLocationString, parsePresentationDuration, pdsProviderFromApi, pickPrimaryPosition, presentationCsvRowToRecord, presentationDeliveryCsvRowToRecord, profileToDimensionInputs, relativeLuminance, resolveCardHealth, resolveCardUrl, rgbToString, sanitizeDisplayText, sanitizeHandleInput, searchResultDisambiguation, singleDateExtractor, sortByDateDesc, stripHtmlToText, summarizePresentationDeliveries, truncateGraphemes };
package/dist/index.d.ts CHANGED
@@ -482,9 +482,36 @@ declare function getCalendarEventStatusLabel(value: string | undefined | null):
482
482
  * It is intentionally not a canonicalizer: acronyms it can't know about stay
483
483
  * word-cased ("gmbh" -> "Gmbh"). The user's own custom display name is the
484
484
  * escape hatch when the heuristic is wrong.
485
+ *
486
+ * Scoped to ASCII-Latin case-bearing strings (decision D8): any name
487
+ * containing a non-ASCII letter (accented Latin, Cyrillic, Greek, CJK,
488
+ * Turkish dotted/dotless i, etc) is returned unchanged. Locale-dependent
489
+ * casing rules (Turkish i/İ vs ı/I is the canonical trap) make naive
490
+ * `toUpperCase`/`toLowerCase` unsafe outside ASCII, and this formatter has
491
+ * no reliable way to pick the right locale for an arbitrary company name.
492
+ *
493
+ * Known limitation: this does not (and cannot) distinguish an intentional
494
+ * all-lowercase ASCII wordmark ("adidas", "thyssenkrupp") from a
495
+ * PDL-lowercased name that should be title-cased ("spryker" -> "Spryker").
496
+ * Both are pure ASCII, so both still get title-cased. See sifa-workspace#235.
485
497
  */
486
498
  declare function formatCompanyName(name: string): string;
487
499
 
500
+ /**
501
+ * Build a stable dedup/prefix key for a company name (decision D8).
502
+ *
503
+ * NFC-normalizes, case-folds, and strips Latin diacritics so that visually
504
+ * or logically equivalent spellings collapse to one key: "Nestlé", "Nestle",
505
+ * and "NESTLE" all produce the same value. Non-Latin scripts (Cyrillic, CJK,
506
+ * etc) have no Latin diacritics to strip, so they pass through case-folded
507
+ * and NFC-normalized only.
508
+ *
509
+ * This is a pure SDK helper for the in-memory/dedup key. Persisting it as a
510
+ * dedicated column on the sifa-api side is tracked separately
511
+ * (sifa-workspace#229) and out of scope here.
512
+ */
513
+ declare function normalizeCompanyKey(name: string): string;
514
+
488
515
  /**
489
516
  * Format a date string as a relative time (e.g. "5m ago", "3d ago").
490
517
  * Returns an empty string for invalid or future dates.
@@ -1056,6 +1083,34 @@ declare function searchResultDisambiguation(result: EntitySearchResult): string;
1056
1083
  /** Stable per-row identity for React keys and dedupe (entity id or PDL id). */
1057
1084
  declare function entityResultKey(result: EntitySearchResult): string;
1058
1085
 
1086
+ /**
1087
+ * Anchor-quality classification for a position's `entityRef` pointer (#159).
1088
+ *
1089
+ * A durable company link tiers by the quality of its anchor, which drives the
1090
+ * link indicator in the UI (registry-backed reads stronger than a Sifa-scoped
1091
+ * PDL pointer, per the ratified D5 chip policy). The classification is derived
1092
+ * purely from the ref URI's host, so it is a shared, cross-platform predicate
1093
+ * (web today, the native app later).
1094
+ *
1095
+ * registry -- a portable external id any atproto app can resolve
1096
+ * (Wikidata / ROR / GLEIF). Renders as a full "Linked" indicator.
1097
+ * sifa -- a Sifa-scoped `sifa.id/company/<publicId>` pointer for a
1098
+ * PDL-only company. Renders as a muted "Linked" (no glyph).
1099
+ * unlinked -- no ref, a malformed URL, or an unrecognized host. Free text.
1100
+ *
1101
+ * NEVER surfaced as "verified": a link is not a verification.
1102
+ */
1103
+ declare const ENTITY_REF_ANCHORS: readonly ["registry", "sifa", "unlinked"];
1104
+ type EntityRefAnchor = (typeof ENTITY_REF_ANCHORS)[number];
1105
+ /**
1106
+ * Classify an entityRef by anchor quality. Uses strict host parsing (never
1107
+ * substring matching) so a hostile URL that merely contains a registry host in a
1108
+ * query string is treated as unlinked, not falsely linked.
1109
+ */
1110
+ declare function classifyEntityRef(entityRef: string | null | undefined): EntityRefAnchor;
1111
+ /** Whether a position carries a durable link of any anchor quality. */
1112
+ declare function isLinked(entityRef: string | null | undefined): boolean;
1113
+
1059
1114
  /**
1060
1115
  * Sifa SDK -- public client library for the Sifa AppView on AT Protocol.
1061
1116
  *
@@ -1065,4 +1120,4 @@ declare function entityResultKey(result: EntitySearchResult): string;
1065
1120
  */
1066
1121
  declare const SIFA_SDK_VERSION: string;
1067
1122
 
1068
- export { ACTIVITY_TIERS, ACTIVITY_VISIBILITY_RULES, APP_CATEGORIES, APP_CATEGORY_IDS, APP_CATEGORY_MAP, APP_URL_PATTERNS, type ActivityItemForUrl, type ActivityTaxonomy, type ActivityTier, type AppCategoryId, type AppUrlPatterns, CALENDAR_EVENT_MODE_LABELS, CALENDAR_EVENT_STATUS_LABELS, CATEGORY_LABELS, CATEGORY_ORDER, COLLECTION_TO_APP, COMPANY_OPTIONAL_EMPLOYMENT_TYPES, COMPLETENESS_MAX_SCORE, CONTINENTS, COUNTRIES, type CardHealth, type CardHealthStrategy, type ContinentCode, type CsvRow, DIMENSIONS_MAX_SCORE, type DimensionKey, type DimensionMap, type DisambiguationFields, EMPLOYMENT_TYPE_GROUPS, EMPLOYMENT_TYPE_LABELS, type EmploymentTypeGroup, type EmploymentTypeOption, EntitySearchResult, INDUSTRY_OPTIONS, type IndustryOption, type KnownAppId, type LexiconEntry, LocationValue, MIN_SKILLS, type MergedProfileSkill, OPEN_TO_OPTIONS, OPEN_TO_TOKENS, OPEN_TO_TOKEN_TO_VALUE, OPEN_TO_VALUE_TO_TOKEN, type OpenToGroup, type OpenToOption, PLATFORM_LABELS, PLATFORM_OPTIONS, PRESENTATION_LINK_TYPE_LABELS, PRESENTATION_LINK_TYPE_OPTIONS, PRESENTATION_ROLE_LABELS, PRESENTATION_ROLE_OPTIONS, PUBLISHERS, type ParsedDelivery, type ParsedPresentation, type PdsProvider, PdsProviderInfo, type PlatformId, type PresentationDeliverySummary, PresentationDuration, type PresentationLinkTypeOption, type PresentationRoleOption, type PrimaryPositionCandidate, Profile, type ProfileCompletion, type ProfileDimensionInputs, ProfilePresentationDelivery, ProfilePresentationDeliveryRecord, ProfilePresentationRecord, ProfileSkill, type Publisher, type RgbColor, SIFA_SDK_VERSION, SKILL_CATEGORIES, STANDARD_PUBLISHER_ID, type SkillCategory, type TierMeta, WORKPLACE_TYPE_LABELS, WORKPLACE_TYPE_OPTIONS, type WorkplaceTypeOption, categoryForApp, certDateExtractor, completenessPercent, completenessScore, contrastRatio, countFilledDimensions, countryCodeToFlag, dateRangeExtractor, dedupeSkills, detectPdsProvider, dimensionsFromInputs, durationFromMinutes, entityDisambiguationLabel, entityResultKey, findIndustry, formatCompanyName, formatDistanceToNow, formatLocation, formatPresentationDuration, formatRelativeTime, getActivityTaxonomyVersion, getActivityTier, getAppCategoryIcon, getAppIdForCollection, getCalendarEventModeLabel, getCalendarEventStatusLabel, getContinent, getDisplayLabel, getEmploymentTypeLabel, getFaviconUrl, getFilledDimensionsMap, getHandleStem, getIndustryLabelKey, getLexiconEntry, getOpenToLabelKey, getPdsDisplayName, getPlatformLabel, getPresentationLinkTypeLabel, getPresentationRoleLabel, getPublisherByHost, getPublisherById, getPublisherFromSiteUrl, getTierMeta, getWorkplaceTypeLabel, groupSkillsByCategory, isAppCategory, isCompanyRequired, isKnownAppId, isKnownPlatform, isPseudoEmployer, isValidRgbColor, isVisibleActivityItem, lexiconDateExtractor, limitCombiningMarks, meetsContrastAA, normalizeOpenTo, normalizePlatformId, normalizePresentationMode, normalizePresentationRole, normalizeWorkplaceTypes, openToTokenToValue, openToValueToToken, parseIntendedAudiences, parseLocationString, parsePresentationDuration, pdsProviderFromApi, pickPrimaryPosition, presentationCsvRowToRecord, presentationDeliveryCsvRowToRecord, profileToDimensionInputs, relativeLuminance, resolveCardHealth, resolveCardUrl, rgbToString, sanitizeDisplayText, sanitizeHandleInput, searchResultDisambiguation, singleDateExtractor, sortByDateDesc, stripHtmlToText, summarizePresentationDeliveries, truncateGraphemes };
1123
+ export { ACTIVITY_TIERS, ACTIVITY_VISIBILITY_RULES, APP_CATEGORIES, APP_CATEGORY_IDS, APP_CATEGORY_MAP, APP_URL_PATTERNS, type ActivityItemForUrl, type ActivityTaxonomy, type ActivityTier, type AppCategoryId, type AppUrlPatterns, CALENDAR_EVENT_MODE_LABELS, CALENDAR_EVENT_STATUS_LABELS, CATEGORY_LABELS, CATEGORY_ORDER, COLLECTION_TO_APP, COMPANY_OPTIONAL_EMPLOYMENT_TYPES, COMPLETENESS_MAX_SCORE, CONTINENTS, COUNTRIES, type CardHealth, type CardHealthStrategy, type ContinentCode, type CsvRow, DIMENSIONS_MAX_SCORE, type DimensionKey, type DimensionMap, type DisambiguationFields, EMPLOYMENT_TYPE_GROUPS, EMPLOYMENT_TYPE_LABELS, ENTITY_REF_ANCHORS, type EmploymentTypeGroup, type EmploymentTypeOption, type EntityRefAnchor, EntitySearchResult, INDUSTRY_OPTIONS, type IndustryOption, type KnownAppId, type LexiconEntry, LocationValue, MIN_SKILLS, type MergedProfileSkill, OPEN_TO_OPTIONS, OPEN_TO_TOKENS, OPEN_TO_TOKEN_TO_VALUE, OPEN_TO_VALUE_TO_TOKEN, type OpenToGroup, type OpenToOption, PLATFORM_LABELS, PLATFORM_OPTIONS, PRESENTATION_LINK_TYPE_LABELS, PRESENTATION_LINK_TYPE_OPTIONS, PRESENTATION_ROLE_LABELS, PRESENTATION_ROLE_OPTIONS, PUBLISHERS, type ParsedDelivery, type ParsedPresentation, type PdsProvider, PdsProviderInfo, type PlatformId, type PresentationDeliverySummary, PresentationDuration, type PresentationLinkTypeOption, type PresentationRoleOption, type PrimaryPositionCandidate, Profile, type ProfileCompletion, type ProfileDimensionInputs, ProfilePresentationDelivery, ProfilePresentationDeliveryRecord, ProfilePresentationRecord, ProfileSkill, type Publisher, type RgbColor, SIFA_SDK_VERSION, SKILL_CATEGORIES, STANDARD_PUBLISHER_ID, type SkillCategory, type TierMeta, WORKPLACE_TYPE_LABELS, WORKPLACE_TYPE_OPTIONS, type WorkplaceTypeOption, categoryForApp, certDateExtractor, classifyEntityRef, completenessPercent, completenessScore, contrastRatio, countFilledDimensions, countryCodeToFlag, dateRangeExtractor, dedupeSkills, detectPdsProvider, dimensionsFromInputs, durationFromMinutes, entityDisambiguationLabel, entityResultKey, findIndustry, formatCompanyName, formatDistanceToNow, formatLocation, formatPresentationDuration, formatRelativeTime, getActivityTaxonomyVersion, getActivityTier, getAppCategoryIcon, getAppIdForCollection, getCalendarEventModeLabel, getCalendarEventStatusLabel, getContinent, getDisplayLabel, getEmploymentTypeLabel, getFaviconUrl, getFilledDimensionsMap, getHandleStem, getIndustryLabelKey, getLexiconEntry, getOpenToLabelKey, getPdsDisplayName, getPlatformLabel, getPresentationLinkTypeLabel, getPresentationRoleLabel, getPublisherByHost, getPublisherById, getPublisherFromSiteUrl, getTierMeta, getWorkplaceTypeLabel, groupSkillsByCategory, isAppCategory, isCompanyRequired, isKnownAppId, isKnownPlatform, isLinked, isPseudoEmployer, isValidRgbColor, isVisibleActivityItem, lexiconDateExtractor, limitCombiningMarks, meetsContrastAA, normalizeCompanyKey, normalizeOpenTo, normalizePlatformId, normalizePresentationMode, normalizePresentationRole, normalizeWorkplaceTypes, openToTokenToValue, openToValueToToken, parseIntendedAudiences, parseLocationString, parsePresentationDuration, pdsProviderFromApi, pickPrimaryPosition, presentationCsvRowToRecord, presentationDeliveryCsvRowToRecord, profileToDimensionInputs, relativeLuminance, resolveCardHealth, resolveCardUrl, rgbToString, sanitizeDisplayText, sanitizeHandleInput, searchResultDisambiguation, singleDateExtractor, sortByDateDesc, stripHtmlToText, summarizePresentationDeliveries, truncateGraphemes };
package/dist/index.js CHANGED
@@ -1459,6 +1459,13 @@ var SMALL_WORDS = /* @__PURE__ */ new Set([
1459
1459
  "le",
1460
1460
  "y"
1461
1461
  ]);
1462
+ function hasNonAsciiLetter(value) {
1463
+ for (const char of value) {
1464
+ const codePoint = char.codePointAt(0) ?? 0;
1465
+ if (codePoint > 127 && /\p{L}/u.test(char)) return true;
1466
+ }
1467
+ return false;
1468
+ }
1462
1469
  function capitalizeWord(word) {
1463
1470
  return word.replace(
1464
1471
  /^([^\p{L}\p{N}]*)(\p{L})/u,
@@ -1467,7 +1474,7 @@ function capitalizeWord(word) {
1467
1474
  }
1468
1475
  function formatCompanyName(name) {
1469
1476
  const trimmed = name.trim();
1470
- if (!trimmed || trimmed !== trimmed.toLowerCase()) return trimmed;
1477
+ if (!trimmed || hasNonAsciiLetter(trimmed) || trimmed !== trimmed.toLowerCase()) return trimmed;
1471
1478
  let seenWord = false;
1472
1479
  return trimmed.split(/(\s+)/).map((token) => {
1473
1480
  if (token.length === 0 || /^\s+$/.test(token)) return token;
@@ -1478,6 +1485,15 @@ function formatCompanyName(name) {
1478
1485
  }).join("");
1479
1486
  }
1480
1487
 
1488
+ // src/format/normalize-company-key.ts
1489
+ var COMBINING_MARKS = /[\u0300-\u036f]/g;
1490
+ function normalizeCompanyKey(name) {
1491
+ const trimmed = name.trim();
1492
+ if (!trimmed) return "";
1493
+ const caseFolded = trimmed.normalize("NFC").toLowerCase();
1494
+ return caseFolded.normalize("NFD").replace(COMBINING_MARKS, "").normalize("NFC");
1495
+ }
1496
+
1481
1497
  // src/format/format-time.ts
1482
1498
  function formatRelativeTime(dateString) {
1483
1499
  const date = new Date(dateString);
@@ -2502,6 +2518,34 @@ function searchResultDisambiguation(result) {
2502
2518
  function entityResultKey(result) {
2503
2519
  return result.source === "entity" ? `entity:${result.entityId}` : `pdl:${result.pdlId}`;
2504
2520
  }
2521
+
2522
+ // src/logic/entity-ref-anchor.ts
2523
+ var ENTITY_REF_ANCHORS = ["registry", "sifa", "unlinked"];
2524
+ var REGISTRY_HOSTS = /* @__PURE__ */ new Set([
2525
+ "wikidata.org",
2526
+ "www.wikidata.org",
2527
+ "ror.org",
2528
+ "gleif.org",
2529
+ "www.gleif.org"
2530
+ ]);
2531
+ var SIFA_HOST = "sifa.id";
2532
+ function classifyEntityRef(entityRef) {
2533
+ if (!entityRef || !entityRef.trim()) return "unlinked";
2534
+ let url;
2535
+ try {
2536
+ url = new URL(entityRef.trim());
2537
+ } catch {
2538
+ return "unlinked";
2539
+ }
2540
+ if (url.protocol !== "https:" && url.protocol !== "http:") return "unlinked";
2541
+ const host = url.hostname.toLowerCase();
2542
+ if (REGISTRY_HOSTS.has(host)) return "registry";
2543
+ if (host === SIFA_HOST) return "sifa";
2544
+ return "unlinked";
2545
+ }
2546
+ function isLinked(entityRef) {
2547
+ return classifyEntityRef(entityRef) !== "unlinked";
2548
+ }
2505
2549
  function maxGraphemes(max) {
2506
2550
  return (value) => {
2507
2551
  const segmenter = new Intl.Segmenter(void 0, { granularity: "grapheme" });
@@ -2849,8 +2893,8 @@ var ProfileVolunteeringRecordSchema = z.object({
2849
2893
  });
2850
2894
 
2851
2895
  // src/index.ts
2852
- var SIFA_SDK_VERSION = "0.11.18";
2896
+ var SIFA_SDK_VERSION = "0.11.20";
2853
2897
 
2854
- export { ACTIVITY_TIERS, ACTIVITY_VISIBILITY_RULES, ADULT_CONTENT_LABELS, APP_CATEGORIES, APP_CATEGORY_IDS, APP_CATEGORY_MAP, APP_URL_PATTERNS, AtmosphereFeedItemSchema, CALENDAR_EVENT_MODE_LABELS, CALENDAR_EVENT_STATUS_LABELS, CATEGORY_LABELS, CATEGORY_ORDER, COLLECTION_TO_APP, COMPANY_OPTIONAL_EMPLOYMENT_TYPES, COMPLETENESS_MAX_SCORE, CONTINENTS, COUNTRIES, DIMENSIONS_MAX_SCORE, EMPLOYMENT_TYPE_GROUPS, EMPLOYMENT_TYPE_LABELS, EndorsementConfirmationRecordSchema, EndorsementRecordSchema, EntityImportSearchResponseSchema, EntitySearchResponseSchema, EntitySearchResultSchema, EntitySelectRequestSchema, EntitySelectResponseSchema, FEATURE_FLAGS, FeatureAllowlistEntrySchema, FeedActorSchema, FollowFeedItemSchema, FollowFeedPageSchema, FollowProfilePageSchema, FollowProfileSchema, GraphFollowRecordSchema, INDUSTRY_OPTIONS, MIN_SKILLS, OPEN_TO_OPTIONS, OPEN_TO_TOKENS, OPEN_TO_TOKEN_TO_VALUE, OPEN_TO_VALUE_TO_TOKEN, PLATFORM_LABELS, PLATFORM_OPTIONS, PRESENTATION_LINK_TYPE_LABELS, PRESENTATION_LINK_TYPE_OPTIONS, PRESENTATION_ROLE_LABELS, PRESENTATION_ROLE_OPTIONS, PUBLISHERS, PresentationDurationSchema, PresentationLinkSchema, ProfileCertificationRecordSchema, ProfileCourseRecordSchema, ProfileEducationRecordSchema, ProfileExternalAccountRecordSchema, ProfileHonorRecordSchema, ProfileLanguageRecordSchema, ProfilePositionRecordSchema, ProfilePresentationDeliveryRecordSchema, ProfilePresentationRecordSchema, ProfileProjectRecordSchema, ProfilePublicationRecordSchema, ProfileSelfRecordSchema, ProfileSkillRecordSchema, ProfileVolunteeringRecordSchema, PublicationAuthorSchema, SIFA_SDK_VERSION, SKILL_CATEGORIES, STANDARD_PUBLISHER_ID, SifaFeedItemSchema, WORKPLACE_TYPE_LABELS, WORKPLACE_TYPE_OPTIONS, atUriSchema, categoryForApp, certDateExtractor, cidSchema, completenessPercent, completenessScore, contrastRatio, countFilledDimensions, countryCodeToFlag, dateRangeExtractor, datetimeSchema, decodeFeedCursor, dedupeSkills, detectPdsProvider, didSchema, dimensionsFromInputs, durationFromMinutes, encodeFeedCursor, entityDisambiguationLabel, entityResultKey, externalRecordRefSchema, findIndustry, formatCompanyName, formatDistanceToNow, formatLocation, formatPresentationDuration, formatRelativeTime, getActivityTaxonomyVersion, getActivityTier, getAppCategoryIcon, getAppIdForCollection, getCalendarEventModeLabel, getCalendarEventStatusLabel, getContinent, getDisplayLabel, getEmploymentTypeLabel, getFaviconUrl, getFilledDimensionsMap, getHandleStem, getIndustryLabelKey, getLexiconEntry, getOpenToLabelKey, getPdsDisplayName, getPlatformLabel, getPresentationLinkTypeLabel, getPresentationRoleLabel, getPublisherByHost, getPublisherById, getPublisherFromSiteUrl, getTierMeta, getWorkplaceTypeLabel, groupSkillsByCategory, hasAdultContent, isAppCategory, isCompanyRequired, isKnownAppId, isKnownPlatform, isPseudoEmployer, isValidRgbColor, isVisibleActivityItem, languageTagSchema, lexiconDateExtractor, limitCombiningMarks, makeGraphFollowRecordSchema, maxGraphemes, meetsContrastAA, normalizeOpenTo, normalizePlatformId, normalizePresentationMode, normalizePresentationRole, normalizeWorkplaceTypes, openToTokenToValue, openToValueToToken, parseIntendedAudiences, parseLocationString, parsePresentationDuration, pdsProviderFromApi, pickPrimaryPosition, presentationCsvRowToRecord, presentationDeliveryCsvRowToRecord, profileToDimensionInputs, relativeLuminance, resolveCardHealth, resolveCardUrl, rgbToString, sanitizeDisplayText, sanitizeHandleInput, searchResultDisambiguation, selfLabelsSchema, singleDateExtractor, sortByDateDesc, stripHtmlToText, strongRefSchema, summarizePresentationDeliveries, truncateGraphemes, uriSchema };
2898
+ export { ACTIVITY_TIERS, ACTIVITY_VISIBILITY_RULES, ADULT_CONTENT_LABELS, APP_CATEGORIES, APP_CATEGORY_IDS, APP_CATEGORY_MAP, APP_URL_PATTERNS, AtmosphereFeedItemSchema, CALENDAR_EVENT_MODE_LABELS, CALENDAR_EVENT_STATUS_LABELS, CATEGORY_LABELS, CATEGORY_ORDER, COLLECTION_TO_APP, COMPANY_OPTIONAL_EMPLOYMENT_TYPES, COMPLETENESS_MAX_SCORE, CONTINENTS, COUNTRIES, DIMENSIONS_MAX_SCORE, EMPLOYMENT_TYPE_GROUPS, EMPLOYMENT_TYPE_LABELS, ENTITY_REF_ANCHORS, EndorsementConfirmationRecordSchema, EndorsementRecordSchema, EntityImportSearchResponseSchema, EntitySearchResponseSchema, EntitySearchResultSchema, EntitySelectRequestSchema, EntitySelectResponseSchema, FEATURE_FLAGS, FeatureAllowlistEntrySchema, FeedActorSchema, FollowFeedItemSchema, FollowFeedPageSchema, FollowProfilePageSchema, FollowProfileSchema, GraphFollowRecordSchema, INDUSTRY_OPTIONS, MIN_SKILLS, OPEN_TO_OPTIONS, OPEN_TO_TOKENS, OPEN_TO_TOKEN_TO_VALUE, OPEN_TO_VALUE_TO_TOKEN, PLATFORM_LABELS, PLATFORM_OPTIONS, PRESENTATION_LINK_TYPE_LABELS, PRESENTATION_LINK_TYPE_OPTIONS, PRESENTATION_ROLE_LABELS, PRESENTATION_ROLE_OPTIONS, PUBLISHERS, PresentationDurationSchema, PresentationLinkSchema, ProfileCertificationRecordSchema, ProfileCourseRecordSchema, ProfileEducationRecordSchema, ProfileExternalAccountRecordSchema, ProfileHonorRecordSchema, ProfileLanguageRecordSchema, ProfilePositionRecordSchema, ProfilePresentationDeliveryRecordSchema, ProfilePresentationRecordSchema, ProfileProjectRecordSchema, ProfilePublicationRecordSchema, ProfileSelfRecordSchema, ProfileSkillRecordSchema, ProfileVolunteeringRecordSchema, PublicationAuthorSchema, SIFA_SDK_VERSION, SKILL_CATEGORIES, STANDARD_PUBLISHER_ID, SifaFeedItemSchema, WORKPLACE_TYPE_LABELS, WORKPLACE_TYPE_OPTIONS, atUriSchema, categoryForApp, certDateExtractor, cidSchema, classifyEntityRef, completenessPercent, completenessScore, contrastRatio, countFilledDimensions, countryCodeToFlag, dateRangeExtractor, datetimeSchema, decodeFeedCursor, dedupeSkills, detectPdsProvider, didSchema, dimensionsFromInputs, durationFromMinutes, encodeFeedCursor, entityDisambiguationLabel, entityResultKey, externalRecordRefSchema, findIndustry, formatCompanyName, formatDistanceToNow, formatLocation, formatPresentationDuration, formatRelativeTime, getActivityTaxonomyVersion, getActivityTier, getAppCategoryIcon, getAppIdForCollection, getCalendarEventModeLabel, getCalendarEventStatusLabel, getContinent, getDisplayLabel, getEmploymentTypeLabel, getFaviconUrl, getFilledDimensionsMap, getHandleStem, getIndustryLabelKey, getLexiconEntry, getOpenToLabelKey, getPdsDisplayName, getPlatformLabel, getPresentationLinkTypeLabel, getPresentationRoleLabel, getPublisherByHost, getPublisherById, getPublisherFromSiteUrl, getTierMeta, getWorkplaceTypeLabel, groupSkillsByCategory, hasAdultContent, isAppCategory, isCompanyRequired, isKnownAppId, isKnownPlatform, isLinked, isPseudoEmployer, isValidRgbColor, isVisibleActivityItem, languageTagSchema, lexiconDateExtractor, limitCombiningMarks, makeGraphFollowRecordSchema, maxGraphemes, meetsContrastAA, normalizeCompanyKey, normalizeOpenTo, normalizePlatformId, normalizePresentationMode, normalizePresentationRole, normalizeWorkplaceTypes, openToTokenToValue, openToValueToToken, parseIntendedAudiences, parseLocationString, parsePresentationDuration, pdsProviderFromApi, pickPrimaryPosition, presentationCsvRowToRecord, presentationDeliveryCsvRowToRecord, profileToDimensionInputs, relativeLuminance, resolveCardHealth, resolveCardUrl, rgbToString, sanitizeDisplayText, sanitizeHandleInput, searchResultDisambiguation, selfLabelsSchema, singleDateExtractor, sortByDateDesc, stripHtmlToText, strongRefSchema, summarizePresentationDeliveries, truncateGraphemes, uriSchema };
2855
2899
  //# sourceMappingURL=index.js.map
2856
2900
  //# sourceMappingURL=index.js.map