@singi-labs/sifa-sdk 0.19.13 → 0.19.15
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 +86 -26
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +23 -5
- package/dist/index.d.ts +23 -5
- package/dist/index.js +86 -26
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -4014,37 +4014,48 @@ function getPublisherFromSiteUrl(siteUrl) {
|
|
|
4014
4014
|
// src/stream/verbs.json
|
|
4015
4015
|
var verbs_default = {
|
|
4016
4016
|
$schema: "https://sifa.id/schemas/activity-verbs/v1.json",
|
|
4017
|
-
version: "1.
|
|
4018
|
-
updated: "2026-
|
|
4017
|
+
version: "1.2.0",
|
|
4018
|
+
updated: "2026-09-18",
|
|
4019
4019
|
defaultVerb: "created",
|
|
4020
4020
|
verbs: {
|
|
4021
|
+
"agency.portable.membership": "joined",
|
|
4022
|
+
"app.atmobb.discussion.reply": "replied",
|
|
4021
4023
|
"app.bsky.feed.post": "posted",
|
|
4024
|
+
"app.bsky.feed.repost": "reposted",
|
|
4025
|
+
"app.sidetrail.trail": "shipped",
|
|
4026
|
+
"app.sidetrail.walk": "shipped",
|
|
4027
|
+
"app.userinput.reply": "replied",
|
|
4028
|
+
"at.margin.bookmark": "bookmarked",
|
|
4029
|
+
"at.youandme.connection": "followed",
|
|
4022
4030
|
"blue.flashes.feed.post": "posted",
|
|
4023
|
-
"social.psky.feed.post": "posted",
|
|
4024
|
-
"social.popfeed.feed.post": "posted",
|
|
4025
|
-
"social.popfeed.feed.note": "posted",
|
|
4026
|
-
"social.popfeed.feed.review": "reviewed",
|
|
4027
4031
|
"buzz.bookhive.book": "reviewed",
|
|
4028
|
-
"fyi.unravel.frontpage.post": "posted",
|
|
4029
|
-
"forum.barazo.post": "posted",
|
|
4030
|
-
"app.bsky.feed.repost": "reposted",
|
|
4031
4032
|
"com.whtwnd.blog.entry": "published",
|
|
4032
|
-
"
|
|
4033
|
+
"community.lexicon.calendar.rsvp": "rsvped",
|
|
4034
|
+
"community.nooki.comments": "commented",
|
|
4035
|
+
"community.nooki.membership": "joined",
|
|
4036
|
+
"community.opensocial.membership": "joined",
|
|
4033
4037
|
"computer.aetheros.page": "published",
|
|
4034
|
-
"
|
|
4035
|
-
"
|
|
4038
|
+
"eu.atcommons.member": "joined",
|
|
4039
|
+
"fm.plyr.comment": "commented",
|
|
4040
|
+
"forum.barazo.post": "posted",
|
|
4041
|
+
"fyi.unravel.frontpage.post": "posted",
|
|
4042
|
+
"id.sifa.endorsement": "endorsed",
|
|
4043
|
+
"id.sifa.graph.connection": "joined",
|
|
4036
4044
|
"id.sifa.profile.presentation": "presented",
|
|
4037
4045
|
"id.sifa.profile.presentationDelivery": "presented",
|
|
4038
|
-
"
|
|
4046
|
+
"link.pastesphere.snippet": "published",
|
|
4047
|
+
"org.impactindexer.review.comment": "commented",
|
|
4048
|
+
"pub.leaflet.comment": "commented",
|
|
4039
4049
|
"sh.tangled.repo": "shipped",
|
|
4040
4050
|
"sh.tangled.repo.issue": "shipped",
|
|
4041
4051
|
"sh.tangled.repo.pull": "shipped",
|
|
4042
|
-
"
|
|
4043
|
-
"app.sidetrail.walk": "shipped",
|
|
4052
|
+
"site.standard.document": "published",
|
|
4044
4053
|
"social.colibri.membership": "joined",
|
|
4045
|
-
"
|
|
4046
|
-
"
|
|
4047
|
-
"
|
|
4054
|
+
"social.kut.community.membership": "joined",
|
|
4055
|
+
"social.popfeed.feed.note": "posted",
|
|
4056
|
+
"social.popfeed.feed.post": "posted",
|
|
4057
|
+
"social.popfeed.feed.review": "reviewed",
|
|
4058
|
+
"social.psky.feed.post": "posted"
|
|
4048
4059
|
}
|
|
4049
4060
|
};
|
|
4050
4061
|
|
|
@@ -4058,7 +4069,16 @@ var STREAM_VERBS = [
|
|
|
4058
4069
|
"joined",
|
|
4059
4070
|
"shipped",
|
|
4060
4071
|
"reviewed",
|
|
4061
|
-
"created"
|
|
4072
|
+
"created",
|
|
4073
|
+
// Relational verbs: a reaction or reference to someone else's thing. These
|
|
4074
|
+
// read with the subject the two-tier line renders after them ("Commented on
|
|
4075
|
+
// {doc}", "Followed {person}").
|
|
4076
|
+
"commented",
|
|
4077
|
+
"replied",
|
|
4078
|
+
"rsvped",
|
|
4079
|
+
"liked",
|
|
4080
|
+
"followed",
|
|
4081
|
+
"bookmarked"
|
|
4062
4082
|
];
|
|
4063
4083
|
var streamVerbSchema = zod.z.enum(STREAM_VERBS);
|
|
4064
4084
|
var verbMapSchema = zod.z.object({
|
|
@@ -4270,7 +4290,8 @@ var streamCardSubjectSchema = zod.z.discriminatedUnion("kind", [
|
|
|
4270
4290
|
zod.z.object({
|
|
4271
4291
|
kind: zod.z.literal("record"),
|
|
4272
4292
|
uri: zod.z.string(),
|
|
4273
|
-
title: zod.z.string().optional()
|
|
4293
|
+
title: zod.z.string().optional(),
|
|
4294
|
+
url: zod.z.string().optional()
|
|
4274
4295
|
})
|
|
4275
4296
|
]);
|
|
4276
4297
|
var hypercertDetailsSchema = zod.z.object({
|
|
@@ -4507,10 +4528,33 @@ var TITLE_BY_VERB = {
|
|
|
4507
4528
|
joined: (label) => `Joined ${label}`,
|
|
4508
4529
|
shipped: (label) => `Shipped on ${label}`,
|
|
4509
4530
|
reviewed: (label) => `Reviewed on ${label}`,
|
|
4510
|
-
created: (label) => `Shared on ${label}
|
|
4531
|
+
created: (label) => `Shared on ${label}`,
|
|
4532
|
+
commented: (_label, hasSubject) => hasSubject ? "Commented on" : "Commented",
|
|
4533
|
+
replied: (_label, hasSubject) => hasSubject ? "Replied to" : "Replied",
|
|
4534
|
+
rsvped: (_label, hasSubject) => hasSubject ? "RSVP'd to" : "RSVP'd",
|
|
4535
|
+
liked: () => "Liked",
|
|
4536
|
+
followed: () => "Followed",
|
|
4537
|
+
bookmarked: () => "Bookmarked"
|
|
4511
4538
|
};
|
|
4512
|
-
function buildTitle(verb, label) {
|
|
4513
|
-
return TITLE_BY_VERB[verb](label);
|
|
4539
|
+
function buildTitle(verb, label, hasSubject) {
|
|
4540
|
+
return TITLE_BY_VERB[verb](label, hasSubject);
|
|
4541
|
+
}
|
|
4542
|
+
function recordHasSubjectRef(record) {
|
|
4543
|
+
if (!record) return false;
|
|
4544
|
+
const subject = record.subject;
|
|
4545
|
+
if (typeof subject === "string" && subject.startsWith("at://")) return true;
|
|
4546
|
+
if (subject && typeof subject === "object") {
|
|
4547
|
+
const uri = subject.uri;
|
|
4548
|
+
if (typeof uri === "string" && uri.length > 0) return true;
|
|
4549
|
+
}
|
|
4550
|
+
const reply = record.reply;
|
|
4551
|
+
if (reply && typeof reply === "object") {
|
|
4552
|
+
for (const key of ["parent", "root"]) {
|
|
4553
|
+
const ref = reply[key];
|
|
4554
|
+
if (ref && typeof ref === "object" && typeof ref.uri === "string") return true;
|
|
4555
|
+
}
|
|
4556
|
+
}
|
|
4557
|
+
return false;
|
|
4514
4558
|
}
|
|
4515
4559
|
function resolveSourceUrl(item, record) {
|
|
4516
4560
|
const authorDid = didFromUri(item.uri);
|
|
@@ -4723,6 +4767,14 @@ function applyEventRsvp(vm, record) {
|
|
|
4723
4767
|
if (locationCountry) body.locationCountry = locationCountry;
|
|
4724
4768
|
}
|
|
4725
4769
|
vm.body = body;
|
|
4770
|
+
const eventUri = nonBlankString(asRecord(record.subject)?.uri);
|
|
4771
|
+
if (eventUri) {
|
|
4772
|
+
vm.subject = {
|
|
4773
|
+
kind: "record",
|
|
4774
|
+
uri: eventUri,
|
|
4775
|
+
...body.eventName ? { title: body.eventName } : {}
|
|
4776
|
+
};
|
|
4777
|
+
}
|
|
4726
4778
|
return vm;
|
|
4727
4779
|
}
|
|
4728
4780
|
function applyKeytraceVerification(vm, record) {
|
|
@@ -4931,8 +4983,16 @@ function genericSubject(record) {
|
|
|
4931
4983
|
}
|
|
4932
4984
|
const uri = nonBlankString(asRecord(subject)?.uri);
|
|
4933
4985
|
if (uri && uri.startsWith("at://")) return { kind: "record", uri };
|
|
4986
|
+
const parentUri = nonBlankString(asRecord(asRecord(record.reply)?.parent)?.uri);
|
|
4987
|
+
if (parentUri && parentUri.startsWith("at://")) return { kind: "record", uri: parentUri };
|
|
4934
4988
|
return void 0;
|
|
4935
4989
|
}
|
|
4990
|
+
function withResolvedSubjectMeta(subject, item) {
|
|
4991
|
+
if (subject.kind !== "record") return subject;
|
|
4992
|
+
const title = nonBlankString(item.subjectTitle) ?? subject.title;
|
|
4993
|
+
const url = nonBlankString(item.subjectUrl);
|
|
4994
|
+
return { ...subject, ...title ? { title } : {}, ...url ? { url } : {} };
|
|
4995
|
+
}
|
|
4936
4996
|
function parseFacetFeature(features) {
|
|
4937
4997
|
for (const raw of features) {
|
|
4938
4998
|
const feat = asRecord(raw);
|
|
@@ -5005,7 +5065,7 @@ function applyGeneric(vm, item, record) {
|
|
|
5005
5065
|
if (externalLink) vm.externalLink = externalLink;
|
|
5006
5066
|
if (!vm.subject) {
|
|
5007
5067
|
const subject = genericSubject(record);
|
|
5008
|
-
if (subject) vm.subject = subject;
|
|
5068
|
+
if (subject) vm.subject = withResolvedSubjectMeta(subject, item);
|
|
5009
5069
|
}
|
|
5010
5070
|
let body;
|
|
5011
5071
|
if (text) {
|
|
@@ -5038,7 +5098,7 @@ function toStreamCardVM(item, options = {}) {
|
|
|
5038
5098
|
source,
|
|
5039
5099
|
tier: getActivityTier(item.collection),
|
|
5040
5100
|
timestamp,
|
|
5041
|
-
title: buildTitle(verb, source.label)
|
|
5101
|
+
title: buildTitle(verb, source.label, recordHasSubjectRef(record))
|
|
5042
5102
|
};
|
|
5043
5103
|
const author = buildAuthor(item);
|
|
5044
5104
|
if (author) vm.author = author;
|
|
@@ -6525,7 +6585,7 @@ function describeSifaRecord(collection, value) {
|
|
|
6525
6585
|
}
|
|
6526
6586
|
|
|
6527
6587
|
// src/index.ts
|
|
6528
|
-
var SIFA_SDK_VERSION = "0.19.
|
|
6588
|
+
var SIFA_SDK_VERSION = "0.19.15";
|
|
6529
6589
|
|
|
6530
6590
|
exports.ACTIVITY_TIERS = ACTIVITY_TIERS;
|
|
6531
6591
|
exports.ACTIVITY_VERBS = ACTIVITY_VERBS;
|