@singi-labs/sifa-sdk 0.9.5 → 0.9.7

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
@@ -1440,7 +1440,19 @@ var APP_URL_PATTERNS = Object.freeze({
1440
1440
  bookhive: { profileUrlPattern: "https://bookhive.buzz/profile/{handle}" },
1441
1441
  colibri: { profileUrlPattern: "https://colibri.social" },
1442
1442
  collectivesocial: { profileUrlPattern: "https://app.collectivesocial.app" },
1443
- github: {}
1443
+ github: {},
1444
+ asq: {
1445
+ // Questions live at /q/{did}/{rkey}. Answer cards build their own URL
1446
+ // from the parsed subject.uri (which points to the question), so the
1447
+ // pattern below is invoked only for question records.
1448
+ urlPattern: "https://asq.fyi/q/{did}/{rkey}",
1449
+ profileUrlPattern: "https://asq.fyi"
1450
+ },
1451
+ passports: {
1452
+ // Per-record URLs don't exist on passports.social — its SvelteKit routes
1453
+ // stop at /profile/{handle}/{passport_slug}. Profile-level fallback only.
1454
+ profileUrlPattern: "https://passports.social/profile/{handle}"
1455
+ }
1444
1456
  });
1445
1457
  var COLLECTION_TO_APP = [
1446
1458
  ["app.bsky.", "bluesky"],
@@ -1473,7 +1485,9 @@ var COLLECTION_TO_APP = [
1473
1485
  ["at.margin.", "margin"],
1474
1486
  ["app.beaconbits.", "beaconbits"],
1475
1487
  ["buzz.bookhive.", "bookhive"],
1476
- ["social.colibri.", "colibri"]
1488
+ ["social.colibri.", "colibri"],
1489
+ ["social.passports.", "passports"],
1490
+ ["fyi.asq.", "asq"]
1477
1491
  ];
1478
1492
 
1479
1493
  // src/cards/resolve-card-url.ts
@@ -1495,10 +1509,16 @@ function interpolate(pattern, vars) {
1495
1509
  }
1496
1510
  return result;
1497
1511
  }
1498
- function patternUrl(appId, vars) {
1512
+ function shouldUseItemPattern(appId, collection) {
1513
+ if (appId === "bluesky") {
1514
+ return collection === "app.bsky.feed.post";
1515
+ }
1516
+ return true;
1517
+ }
1518
+ function patternUrl(appId, vars, collection) {
1499
1519
  const patterns = APP_URL_PATTERNS[appId];
1500
1520
  if (!patterns) return null;
1501
- if (patterns.urlPattern) {
1521
+ if (patterns.urlPattern && shouldUseItemPattern(appId, collection)) {
1502
1522
  const url = interpolate(patterns.urlPattern, vars);
1503
1523
  if (url) return url;
1504
1524
  }
@@ -1508,6 +1528,7 @@ function patternUrl(appId, vars) {
1508
1528
  }
1509
1529
  return null;
1510
1530
  }
1531
+ var TANGLED_REPO_SLUG = /^[a-zA-Z0-9._-]+$/;
1511
1532
  function stringOrNull(value) {
1512
1533
  if (typeof value !== "string") return null;
1513
1534
  const trimmed = value.trim();
@@ -1523,10 +1544,10 @@ function resolveCardUrl(item) {
1523
1544
  const appId = getAppIdForCollection(collection);
1524
1545
  if (collection.startsWith("sh.tangled.")) {
1525
1546
  const repoName = stringOrNull(record.name);
1526
- if (repoName && authorHandle) {
1547
+ if (repoName && authorHandle && TANGLED_REPO_SLUG.test(repoName)) {
1527
1548
  return `https://tangled.sh/${authorHandle}/${repoName}`;
1528
1549
  }
1529
- return patternUrl("tangled", { handle: authorHandle, did: authorDid, rkey });
1550
+ return patternUrl("tangled", { handle: authorHandle, did: authorDid, rkey }, collection);
1530
1551
  }
1531
1552
  if (collection.startsWith("com.kipclip.") || collection.startsWith("community.lexicon.bookmarks.")) {
1532
1553
  const subject = stringOrNull(record.subject);
@@ -1574,7 +1595,7 @@ function resolveCardUrl(item) {
1574
1595
  }
1575
1596
  const recordUrl = stringOrNull(record.url);
1576
1597
  if (recordUrl) return recordUrl;
1577
- return patternUrl(appId, { handle: authorHandle, did: authorDid, rkey });
1598
+ return patternUrl(appId, { handle: authorHandle, did: authorDid, rkey }, collection);
1578
1599
  }
1579
1600
 
1580
1601
  // src/logic/profile-completeness.ts
@@ -1797,7 +1818,7 @@ var ProfileVolunteeringRecordSchema = z.object({
1797
1818
  });
1798
1819
 
1799
1820
  // src/index.ts
1800
- var SIFA_SDK_VERSION = "0.9.5";
1821
+ var SIFA_SDK_VERSION = "0.9.7";
1801
1822
 
1802
1823
  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
1824
  //# sourceMappingURL=index.js.map