@singi-labs/sifa-sdk 0.9.19 → 0.9.21
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/feed-DHTy7fUN.d.cts +254 -0
- package/dist/feed-DHTy7fUN.d.ts +254 -0
- package/dist/{index-DCpMh2Ny.d.cts → index-DYUYJxOs.d.cts} +1 -1
- package/dist/{index-DCpMh2Ny.d.ts → index-DYUYJxOs.d.ts} +1 -1
- package/dist/index.cjs +132 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4 -3
- package/dist/index.d.ts +4 -3
- package/dist/index.js +121 -5
- package/dist/index.js.map +1 -1
- package/dist/keys-D-vNPzXx.d.ts +1085 -0
- package/dist/keys-DRD79nDE.d.cts +1085 -0
- package/dist/query/fetchers/index.cjs +155 -1
- package/dist/query/fetchers/index.cjs.map +1 -1
- package/dist/query/fetchers/index.d.cts +6 -933
- package/dist/query/fetchers/index.d.ts +6 -933
- package/dist/query/fetchers/index.js +146 -2
- package/dist/query/fetchers/index.js.map +1 -1
- package/dist/query/hooks/index.cjs +2268 -0
- package/dist/query/hooks/index.cjs.map +1 -0
- package/dist/query/hooks/index.d.cts +479 -0
- package/dist/query/hooks/index.d.ts +479 -0
- package/dist/query/hooks/index.js +2178 -0
- package/dist/query/hooks/index.js.map +1 -0
- package/dist/query/index.cjs +340 -1
- package/dist/query/index.cjs.map +1 -1
- package/dist/query/index.d.cts +9 -352
- package/dist/query/index.d.ts +9 -352
- package/dist/query/index.js +322 -3
- package/dist/query/index.js.map +1 -1
- package/dist/schemas/index.cjs +102 -1
- package/dist/schemas/index.cjs.map +1 -1
- package/dist/schemas/index.d.cts +28 -2
- package/dist/schemas/index.d.ts +28 -2
- package/dist/schemas/index.js +91 -2
- package/dist/schemas/index.js.map +1 -1
- package/package.json +11 -1
package/dist/index.cjs
CHANGED
|
@@ -1436,7 +1436,7 @@ var APP_URL_PATTERNS = Object.freeze({
|
|
|
1436
1436
|
profileUrlPattern: "https://grain.social/profile/{did}"
|
|
1437
1437
|
},
|
|
1438
1438
|
youandme: { profileUrlPattern: "https://youandme.at" },
|
|
1439
|
-
anisota:
|
|
1439
|
+
// anisota: upgraded with per-record URL pattern below.
|
|
1440
1440
|
margin: { profileUrlPattern: "https://margin.at" },
|
|
1441
1441
|
beaconbits: { profileUrlPattern: "https://beaconbits.app" },
|
|
1442
1442
|
bookhive: { profileUrlPattern: "https://bookhive.buzz/profile/{handle}" },
|
|
@@ -1463,6 +1463,29 @@ var APP_URL_PATTERNS = Object.freeze({
|
|
|
1463
1463
|
// at the marketing site.
|
|
1464
1464
|
urlPattern: "https://leaflet.pub/{rkey}",
|
|
1465
1465
|
profileUrlPattern: "https://leaflet.pub"
|
|
1466
|
+
},
|
|
1467
|
+
spark: {
|
|
1468
|
+
// Verified live: GET /post/{did}/{rkey} returns 200.
|
|
1469
|
+
urlPattern: "https://sprk.so/post/{did}/{rkey}",
|
|
1470
|
+
profileUrlPattern: "https://sprk.so/profile/{handle}"
|
|
1471
|
+
},
|
|
1472
|
+
anisota: {
|
|
1473
|
+
urlPattern: "https://anisota.net/post/{did}/{rkey}",
|
|
1474
|
+
profileUrlPattern: "https://anisota.net/profile/{handle}"
|
|
1475
|
+
},
|
|
1476
|
+
nooki: {
|
|
1477
|
+
// Per-post URLs use slug-based routing (e.g. /post/{slug}), not rkey —
|
|
1478
|
+
// can't be constructed from a record. Profile fallback only.
|
|
1479
|
+
profileUrlPattern: "https://nooki.me/user/{handle}"
|
|
1480
|
+
},
|
|
1481
|
+
atstore: {
|
|
1482
|
+
// SPA — per-record URLs require JS routing. Profile fallback only.
|
|
1483
|
+
profileUrlPattern: "https://atstore.fyi/@{handle}"
|
|
1484
|
+
},
|
|
1485
|
+
plyr: {
|
|
1486
|
+
// SPA — per-record URLs require JS routing. plyr.fm doesn't expose a
|
|
1487
|
+
// public per-handle profile page server-side either; falls back to root.
|
|
1488
|
+
profileUrlPattern: "https://plyr.fm"
|
|
1466
1489
|
}
|
|
1467
1490
|
});
|
|
1468
1491
|
var COLLECTION_TO_APP = [
|
|
@@ -1499,7 +1522,11 @@ var COLLECTION_TO_APP = [
|
|
|
1499
1522
|
["social.colibri.", "colibri"],
|
|
1500
1523
|
["social.passports.", "passports"],
|
|
1501
1524
|
["fyi.asq.", "asq"],
|
|
1502
|
-
["pub.leaflet.", "leaflet"]
|
|
1525
|
+
["pub.leaflet.", "leaflet"],
|
|
1526
|
+
["so.sprk.", "spark"],
|
|
1527
|
+
["community.nooki.", "nooki"],
|
|
1528
|
+
["fyi.atstore.", "atstore"],
|
|
1529
|
+
["fm.plyr.", "plyr"]
|
|
1503
1530
|
];
|
|
1504
1531
|
|
|
1505
1532
|
// src/cards/resolve-card-url.ts
|
|
@@ -1754,8 +1781,97 @@ var EndorsementRecordSchema = zod.z.object({
|
|
|
1754
1781
|
});
|
|
1755
1782
|
var GraphFollowRecordSchema = zod.z.object({
|
|
1756
1783
|
subject: didSchema,
|
|
1757
|
-
createdAt: datetimeSchema
|
|
1784
|
+
createdAt: datetimeSchema,
|
|
1785
|
+
note: zod.z.string().refine(maxGraphemes(200), "note must be at most 200 graphemes").optional()
|
|
1786
|
+
});
|
|
1787
|
+
function makeGraphFollowRecordSchema(followerDid) {
|
|
1788
|
+
return GraphFollowRecordSchema.refine((record) => record.subject !== followerDid, {
|
|
1789
|
+
message: "Self-follow is not allowed",
|
|
1790
|
+
path: ["subject"]
|
|
1791
|
+
});
|
|
1792
|
+
}
|
|
1793
|
+
var FollowProfileSchema = zod.z.object({
|
|
1794
|
+
did: didSchema,
|
|
1795
|
+
handle: zod.z.string(),
|
|
1796
|
+
displayName: zod.z.string().optional(),
|
|
1797
|
+
headline: zod.z.string().optional(),
|
|
1798
|
+
avatarUrl: zod.z.string().optional(),
|
|
1799
|
+
source: zod.z.string(),
|
|
1800
|
+
claimed: zod.z.boolean(),
|
|
1801
|
+
followedAt: datetimeSchema,
|
|
1802
|
+
blueskyVerified: zod.z.boolean().optional(),
|
|
1803
|
+
blueskyVerifiedAt: datetimeSchema.nullable().optional()
|
|
1804
|
+
});
|
|
1805
|
+
var FollowProfilePageSchema = zod.z.object({
|
|
1806
|
+
items: zod.z.array(FollowProfileSchema),
|
|
1807
|
+
cursor: zod.z.string().nullable()
|
|
1808
|
+
});
|
|
1809
|
+
var FeatureAllowlistEntrySchema = zod.z.object({
|
|
1810
|
+
did: didSchema,
|
|
1811
|
+
addedAt: datetimeSchema,
|
|
1812
|
+
note: zod.z.string().nullable().optional()
|
|
1758
1813
|
});
|
|
1814
|
+
var FEATURE_FLAGS = ["FEED_V5_ENABLED"];
|
|
1815
|
+
var FeedActorSchema = zod.z.object({
|
|
1816
|
+
did: didSchema,
|
|
1817
|
+
handle: zod.z.string(),
|
|
1818
|
+
displayName: zod.z.string().optional(),
|
|
1819
|
+
avatarUrl: zod.z.string().optional()
|
|
1820
|
+
});
|
|
1821
|
+
var FeedItemBaseSchema = zod.z.object({
|
|
1822
|
+
id: zod.z.string(),
|
|
1823
|
+
actor: FeedActorSchema,
|
|
1824
|
+
indexedAt: datetimeSchema,
|
|
1825
|
+
eventType: zod.z.string()
|
|
1826
|
+
});
|
|
1827
|
+
var SifaFeedItemSchema = FeedItemBaseSchema.extend({
|
|
1828
|
+
source: zod.z.literal("sifa"),
|
|
1829
|
+
appId: zod.z.literal("sifa").optional(),
|
|
1830
|
+
payload: zod.z.record(zod.z.string(), zod.z.unknown())
|
|
1831
|
+
});
|
|
1832
|
+
var AtmosphereFeedItemSchema = FeedItemBaseSchema.extend({
|
|
1833
|
+
source: zod.z.literal("atmosphere"),
|
|
1834
|
+
appId: zod.z.string(),
|
|
1835
|
+
uri: atUriSchema.optional(),
|
|
1836
|
+
cid: cidSchema.optional(),
|
|
1837
|
+
payload: zod.z.record(zod.z.string(), zod.z.unknown())
|
|
1838
|
+
});
|
|
1839
|
+
var FollowFeedItemSchema = zod.z.discriminatedUnion("source", [
|
|
1840
|
+
SifaFeedItemSchema,
|
|
1841
|
+
AtmosphereFeedItemSchema
|
|
1842
|
+
]);
|
|
1843
|
+
var FollowFeedPageSchema = zod.z.object({
|
|
1844
|
+
items: zod.z.array(FollowFeedItemSchema),
|
|
1845
|
+
cursor: zod.z.string().nullable()
|
|
1846
|
+
});
|
|
1847
|
+
var FeedCursorSchema = zod.z.object({
|
|
1848
|
+
indexedAt: datetimeSchema,
|
|
1849
|
+
source: zod.z.union([zod.z.literal("sifa"), zod.z.literal("atmosphere")]),
|
|
1850
|
+
id: zod.z.string().min(1)
|
|
1851
|
+
});
|
|
1852
|
+
function toBase64Url(input) {
|
|
1853
|
+
const g = globalThis;
|
|
1854
|
+
const b64 = typeof g.btoa === "function" ? g.btoa(unescape(encodeURIComponent(input))) : g.Buffer.from(input, "utf-8").toString("base64");
|
|
1855
|
+
let end = b64.length;
|
|
1856
|
+
while (end > 0 && b64.charCodeAt(end - 1) === 61) end--;
|
|
1857
|
+
return b64.slice(0, end).replace(/\+/g, "-").replace(/\//g, "_");
|
|
1858
|
+
}
|
|
1859
|
+
function fromBase64Url(input) {
|
|
1860
|
+
const padded = input.replace(/-/g, "+").replace(/_/g, "/") + "===".slice((input.length + 3) % 4);
|
|
1861
|
+
const g = globalThis;
|
|
1862
|
+
if (typeof g.atob === "function") {
|
|
1863
|
+
return decodeURIComponent(escape(g.atob(padded)));
|
|
1864
|
+
}
|
|
1865
|
+
return g.Buffer.from(padded, "base64").toString("utf-8");
|
|
1866
|
+
}
|
|
1867
|
+
function encodeFeedCursor(cursor) {
|
|
1868
|
+
return toBase64Url(JSON.stringify(cursor));
|
|
1869
|
+
}
|
|
1870
|
+
function decodeFeedCursor(encoded) {
|
|
1871
|
+
const json = fromBase64Url(encoded);
|
|
1872
|
+
const parsed2 = JSON.parse(json);
|
|
1873
|
+
return FeedCursorSchema.parse(parsed2);
|
|
1874
|
+
}
|
|
1759
1875
|
var ProfileCertificationRecordSchema = zod.z.object({
|
|
1760
1876
|
name: zod.z.string().min(1).refine(maxGraphemes(100)).max(1e3),
|
|
1761
1877
|
authority: zod.z.string().refine(maxGraphemes(100)).max(1e3).optional(),
|
|
@@ -1877,11 +1993,12 @@ var ProfileVolunteeringRecordSchema = zod.z.object({
|
|
|
1877
1993
|
});
|
|
1878
1994
|
|
|
1879
1995
|
// src/index.ts
|
|
1880
|
-
var SIFA_SDK_VERSION = "0.9.
|
|
1996
|
+
var SIFA_SDK_VERSION = "0.9.21";
|
|
1881
1997
|
|
|
1882
1998
|
exports.ACTIVITY_TIERS = ACTIVITY_TIERS;
|
|
1883
1999
|
exports.ACTIVITY_VISIBILITY_RULES = ACTIVITY_VISIBILITY_RULES;
|
|
1884
2000
|
exports.APP_URL_PATTERNS = APP_URL_PATTERNS;
|
|
2001
|
+
exports.AtmosphereFeedItemSchema = AtmosphereFeedItemSchema;
|
|
1885
2002
|
exports.CATEGORY_LABELS = CATEGORY_LABELS;
|
|
1886
2003
|
exports.CATEGORY_ORDER = CATEGORY_ORDER;
|
|
1887
2004
|
exports.COLLECTION_TO_APP = COLLECTION_TO_APP;
|
|
@@ -1893,6 +2010,13 @@ exports.EMPLOYMENT_TYPE_GROUPS = EMPLOYMENT_TYPE_GROUPS;
|
|
|
1893
2010
|
exports.EMPLOYMENT_TYPE_LABELS = EMPLOYMENT_TYPE_LABELS;
|
|
1894
2011
|
exports.EndorsementConfirmationRecordSchema = EndorsementConfirmationRecordSchema;
|
|
1895
2012
|
exports.EndorsementRecordSchema = EndorsementRecordSchema;
|
|
2013
|
+
exports.FEATURE_FLAGS = FEATURE_FLAGS;
|
|
2014
|
+
exports.FeatureAllowlistEntrySchema = FeatureAllowlistEntrySchema;
|
|
2015
|
+
exports.FeedActorSchema = FeedActorSchema;
|
|
2016
|
+
exports.FollowFeedItemSchema = FollowFeedItemSchema;
|
|
2017
|
+
exports.FollowFeedPageSchema = FollowFeedPageSchema;
|
|
2018
|
+
exports.FollowProfilePageSchema = FollowProfilePageSchema;
|
|
2019
|
+
exports.FollowProfileSchema = FollowProfileSchema;
|
|
1896
2020
|
exports.GraphFollowRecordSchema = GraphFollowRecordSchema;
|
|
1897
2021
|
exports.INDUSTRY_OPTIONS = INDUSTRY_OPTIONS;
|
|
1898
2022
|
exports.MIN_SKILLS = MIN_SKILLS;
|
|
@@ -1914,6 +2038,7 @@ exports.ProfileVolunteeringRecordSchema = ProfileVolunteeringRecordSchema;
|
|
|
1914
2038
|
exports.PublicationAuthorSchema = PublicationAuthorSchema;
|
|
1915
2039
|
exports.SIFA_SDK_VERSION = SIFA_SDK_VERSION;
|
|
1916
2040
|
exports.SKILL_CATEGORIES = SKILL_CATEGORIES;
|
|
2041
|
+
exports.SifaFeedItemSchema = SifaFeedItemSchema;
|
|
1917
2042
|
exports.WORKPLACE_TYPE_LABELS = WORKPLACE_TYPE_LABELS;
|
|
1918
2043
|
exports.WORKPLACE_TYPE_OPTIONS = WORKPLACE_TYPE_OPTIONS;
|
|
1919
2044
|
exports.atUriSchema = atUriSchema;
|
|
@@ -1926,10 +2051,12 @@ exports.countFilledDimensions = countFilledDimensions;
|
|
|
1926
2051
|
exports.countryCodeToFlag = countryCodeToFlag;
|
|
1927
2052
|
exports.dateRangeExtractor = dateRangeExtractor;
|
|
1928
2053
|
exports.datetimeSchema = datetimeSchema;
|
|
2054
|
+
exports.decodeFeedCursor = decodeFeedCursor;
|
|
1929
2055
|
exports.dedupeSkills = dedupeSkills;
|
|
1930
2056
|
exports.detectPdsProvider = detectPdsProvider;
|
|
1931
2057
|
exports.didSchema = didSchema;
|
|
1932
2058
|
exports.dimensionsFromInputs = dimensionsFromInputs;
|
|
2059
|
+
exports.encodeFeedCursor = encodeFeedCursor;
|
|
1933
2060
|
exports.findIndustry = findIndustry;
|
|
1934
2061
|
exports.formatDistanceToNow = formatDistanceToNow;
|
|
1935
2062
|
exports.formatLocation = formatLocation;
|
|
@@ -1957,6 +2084,7 @@ exports.isVisibleActivityItem = isVisibleActivityItem;
|
|
|
1957
2084
|
exports.languageTagSchema = languageTagSchema;
|
|
1958
2085
|
exports.lexiconDateExtractor = lexiconDateExtractor;
|
|
1959
2086
|
exports.limitCombiningMarks = limitCombiningMarks;
|
|
2087
|
+
exports.makeGraphFollowRecordSchema = makeGraphFollowRecordSchema;
|
|
1960
2088
|
exports.maxGraphemes = maxGraphemes;
|
|
1961
2089
|
exports.meetsContrastAA = meetsContrastAA;
|
|
1962
2090
|
exports.parseLocationString = parseLocationString;
|