@singi-labs/sifa-sdk 0.9.18 → 0.9.20

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.
Files changed (37) hide show
  1. package/dist/feed-DHTy7fUN.d.cts +254 -0
  2. package/dist/feed-DHTy7fUN.d.ts +254 -0
  3. package/dist/{index-DCpMh2Ny.d.cts → index-DYUYJxOs.d.cts} +1 -1
  4. package/dist/{index-DCpMh2Ny.d.ts → index-DYUYJxOs.d.ts} +1 -1
  5. package/dist/index.cjs +114 -3
  6. package/dist/index.cjs.map +1 -1
  7. package/dist/index.d.cts +4 -3
  8. package/dist/index.d.ts +4 -3
  9. package/dist/index.js +103 -4
  10. package/dist/index.js.map +1 -1
  11. package/dist/keys-D-vNPzXx.d.ts +1085 -0
  12. package/dist/keys-DRD79nDE.d.cts +1085 -0
  13. package/dist/query/fetchers/index.cjs +155 -1
  14. package/dist/query/fetchers/index.cjs.map +1 -1
  15. package/dist/query/fetchers/index.d.cts +6 -933
  16. package/dist/query/fetchers/index.d.ts +6 -933
  17. package/dist/query/fetchers/index.js +146 -2
  18. package/dist/query/fetchers/index.js.map +1 -1
  19. package/dist/query/hooks/index.cjs +2268 -0
  20. package/dist/query/hooks/index.cjs.map +1 -0
  21. package/dist/query/hooks/index.d.cts +479 -0
  22. package/dist/query/hooks/index.d.ts +479 -0
  23. package/dist/query/hooks/index.js +2178 -0
  24. package/dist/query/hooks/index.js.map +1 -0
  25. package/dist/query/index.cjs +340 -1
  26. package/dist/query/index.cjs.map +1 -1
  27. package/dist/query/index.d.cts +9 -352
  28. package/dist/query/index.d.ts +9 -352
  29. package/dist/query/index.js +322 -3
  30. package/dist/query/index.js.map +1 -1
  31. package/dist/schemas/index.cjs +102 -1
  32. package/dist/schemas/index.cjs.map +1 -1
  33. package/dist/schemas/index.d.cts +28 -2
  34. package/dist/schemas/index.d.ts +28 -2
  35. package/dist/schemas/index.js +91 -2
  36. package/dist/schemas/index.js.map +1 -1
  37. package/package.json +14 -4
package/dist/index.cjs CHANGED
@@ -1454,6 +1454,15 @@ var APP_URL_PATTERNS = Object.freeze({
1454
1454
  // Per-record URLs don't exist on passports.social — its SvelteKit routes
1455
1455
  // stop at /profile/{handle}/{passport_slug}. Profile-level fallback only.
1456
1456
  profileUrlPattern: "https://passports.social/profile/{handle}"
1457
+ },
1458
+ leaflet: {
1459
+ // Per-document URLs are short and rkey-only: https://leaflet.pub/{rkey}.
1460
+ // Each publication has its own base_path subdomain (e.g. zzstoatzz.leaflet.pub)
1461
+ // but the canonical short URL renders the same document. There is no
1462
+ // per-user profile route on leaflet.pub, so the profile fallback points
1463
+ // at the marketing site.
1464
+ urlPattern: "https://leaflet.pub/{rkey}",
1465
+ profileUrlPattern: "https://leaflet.pub"
1457
1466
  }
1458
1467
  });
1459
1468
  var COLLECTION_TO_APP = [
@@ -1489,7 +1498,8 @@ var COLLECTION_TO_APP = [
1489
1498
  ["buzz.bookhive.", "bookhive"],
1490
1499
  ["social.colibri.", "colibri"],
1491
1500
  ["social.passports.", "passports"],
1492
- ["fyi.asq.", "asq"]
1501
+ ["fyi.asq.", "asq"],
1502
+ ["pub.leaflet.", "leaflet"]
1493
1503
  ];
1494
1504
 
1495
1505
  // src/cards/resolve-card-url.ts
@@ -1744,8 +1754,97 @@ var EndorsementRecordSchema = zod.z.object({
1744
1754
  });
1745
1755
  var GraphFollowRecordSchema = zod.z.object({
1746
1756
  subject: didSchema,
1747
- createdAt: datetimeSchema
1757
+ createdAt: datetimeSchema,
1758
+ note: zod.z.string().refine(maxGraphemes(200), "note must be at most 200 graphemes").optional()
1759
+ });
1760
+ function makeGraphFollowRecordSchema(followerDid) {
1761
+ return GraphFollowRecordSchema.refine((record) => record.subject !== followerDid, {
1762
+ message: "Self-follow is not allowed",
1763
+ path: ["subject"]
1764
+ });
1765
+ }
1766
+ var FollowProfileSchema = zod.z.object({
1767
+ did: didSchema,
1768
+ handle: zod.z.string(),
1769
+ displayName: zod.z.string().optional(),
1770
+ headline: zod.z.string().optional(),
1771
+ avatarUrl: zod.z.string().optional(),
1772
+ source: zod.z.string(),
1773
+ claimed: zod.z.boolean(),
1774
+ followedAt: datetimeSchema,
1775
+ blueskyVerified: zod.z.boolean().optional(),
1776
+ blueskyVerifiedAt: datetimeSchema.nullable().optional()
1777
+ });
1778
+ var FollowProfilePageSchema = zod.z.object({
1779
+ items: zod.z.array(FollowProfileSchema),
1780
+ cursor: zod.z.string().nullable()
1781
+ });
1782
+ var FeatureAllowlistEntrySchema = zod.z.object({
1783
+ did: didSchema,
1784
+ addedAt: datetimeSchema,
1785
+ note: zod.z.string().nullable().optional()
1786
+ });
1787
+ var FEATURE_FLAGS = ["FEED_V5_ENABLED"];
1788
+ var FeedActorSchema = zod.z.object({
1789
+ did: didSchema,
1790
+ handle: zod.z.string(),
1791
+ displayName: zod.z.string().optional(),
1792
+ avatarUrl: zod.z.string().optional()
1793
+ });
1794
+ var FeedItemBaseSchema = zod.z.object({
1795
+ id: zod.z.string(),
1796
+ actor: FeedActorSchema,
1797
+ indexedAt: datetimeSchema,
1798
+ eventType: zod.z.string()
1748
1799
  });
1800
+ var SifaFeedItemSchema = FeedItemBaseSchema.extend({
1801
+ source: zod.z.literal("sifa"),
1802
+ appId: zod.z.literal("sifa").optional(),
1803
+ payload: zod.z.record(zod.z.string(), zod.z.unknown())
1804
+ });
1805
+ var AtmosphereFeedItemSchema = FeedItemBaseSchema.extend({
1806
+ source: zod.z.literal("atmosphere"),
1807
+ appId: zod.z.string(),
1808
+ uri: atUriSchema.optional(),
1809
+ cid: cidSchema.optional(),
1810
+ payload: zod.z.record(zod.z.string(), zod.z.unknown())
1811
+ });
1812
+ var FollowFeedItemSchema = zod.z.discriminatedUnion("source", [
1813
+ SifaFeedItemSchema,
1814
+ AtmosphereFeedItemSchema
1815
+ ]);
1816
+ var FollowFeedPageSchema = zod.z.object({
1817
+ items: zod.z.array(FollowFeedItemSchema),
1818
+ cursor: zod.z.string().nullable()
1819
+ });
1820
+ var FeedCursorSchema = zod.z.object({
1821
+ indexedAt: datetimeSchema,
1822
+ source: zod.z.union([zod.z.literal("sifa"), zod.z.literal("atmosphere")]),
1823
+ id: zod.z.string().min(1)
1824
+ });
1825
+ function toBase64Url(input) {
1826
+ const g = globalThis;
1827
+ const b64 = typeof g.btoa === "function" ? g.btoa(unescape(encodeURIComponent(input))) : g.Buffer.from(input, "utf-8").toString("base64");
1828
+ let end = b64.length;
1829
+ while (end > 0 && b64.charCodeAt(end - 1) === 61) end--;
1830
+ return b64.slice(0, end).replace(/\+/g, "-").replace(/\//g, "_");
1831
+ }
1832
+ function fromBase64Url(input) {
1833
+ const padded = input.replace(/-/g, "+").replace(/_/g, "/") + "===".slice((input.length + 3) % 4);
1834
+ const g = globalThis;
1835
+ if (typeof g.atob === "function") {
1836
+ return decodeURIComponent(escape(g.atob(padded)));
1837
+ }
1838
+ return g.Buffer.from(padded, "base64").toString("utf-8");
1839
+ }
1840
+ function encodeFeedCursor(cursor) {
1841
+ return toBase64Url(JSON.stringify(cursor));
1842
+ }
1843
+ function decodeFeedCursor(encoded) {
1844
+ const json = fromBase64Url(encoded);
1845
+ const parsed2 = JSON.parse(json);
1846
+ return FeedCursorSchema.parse(parsed2);
1847
+ }
1749
1848
  var ProfileCertificationRecordSchema = zod.z.object({
1750
1849
  name: zod.z.string().min(1).refine(maxGraphemes(100)).max(1e3),
1751
1850
  authority: zod.z.string().refine(maxGraphemes(100)).max(1e3).optional(),
@@ -1867,11 +1966,12 @@ var ProfileVolunteeringRecordSchema = zod.z.object({
1867
1966
  });
1868
1967
 
1869
1968
  // src/index.ts
1870
- var SIFA_SDK_VERSION = "0.9.18";
1969
+ var SIFA_SDK_VERSION = "0.9.20";
1871
1970
 
1872
1971
  exports.ACTIVITY_TIERS = ACTIVITY_TIERS;
1873
1972
  exports.ACTIVITY_VISIBILITY_RULES = ACTIVITY_VISIBILITY_RULES;
1874
1973
  exports.APP_URL_PATTERNS = APP_URL_PATTERNS;
1974
+ exports.AtmosphereFeedItemSchema = AtmosphereFeedItemSchema;
1875
1975
  exports.CATEGORY_LABELS = CATEGORY_LABELS;
1876
1976
  exports.CATEGORY_ORDER = CATEGORY_ORDER;
1877
1977
  exports.COLLECTION_TO_APP = COLLECTION_TO_APP;
@@ -1883,6 +1983,13 @@ exports.EMPLOYMENT_TYPE_GROUPS = EMPLOYMENT_TYPE_GROUPS;
1883
1983
  exports.EMPLOYMENT_TYPE_LABELS = EMPLOYMENT_TYPE_LABELS;
1884
1984
  exports.EndorsementConfirmationRecordSchema = EndorsementConfirmationRecordSchema;
1885
1985
  exports.EndorsementRecordSchema = EndorsementRecordSchema;
1986
+ exports.FEATURE_FLAGS = FEATURE_FLAGS;
1987
+ exports.FeatureAllowlistEntrySchema = FeatureAllowlistEntrySchema;
1988
+ exports.FeedActorSchema = FeedActorSchema;
1989
+ exports.FollowFeedItemSchema = FollowFeedItemSchema;
1990
+ exports.FollowFeedPageSchema = FollowFeedPageSchema;
1991
+ exports.FollowProfilePageSchema = FollowProfilePageSchema;
1992
+ exports.FollowProfileSchema = FollowProfileSchema;
1886
1993
  exports.GraphFollowRecordSchema = GraphFollowRecordSchema;
1887
1994
  exports.INDUSTRY_OPTIONS = INDUSTRY_OPTIONS;
1888
1995
  exports.MIN_SKILLS = MIN_SKILLS;
@@ -1904,6 +2011,7 @@ exports.ProfileVolunteeringRecordSchema = ProfileVolunteeringRecordSchema;
1904
2011
  exports.PublicationAuthorSchema = PublicationAuthorSchema;
1905
2012
  exports.SIFA_SDK_VERSION = SIFA_SDK_VERSION;
1906
2013
  exports.SKILL_CATEGORIES = SKILL_CATEGORIES;
2014
+ exports.SifaFeedItemSchema = SifaFeedItemSchema;
1907
2015
  exports.WORKPLACE_TYPE_LABELS = WORKPLACE_TYPE_LABELS;
1908
2016
  exports.WORKPLACE_TYPE_OPTIONS = WORKPLACE_TYPE_OPTIONS;
1909
2017
  exports.atUriSchema = atUriSchema;
@@ -1916,10 +2024,12 @@ exports.countFilledDimensions = countFilledDimensions;
1916
2024
  exports.countryCodeToFlag = countryCodeToFlag;
1917
2025
  exports.dateRangeExtractor = dateRangeExtractor;
1918
2026
  exports.datetimeSchema = datetimeSchema;
2027
+ exports.decodeFeedCursor = decodeFeedCursor;
1919
2028
  exports.dedupeSkills = dedupeSkills;
1920
2029
  exports.detectPdsProvider = detectPdsProvider;
1921
2030
  exports.didSchema = didSchema;
1922
2031
  exports.dimensionsFromInputs = dimensionsFromInputs;
2032
+ exports.encodeFeedCursor = encodeFeedCursor;
1923
2033
  exports.findIndustry = findIndustry;
1924
2034
  exports.formatDistanceToNow = formatDistanceToNow;
1925
2035
  exports.formatLocation = formatLocation;
@@ -1947,6 +2057,7 @@ exports.isVisibleActivityItem = isVisibleActivityItem;
1947
2057
  exports.languageTagSchema = languageTagSchema;
1948
2058
  exports.lexiconDateExtractor = lexiconDateExtractor;
1949
2059
  exports.limitCombiningMarks = limitCombiningMarks;
2060
+ exports.makeGraphFollowRecordSchema = makeGraphFollowRecordSchema;
1950
2061
  exports.maxGraphemes = maxGraphemes;
1951
2062
  exports.meetsContrastAA = meetsContrastAA;
1952
2063
  exports.parseLocationString = parseLocationString;