@singi-labs/sifa-sdk 0.12.12 → 0.12.14
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 +42 -24
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +33 -7
- package/dist/index.d.ts +33 -7
- package/dist/index.js +41 -25
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1907,6 +1907,27 @@ function detectPdsProvider(handle) {
|
|
|
1907
1907
|
// src/format/embed.ts
|
|
1908
1908
|
var LINK = { kind: "link" };
|
|
1909
1909
|
var YOUTUBE_ID = /^[A-Za-z0-9_-]{6,}$/;
|
|
1910
|
+
function youtubeVideoId(url) {
|
|
1911
|
+
let parsed3;
|
|
1912
|
+
try {
|
|
1913
|
+
parsed3 = new URL(url);
|
|
1914
|
+
} catch {
|
|
1915
|
+
return null;
|
|
1916
|
+
}
|
|
1917
|
+
if (parsed3.protocol !== "https:") return null;
|
|
1918
|
+
const host = bareHost(parsed3.hostname);
|
|
1919
|
+
const segments = parsed3.pathname.split("/").filter(Boolean);
|
|
1920
|
+
let id = null;
|
|
1921
|
+
if (host === "youtu.be") id = segments[0] ?? null;
|
|
1922
|
+
else if (host === "youtube.com" || host === "m.youtube.com") {
|
|
1923
|
+
if (parsed3.pathname === "/watch") id = parsed3.searchParams.get("v");
|
|
1924
|
+
else if (segments[0] === "embed" || segments[0] === "shorts") id = segments[1] ?? null;
|
|
1925
|
+
}
|
|
1926
|
+
return id && YOUTUBE_ID.test(id) ? id : null;
|
|
1927
|
+
}
|
|
1928
|
+
function youtubeThumbnailUrl(videoId) {
|
|
1929
|
+
return `https://i.ytimg.com/vi/${videoId}/hqdefault.jpg`;
|
|
1930
|
+
}
|
|
1910
1931
|
function bareHost(hostname) {
|
|
1911
1932
|
return hostname.toLowerCase().replace(/^www\./, "");
|
|
1912
1933
|
}
|
|
@@ -1920,24 +1941,9 @@ function resolveEmbed(url) {
|
|
|
1920
1941
|
if (parsed3.protocol !== "https:") return LINK;
|
|
1921
1942
|
const host = bareHost(parsed3.hostname);
|
|
1922
1943
|
const segments = parsed3.pathname.split("/").filter(Boolean);
|
|
1923
|
-
if (host === "youtu.be") {
|
|
1924
|
-
const id =
|
|
1925
|
-
|
|
1926
|
-
return youtubeEmbed(id);
|
|
1927
|
-
}
|
|
1928
|
-
return LINK;
|
|
1929
|
-
}
|
|
1930
|
-
if (host === "youtube.com" || host === "m.youtube.com") {
|
|
1931
|
-
if (parsed3.pathname === "/watch") {
|
|
1932
|
-
const id = parsed3.searchParams.get("v");
|
|
1933
|
-
if (id && YOUTUBE_ID.test(id)) return youtubeEmbed(id);
|
|
1934
|
-
return LINK;
|
|
1935
|
-
}
|
|
1936
|
-
if (segments[0] === "embed" || segments[0] === "shorts") {
|
|
1937
|
-
const id = segments[1];
|
|
1938
|
-
if (id && YOUTUBE_ID.test(id)) return youtubeEmbed(id);
|
|
1939
|
-
}
|
|
1940
|
-
return LINK;
|
|
1944
|
+
if (host === "youtu.be" || host === "youtube.com" || host === "m.youtube.com") {
|
|
1945
|
+
const id = youtubeVideoId(url);
|
|
1946
|
+
return id ? youtubeEmbed(id) : LINK;
|
|
1941
1947
|
}
|
|
1942
1948
|
if (host === "vimeo.com") {
|
|
1943
1949
|
const id = segments[0];
|
|
@@ -1966,12 +1972,18 @@ function resolveEmbed(url) {
|
|
|
1966
1972
|
if (segments[0] === "player" && segments[1]) {
|
|
1967
1973
|
return { kind: "iframe", provider: "speakerdeck", src: parsed3.href, aspectRatio: "4:3" };
|
|
1968
1974
|
}
|
|
1975
|
+
if (segments.length >= 2) {
|
|
1976
|
+
return { kind: "oembed", provider: "speakerdeck", aspectRatio: "4:3", pageUrl: parsed3.href };
|
|
1977
|
+
}
|
|
1969
1978
|
return LINK;
|
|
1970
1979
|
}
|
|
1971
1980
|
if (host === "slideshare.net") {
|
|
1972
1981
|
if (segments[0] === "slideshow" && segments[1] === "embed_code") {
|
|
1973
1982
|
return { kind: "iframe", provider: "slideshare", src: parsed3.href, aspectRatio: "4:3" };
|
|
1974
1983
|
}
|
|
1984
|
+
if (segments.length >= 2) {
|
|
1985
|
+
return { kind: "oembed", provider: "slideshare", aspectRatio: "4:3", pageUrl: parsed3.href };
|
|
1986
|
+
}
|
|
1975
1987
|
return LINK;
|
|
1976
1988
|
}
|
|
1977
1989
|
if (host === "docs.google.com") {
|
|
@@ -2735,8 +2747,8 @@ function getPublisherFromSiteUrl(siteUrl) {
|
|
|
2735
2747
|
// src/stream/verbs.json
|
|
2736
2748
|
var verbs_default = {
|
|
2737
2749
|
$schema: "https://sifa.id/schemas/activity-verbs/v1.json",
|
|
2738
|
-
version: "1.
|
|
2739
|
-
updated: "2026-07-
|
|
2750
|
+
version: "1.1.0",
|
|
2751
|
+
updated: "2026-07-19",
|
|
2740
2752
|
defaultVerb: "created",
|
|
2741
2753
|
verbs: {
|
|
2742
2754
|
"app.bsky.feed.post": "posted",
|
|
@@ -2744,6 +2756,8 @@ var verbs_default = {
|
|
|
2744
2756
|
"social.psky.feed.post": "posted",
|
|
2745
2757
|
"social.popfeed.feed.post": "posted",
|
|
2746
2758
|
"social.popfeed.feed.note": "posted",
|
|
2759
|
+
"social.popfeed.feed.review": "reviewed",
|
|
2760
|
+
"buzz.bookhive.book": "reviewed",
|
|
2747
2761
|
"fyi.unravel.frontpage.post": "posted",
|
|
2748
2762
|
"forum.barazo.post": "posted",
|
|
2749
2763
|
"app.bsky.feed.repost": "reposted",
|
|
@@ -2778,6 +2792,7 @@ var STREAM_VERBS = [
|
|
|
2778
2792
|
"endorsed",
|
|
2779
2793
|
"joined",
|
|
2780
2794
|
"shipped",
|
|
2795
|
+
"reviewed",
|
|
2781
2796
|
"created"
|
|
2782
2797
|
];
|
|
2783
2798
|
var streamVerbSchema = zod.z.enum(STREAM_VERBS);
|
|
@@ -3158,14 +3173,15 @@ function buildSource(item, options) {
|
|
|
3158
3173
|
};
|
|
3159
3174
|
}
|
|
3160
3175
|
var TITLE_BY_VERB = {
|
|
3161
|
-
posted: (
|
|
3162
|
-
reposted: () => "Reposted
|
|
3176
|
+
posted: () => "Posted",
|
|
3177
|
+
reposted: () => "Reposted",
|
|
3163
3178
|
published: (label) => `Published on ${label}`,
|
|
3164
3179
|
presented: () => "Gave a presentation",
|
|
3165
3180
|
endorsed: () => "Wrote an endorsement",
|
|
3166
3181
|
joined: (label) => `Joined ${label}`,
|
|
3167
3182
|
shipped: (label) => `Shipped on ${label}`,
|
|
3168
|
-
|
|
3183
|
+
reviewed: (label) => `Reviewed on ${label}`,
|
|
3184
|
+
created: (label) => `Shared on ${label}`
|
|
3169
3185
|
};
|
|
3170
3186
|
function buildTitle(verb, label) {
|
|
3171
3187
|
return TITLE_BY_VERB[verb](label);
|
|
@@ -4528,7 +4544,7 @@ var ProfileVolunteeringRecordSchema = zod.z.object({
|
|
|
4528
4544
|
});
|
|
4529
4545
|
|
|
4530
4546
|
// src/index.ts
|
|
4531
|
-
var SIFA_SDK_VERSION = "0.12.
|
|
4547
|
+
var SIFA_SDK_VERSION = "0.12.14";
|
|
4532
4548
|
|
|
4533
4549
|
exports.ACTIVITY_TIERS = ACTIVITY_TIERS;
|
|
4534
4550
|
exports.ACTIVITY_VERBS = ACTIVITY_VERBS;
|
|
@@ -4772,5 +4788,7 @@ exports.truncateGraphemes = truncateGraphemes;
|
|
|
4772
4788
|
exports.uriSchema = uriSchema;
|
|
4773
4789
|
exports.verbForCollection = verbForCollection;
|
|
4774
4790
|
exports.visibleItems = visibleItems;
|
|
4791
|
+
exports.youtubeThumbnailUrl = youtubeThumbnailUrl;
|
|
4792
|
+
exports.youtubeVideoId = youtubeVideoId;
|
|
4775
4793
|
//# sourceMappingURL=index.cjs.map
|
|
4776
4794
|
//# sourceMappingURL=index.cjs.map
|