@singi-labs/sifa-sdk 0.9.3 → 0.9.5
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/README.md +12 -1
- package/dist/index.cjs +580 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +140 -1
- package/dist/index.d.ts +140 -1
- package/dist/index.js +570 -2
- package/dist/index.js.map +1 -1
- package/package.json +3 -2
package/dist/index.js
CHANGED
|
@@ -691,6 +691,10 @@ function getWorkplaceTypeLabel(value) {
|
|
|
691
691
|
var PLATFORM_LABELS = {
|
|
692
692
|
bluesky: "Bluesky",
|
|
693
693
|
github: "GitHub",
|
|
694
|
+
codeberg: "Codeberg",
|
|
695
|
+
gitlab: "GitLab",
|
|
696
|
+
forgejo: "Forgejo",
|
|
697
|
+
gitea: "Gitea",
|
|
694
698
|
linkedin: "LinkedIn",
|
|
695
699
|
youtube: "YouTube",
|
|
696
700
|
twitter: "X (Twitter)",
|
|
@@ -790,6 +794,350 @@ function groupSkillsByCategory(skills) {
|
|
|
790
794
|
return ordered;
|
|
791
795
|
}
|
|
792
796
|
|
|
797
|
+
// src/taxonomy/activity-tiers.json
|
|
798
|
+
var activity_tiers_default = {
|
|
799
|
+
$schema: "https://sifa.id/schemas/activity-tiers/v1.json",
|
|
800
|
+
version: "1.0.0",
|
|
801
|
+
updated: "2026-05-28",
|
|
802
|
+
tiers: {
|
|
803
|
+
creation: {
|
|
804
|
+
label: "Made",
|
|
805
|
+
description: "Substantive records the actor authored: posts, articles, repos, galleries, livestreams, RSVPs, CV entries. Surfaced on the public profile and in the network timeline.",
|
|
806
|
+
shownOnPublicProfile: true
|
|
807
|
+
},
|
|
808
|
+
action: {
|
|
809
|
+
label: "Did",
|
|
810
|
+
description: "Engagement records (likes, reposts, follows, votes, stars, reactions). Visible to the actor on the 'What is public about me' page and on the originating app, but not surfaced on the Sifa public profile.",
|
|
811
|
+
shownOnPublicProfile: false
|
|
812
|
+
},
|
|
813
|
+
filtered: {
|
|
814
|
+
label: null,
|
|
815
|
+
description: "Configuration, infrastructure, moderation, game state, ephemeral consumption signals (bookmarks, highlights), and other records Sifa does not display anywhere. The records remain public on the actor's PDS regardless.",
|
|
816
|
+
shownOnPublicProfile: false
|
|
817
|
+
}
|
|
818
|
+
},
|
|
819
|
+
lexicons: {
|
|
820
|
+
"app.bsky.feed.post": {
|
|
821
|
+
tier: "creation",
|
|
822
|
+
app: "bluesky",
|
|
823
|
+
notes: "Ambiguous: many posts are casual, but the lexicon also carries long-form posts and threads. Treated as creation; empty quote-posts (no text + record embed) are filtered at the consumer layer, not here."
|
|
824
|
+
},
|
|
825
|
+
"app.bsky.feed.like": { tier: "action", app: "bluesky" },
|
|
826
|
+
"app.bsky.feed.repost": { tier: "action", app: "bluesky" },
|
|
827
|
+
"app.bsky.feed.generator": {
|
|
828
|
+
tier: "filtered",
|
|
829
|
+
app: "bluesky",
|
|
830
|
+
notes: "Feed generator definition record, not personal activity."
|
|
831
|
+
},
|
|
832
|
+
"app.bsky.graph.follow": { tier: "action", app: "bluesky" },
|
|
833
|
+
"app.bsky.graph.block": { tier: "filtered", app: "bluesky", notes: "Moderation record." },
|
|
834
|
+
"app.bsky.graph.mute": { tier: "filtered", app: "bluesky", notes: "Moderation record." },
|
|
835
|
+
"app.bsky.graph.listblock": {
|
|
836
|
+
tier: "filtered",
|
|
837
|
+
app: "bluesky",
|
|
838
|
+
notes: "Moderation record."
|
|
839
|
+
},
|
|
840
|
+
"app.bsky.graph.listitem": {
|
|
841
|
+
tier: "filtered",
|
|
842
|
+
app: "bluesky",
|
|
843
|
+
notes: "List membership; rendered via the parent list, not as standalone activity."
|
|
844
|
+
},
|
|
845
|
+
"app.bsky.graph.list": {
|
|
846
|
+
tier: "filtered",
|
|
847
|
+
app: "bluesky",
|
|
848
|
+
notes: "User-curated list metadata; not surfaced as profile activity."
|
|
849
|
+
},
|
|
850
|
+
"app.bsky.graph.starterpack": { tier: "filtered", app: "bluesky" },
|
|
851
|
+
"app.bsky.actor.profile": {
|
|
852
|
+
tier: "filtered",
|
|
853
|
+
app: "bluesky",
|
|
854
|
+
notes: "Profile metadata record."
|
|
855
|
+
},
|
|
856
|
+
"sh.tangled.repo": { tier: "creation", app: "tangled" },
|
|
857
|
+
"sh.tangled.repo.issue": { tier: "creation", app: "tangled" },
|
|
858
|
+
"sh.tangled.repo.pull": { tier: "creation", app: "tangled" },
|
|
859
|
+
"sh.tangled.feed.star": { tier: "action", app: "tangled" },
|
|
860
|
+
"sh.tangled.graph.follow": { tier: "action", app: "tangled" },
|
|
861
|
+
"sh.tangled.actor.profile": {
|
|
862
|
+
tier: "filtered",
|
|
863
|
+
app: "tangled",
|
|
864
|
+
notes: "Profile metadata record."
|
|
865
|
+
},
|
|
866
|
+
"community.lexicon.calendar.rsvp": {
|
|
867
|
+
tier: "creation",
|
|
868
|
+
app: "smokesignal",
|
|
869
|
+
notes: "Ambiguous: RSVPs are reactions to events, but they are public commitments and the only Smoke Signal record Sifa scans today. Classified as creation."
|
|
870
|
+
},
|
|
871
|
+
"events.smokesignal.profile": {
|
|
872
|
+
tier: "filtered",
|
|
873
|
+
app: "smokesignal",
|
|
874
|
+
notes: "Profile metadata record."
|
|
875
|
+
},
|
|
876
|
+
"blue.flashes.feed.post": { tier: "creation", app: "flashes" },
|
|
877
|
+
"social.grain.gallery": { tier: "creation", app: "grain" },
|
|
878
|
+
"social.grain.gallery.item": {
|
|
879
|
+
tier: "filtered",
|
|
880
|
+
app: "grain",
|
|
881
|
+
notes: "Item-within-gallery; rendered via parent gallery."
|
|
882
|
+
},
|
|
883
|
+
"social.grain.photo": {
|
|
884
|
+
tier: "filtered",
|
|
885
|
+
app: "grain",
|
|
886
|
+
notes: "Raw photo asset; surfaced via the gallery that references it."
|
|
887
|
+
},
|
|
888
|
+
"social.grain.photo.exif": {
|
|
889
|
+
tier: "filtered",
|
|
890
|
+
app: "grain",
|
|
891
|
+
notes: "EXIF metadata for a photo."
|
|
892
|
+
},
|
|
893
|
+
"social.grain.story": {
|
|
894
|
+
tier: "filtered",
|
|
895
|
+
app: "grain",
|
|
896
|
+
notes: "Ephemeral story format."
|
|
897
|
+
},
|
|
898
|
+
"com.whtwnd.blog.entry": { tier: "creation", app: "whitewind" },
|
|
899
|
+
"fyi.unravel.frontpage.post": { tier: "creation", app: "frontpage" },
|
|
900
|
+
"fyi.unravel.frontpage.vote": { tier: "action", app: "frontpage" },
|
|
901
|
+
"social.psky.feed.post": { tier: "creation", app: "picosky" },
|
|
902
|
+
"link.pastesphere.snippet": { tier: "creation", app: "pastesphere" },
|
|
903
|
+
"site.standard.document": { tier: "creation", app: "standard" },
|
|
904
|
+
"computer.aetheros.page": { tier: "creation", app: "aetheros" },
|
|
905
|
+
"space.roomy.space.personal": { tier: "creation", app: "roomy" },
|
|
906
|
+
"dev.keytrace.claim": { tier: "creation", app: "keytrace" },
|
|
907
|
+
"social.popfeed.feed.review": { tier: "creation", app: "popfeed" },
|
|
908
|
+
"social.popfeed.feed.post": { tier: "creation", app: "popfeed" },
|
|
909
|
+
"social.popfeed.feed.note": { tier: "creation", app: "popfeed" },
|
|
910
|
+
"social.popfeed.feed.like": { tier: "action", app: "popfeed" },
|
|
911
|
+
"social.popfeed.challenge.participation": {
|
|
912
|
+
tier: "filtered",
|
|
913
|
+
app: "popfeed",
|
|
914
|
+
notes: "Challenge participation tracking."
|
|
915
|
+
},
|
|
916
|
+
"social.popfeed.actor.profile": {
|
|
917
|
+
tier: "filtered",
|
|
918
|
+
app: "popfeed",
|
|
919
|
+
notes: "Profile metadata record."
|
|
920
|
+
},
|
|
921
|
+
"place.stream.livestream": { tier: "creation", app: "streamplace" },
|
|
922
|
+
"place.stream.broadcast.origin": {
|
|
923
|
+
tier: "filtered",
|
|
924
|
+
app: "streamplace",
|
|
925
|
+
notes: "Broadcast origin/infrastructure record."
|
|
926
|
+
},
|
|
927
|
+
"place.stream.key": {
|
|
928
|
+
tier: "filtered",
|
|
929
|
+
app: "streamplace",
|
|
930
|
+
notes: "Stream key \u2014 sensitive infrastructure record."
|
|
931
|
+
},
|
|
932
|
+
"place.stream.metadata.configuration": {
|
|
933
|
+
tier: "filtered",
|
|
934
|
+
app: "streamplace",
|
|
935
|
+
notes: "Stream configuration metadata."
|
|
936
|
+
},
|
|
937
|
+
"place.stream.chat.message": {
|
|
938
|
+
tier: "filtered",
|
|
939
|
+
app: "streamplace",
|
|
940
|
+
notes: "Ephemeral chat message."
|
|
941
|
+
},
|
|
942
|
+
"place.stream.chat.profile": {
|
|
943
|
+
tier: "filtered",
|
|
944
|
+
app: "streamplace",
|
|
945
|
+
notes: "Chat profile metadata."
|
|
946
|
+
},
|
|
947
|
+
"app.sidetrail.trail": { tier: "creation", app: "semble" },
|
|
948
|
+
"app.sidetrail.walk": { tier: "creation", app: "semble" },
|
|
949
|
+
"at.youandme.connection": { tier: "creation", app: "youandme" },
|
|
950
|
+
"pub.leaflet.comment": { tier: "creation", app: "leaflet" },
|
|
951
|
+
"pub.leaflet.interactions.recommend": { tier: "action", app: "leaflet" },
|
|
952
|
+
"pub.leaflet.authFullPermissions": {
|
|
953
|
+
tier: "filtered",
|
|
954
|
+
app: "leaflet",
|
|
955
|
+
notes: "OAuth permission record."
|
|
956
|
+
},
|
|
957
|
+
"social.colibri.membership": { tier: "creation", app: "colibri" },
|
|
958
|
+
"social.colibri.message": {
|
|
959
|
+
tier: "filtered",
|
|
960
|
+
app: "colibri",
|
|
961
|
+
notes: "Chat message \u2014 high-volume conversational signal, not portfolio."
|
|
962
|
+
},
|
|
963
|
+
"social.colibri.reaction": { tier: "filtered", app: "colibri", notes: "Chat reaction." },
|
|
964
|
+
"social.colibri.channel": {
|
|
965
|
+
tier: "filtered",
|
|
966
|
+
app: "colibri",
|
|
967
|
+
notes: "Channel definition."
|
|
968
|
+
},
|
|
969
|
+
"social.colibri.community": {
|
|
970
|
+
tier: "filtered",
|
|
971
|
+
app: "colibri",
|
|
972
|
+
notes: "Community definition."
|
|
973
|
+
},
|
|
974
|
+
"social.colibri.approval": {
|
|
975
|
+
tier: "filtered",
|
|
976
|
+
app: "colibri",
|
|
977
|
+
notes: "Moderation approval record."
|
|
978
|
+
},
|
|
979
|
+
"social.colibri.category": {
|
|
980
|
+
tier: "filtered",
|
|
981
|
+
app: "colibri",
|
|
982
|
+
notes: "Category metadata."
|
|
983
|
+
},
|
|
984
|
+
"social.colibri.channel.read": {
|
|
985
|
+
tier: "filtered",
|
|
986
|
+
app: "colibri",
|
|
987
|
+
notes: "Read-state marker."
|
|
988
|
+
},
|
|
989
|
+
"social.colibri.actor.data": {
|
|
990
|
+
tier: "filtered",
|
|
991
|
+
app: "colibri",
|
|
992
|
+
notes: "Actor metadata."
|
|
993
|
+
},
|
|
994
|
+
"social.colibri.richtext.facet": {
|
|
995
|
+
tier: "filtered",
|
|
996
|
+
app: "colibri",
|
|
997
|
+
notes: "Richtext facet sub-record."
|
|
998
|
+
},
|
|
999
|
+
"app.collectivesocial.feed.list": {
|
|
1000
|
+
tier: "creation",
|
|
1001
|
+
app: "collectivesocial",
|
|
1002
|
+
notes: "Auto-created default Inbox lists are filtered at the consumer layer via isDefault=true predicate."
|
|
1003
|
+
},
|
|
1004
|
+
"net.alternativeproto.vote": {
|
|
1005
|
+
tier: "action",
|
|
1006
|
+
notes: "Vote record on a third-party protocol."
|
|
1007
|
+
},
|
|
1008
|
+
"network.cosmik.collection": {
|
|
1009
|
+
tier: "filtered",
|
|
1010
|
+
notes: "Stale registry id \u2014 Cosmik formerly in app registry."
|
|
1011
|
+
},
|
|
1012
|
+
"network.cosmik.collectionLink": { tier: "filtered" },
|
|
1013
|
+
"network.cosmik.connection": { tier: "filtered" },
|
|
1014
|
+
"network.cosmik.follow": { tier: "filtered" },
|
|
1015
|
+
"network.cosmik.card": { tier: "filtered", notes: "Link-in-bio card; consumption signal." },
|
|
1016
|
+
"social.pinksky.app.preference": {
|
|
1017
|
+
tier: "filtered",
|
|
1018
|
+
app: "bluesky",
|
|
1019
|
+
notes: "Pinkleap (Bluesky client) app preferences."
|
|
1020
|
+
},
|
|
1021
|
+
"at.margin.bookmark": {
|
|
1022
|
+
tier: "filtered",
|
|
1023
|
+
notes: "Bookmark \u2014 consumption signal, not creation."
|
|
1024
|
+
},
|
|
1025
|
+
"at.margin.highlight": {
|
|
1026
|
+
tier: "filtered",
|
|
1027
|
+
notes: "Highlight \u2014 consumption signal, not creation."
|
|
1028
|
+
},
|
|
1029
|
+
"community.lexicon.bookmarks.bookmark": {
|
|
1030
|
+
tier: "filtered",
|
|
1031
|
+
notes: "Bookmark \u2014 consumption signal."
|
|
1032
|
+
},
|
|
1033
|
+
"blue.linkat.board": { tier: "filtered", notes: "Link-in-bio board; consumption signal." },
|
|
1034
|
+
"dev.skyboard.board": { tier: "filtered", notes: "Skyboard task-board metadata." },
|
|
1035
|
+
"dev.skyboard.op": { tier: "filtered", notes: "Skyboard operation log." },
|
|
1036
|
+
"dev.skyboard.task": { tier: "filtered", notes: "Skyboard task record." },
|
|
1037
|
+
"net.anisota.player.state": { tier: "filtered", notes: "Anisota game player state." },
|
|
1038
|
+
"xyz.statusphere.status": {
|
|
1039
|
+
tier: "filtered",
|
|
1040
|
+
notes: "Statusphere emoji status \u2014 leisure signal."
|
|
1041
|
+
},
|
|
1042
|
+
"id.sifa.profile.self": {
|
|
1043
|
+
tier: "creation",
|
|
1044
|
+
app: "sifa",
|
|
1045
|
+
notes: "Sifa professional profile root."
|
|
1046
|
+
},
|
|
1047
|
+
"id.sifa.profile.position": { tier: "creation", app: "sifa" },
|
|
1048
|
+
"id.sifa.profile.education": { tier: "creation", app: "sifa" },
|
|
1049
|
+
"id.sifa.profile.skill": { tier: "creation", app: "sifa" },
|
|
1050
|
+
"id.sifa.profile.certification": { tier: "creation", app: "sifa" },
|
|
1051
|
+
"id.sifa.profile.project": { tier: "creation", app: "sifa" },
|
|
1052
|
+
"id.sifa.profile.volunteering": { tier: "creation", app: "sifa" },
|
|
1053
|
+
"id.sifa.profile.publication": { tier: "creation", app: "sifa" },
|
|
1054
|
+
"id.sifa.profile.course": { tier: "creation", app: "sifa" },
|
|
1055
|
+
"id.sifa.profile.honor": { tier: "creation", app: "sifa" },
|
|
1056
|
+
"id.sifa.profile.language": { tier: "creation", app: "sifa" },
|
|
1057
|
+
"id.sifa.profile.externalAccount": { tier: "creation", app: "sifa" },
|
|
1058
|
+
"id.sifa.profile.location": { tier: "creation", app: "sifa" },
|
|
1059
|
+
"id.sifa.endorsement": {
|
|
1060
|
+
tier: "creation",
|
|
1061
|
+
app: "sifa",
|
|
1062
|
+
notes: "Endorsement authored by the actor about another profile."
|
|
1063
|
+
},
|
|
1064
|
+
"id.sifa.endorsement.confirmation": {
|
|
1065
|
+
tier: "action",
|
|
1066
|
+
app: "sifa",
|
|
1067
|
+
notes: "Confirmation/acceptance of an endorsement received."
|
|
1068
|
+
},
|
|
1069
|
+
"id.sifa.graph.follow": { tier: "action", app: "sifa" },
|
|
1070
|
+
"id.sifa.graph.connection": {
|
|
1071
|
+
tier: "creation",
|
|
1072
|
+
app: "sifa",
|
|
1073
|
+
notes: "Mutual professional connection record."
|
|
1074
|
+
},
|
|
1075
|
+
"id.sifa.project.self": { tier: "creation", app: "sifa" },
|
|
1076
|
+
"id.sifa.project.member": { tier: "creation", app: "sifa" },
|
|
1077
|
+
"id.sifa.project.membership": { tier: "creation", app: "sifa" },
|
|
1078
|
+
"id.sifa.meeting": { tier: "creation", app: "sifa" },
|
|
1079
|
+
"id.sifa.authProfile": { tier: "filtered", app: "sifa", notes: "OAuth scope record." },
|
|
1080
|
+
"id.sifa.authProfileAccess": {
|
|
1081
|
+
tier: "filtered",
|
|
1082
|
+
app: "sifa",
|
|
1083
|
+
notes: "OAuth profile-access record."
|
|
1084
|
+
},
|
|
1085
|
+
"id.sifa.authProject": { tier: "filtered", app: "sifa", notes: "OAuth scope record." },
|
|
1086
|
+
"id.sifa.authConnection": { tier: "filtered", app: "sifa", notes: "OAuth scope record." },
|
|
1087
|
+
"id.sifa.authMeet": { tier: "filtered", app: "sifa", notes: "OAuth scope record." },
|
|
1088
|
+
"forum.barazo.post": { tier: "creation", app: "barazo" },
|
|
1089
|
+
"forum.barazo.community.member": { tier: "creation", app: "barazo" },
|
|
1090
|
+
"forum.barazo.reputation.event": { tier: "creation", app: "barazo" },
|
|
1091
|
+
"forum.barazo.reaction": { tier: "action", app: "barazo" },
|
|
1092
|
+
"forum.barazo.reply": {
|
|
1093
|
+
tier: "action",
|
|
1094
|
+
app: "barazo",
|
|
1095
|
+
notes: "Short conversational reply \u2014 engagement signal."
|
|
1096
|
+
},
|
|
1097
|
+
"forum.barazo.flag": { tier: "filtered", app: "barazo", notes: "Moderation flag." }
|
|
1098
|
+
}
|
|
1099
|
+
};
|
|
1100
|
+
|
|
1101
|
+
// src/taxonomy/activity-tiers.ts
|
|
1102
|
+
var tierMetaSchema = z.object({
|
|
1103
|
+
label: z.string().nullable(),
|
|
1104
|
+
description: z.string(),
|
|
1105
|
+
shownOnPublicProfile: z.boolean()
|
|
1106
|
+
});
|
|
1107
|
+
var lexiconEntrySchema = z.object({
|
|
1108
|
+
tier: z.enum(["creation", "action", "filtered"]),
|
|
1109
|
+
app: z.string().optional(),
|
|
1110
|
+
notes: z.string().optional()
|
|
1111
|
+
});
|
|
1112
|
+
var taxonomySchema = z.object({
|
|
1113
|
+
version: z.string(),
|
|
1114
|
+
updated: z.string(),
|
|
1115
|
+
tiers: z.object({
|
|
1116
|
+
creation: tierMetaSchema,
|
|
1117
|
+
action: tierMetaSchema,
|
|
1118
|
+
filtered: tierMetaSchema
|
|
1119
|
+
}),
|
|
1120
|
+
lexicons: z.record(z.string(), lexiconEntrySchema)
|
|
1121
|
+
});
|
|
1122
|
+
var parsed = taxonomySchema.parse(activity_tiers_default);
|
|
1123
|
+
var ACTIVITY_TIERS = Object.freeze(parsed);
|
|
1124
|
+
function getActivityTier(nsid) {
|
|
1125
|
+
if (!nsid) return "filtered";
|
|
1126
|
+
const entry = ACTIVITY_TIERS.lexicons[nsid];
|
|
1127
|
+
return entry ? entry.tier : "filtered";
|
|
1128
|
+
}
|
|
1129
|
+
function getLexiconEntry(nsid) {
|
|
1130
|
+
if (!nsid) return null;
|
|
1131
|
+
const entry = ACTIVITY_TIERS.lexicons[nsid];
|
|
1132
|
+
return entry ?? null;
|
|
1133
|
+
}
|
|
1134
|
+
function getTierMeta(tier) {
|
|
1135
|
+
return ACTIVITY_TIERS.tiers[tier];
|
|
1136
|
+
}
|
|
1137
|
+
function getActivityTaxonomyVersion() {
|
|
1138
|
+
return { version: ACTIVITY_TIERS.version, updated: ACTIVITY_TIERS.updated };
|
|
1139
|
+
}
|
|
1140
|
+
|
|
793
1141
|
// src/format/format-time.ts
|
|
794
1142
|
function formatRelativeTime(dateString) {
|
|
795
1143
|
const date = new Date(dateString);
|
|
@@ -955,6 +1303,31 @@ function detectPdsProvider(handle) {
|
|
|
955
1303
|
return null;
|
|
956
1304
|
}
|
|
957
1305
|
|
|
1306
|
+
// src/format/text-sanitize.ts
|
|
1307
|
+
var COMBINING_MARK = /\p{M}/u;
|
|
1308
|
+
var BIDI_CONTROLS = /[--]/gu;
|
|
1309
|
+
function limitCombiningMarks(value, maxPerBase = 4) {
|
|
1310
|
+
if (!value || !COMBINING_MARK.test(value)) return value;
|
|
1311
|
+
let out = "";
|
|
1312
|
+
let combiningRun = 0;
|
|
1313
|
+
for (const char of value) {
|
|
1314
|
+
if (/\p{M}/u.test(char)) {
|
|
1315
|
+
if (combiningRun < maxPerBase) {
|
|
1316
|
+
out += char;
|
|
1317
|
+
combiningRun += 1;
|
|
1318
|
+
}
|
|
1319
|
+
} else {
|
|
1320
|
+
out += char;
|
|
1321
|
+
combiningRun = 0;
|
|
1322
|
+
}
|
|
1323
|
+
}
|
|
1324
|
+
return out;
|
|
1325
|
+
}
|
|
1326
|
+
function sanitizeDisplayText(value, maxCombiningPerBase = 4) {
|
|
1327
|
+
if (!value) return value;
|
|
1328
|
+
return limitCombiningMarks(value.replace(BIDI_CONTROLS, ""), maxCombiningPerBase);
|
|
1329
|
+
}
|
|
1330
|
+
|
|
958
1331
|
// src/format/text-truncate.ts
|
|
959
1332
|
var ELLIPSIS = "\u2026";
|
|
960
1333
|
function truncateGraphemes(value, maxLen) {
|
|
@@ -1009,6 +1382,201 @@ function meetsContrastAA(foreground, background) {
|
|
|
1009
1382
|
return contrastRatio(foreground, background) >= 4.5;
|
|
1010
1383
|
}
|
|
1011
1384
|
|
|
1385
|
+
// src/cards/app-url-patterns.ts
|
|
1386
|
+
var APP_URL_PATTERNS = Object.freeze({
|
|
1387
|
+
bluesky: {
|
|
1388
|
+
urlPattern: "https://bsky.app/profile/{handle}/post/{rkey}",
|
|
1389
|
+
profileUrlPattern: "https://bsky.app/profile/{handle}"
|
|
1390
|
+
},
|
|
1391
|
+
tangled: {
|
|
1392
|
+
profileUrlPattern: "https://tangled.sh/{handle}"
|
|
1393
|
+
},
|
|
1394
|
+
smokesignal: {
|
|
1395
|
+
urlPattern: "https://smokesignal.events/{did}/{rkey}",
|
|
1396
|
+
profileUrlPattern: "https://smokesignal.events/{did}"
|
|
1397
|
+
},
|
|
1398
|
+
whitewind: {
|
|
1399
|
+
urlPattern: "https://whtwnd.com/{handle}/{rkey}",
|
|
1400
|
+
profileUrlPattern: "https://whtwnd.com/{handle}"
|
|
1401
|
+
},
|
|
1402
|
+
frontpage: {
|
|
1403
|
+
urlPattern: "https://frontpage.fyi/post/{did}/{rkey}",
|
|
1404
|
+
profileUrlPattern: "https://frontpage.fyi/profile/{did}"
|
|
1405
|
+
},
|
|
1406
|
+
linkat: {
|
|
1407
|
+
profileUrlPattern: "https://linkat.blue/{handle}"
|
|
1408
|
+
},
|
|
1409
|
+
pastesphere: {
|
|
1410
|
+
urlPattern: "https://pastesphere.link/user/{handle}/snippet/{rkey}",
|
|
1411
|
+
profileUrlPattern: "https://pastesphere.link/user/{handle}"
|
|
1412
|
+
},
|
|
1413
|
+
kipclip: {
|
|
1414
|
+
profileUrlPattern: "https://kipclip.com/{handle}"
|
|
1415
|
+
},
|
|
1416
|
+
keytrace: {
|
|
1417
|
+
profileUrlPattern: "https://keytrace.dev/@{handle}"
|
|
1418
|
+
},
|
|
1419
|
+
sifa: {
|
|
1420
|
+
profileUrlPattern: "https://sifa.id/p/{handle}"
|
|
1421
|
+
},
|
|
1422
|
+
popfeed: {
|
|
1423
|
+
urlPattern: "https://popfeed.social/profile/{handle}",
|
|
1424
|
+
profileUrlPattern: "https://popfeed.social/profile/{handle}"
|
|
1425
|
+
},
|
|
1426
|
+
streamplace: {
|
|
1427
|
+
profileUrlPattern: "https://stream.place/{handle}"
|
|
1428
|
+
},
|
|
1429
|
+
semble: {
|
|
1430
|
+
profileUrlPattern: "https://semble.so/profile/{handle}"
|
|
1431
|
+
},
|
|
1432
|
+
grain: {
|
|
1433
|
+
urlPattern: "https://grain.social/profile/{did}/gallery/{rkey}",
|
|
1434
|
+
profileUrlPattern: "https://grain.social/profile/{did}"
|
|
1435
|
+
},
|
|
1436
|
+
youandme: { profileUrlPattern: "https://youandme.at" },
|
|
1437
|
+
anisota: { profileUrlPattern: "https://anisota.net" },
|
|
1438
|
+
margin: { profileUrlPattern: "https://margin.at" },
|
|
1439
|
+
beaconbits: { profileUrlPattern: "https://beaconbits.app" },
|
|
1440
|
+
bookhive: { profileUrlPattern: "https://bookhive.buzz/profile/{handle}" },
|
|
1441
|
+
colibri: { profileUrlPattern: "https://colibri.social" },
|
|
1442
|
+
collectivesocial: { profileUrlPattern: "https://app.collectivesocial.app" },
|
|
1443
|
+
github: {}
|
|
1444
|
+
});
|
|
1445
|
+
var COLLECTION_TO_APP = [
|
|
1446
|
+
["app.bsky.", "bluesky"],
|
|
1447
|
+
["sh.tangled.", "tangled"],
|
|
1448
|
+
["events.smokesignal.", "smokesignal"],
|
|
1449
|
+
["community.lexicon.calendar.", "smokesignal"],
|
|
1450
|
+
["community.lexicon.bookmarks.", "kipclip"],
|
|
1451
|
+
["com.kipclip.", "kipclip"],
|
|
1452
|
+
["blue.flashes.", "flashes"],
|
|
1453
|
+
["social.grain.", "grain"],
|
|
1454
|
+
["com.whtwnd.", "whitewind"],
|
|
1455
|
+
["fyi.unravel.frontpage.", "frontpage"],
|
|
1456
|
+
["social.psky.", "picosky"],
|
|
1457
|
+
["blue.linkat.", "linkat"],
|
|
1458
|
+
["link.pastesphere.", "pastesphere"],
|
|
1459
|
+
["site.standard.", "standard"],
|
|
1460
|
+
["computer.aetheros.", "aetheros"],
|
|
1461
|
+
["space.roomy.", "roomy"],
|
|
1462
|
+
["dev.keytrace.", "keytrace"],
|
|
1463
|
+
["social.popfeed.", "popfeed"],
|
|
1464
|
+
["app.popsky.", "popfeed"],
|
|
1465
|
+
["place.stream.", "streamplace"],
|
|
1466
|
+
["app.sidetrail.", "semble"],
|
|
1467
|
+
["network.cosmik.", "cosmik"],
|
|
1468
|
+
["id.sifa.", "sifa"],
|
|
1469
|
+
["forum.barazo.", "barazo"],
|
|
1470
|
+
["xyz.statusphere.", "statusphere"],
|
|
1471
|
+
["at.youandme.", "youandme"],
|
|
1472
|
+
["net.anisota.", "anisota"],
|
|
1473
|
+
["at.margin.", "margin"],
|
|
1474
|
+
["app.beaconbits.", "beaconbits"],
|
|
1475
|
+
["buzz.bookhive.", "bookhive"],
|
|
1476
|
+
["social.colibri.", "colibri"]
|
|
1477
|
+
];
|
|
1478
|
+
|
|
1479
|
+
// src/cards/resolve-card-url.ts
|
|
1480
|
+
function getAppIdForCollection(collection) {
|
|
1481
|
+
for (const [prefix, appId] of COLLECTION_TO_APP) {
|
|
1482
|
+
if (collection.startsWith(prefix)) return appId;
|
|
1483
|
+
}
|
|
1484
|
+
const parts = collection.split(".");
|
|
1485
|
+
if (parts.length >= 2) return `${parts[0]}.${parts[1]}`;
|
|
1486
|
+
return collection;
|
|
1487
|
+
}
|
|
1488
|
+
function interpolate(pattern, vars) {
|
|
1489
|
+
let result = pattern;
|
|
1490
|
+
for (const [key, value] of Object.entries(vars)) {
|
|
1491
|
+
if (result.includes(`{${key}}`)) {
|
|
1492
|
+
if (!value) return null;
|
|
1493
|
+
result = result.replaceAll(`{${key}}`, encodeURIComponent(value));
|
|
1494
|
+
}
|
|
1495
|
+
}
|
|
1496
|
+
return result;
|
|
1497
|
+
}
|
|
1498
|
+
function patternUrl(appId, vars) {
|
|
1499
|
+
const patterns = APP_URL_PATTERNS[appId];
|
|
1500
|
+
if (!patterns) return null;
|
|
1501
|
+
if (patterns.urlPattern) {
|
|
1502
|
+
const url = interpolate(patterns.urlPattern, vars);
|
|
1503
|
+
if (url) return url;
|
|
1504
|
+
}
|
|
1505
|
+
if (patterns.profileUrlPattern) {
|
|
1506
|
+
const url = interpolate(patterns.profileUrlPattern, vars);
|
|
1507
|
+
if (url) return url;
|
|
1508
|
+
}
|
|
1509
|
+
return null;
|
|
1510
|
+
}
|
|
1511
|
+
function stringOrNull(value) {
|
|
1512
|
+
if (typeof value !== "string") return null;
|
|
1513
|
+
const trimmed = value.trim();
|
|
1514
|
+
return trimmed.length > 0 ? trimmed : null;
|
|
1515
|
+
}
|
|
1516
|
+
function parseAtUri(atUri) {
|
|
1517
|
+
const match = atUri.match(/^at:\/\/(did:[^/]+)\/[^/]+\/(.+)$/);
|
|
1518
|
+
if (!match || !match[1] || !match[2]) return null;
|
|
1519
|
+
return { did: match[1], rkey: match[2] };
|
|
1520
|
+
}
|
|
1521
|
+
function resolveCardUrl(item) {
|
|
1522
|
+
const { collection, record, uri, rkey, authorDid, authorHandle } = item;
|
|
1523
|
+
const appId = getAppIdForCollection(collection);
|
|
1524
|
+
if (collection.startsWith("sh.tangled.")) {
|
|
1525
|
+
const repoName = stringOrNull(record.name);
|
|
1526
|
+
if (repoName && authorHandle) {
|
|
1527
|
+
return `https://tangled.sh/${authorHandle}/${repoName}`;
|
|
1528
|
+
}
|
|
1529
|
+
return patternUrl("tangled", { handle: authorHandle, did: authorDid, rkey });
|
|
1530
|
+
}
|
|
1531
|
+
if (collection.startsWith("com.kipclip.") || collection.startsWith("community.lexicon.bookmarks.")) {
|
|
1532
|
+
const subject = stringOrNull(record.subject);
|
|
1533
|
+
if (subject) return subject;
|
|
1534
|
+
return patternUrl("kipclip", { handle: authorHandle, did: authorDid, rkey });
|
|
1535
|
+
}
|
|
1536
|
+
if (collection === "at.margin.bookmark") {
|
|
1537
|
+
const source = stringOrNull(record.source);
|
|
1538
|
+
if (source) return source;
|
|
1539
|
+
return null;
|
|
1540
|
+
}
|
|
1541
|
+
if (collection === "at.margin.annotation") {
|
|
1542
|
+
const target = record.target;
|
|
1543
|
+
if (target != null && typeof target === "object") {
|
|
1544
|
+
const source = stringOrNull(target.source);
|
|
1545
|
+
if (source) return source;
|
|
1546
|
+
}
|
|
1547
|
+
return APP_URL_PATTERNS.margin?.profileUrlPattern ?? null;
|
|
1548
|
+
}
|
|
1549
|
+
if (collection === "community.lexicon.calendar.rsvp") {
|
|
1550
|
+
const subject = record.subject;
|
|
1551
|
+
if (subject != null && typeof subject === "object") {
|
|
1552
|
+
const subjectUri = stringOrNull(subject.uri);
|
|
1553
|
+
if (subjectUri) {
|
|
1554
|
+
const parsed2 = parseAtUri(subjectUri);
|
|
1555
|
+
if (parsed2) {
|
|
1556
|
+
return `https://smokesignal.events/${parsed2.did}/${parsed2.rkey}`;
|
|
1557
|
+
}
|
|
1558
|
+
}
|
|
1559
|
+
}
|
|
1560
|
+
return null;
|
|
1561
|
+
}
|
|
1562
|
+
if (collection === "community.lexicon.calendar.event") {
|
|
1563
|
+
const parsed2 = parseAtUri(uri);
|
|
1564
|
+
if (parsed2) {
|
|
1565
|
+
return `https://smokesignal.events/${parsed2.did}/${parsed2.rkey}`;
|
|
1566
|
+
}
|
|
1567
|
+
return null;
|
|
1568
|
+
}
|
|
1569
|
+
if (collection.startsWith("site.standard.")) {
|
|
1570
|
+
const siteUrl = stringOrNull(record.siteUrl);
|
|
1571
|
+
const path = stringOrNull(record.path);
|
|
1572
|
+
if (siteUrl && path) return `${siteUrl}${path}`;
|
|
1573
|
+
if (siteUrl) return siteUrl;
|
|
1574
|
+
}
|
|
1575
|
+
const recordUrl = stringOrNull(record.url);
|
|
1576
|
+
if (recordUrl) return recordUrl;
|
|
1577
|
+
return patternUrl(appId, { handle: authorHandle, did: authorDid, rkey });
|
|
1578
|
+
}
|
|
1579
|
+
|
|
1012
1580
|
// src/logic/profile-completeness.ts
|
|
1013
1581
|
var COMPLETENESS_MAX_SCORE = 6;
|
|
1014
1582
|
function completenessScore(c) {
|
|
@@ -1229,8 +1797,8 @@ var ProfileVolunteeringRecordSchema = z.object({
|
|
|
1229
1797
|
});
|
|
1230
1798
|
|
|
1231
1799
|
// src/index.ts
|
|
1232
|
-
var SIFA_SDK_VERSION = "0.9.
|
|
1800
|
+
var SIFA_SDK_VERSION = "0.9.5";
|
|
1233
1801
|
|
|
1234
|
-
export { CATEGORY_LABELS, CATEGORY_ORDER, COMPLETENESS_MAX_SCORE, CONTINENTS, COUNTRIES, DIMENSIONS_MAX_SCORE, EMPLOYMENT_TYPE_GROUPS, EMPLOYMENT_TYPE_LABELS, EndorsementConfirmationRecordSchema, EndorsementRecordSchema, GraphFollowRecordSchema, INDUSTRY_OPTIONS, MIN_SKILLS, OPEN_TO_OPTIONS, PLATFORM_LABELS, PLATFORM_OPTIONS, ProfileCertificationRecordSchema, ProfileCourseRecordSchema, ProfileEducationRecordSchema, ProfileExternalAccountRecordSchema, ProfileHonorRecordSchema, ProfileLanguageRecordSchema, ProfilePositionRecordSchema, ProfileProjectRecordSchema, ProfilePublicationRecordSchema, ProfileSelfRecordSchema, ProfileSkillRecordSchema, ProfileVolunteeringRecordSchema, PublicationAuthorSchema, SIFA_SDK_VERSION, SKILL_CATEGORIES, WORKPLACE_TYPE_LABELS, WORKPLACE_TYPE_OPTIONS, atUriSchema, certDateExtractor, cidSchema, completenessPercent, completenessScore, contrastRatio, countFilledDimensions, countryCodeToFlag, dateRangeExtractor, datetimeSchema, dedupeSkills, detectPdsProvider, didSchema, dimensionsFromInputs, findIndustry, formatDistanceToNow, formatLocation, formatRelativeTime, getContinent, getDisplayLabel, getEmploymentTypeLabel, getFaviconUrl, getFilledDimensionsMap, getHandleStem, getIndustryLabelKey, getOpenToLabelKey, getPdsDisplayName, getPlatformLabel, getWorkplaceTypeLabel, groupSkillsByCategory, isKnownPlatform, isValidRgbColor, languageTagSchema, lexiconDateExtractor, maxGraphemes, meetsContrastAA, parseLocationString, pdsProviderFromApi, profileToDimensionInputs, relativeLuminance, rgbToString, sanitizeHandleInput, selfLabelsSchema, singleDateExtractor, sortByDateDesc, strongRefSchema, truncateGraphemes, uriSchema };
|
|
1802
|
+
export { ACTIVITY_TIERS, APP_URL_PATTERNS, CATEGORY_LABELS, CATEGORY_ORDER, COLLECTION_TO_APP, COMPLETENESS_MAX_SCORE, CONTINENTS, COUNTRIES, DIMENSIONS_MAX_SCORE, EMPLOYMENT_TYPE_GROUPS, EMPLOYMENT_TYPE_LABELS, EndorsementConfirmationRecordSchema, EndorsementRecordSchema, GraphFollowRecordSchema, INDUSTRY_OPTIONS, MIN_SKILLS, OPEN_TO_OPTIONS, PLATFORM_LABELS, PLATFORM_OPTIONS, ProfileCertificationRecordSchema, ProfileCourseRecordSchema, ProfileEducationRecordSchema, ProfileExternalAccountRecordSchema, ProfileHonorRecordSchema, ProfileLanguageRecordSchema, ProfilePositionRecordSchema, ProfileProjectRecordSchema, ProfilePublicationRecordSchema, ProfileSelfRecordSchema, ProfileSkillRecordSchema, ProfileVolunteeringRecordSchema, PublicationAuthorSchema, SIFA_SDK_VERSION, SKILL_CATEGORIES, WORKPLACE_TYPE_LABELS, WORKPLACE_TYPE_OPTIONS, atUriSchema, certDateExtractor, cidSchema, completenessPercent, completenessScore, contrastRatio, countFilledDimensions, countryCodeToFlag, dateRangeExtractor, datetimeSchema, dedupeSkills, detectPdsProvider, didSchema, dimensionsFromInputs, findIndustry, formatDistanceToNow, formatLocation, formatRelativeTime, getActivityTaxonomyVersion, getActivityTier, getAppIdForCollection, getContinent, getDisplayLabel, getEmploymentTypeLabel, getFaviconUrl, getFilledDimensionsMap, getHandleStem, getIndustryLabelKey, getLexiconEntry, getOpenToLabelKey, getPdsDisplayName, getPlatformLabel, getTierMeta, getWorkplaceTypeLabel, groupSkillsByCategory, isKnownPlatform, isValidRgbColor, languageTagSchema, lexiconDateExtractor, limitCombiningMarks, maxGraphemes, meetsContrastAA, parseLocationString, pdsProviderFromApi, profileToDimensionInputs, relativeLuminance, resolveCardUrl, rgbToString, sanitizeDisplayText, sanitizeHandleInput, selfLabelsSchema, singleDateExtractor, sortByDateDesc, strongRefSchema, truncateGraphemes, uriSchema };
|
|
1235
1803
|
//# sourceMappingURL=index.js.map
|
|
1236
1804
|
//# sourceMappingURL=index.js.map
|