@singi-labs/sifa-sdk 0.10.3 → 0.10.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/dist/{index-DYUYJxOs.d.cts → adult-content-BjbP46ad.d.cts} +40 -1
- package/dist/{index-DYUYJxOs.d.ts → adult-content-BjbP46ad.d.ts} +40 -1
- package/dist/index.cjs +28 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +27 -4
- package/dist/index.js.map +1 -1
- package/dist/{keys-D-vNPzXx.d.ts → keys-Ba4_wCnj.d.ts} +8 -1
- package/dist/{keys-DRD79nDE.d.cts → keys-DPeDdYki.d.cts} +8 -1
- 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.map +1 -1
- package/dist/query/index.d.cts +2 -2
- package/dist/query/index.d.ts +2 -2
- package/dist/query/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -318,4 +318,43 @@ interface Profile {
|
|
|
318
318
|
externalAccounts?: ExternalAccount[];
|
|
319
319
|
}
|
|
320
320
|
|
|
321
|
-
|
|
321
|
+
/**
|
|
322
|
+
* Adult-content gating for Bluesky activity items.
|
|
323
|
+
*
|
|
324
|
+
* Bluesky's official moderation labeler attaches content labels to
|
|
325
|
+
* `app.bsky.feed.defs#postView.labels`. The four sex-and-violence labels
|
|
326
|
+
* below are the ones we hide by default on Sifa: media is replaced with an
|
|
327
|
+
* `<AdultContentWarning>` placeholder card in sifa-web. Authenticated
|
|
328
|
+
* viewers can reveal per-card; anonymous viewers cannot.
|
|
329
|
+
*
|
|
330
|
+
* The list mirrors Bluesky's own globalLabelStrings; if the official set
|
|
331
|
+
* grows (e.g. a new `extreme-violence` label), update this constant.
|
|
332
|
+
*
|
|
333
|
+
* Why a constant + predicate live in the SDK: the same logic needs to run
|
|
334
|
+
* in sifa-web today and sifa-app tomorrow, and the API only forwards the
|
|
335
|
+
* raw labels — the hide decision is a client concern.
|
|
336
|
+
*/
|
|
337
|
+
declare const ADULT_CONTENT_LABELS: readonly ["porn", "sexual", "nudity", "graphic-media"];
|
|
338
|
+
type AdultContentLabel = (typeof ADULT_CONTENT_LABELS)[number];
|
|
339
|
+
/**
|
|
340
|
+
* A single label entry as emitted by `app.bsky.feed.defs#postView.labels`.
|
|
341
|
+
* Matches `com.atproto.label.defs#label` (the on-wire shape after the AppView
|
|
342
|
+
* resolves a `postView`). `neg: true` marks a retraction.
|
|
343
|
+
*/
|
|
344
|
+
interface ActivityLabel {
|
|
345
|
+
val: string;
|
|
346
|
+
src: string;
|
|
347
|
+
uri: string;
|
|
348
|
+
cts?: string;
|
|
349
|
+
neg?: boolean;
|
|
350
|
+
}
|
|
351
|
+
/**
|
|
352
|
+
* Return true if the item carries at least one adult-content label that is
|
|
353
|
+
* not negated. Items without a `labels` field (every non-Bluesky source,
|
|
354
|
+
* legacy responses) are treated as safe.
|
|
355
|
+
*/
|
|
356
|
+
declare function hasAdultContent(item: {
|
|
357
|
+
labels?: ActivityLabel[];
|
|
358
|
+
}): boolean;
|
|
359
|
+
|
|
360
|
+
export { type ActivityLabel as A, 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 PdsProviderInfo as a, type Profile as b, ADULT_CONTENT_LABELS as c, type ActiveApp as d, type AdultContentLabel as e, type Endorsement as f, type EndorsementData as g, type ExternalAccountKeytraceClaim as h, type LanguageProficiency as i, type ProfileCertification as j, type ProfileCourse as k, type ProfileEducation as l, type ProfileHonor as m, type ProfileIndustry as n, type ProfileLanguage as o, type ProfileLocation as p, type ProfileOverrideSource as q, type ProfilePosition as r, type ProfileProject as s, type ProfilePublication as t, type ProfileVolunteering as u, type PublicationContributor as v, type SkillRef as w, hasAdultContent as x };
|
|
@@ -318,4 +318,43 @@ interface Profile {
|
|
|
318
318
|
externalAccounts?: ExternalAccount[];
|
|
319
319
|
}
|
|
320
320
|
|
|
321
|
-
|
|
321
|
+
/**
|
|
322
|
+
* Adult-content gating for Bluesky activity items.
|
|
323
|
+
*
|
|
324
|
+
* Bluesky's official moderation labeler attaches content labels to
|
|
325
|
+
* `app.bsky.feed.defs#postView.labels`. The four sex-and-violence labels
|
|
326
|
+
* below are the ones we hide by default on Sifa: media is replaced with an
|
|
327
|
+
* `<AdultContentWarning>` placeholder card in sifa-web. Authenticated
|
|
328
|
+
* viewers can reveal per-card; anonymous viewers cannot.
|
|
329
|
+
*
|
|
330
|
+
* The list mirrors Bluesky's own globalLabelStrings; if the official set
|
|
331
|
+
* grows (e.g. a new `extreme-violence` label), update this constant.
|
|
332
|
+
*
|
|
333
|
+
* Why a constant + predicate live in the SDK: the same logic needs to run
|
|
334
|
+
* in sifa-web today and sifa-app tomorrow, and the API only forwards the
|
|
335
|
+
* raw labels — the hide decision is a client concern.
|
|
336
|
+
*/
|
|
337
|
+
declare const ADULT_CONTENT_LABELS: readonly ["porn", "sexual", "nudity", "graphic-media"];
|
|
338
|
+
type AdultContentLabel = (typeof ADULT_CONTENT_LABELS)[number];
|
|
339
|
+
/**
|
|
340
|
+
* A single label entry as emitted by `app.bsky.feed.defs#postView.labels`.
|
|
341
|
+
* Matches `com.atproto.label.defs#label` (the on-wire shape after the AppView
|
|
342
|
+
* resolves a `postView`). `neg: true` marks a retraction.
|
|
343
|
+
*/
|
|
344
|
+
interface ActivityLabel {
|
|
345
|
+
val: string;
|
|
346
|
+
src: string;
|
|
347
|
+
uri: string;
|
|
348
|
+
cts?: string;
|
|
349
|
+
neg?: boolean;
|
|
350
|
+
}
|
|
351
|
+
/**
|
|
352
|
+
* Return true if the item carries at least one adult-content label that is
|
|
353
|
+
* not negated. Items without a `labels` field (every non-Bluesky source,
|
|
354
|
+
* legacy responses) are treated as safe.
|
|
355
|
+
*/
|
|
356
|
+
declare function hasAdultContent(item: {
|
|
357
|
+
labels?: ActivityLabel[];
|
|
358
|
+
}): boolean;
|
|
359
|
+
|
|
360
|
+
export { type ActivityLabel as A, 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 PdsProviderInfo as a, type Profile as b, ADULT_CONTENT_LABELS as c, type ActiveApp as d, type AdultContentLabel as e, type Endorsement as f, type EndorsementData as g, type ExternalAccountKeytraceClaim as h, type LanguageProficiency as i, type ProfileCertification as j, type ProfileCourse as k, type ProfileEducation as l, type ProfileHonor as m, type ProfileIndustry as n, type ProfileLanguage as o, type ProfileLocation as p, type ProfileOverrideSource as q, type ProfilePosition as r, type ProfileProject as s, type ProfilePublication as t, type ProfileVolunteering as u, type PublicationContributor as v, type SkillRef as w, hasAdultContent as x };
|
package/dist/index.cjs
CHANGED
|
@@ -1554,8 +1554,13 @@ var APP_URL_PATTERNS = Object.freeze({
|
|
|
1554
1554
|
profileUrlPattern: "https://nooki.me/user/{handle}"
|
|
1555
1555
|
},
|
|
1556
1556
|
atstore: {
|
|
1557
|
-
//
|
|
1558
|
-
|
|
1557
|
+
// atstore.fyi has no user-profile pages (the legacy `/@{handle}` pattern
|
|
1558
|
+
// resolved to a 404), and no per-review deep link exists. The per-product
|
|
1559
|
+
// page (https://atstore.fyi/products/{slug}) is the most specific URL
|
|
1560
|
+
// available — resolveCardUrl builds it from record.listingMeta.slug,
|
|
1561
|
+
// which sifa-api enriches by resolving the review's `subject` to the
|
|
1562
|
+
// referenced listing.detail record.
|
|
1563
|
+
profileUrlPattern: "https://atstore.fyi"
|
|
1559
1564
|
},
|
|
1560
1565
|
plyr: {
|
|
1561
1566
|
// SPA — per-record URLs require JS routing. plyr.fm doesn't expose a
|
|
@@ -1701,6 +1706,14 @@ function resolveCardUrl(item) {
|
|
|
1701
1706
|
}
|
|
1702
1707
|
return null;
|
|
1703
1708
|
}
|
|
1709
|
+
if (collection === "fyi.atstore.listing.review") {
|
|
1710
|
+
const listingMeta = record.listingMeta;
|
|
1711
|
+
if (listingMeta != null && typeof listingMeta === "object") {
|
|
1712
|
+
const slug = stringOrNull(listingMeta.slug);
|
|
1713
|
+
if (slug) return `https://atstore.fyi/products/${encodeURIComponent(slug)}`;
|
|
1714
|
+
}
|
|
1715
|
+
return APP_URL_PATTERNS.atstore?.profileUrlPattern ?? null;
|
|
1716
|
+
}
|
|
1704
1717
|
if (collection.startsWith("site.standard.")) {
|
|
1705
1718
|
const siteUrl = stringOrNull(record.siteUrl);
|
|
1706
1719
|
const path = stringOrNull(record.path);
|
|
@@ -1749,6 +1762,16 @@ function isVisibleActivityItem(collection, record) {
|
|
|
1749
1762
|
return rule(record);
|
|
1750
1763
|
}
|
|
1751
1764
|
|
|
1765
|
+
// src/cards/adult-content.ts
|
|
1766
|
+
var ADULT_CONTENT_LABELS = ["porn", "sexual", "nudity", "graphic-media"];
|
|
1767
|
+
function hasAdultContent(item) {
|
|
1768
|
+
const labels = item.labels;
|
|
1769
|
+
if (!labels || labels.length === 0) return false;
|
|
1770
|
+
return labels.some(
|
|
1771
|
+
(label) => !label.neg && ADULT_CONTENT_LABELS.includes(label.val)
|
|
1772
|
+
);
|
|
1773
|
+
}
|
|
1774
|
+
|
|
1752
1775
|
// src/publishers/registry.ts
|
|
1753
1776
|
var STANDARD_PUBLISHER_ID = "standard";
|
|
1754
1777
|
var PUBLISHERS = Object.freeze([
|
|
@@ -2148,10 +2171,11 @@ var ProfileVolunteeringRecordSchema = zod.z.object({
|
|
|
2148
2171
|
});
|
|
2149
2172
|
|
|
2150
2173
|
// src/index.ts
|
|
2151
|
-
var SIFA_SDK_VERSION = "0.10.
|
|
2174
|
+
var SIFA_SDK_VERSION = "0.10.5";
|
|
2152
2175
|
|
|
2153
2176
|
exports.ACTIVITY_TIERS = ACTIVITY_TIERS;
|
|
2154
2177
|
exports.ACTIVITY_VISIBILITY_RULES = ACTIVITY_VISIBILITY_RULES;
|
|
2178
|
+
exports.ADULT_CONTENT_LABELS = ADULT_CONTENT_LABELS;
|
|
2155
2179
|
exports.APP_CATEGORIES = APP_CATEGORIES;
|
|
2156
2180
|
exports.APP_CATEGORY_IDS = APP_CATEGORY_IDS;
|
|
2157
2181
|
exports.APP_CATEGORY_MAP = APP_CATEGORY_MAP;
|
|
@@ -2243,6 +2267,7 @@ exports.getPublisherFromSiteUrl = getPublisherFromSiteUrl;
|
|
|
2243
2267
|
exports.getTierMeta = getTierMeta;
|
|
2244
2268
|
exports.getWorkplaceTypeLabel = getWorkplaceTypeLabel;
|
|
2245
2269
|
exports.groupSkillsByCategory = groupSkillsByCategory;
|
|
2270
|
+
exports.hasAdultContent = hasAdultContent;
|
|
2246
2271
|
exports.isAppCategory = isAppCategory;
|
|
2247
2272
|
exports.isKnownAppId = isKnownAppId;
|
|
2248
2273
|
exports.isKnownPlatform = isKnownPlatform;
|