@singi-labs/sifa-sdk 0.11.10 → 0.11.12
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/{adult-content-B5hAdi76.d.cts → adult-content-BpZD_3ow.d.cts} +15 -1
- package/dist/{adult-content-B5hAdi76.d.ts → adult-content-BpZD_3ow.d.ts} +15 -1
- package/dist/index.cjs +44 -34
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +38 -12
- package/dist/index.d.ts +38 -12
- package/dist/index.js +44 -35
- package/dist/index.js.map +1 -1
- package/dist/{keys-_UjR-zwC.d.ts → keys-DuICaiIq.d.ts} +9 -6
- package/dist/{keys-qoNpril5.d.cts → keys-K8kCuA5J.d.cts} +9 -6
- package/dist/query/fetchers/index.cjs.map +1 -1
- package/dist/query/fetchers/index.d.cts +3 -3
- package/dist/query/fetchers/index.d.ts +3 -3
- package/dist/query/fetchers/index.js.map +1 -1
- package/dist/query/hooks/index.cjs.map +1 -1
- package/dist/query/hooks/index.d.cts +3 -3
- package/dist/query/hooks/index.d.ts +3 -3
- package/dist/query/hooks/index.js.map +1 -1
- package/dist/query/index.cjs +11 -0
- package/dist/query/index.cjs.map +1 -1
- package/dist/query/index.d.cts +12 -4
- package/dist/query/index.d.ts +12 -4
- package/dist/query/index.js +11 -1
- package/dist/query/index.js.map +1 -1
- package/dist/schemas/index.cjs +2 -0
- package/dist/schemas/index.cjs.map +1 -1
- package/dist/schemas/index.d.cts +1 -0
- package/dist/schemas/index.d.ts +1 -0
- package/dist/schemas/index.js +2 -0
- package/dist/schemas/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -180,11 +180,25 @@ interface PresentationLinkView {
|
|
|
180
180
|
label?: string;
|
|
181
181
|
type?: string;
|
|
182
182
|
}
|
|
183
|
+
/**
|
|
184
|
+
* A co-speaker on a delivery, hydrated from a stored DID to a profile card.
|
|
185
|
+
* Any atproto account; `hasSifaProfile` is true when they have a claimed Sifa
|
|
186
|
+
* profile (vs an unclaimed atproto account that still renders at /p/<handle>).
|
|
187
|
+
*/
|
|
188
|
+
interface CoSpeaker {
|
|
189
|
+
did: string;
|
|
190
|
+
handle: string;
|
|
191
|
+
displayName?: string;
|
|
192
|
+
avatar?: string;
|
|
193
|
+
hasSifaProfile?: boolean;
|
|
194
|
+
}
|
|
183
195
|
/** An occasion on which a presentation was delivered (the AppView view-model). */
|
|
184
196
|
interface ProfilePresentationDelivery {
|
|
185
197
|
rkey: string;
|
|
186
198
|
/** rkey of the parent presentation when this delivery references one. */
|
|
187
199
|
presentationRkey?: string | null;
|
|
200
|
+
/** Co-speakers at this occasion, hydrated from the stored DIDs. */
|
|
201
|
+
coSpeakers?: CoSpeaker[];
|
|
188
202
|
title?: string | null;
|
|
189
203
|
role?: string | null;
|
|
190
204
|
eventName?: string | null;
|
|
@@ -406,4 +420,4 @@ declare function hasAdultContent(item: {
|
|
|
406
420
|
labels?: ActivityLabel[];
|
|
407
421
|
}): boolean;
|
|
408
422
|
|
|
409
|
-
export { type AdultContentLabel as A, hasAdultContent as B, type ExternalAccount as E, type FeedItem as F, type LocationValue as L, type ProfileSkill as P, type SkillSuggestion as S, type TrustStat as T, type VerifiedAccount as V, type ActivityLabel as a, type ProfilePresentationDelivery as b, type PdsProviderInfo as c, type Profile as d, ADULT_CONTENT_LABELS as e, type ActiveApp as f, type Endorsement as g, type EndorsementData as h, type ExternalAccountKeytraceClaim as i, type LanguageProficiency as j, type PresentationLinkView as k, type ProfileCertification as l, type ProfileCourse as m, type ProfileEducation as n, type ProfileHonor as o, type ProfileIndustry as p, type ProfileLanguage as q, type ProfileLocation as r, type ProfileOverrideSource as s, type ProfilePosition as t, type ProfilePresentation as u, type ProfileProject as v, type ProfilePublication as w, type ProfileVolunteering as x, type PublicationContributor as y, type SkillRef as z };
|
|
423
|
+
export { type AdultContentLabel as A, hasAdultContent as B, type CoSpeaker as C, type ExternalAccount as E, type FeedItem as F, type LocationValue as L, type ProfileSkill as P, type SkillSuggestion as S, type TrustStat as T, type VerifiedAccount as V, type ActivityLabel as a, type ProfilePresentationDelivery as b, type PdsProviderInfo as c, type Profile as d, ADULT_CONTENT_LABELS as e, type ActiveApp as f, type Endorsement as g, type EndorsementData as h, type ExternalAccountKeytraceClaim as i, type LanguageProficiency as j, type PresentationLinkView as k, type ProfileCertification as l, type ProfileCourse as m, type ProfileEducation as n, type ProfileHonor as o, type ProfileIndustry as p, type ProfileLanguage as q, type ProfileLocation as r, type ProfileOverrideSource as s, type ProfilePosition as t, type ProfilePresentation as u, type ProfileProject as v, type ProfilePublication as w, type ProfileVolunteering as x, type PublicationContributor as y, type SkillRef as z };
|
|
@@ -180,11 +180,25 @@ interface PresentationLinkView {
|
|
|
180
180
|
label?: string;
|
|
181
181
|
type?: string;
|
|
182
182
|
}
|
|
183
|
+
/**
|
|
184
|
+
* A co-speaker on a delivery, hydrated from a stored DID to a profile card.
|
|
185
|
+
* Any atproto account; `hasSifaProfile` is true when they have a claimed Sifa
|
|
186
|
+
* profile (vs an unclaimed atproto account that still renders at /p/<handle>).
|
|
187
|
+
*/
|
|
188
|
+
interface CoSpeaker {
|
|
189
|
+
did: string;
|
|
190
|
+
handle: string;
|
|
191
|
+
displayName?: string;
|
|
192
|
+
avatar?: string;
|
|
193
|
+
hasSifaProfile?: boolean;
|
|
194
|
+
}
|
|
183
195
|
/** An occasion on which a presentation was delivered (the AppView view-model). */
|
|
184
196
|
interface ProfilePresentationDelivery {
|
|
185
197
|
rkey: string;
|
|
186
198
|
/** rkey of the parent presentation when this delivery references one. */
|
|
187
199
|
presentationRkey?: string | null;
|
|
200
|
+
/** Co-speakers at this occasion, hydrated from the stored DIDs. */
|
|
201
|
+
coSpeakers?: CoSpeaker[];
|
|
188
202
|
title?: string | null;
|
|
189
203
|
role?: string | null;
|
|
190
204
|
eventName?: string | null;
|
|
@@ -406,4 +420,4 @@ declare function hasAdultContent(item: {
|
|
|
406
420
|
labels?: ActivityLabel[];
|
|
407
421
|
}): boolean;
|
|
408
422
|
|
|
409
|
-
export { type AdultContentLabel as A, hasAdultContent as B, type ExternalAccount as E, type FeedItem as F, type LocationValue as L, type ProfileSkill as P, type SkillSuggestion as S, type TrustStat as T, type VerifiedAccount as V, type ActivityLabel as a, type ProfilePresentationDelivery as b, type PdsProviderInfo as c, type Profile as d, ADULT_CONTENT_LABELS as e, type ActiveApp as f, type Endorsement as g, type EndorsementData as h, type ExternalAccountKeytraceClaim as i, type LanguageProficiency as j, type PresentationLinkView as k, type ProfileCertification as l, type ProfileCourse as m, type ProfileEducation as n, type ProfileHonor as o, type ProfileIndustry as p, type ProfileLanguage as q, type ProfileLocation as r, type ProfileOverrideSource as s, type ProfilePosition as t, type ProfilePresentation as u, type ProfileProject as v, type ProfilePublication as w, type ProfileVolunteering as x, type PublicationContributor as y, type SkillRef as z };
|
|
423
|
+
export { type AdultContentLabel as A, hasAdultContent as B, type CoSpeaker as C, type ExternalAccount as E, type FeedItem as F, type LocationValue as L, type ProfileSkill as P, type SkillSuggestion as S, type TrustStat as T, type VerifiedAccount as V, type ActivityLabel as a, type ProfilePresentationDelivery as b, type PdsProviderInfo as c, type Profile as d, ADULT_CONTENT_LABELS as e, type ActiveApp as f, type Endorsement as g, type EndorsementData as h, type ExternalAccountKeytraceClaim as i, type LanguageProficiency as j, type PresentationLinkView as k, type ProfileCertification as l, type ProfileCourse as m, type ProfileEducation as n, type ProfileHonor as o, type ProfileIndustry as p, type ProfileLanguage as q, type ProfileLocation as r, type ProfileOverrideSource as s, type ProfilePosition as t, type ProfilePresentation as u, type ProfileProject as v, type ProfilePublication as w, type ProfileVolunteering as x, type PublicationContributor as y, type SkillRef as z };
|
package/dist/index.cjs
CHANGED
|
@@ -2057,6 +2057,12 @@ function getAppIdForCollection(collection) {
|
|
|
2057
2057
|
if (parts.length >= 2) return `${parts[0]}.${parts[1]}`;
|
|
2058
2058
|
return collection;
|
|
2059
2059
|
}
|
|
2060
|
+
function urlHealth(url) {
|
|
2061
|
+
return url ? { url, strategy: "url" } : { url: null, strategy: "none" };
|
|
2062
|
+
}
|
|
2063
|
+
function recordHealth(url) {
|
|
2064
|
+
return url ? { url, strategy: "record" } : { url: null, strategy: "none" };
|
|
2065
|
+
}
|
|
2060
2066
|
function interpolate(pattern, vars) {
|
|
2061
2067
|
let result = pattern;
|
|
2062
2068
|
for (const [key, value] of Object.entries(vars)) {
|
|
@@ -2073,18 +2079,18 @@ function shouldUseItemPattern(appId, collection) {
|
|
|
2073
2079
|
}
|
|
2074
2080
|
return true;
|
|
2075
2081
|
}
|
|
2076
|
-
function
|
|
2082
|
+
function patternHealth(appId, vars, collection) {
|
|
2077
2083
|
const patterns = APP_URL_PATTERNS[appId];
|
|
2078
|
-
if (!patterns) return null;
|
|
2084
|
+
if (!patterns) return { url: null, strategy: "none" };
|
|
2079
2085
|
if (patterns.urlPattern && shouldUseItemPattern(appId, collection)) {
|
|
2080
2086
|
const url = interpolate(patterns.urlPattern, vars);
|
|
2081
|
-
if (url) return url;
|
|
2087
|
+
if (url) return recordHealth(url);
|
|
2082
2088
|
}
|
|
2083
2089
|
if (patterns.profileUrlPattern) {
|
|
2084
2090
|
const url = interpolate(patterns.profileUrlPattern, vars);
|
|
2085
|
-
if (url) return url;
|
|
2091
|
+
if (url) return urlHealth(url);
|
|
2086
2092
|
}
|
|
2087
|
-
return null;
|
|
2093
|
+
return { url: null, strategy: "none" };
|
|
2088
2094
|
}
|
|
2089
2095
|
var TANGLED_REPO_SLUG = /^[a-zA-Z0-9._-]+$/;
|
|
2090
2096
|
function stringOrNull(value) {
|
|
@@ -2097,33 +2103,31 @@ function parseAtUri(atUri) {
|
|
|
2097
2103
|
if (!match || !match[1] || !match[2]) return null;
|
|
2098
2104
|
return { did: match[1], rkey: match[2] };
|
|
2099
2105
|
}
|
|
2100
|
-
function
|
|
2106
|
+
function resolveCardHealth(item) {
|
|
2101
2107
|
const { collection, record, uri, rkey, authorDid, authorHandle } = item;
|
|
2102
2108
|
const appId = getAppIdForCollection(collection);
|
|
2103
2109
|
if (collection.startsWith("sh.tangled.")) {
|
|
2104
2110
|
const repoName = stringOrNull(record.name) ?? (collection === "sh.tangled.repo" ? rkey : null);
|
|
2105
2111
|
if (repoName && authorHandle && TANGLED_REPO_SLUG.test(repoName)) {
|
|
2106
|
-
return `https://tangled.sh/${authorHandle}/${repoName}
|
|
2112
|
+
return recordHealth(`https://tangled.sh/${authorHandle}/${repoName}`);
|
|
2107
2113
|
}
|
|
2108
|
-
return
|
|
2114
|
+
return patternHealth("tangled", { handle: authorHandle, did: authorDid, rkey }, collection);
|
|
2109
2115
|
}
|
|
2110
2116
|
if (collection.startsWith("com.kipclip.") || collection.startsWith("community.lexicon.bookmarks.")) {
|
|
2111
2117
|
const subject = stringOrNull(record.subject);
|
|
2112
|
-
if (subject) return subject;
|
|
2113
|
-
return
|
|
2118
|
+
if (subject) return urlHealth(subject);
|
|
2119
|
+
return patternHealth("kipclip", { handle: authorHandle, did: authorDid, rkey });
|
|
2114
2120
|
}
|
|
2115
2121
|
if (collection === "at.margin.bookmark") {
|
|
2116
|
-
|
|
2117
|
-
if (source) return source;
|
|
2118
|
-
return null;
|
|
2122
|
+
return urlHealth(stringOrNull(record.source));
|
|
2119
2123
|
}
|
|
2120
2124
|
if (collection === "at.margin.annotation" || collection === "at.margin.note") {
|
|
2121
2125
|
const target = record.target;
|
|
2122
2126
|
if (target != null && typeof target === "object") {
|
|
2123
2127
|
const source = stringOrNull(target.source);
|
|
2124
|
-
if (source) return source;
|
|
2128
|
+
if (source) return urlHealth(source);
|
|
2125
2129
|
}
|
|
2126
|
-
return APP_URL_PATTERNS.margin?.profileUrlPattern ?? null;
|
|
2130
|
+
return urlHealth(APP_URL_PATTERNS.margin?.profileUrlPattern ?? null);
|
|
2127
2131
|
}
|
|
2128
2132
|
if (collection === "community.lexicon.calendar.rsvp") {
|
|
2129
2133
|
const subject = record.subject;
|
|
@@ -2132,65 +2136,68 @@ function resolveCardUrl(item) {
|
|
|
2132
2136
|
if (subjectUri) {
|
|
2133
2137
|
const parsed2 = parseAtUri(subjectUri);
|
|
2134
2138
|
if (parsed2) {
|
|
2135
|
-
return `https://smokesignal.events/${parsed2.did}/${parsed2.rkey}
|
|
2139
|
+
return urlHealth(`https://smokesignal.events/${parsed2.did}/${parsed2.rkey}`);
|
|
2136
2140
|
}
|
|
2137
2141
|
}
|
|
2138
2142
|
}
|
|
2139
|
-
return null;
|
|
2143
|
+
return { url: null, strategy: "none" };
|
|
2140
2144
|
}
|
|
2141
2145
|
if (collection === "community.lexicon.calendar.event") {
|
|
2142
2146
|
const parsed2 = parseAtUri(uri);
|
|
2143
2147
|
if (parsed2) {
|
|
2144
|
-
return `https://smokesignal.events/${parsed2.did}/${parsed2.rkey}
|
|
2148
|
+
return recordHealth(`https://smokesignal.events/${parsed2.did}/${parsed2.rkey}`);
|
|
2145
2149
|
}
|
|
2146
|
-
return null;
|
|
2150
|
+
return { url: null, strategy: "none" };
|
|
2147
2151
|
}
|
|
2148
2152
|
if (collection === "quest.atmo.event") {
|
|
2149
2153
|
const parsed2 = parseAtUri(uri);
|
|
2150
2154
|
if (parsed2) {
|
|
2151
|
-
return `https://atmo.rsvp/p/${parsed2.did}/e/${parsed2.rkey}
|
|
2155
|
+
return recordHealth(`https://atmo.rsvp/p/${parsed2.did}/e/${parsed2.rkey}`);
|
|
2152
2156
|
}
|
|
2153
|
-
return null;
|
|
2157
|
+
return { url: null, strategy: "none" };
|
|
2154
2158
|
}
|
|
2155
2159
|
if (collection === "quest.atmo.checkin") {
|
|
2156
2160
|
const eventUri = stringOrNull(record.event);
|
|
2157
2161
|
if (eventUri) {
|
|
2158
2162
|
const parsed2 = parseAtUri(eventUri);
|
|
2159
2163
|
if (parsed2) {
|
|
2160
|
-
return `https://atmo.rsvp/p/${parsed2.did}/e/${parsed2.rkey}
|
|
2164
|
+
return urlHealth(`https://atmo.rsvp/p/${parsed2.did}/e/${parsed2.rkey}`);
|
|
2161
2165
|
}
|
|
2162
2166
|
}
|
|
2163
|
-
return null;
|
|
2167
|
+
return { url: null, strategy: "none" };
|
|
2164
2168
|
}
|
|
2165
2169
|
if (collection === "fyi.atstore.listing.review") {
|
|
2166
2170
|
const listingMeta = record.listingMeta;
|
|
2167
2171
|
if (listingMeta != null && typeof listingMeta === "object") {
|
|
2168
2172
|
const slug = stringOrNull(listingMeta.slug);
|
|
2169
|
-
if (slug) return `https://atstore.fyi/products/${encodeURIComponent(slug)}
|
|
2173
|
+
if (slug) return urlHealth(`https://atstore.fyi/products/${encodeURIComponent(slug)}`);
|
|
2170
2174
|
}
|
|
2171
|
-
return APP_URL_PATTERNS.atstore?.profileUrlPattern ?? null;
|
|
2175
|
+
return urlHealth(APP_URL_PATTERNS.atstore?.profileUrlPattern ?? null);
|
|
2172
2176
|
}
|
|
2173
2177
|
if (collection === "social.crate.content") {
|
|
2174
|
-
return stringOrNull(record.canonicalUrl);
|
|
2178
|
+
return urlHealth(stringOrNull(record.canonicalUrl));
|
|
2175
2179
|
}
|
|
2176
2180
|
if (collection === "social.crate.note") {
|
|
2177
|
-
return null;
|
|
2181
|
+
return { url: null, strategy: "none" };
|
|
2178
2182
|
}
|
|
2179
2183
|
if (collection.startsWith("site.standard.")) {
|
|
2180
2184
|
const siteUrl = stringOrNull(record.siteUrl);
|
|
2181
2185
|
const path = stringOrNull(record.path);
|
|
2182
|
-
if (siteUrl && path) return `${siteUrl}${path}
|
|
2183
|
-
if (siteUrl) return siteUrl;
|
|
2186
|
+
if (siteUrl && path) return urlHealth(`${siteUrl}${path}`);
|
|
2187
|
+
if (siteUrl) return urlHealth(siteUrl);
|
|
2184
2188
|
}
|
|
2185
2189
|
if (collection === "io.kich.recipe.recipe") {
|
|
2186
|
-
return
|
|
2190
|
+
return patternHealth("kich", { handle: authorHandle, did: authorDid, rkey }, collection);
|
|
2187
2191
|
}
|
|
2188
2192
|
if (collection === "exchange.recipe.recipe") {
|
|
2189
|
-
return
|
|
2193
|
+
return patternHealth("recipe", { handle: authorHandle, did: authorDid, rkey }, collection);
|
|
2190
2194
|
}
|
|
2191
2195
|
const recordUrl = stringOrNull(record.url);
|
|
2192
|
-
if (recordUrl) return recordUrl;
|
|
2193
|
-
return
|
|
2196
|
+
if (recordUrl) return urlHealth(recordUrl);
|
|
2197
|
+
return patternHealth(appId, { handle: authorHandle, did: authorDid, rkey }, collection);
|
|
2198
|
+
}
|
|
2199
|
+
function resolveCardUrl(item) {
|
|
2200
|
+
return resolveCardHealth(item).url;
|
|
2194
2201
|
}
|
|
2195
2202
|
|
|
2196
2203
|
// src/cards/visibility.ts
|
|
@@ -2630,6 +2637,8 @@ var ProfilePresentationDeliveryRecordSchema = zod.z.object({
|
|
|
2630
2637
|
links: zod.z.array(PresentationLinkSchema).max(20).optional(),
|
|
2631
2638
|
// Optional reference to a community.lexicon.calendar.event for this occasion.
|
|
2632
2639
|
eventRef: externalRecordRefSchema.optional(),
|
|
2640
|
+
// DIDs of co-speakers who presented alongside the author at this occasion.
|
|
2641
|
+
coSpeakers: zod.z.array(zod.z.string().regex(/^did:[a-z]+:[^\s]+$/, "must be a DID")).max(20).optional(),
|
|
2633
2642
|
createdAt: datetimeSchema
|
|
2634
2643
|
});
|
|
2635
2644
|
var ProfileProjectRecordSchema = zod.z.object({
|
|
@@ -2686,7 +2695,7 @@ var ProfileVolunteeringRecordSchema = zod.z.object({
|
|
|
2686
2695
|
});
|
|
2687
2696
|
|
|
2688
2697
|
// src/index.ts
|
|
2689
|
-
var SIFA_SDK_VERSION = "0.11.
|
|
2698
|
+
var SIFA_SDK_VERSION = "0.11.12";
|
|
2690
2699
|
|
|
2691
2700
|
exports.ACTIVITY_TIERS = ACTIVITY_TIERS;
|
|
2692
2701
|
exports.ACTIVITY_VISIBILITY_RULES = ACTIVITY_VISIBILITY_RULES;
|
|
@@ -2832,6 +2841,7 @@ exports.presentationCsvRowToRecord = presentationCsvRowToRecord;
|
|
|
2832
2841
|
exports.presentationDeliveryCsvRowToRecord = presentationDeliveryCsvRowToRecord;
|
|
2833
2842
|
exports.profileToDimensionInputs = profileToDimensionInputs;
|
|
2834
2843
|
exports.relativeLuminance = relativeLuminance;
|
|
2844
|
+
exports.resolveCardHealth = resolveCardHealth;
|
|
2835
2845
|
exports.resolveCardUrl = resolveCardUrl;
|
|
2836
2846
|
exports.rgbToString = rgbToString;
|
|
2837
2847
|
exports.sanitizeDisplayText = sanitizeDisplayText;
|