@singi-labs/sifa-sdk 0.9.5 → 0.9.6

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.js CHANGED
@@ -1495,10 +1495,16 @@ function interpolate(pattern, vars) {
1495
1495
  }
1496
1496
  return result;
1497
1497
  }
1498
- function patternUrl(appId, vars) {
1498
+ function shouldUseItemPattern(appId, collection) {
1499
+ if (appId === "bluesky") {
1500
+ return collection === "app.bsky.feed.post";
1501
+ }
1502
+ return true;
1503
+ }
1504
+ function patternUrl(appId, vars, collection) {
1499
1505
  const patterns = APP_URL_PATTERNS[appId];
1500
1506
  if (!patterns) return null;
1501
- if (patterns.urlPattern) {
1507
+ if (patterns.urlPattern && shouldUseItemPattern(appId, collection)) {
1502
1508
  const url = interpolate(patterns.urlPattern, vars);
1503
1509
  if (url) return url;
1504
1510
  }
@@ -1508,6 +1514,7 @@ function patternUrl(appId, vars) {
1508
1514
  }
1509
1515
  return null;
1510
1516
  }
1517
+ var TANGLED_REPO_SLUG = /^[a-zA-Z0-9._-]+$/;
1511
1518
  function stringOrNull(value) {
1512
1519
  if (typeof value !== "string") return null;
1513
1520
  const trimmed = value.trim();
@@ -1523,10 +1530,10 @@ function resolveCardUrl(item) {
1523
1530
  const appId = getAppIdForCollection(collection);
1524
1531
  if (collection.startsWith("sh.tangled.")) {
1525
1532
  const repoName = stringOrNull(record.name);
1526
- if (repoName && authorHandle) {
1533
+ if (repoName && authorHandle && TANGLED_REPO_SLUG.test(repoName)) {
1527
1534
  return `https://tangled.sh/${authorHandle}/${repoName}`;
1528
1535
  }
1529
- return patternUrl("tangled", { handle: authorHandle, did: authorDid, rkey });
1536
+ return patternUrl("tangled", { handle: authorHandle, did: authorDid, rkey }, collection);
1530
1537
  }
1531
1538
  if (collection.startsWith("com.kipclip.") || collection.startsWith("community.lexicon.bookmarks.")) {
1532
1539
  const subject = stringOrNull(record.subject);
@@ -1574,7 +1581,7 @@ function resolveCardUrl(item) {
1574
1581
  }
1575
1582
  const recordUrl = stringOrNull(record.url);
1576
1583
  if (recordUrl) return recordUrl;
1577
- return patternUrl(appId, { handle: authorHandle, did: authorDid, rkey });
1584
+ return patternUrl(appId, { handle: authorHandle, did: authorDid, rkey }, collection);
1578
1585
  }
1579
1586
 
1580
1587
  // src/logic/profile-completeness.ts
@@ -1797,7 +1804,7 @@ var ProfileVolunteeringRecordSchema = z.object({
1797
1804
  });
1798
1805
 
1799
1806
  // src/index.ts
1800
- var SIFA_SDK_VERSION = "0.9.5";
1807
+ var SIFA_SDK_VERSION = "0.9.6";
1801
1808
 
1802
1809
  export { ACTIVITY_TIERS, APP_URL_PATTERNS, CATEGORY_LABELS, CATEGORY_ORDER, COLLECTION_TO_APP, COMPLETENESS_MAX_SCORE, CONTINENTS, COUNTRIES, DIMENSIONS_MAX_SCORE, EMPLOYMENT_TYPE_GROUPS, EMPLOYMENT_TYPE_LABELS, EndorsementConfirmationRecordSchema, EndorsementRecordSchema, GraphFollowRecordSchema, INDUSTRY_OPTIONS, MIN_SKILLS, OPEN_TO_OPTIONS, PLATFORM_LABELS, PLATFORM_OPTIONS, ProfileCertificationRecordSchema, ProfileCourseRecordSchema, ProfileEducationRecordSchema, ProfileExternalAccountRecordSchema, ProfileHonorRecordSchema, ProfileLanguageRecordSchema, ProfilePositionRecordSchema, ProfileProjectRecordSchema, ProfilePublicationRecordSchema, ProfileSelfRecordSchema, ProfileSkillRecordSchema, ProfileVolunteeringRecordSchema, PublicationAuthorSchema, SIFA_SDK_VERSION, SKILL_CATEGORIES, WORKPLACE_TYPE_LABELS, WORKPLACE_TYPE_OPTIONS, atUriSchema, certDateExtractor, cidSchema, completenessPercent, completenessScore, contrastRatio, countFilledDimensions, countryCodeToFlag, dateRangeExtractor, datetimeSchema, dedupeSkills, detectPdsProvider, didSchema, dimensionsFromInputs, findIndustry, formatDistanceToNow, formatLocation, formatRelativeTime, getActivityTaxonomyVersion, getActivityTier, getAppIdForCollection, getContinent, getDisplayLabel, getEmploymentTypeLabel, getFaviconUrl, getFilledDimensionsMap, getHandleStem, getIndustryLabelKey, getLexiconEntry, getOpenToLabelKey, getPdsDisplayName, getPlatformLabel, getTierMeta, getWorkplaceTypeLabel, groupSkillsByCategory, isKnownPlatform, isValidRgbColor, languageTagSchema, lexiconDateExtractor, limitCombiningMarks, maxGraphemes, meetsContrastAA, parseLocationString, pdsProviderFromApi, profileToDimensionInputs, relativeLuminance, resolveCardUrl, rgbToString, sanitizeDisplayText, sanitizeHandleInput, selfLabelsSchema, singleDateExtractor, sortByDateDesc, strongRefSchema, truncateGraphemes, uriSchema };
1803
1810
  //# sourceMappingURL=index.js.map