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