@singi-labs/sifa-sdk 0.11.17 → 0.11.19

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
@@ -1430,6 +1430,56 @@ function getCalendarEventStatusLabel(value) {
1430
1430
  return CALENDAR_EVENT_STATUS_LABELS[value] ?? value;
1431
1431
  }
1432
1432
 
1433
+ // src/format/company-name.ts
1434
+ var SMALL_WORDS = /* @__PURE__ */ new Set([
1435
+ "a",
1436
+ "an",
1437
+ "and",
1438
+ "the",
1439
+ "of",
1440
+ "for",
1441
+ "to",
1442
+ "in",
1443
+ "on",
1444
+ "at",
1445
+ "by",
1446
+ "or",
1447
+ "nor",
1448
+ "but",
1449
+ "as",
1450
+ "vs",
1451
+ "via",
1452
+ "with",
1453
+ "de",
1454
+ "del",
1455
+ "van",
1456
+ "von",
1457
+ "der",
1458
+ "den",
1459
+ "het",
1460
+ "la",
1461
+ "le",
1462
+ "y"
1463
+ ]);
1464
+ function capitalizeWord(word) {
1465
+ return word.replace(
1466
+ /^([^\p{L}\p{N}]*)(\p{L})/u,
1467
+ (_m, lead, ch) => lead + ch.toUpperCase()
1468
+ );
1469
+ }
1470
+ function formatCompanyName(name) {
1471
+ const trimmed = name.trim();
1472
+ if (!trimmed || trimmed !== trimmed.toLowerCase()) return trimmed;
1473
+ let seenWord = false;
1474
+ return trimmed.split(/(\s+)/).map((token) => {
1475
+ if (token.length === 0 || /^\s+$/.test(token)) return token;
1476
+ const isFirst = !seenWord;
1477
+ seenWord = true;
1478
+ if (!isFirst && SMALL_WORDS.has(token)) return token;
1479
+ return capitalizeWord(token);
1480
+ }).join("");
1481
+ }
1482
+
1433
1483
  // src/format/format-time.ts
1434
1484
  function formatRelativeTime(dateString) {
1435
1485
  const date = new Date(dateString);
@@ -2454,6 +2504,34 @@ function searchResultDisambiguation(result) {
2454
2504
  function entityResultKey(result) {
2455
2505
  return result.source === "entity" ? `entity:${result.entityId}` : `pdl:${result.pdlId}`;
2456
2506
  }
2507
+
2508
+ // src/logic/entity-ref-anchor.ts
2509
+ var ENTITY_REF_ANCHORS = ["registry", "sifa", "unlinked"];
2510
+ var REGISTRY_HOSTS = /* @__PURE__ */ new Set([
2511
+ "wikidata.org",
2512
+ "www.wikidata.org",
2513
+ "ror.org",
2514
+ "gleif.org",
2515
+ "www.gleif.org"
2516
+ ]);
2517
+ var SIFA_HOST = "sifa.id";
2518
+ function classifyEntityRef(entityRef) {
2519
+ if (!entityRef || !entityRef.trim()) return "unlinked";
2520
+ let url;
2521
+ try {
2522
+ url = new URL(entityRef.trim());
2523
+ } catch {
2524
+ return "unlinked";
2525
+ }
2526
+ if (url.protocol !== "https:" && url.protocol !== "http:") return "unlinked";
2527
+ const host = url.hostname.toLowerCase();
2528
+ if (REGISTRY_HOSTS.has(host)) return "registry";
2529
+ if (host === SIFA_HOST) return "sifa";
2530
+ return "unlinked";
2531
+ }
2532
+ function isLinked(entityRef) {
2533
+ return classifyEntityRef(entityRef) !== "unlinked";
2534
+ }
2457
2535
  function maxGraphemes(max) {
2458
2536
  return (value) => {
2459
2537
  const segmenter = new Intl.Segmenter(void 0, { granularity: "grapheme" });
@@ -2801,7 +2879,7 @@ var ProfileVolunteeringRecordSchema = zod.z.object({
2801
2879
  });
2802
2880
 
2803
2881
  // src/index.ts
2804
- var SIFA_SDK_VERSION = "0.11.17";
2882
+ var SIFA_SDK_VERSION = "0.11.19";
2805
2883
 
2806
2884
  exports.ACTIVITY_TIERS = ACTIVITY_TIERS;
2807
2885
  exports.ACTIVITY_VISIBILITY_RULES = ACTIVITY_VISIBILITY_RULES;
@@ -2823,6 +2901,7 @@ exports.COUNTRIES = COUNTRIES;
2823
2901
  exports.DIMENSIONS_MAX_SCORE = DIMENSIONS_MAX_SCORE;
2824
2902
  exports.EMPLOYMENT_TYPE_GROUPS = EMPLOYMENT_TYPE_GROUPS;
2825
2903
  exports.EMPLOYMENT_TYPE_LABELS = EMPLOYMENT_TYPE_LABELS;
2904
+ exports.ENTITY_REF_ANCHORS = ENTITY_REF_ANCHORS;
2826
2905
  exports.EndorsementConfirmationRecordSchema = EndorsementConfirmationRecordSchema;
2827
2906
  exports.EndorsementRecordSchema = EndorsementRecordSchema;
2828
2907
  exports.EntityImportSearchResponseSchema = EntityImportSearchResponseSchema;
@@ -2878,6 +2957,7 @@ exports.atUriSchema = atUriSchema;
2878
2957
  exports.categoryForApp = categoryForApp;
2879
2958
  exports.certDateExtractor = certDateExtractor;
2880
2959
  exports.cidSchema = cidSchema;
2960
+ exports.classifyEntityRef = classifyEntityRef;
2881
2961
  exports.completenessPercent = completenessPercent;
2882
2962
  exports.completenessScore = completenessScore;
2883
2963
  exports.contrastRatio = contrastRatio;
@@ -2896,6 +2976,7 @@ exports.entityDisambiguationLabel = entityDisambiguationLabel;
2896
2976
  exports.entityResultKey = entityResultKey;
2897
2977
  exports.externalRecordRefSchema = externalRecordRefSchema;
2898
2978
  exports.findIndustry = findIndustry;
2979
+ exports.formatCompanyName = formatCompanyName;
2899
2980
  exports.formatDistanceToNow = formatDistanceToNow;
2900
2981
  exports.formatLocation = formatLocation;
2901
2982
  exports.formatPresentationDuration = formatPresentationDuration;
@@ -2930,6 +3011,7 @@ exports.isAppCategory = isAppCategory;
2930
3011
  exports.isCompanyRequired = isCompanyRequired;
2931
3012
  exports.isKnownAppId = isKnownAppId;
2932
3013
  exports.isKnownPlatform = isKnownPlatform;
3014
+ exports.isLinked = isLinked;
2933
3015
  exports.isPseudoEmployer = isPseudoEmployer;
2934
3016
  exports.isValidRgbColor = isValidRgbColor;
2935
3017
  exports.isVisibleActivityItem = isVisibleActivityItem;