@singi-labs/sifa-sdk 0.11.18 → 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
@@ -2504,6 +2504,34 @@ function searchResultDisambiguation(result) {
2504
2504
  function entityResultKey(result) {
2505
2505
  return result.source === "entity" ? `entity:${result.entityId}` : `pdl:${result.pdlId}`;
2506
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
+ }
2507
2535
  function maxGraphemes(max) {
2508
2536
  return (value) => {
2509
2537
  const segmenter = new Intl.Segmenter(void 0, { granularity: "grapheme" });
@@ -2851,7 +2879,7 @@ var ProfileVolunteeringRecordSchema = zod.z.object({
2851
2879
  });
2852
2880
 
2853
2881
  // src/index.ts
2854
- var SIFA_SDK_VERSION = "0.11.18";
2882
+ var SIFA_SDK_VERSION = "0.11.19";
2855
2883
 
2856
2884
  exports.ACTIVITY_TIERS = ACTIVITY_TIERS;
2857
2885
  exports.ACTIVITY_VISIBILITY_RULES = ACTIVITY_VISIBILITY_RULES;
@@ -2873,6 +2901,7 @@ exports.COUNTRIES = COUNTRIES;
2873
2901
  exports.DIMENSIONS_MAX_SCORE = DIMENSIONS_MAX_SCORE;
2874
2902
  exports.EMPLOYMENT_TYPE_GROUPS = EMPLOYMENT_TYPE_GROUPS;
2875
2903
  exports.EMPLOYMENT_TYPE_LABELS = EMPLOYMENT_TYPE_LABELS;
2904
+ exports.ENTITY_REF_ANCHORS = ENTITY_REF_ANCHORS;
2876
2905
  exports.EndorsementConfirmationRecordSchema = EndorsementConfirmationRecordSchema;
2877
2906
  exports.EndorsementRecordSchema = EndorsementRecordSchema;
2878
2907
  exports.EntityImportSearchResponseSchema = EntityImportSearchResponseSchema;
@@ -2928,6 +2957,7 @@ exports.atUriSchema = atUriSchema;
2928
2957
  exports.categoryForApp = categoryForApp;
2929
2958
  exports.certDateExtractor = certDateExtractor;
2930
2959
  exports.cidSchema = cidSchema;
2960
+ exports.classifyEntityRef = classifyEntityRef;
2931
2961
  exports.completenessPercent = completenessPercent;
2932
2962
  exports.completenessScore = completenessScore;
2933
2963
  exports.contrastRatio = contrastRatio;
@@ -2981,6 +3011,7 @@ exports.isAppCategory = isAppCategory;
2981
3011
  exports.isCompanyRequired = isCompanyRequired;
2982
3012
  exports.isKnownAppId = isKnownAppId;
2983
3013
  exports.isKnownPlatform = isKnownPlatform;
3014
+ exports.isLinked = isLinked;
2984
3015
  exports.isPseudoEmployer = isPseudoEmployer;
2985
3016
  exports.isValidRgbColor = isValidRgbColor;
2986
3017
  exports.isVisibleActivityItem = isVisibleActivityItem;